?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 32

Line No. Rev Author Line
1 32 kaklik /******************************************************************************
2 File Information:
3 FileName: usb_function_generic.h
4 Dependencies: See INCLUDES section
5 Processor: PIC18 or PIC24 USB Microcontrollers
6 Hardware: The code is natively intended to be used on the following
7 hardware platforms: PICDEM™ FS USB Demo Board,
8 PIC18F87J50 FS USB Plug-In Module, or
9 Explorer 16 + PIC24 USB PIM. The firmware may be
10 modified for use on other USB platforms by editing the
11 HardwareProfile.h file.
12 Complier: Microchip C18 (for PIC18) or C30 (for PIC24)
13 Company: Microchip Technology, Inc.
14  
15 Software License Agreement:
16  
17 The software supplied herewith by Microchip Technology Incorporated
18 (the “Company”) for its PIC® Microcontroller is intended and
19 supplied to you, the Company’s customer, for use solely and
20 exclusively on Microchip PIC Microcontroller products. The
21 software is owned by the Company and/or its supplier, and is
22 protected under applicable copyright laws. All rights are reserved.
23 Any use in violation of the foregoing restrictions may subject the
24 user to criminal sanctions under applicable laws, as well as to
25 civil liability for the breach of the terms and conditions of this
26 license.
27  
28 THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
29 WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
30 TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
31 PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
32 IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
33 CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
34  
35 Summary:
36 This file contains all of functions, macros, definitions, variables,
37 datatypes, etc. that are required for usage with vendor class function
38 drivers. This file should be included in projects that use vendor class
39 \function drivers. This file should also be included into the
40 usb_descriptors.c file and any other user file that requires access to
41 vendor class interfaces.
42  
43  
44  
45 This file is located in the "\<Install
46 Directory\>\\Microchip\\Include\\USB" directory.
47 Description:
48 USB Vender Class Custom Driver File
49  
50 This file contains all of functions, macros, definitions, variables,
51 datatypes, etc. that are required for usage with vendor class function
52 drivers. This file should be included in projects that use vendor class
53 \function drivers. This file should also be included into the
54 usb_descriptors.c file and any other user file that requires access to
55 vendor class interfaces.
56  
57 This file is located in the "\<Install
58 Directory\>\\Microchip\\Include\\USB" directory.
59  
60 When including this file in a new project, this file can either be
61 referenced from the directory in which it was installed or copied
62 directly into the user application folder. If the first method is
63 chosen to keep the file located in the folder in which it is installed
64 then include paths need to be added so that the library and the
65 application both know where to reference each others files. If the
66 application folder is located in the same folder as the Microchip
67 folder (like the current demo folders), then the following include
68 paths need to be added to the application's project:
69  
70 .
71 ..\\..\\Microchip\\Include
72  
73 If a different directory structure is used, modify the paths as
74 required. An example using absolute paths instead of relative paths
75 would be the following:
76  
77 C:\\Microchip Solutions\\Microchip\\Include
78  
79 C:\\Microchip Solutions\\My Demo Application
80 ******************************************************************************/
81  
82 //DOM-IGNORE-BEGIN
83 /********************************************************************
84 Change History:
85 Rev Description
86 ---- -----------
87 2.6 - No Change
88 2.7a
89 ********************************************************************/
90 //DOM-IGNORE-END
91  
92 #ifndef USBGEN_H
93 #define USBGEN_H
94  
95 #include "GenericTypeDefs.h"
96 #include "usb_config.h"
97  
98 /** I N C L U D E S **********************************************************/
99  
100 /** D E F I N I T I O N S ****************************************************/
101  
102 /******************************************************************************
103 Macro:
104 (bit) mUSBGenRxIsBusy(void)
105  
106 Description:
107 This macro is used to check if the OUT endpoint is
108 busy (owned by SIE) or not.
109 Typical Usage: if(mUSBGenRxIsBusy())
110  
111 PreCondition:
112 None
113  
114 Parameters:
115 None
116  
117 Return Values:
118 None
119  
120 Remarks:
121 None
122  
123 *****************************************************************************/
124  
125 /******************************************************************************
126 Macro:
127 (bit) mUSBGenTxIsBusy(void)
128  
129 Description:
130 This macro is used to check if the IN endpoint is
131 busy (owned by SIE) or not.
132 Typical Usage: if(mUSBGenTxIsBusy())
133  
134 PreCondition:
135 None
136  
137 Parameters:
138 None
139  
140 Return Values:
141 None
142  
143 Remarks:
144 None
145  
146 *****************************************************************************/
147  
148 /******************************************************************************
149 Macro:
150 byte mUSBGenGetRxLength(void)
151  
152 Description:
153 mUSBGenGetRxLength is used to retrieve the number of bytes
154 copied to user's buffer by the most recent call to
155 USBGenRead function.
156  
157 PreCondition:
158 None
159  
160 Parameters:
161 None
162  
163 Return Values:
164 mUSBGenGetRxLength returns usbgen_rx_len
165  
166 Remarks:
167 None
168  
169 *****************************************************************************/
170  
171 /** S T R U C T U R E S ******************************************************/
172  
173 /** E X T E R N S ************************************************************/
174  
175 /** P U B L I C P R O T O T Y P E S *****************************************/
176  
177 /********************************************************************
178 Function:
179 USB_HANDLE USBGenWrite(BYTE ep, BYTE* data, WORD len)
180  
181 Summary:
182 Sends the specified data out the specified endpoint
183  
184 Description:
185 This function sends the specified data out the specified
186 endpoint and returns a handle to the transfer information.
187  
188 Typical Usage:
189 <code>
190 //make sure that the last transfer isn't busy by checking the handle
191 if(!USBHandleBusy(USBGenericInHandle))
192 {
193 //Send the data contained in the INPacket[] array out on
194 // endpoint USBGEN_EP_NUM
195 USBGenericInHandle = USBGenWrite(USBGEN_EP_NUM,(BYTE*)&INPacket[0],sizeof(INPacket));
196 }
197 </code>
198  
199 PreCondition:
200 None
201  
202 Parameters:
203 ep - the endpoint you want to send the data out of
204 data - pointer to the data that you wish to send
205 len - the length of the data that you wish to send
206  
207 Return Values:
208 USB_HANDLE - a handle for the transfer. This information
209 should be kept to track the status of the transfer
210  
211 Remarks:
212 None
213  
214 *******************************************************************/
215 #define USBGenWrite(ep,data,len) USBTxOnePacket(ep,data,len)
216  
217 /********************************************************************
218 Function:
219 USB_HANDLE USBGenRead(BYTE ep, BYTE* data, WORD len)
220  
221 Summary:
222 Receives the specified data out the specified endpoint
223  
224 Description:
225 Receives the specified data out the specified endpoint.
226  
227 Typical Usage:
228 <code>
229 //Read 64-bytes from endpoint USBGEN_EP_NUM, into the OUTPacket array.
230 // Make sure to save the return handle so that we can check it later
231 // to determine when the transfer is complete.
232 if(!USBHandleBusy(USBOutHandle))
233 {
234 USBOutHandle = USBGenRead(USBGEN_EP_NUM,(BYTE*)&OUTPacket,64);
235 }
236 </code>
237  
238 PreCondition:
239 None
240  
241 Parameters:
242 ep - the endpoint you want to receive the data into
243 data - pointer to where the data will go when it arrives
244 len - the length of the data that you wish to receive
245  
246 Return Values:
247 USB_HANDLE - a handle for the transfer. This information
248 should be kept to track the status of the transfer
249  
250 Remarks:
251 None
252  
253 *******************************************************************/
254 #define USBGenRead(ep,data,len) USBRxOnePacket(ep,data,len)
255  
256 #endif //USBGEN_H
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3