Line No. | Rev | Author | Line |
---|---|---|---|
1 | 32 | kaklik | /****************************************************************************** |
2 | |||
3 | USB HAL Local (Header File) |
||
4 | |||
5 | This file contains local definitions used by the HAL. |
||
6 | |||
7 | Filename: usb_hal_local.h |
||
8 | Dependancies: See included files, below |
||
9 | Processor: PIC32MX |
||
10 | Hardware: PIC32MX |
||
11 | Company: Microchip Technology, Inc. |
||
12 | |||
13 | Software License Agreement |
||
14 | |||
15 | The software supplied herewith by Microchip Technology Incorporated |
||
16 | (the Company) for its PICmicro® Microcontroller is intended and |
||
17 | supplied to you, the Companys customer, for use solely and |
||
18 | exclusively on Microchip PICmicro Microcontroller products. The |
||
19 | software is owned by the Company and/or its supplier, and is |
||
20 | protected under applicable copyright laws. All rights are reserved. |
||
21 | Any use in violation of the foregoing restrictions may subject the |
||
22 | user to criminal sanctions under applicable laws, as well as to |
||
23 | civil liability for the breach of the terms and conditions of this |
||
24 | license. |
||
25 | |||
26 | THIS SOFTWARE IS PROVIDED IN AN AS IS CONDITION. NO WARRANTIES, |
||
27 | WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED |
||
28 | TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
||
29 | PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, |
||
30 | IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR |
||
31 | CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
||
32 | |||
33 | Change History: |
||
34 | Rev Description |
||
35 | ---------- ---------------------------------------------------------- |
||
36 | 2.6 - 2.7a No change |
||
37 | |||
38 | *******************************************************************************/ |
||
39 | |||
40 | #ifndef _USB_HAL_LOCAL_H_ |
||
41 | #define _USB_HAL_LOCAL_H_ |
||
42 | |||
43 | #include "usb/usb.h" |
||
44 | |||
45 | #if defined (__18CXX) |
||
46 | #include "USB PIC18.h" |
||
47 | #elif defined (__C30__) |
||
48 | //#include "USB PIC24.h" |
||
49 | #elif defined (__PIC32MX__) |
||
50 | #include "p32xxxx.h" |
||
51 | #include "usb_pic32.h" |
||
52 | #else |
||
53 | #error "Error! Unsupported processor" |
||
54 | #endif |
||
55 | |||
56 | |||
57 | // Misc Definitions: |
||
58 | |||
59 | #ifndef USB_DEVICE_ATTACH_DEBOUNCE_TIME |
||
60 | #define USB_DEVICE_ATTACH_DEBOUNCE_TIME 100 // 100 ms default time |
||
61 | #endif |
||
62 | |||
63 | #ifndef LOCAL_INLINE |
||
64 | #define LOCAL_INLINE static inline |
||
65 | #endif |
||
66 | |||
67 | #define OUT 0 // |
||
68 | #define IN 1 // |
||
69 | |||
70 | |||
71 | /* Endpoint control value and mask bits */ |
||
72 | #define EP_HSHK 0x01 // Enable handshake |
||
73 | #define EP_STALL 0x02 // Stall endpoint |
||
74 | #define EP_EP_TX_EN 0x04 // Enable transmitting from endpoint |
||
75 | #define EP_EP_RX_EN 0x08 // Enable receiving from endpoint |
||
76 | #define EP_EP_CTL_DIS 0x10 // Disable control transfers to/from endpoint |
||
77 | #define EP_RETRY_DIS 0x40 // (Host Only) No retry of NAK'd transactions |
||
78 | #define EP_HOST_WOHUB 0x80 // (Host Only) Allow connection to low-speed hub |
||
79 | |||
80 | // Status mask |
||
81 | #if defined(__18CXX) |
||
82 | |||
83 | #define UIR_SOF_TOK (1<<6) |
||
84 | #define UIR_TOK_DNE (1<<3) |
||
85 | #define UIR_USB_RST (1<<0) |
||
86 | #define UIR_UERR (1<<1) |
||
87 | #define UIR_UIDLE (1<<4) |
||
88 | #define UIR_STALL (1<<5) |
||
89 | |||
90 | #define STATUS_MASK (UIR_USB_RST|UIR_UERR|UIR_SOF_TOK|UIR_TOK_DNE| \ |
||
91 | UIR_UIDLE|UIR_STALL) |
||
92 | |||
93 | #elif defined(__C30__) |
||
94 | |||
95 | // Status Bits |
||
96 | #define UIR_USB_RST 0x0001 |
||
97 | #define UIR_UERR 0x0002 |
||
98 | #define UIR_SOF_TOK 0x0004 |
||
99 | #define UIR_TOK_DNE 0x0008 |
||
100 | #define UIR_UIDLE 0x0010 |
||
101 | #define UIR_RESUME 0x0020 |
||
102 | #define UIR_ATTACH 0x0040 |
||
103 | #define UIR_STALL 0x0080 |
||
104 | |||
105 | // Error Status Bits |
||
106 | #define UEIR_PID_ERR 0x0001 |
||
107 | #define UEIR_CRC5 0x0002 |
||
108 | #define UEIR_HOST_EOF 0x0002 |
||
109 | #define UEIR_CRC16 0x0004 |
||
110 | #define UEIR_DFN8 0x0008 |
||
111 | #define UEIR_BTO_ERR 0x0010 |
||
112 | #define UEIR_DMA_ERR 0x0020 |
||
113 | #define UEIR_BTS_ERR 0x0080 |
||
114 | |||
115 | /* #define STATUS_MASK (UIR_USB_RST|UIR_UERR|UIR_SOF_TOK|UIR_TOK_DNE| \ |
||
116 | UIR_UIDLE|UIR_RESUME|UIR_ATTACH|UIR_STALL) */ |
||
117 | #define STATUS_MASK (UIR_USB_RST|UIR_UERR|UIR_TOK_DNE|UIR_STALL) |
||
118 | |||
119 | #else |
||
120 | |||
121 | // Status Bits |
||
122 | #define UIR_USB_RST 0x00000001 |
||
123 | #define UIR_UERR 0x00000002 |
||
124 | #define UIR_SOF_TOK 0x00000004 |
||
125 | #define UIR_TOK_DNE 0x00000008 |
||
126 | #define UIR_UIDLE 0x00000010 |
||
127 | #define UIR_RESUME 0x00000020 |
||
128 | #define UIR_ATTACH 0x00000040 |
||
129 | #define UIR_STALL 0x00000080 |
||
130 | |||
131 | // Error Status Bits |
||
132 | #define UEIR_PID_ERR 0x00000001 |
||
133 | #define UEIR_CRC5 0x00000002 |
||
134 | #define UEIR_HOST_EOF 0x00000002 |
||
135 | #define UEIR_CRC16 0x00000004 |
||
136 | #define UEIR_DFN8 0x00000008 |
||
137 | #define UEIR_BTO_ERR 0x00000010 |
||
138 | #define UEIR_DMA_ERR 0x00000020 |
||
139 | #define UEIR_BTS_ERR 0x00000080 |
||
140 | |||
141 | /*#define STATUS_MASK (UIR_USB_RST|UIR_UERR|UIR_SOF_TOK|UIR_TOK_DNE| \ |
||
142 | UIR_UIDLE|UIR_RESUME|UIR_ATTACH|UIR_STALL) */ |
||
143 | #define STATUS_MASK (UIR_USB_RST|UIR_UERR|UIR_TOK_DNE|UIR_STALL) |
||
144 | |||
145 | #endif |
||
146 | |||
147 | |||
148 | |||
149 | // Assumes HAL error flags are equal to USB OTG UEIR bits |
||
150 | // (see USBHALGetLastError and ErrorHandler). |
||
151 | #if( (USBHAL_PID_ERR != UEIR_PID_ERR ) || \ |
||
152 | (USBHAL_CRC5 != UEIR_CRC5 ) || \ |
||
153 | (USBHAL_HOST_EOF != UEIR_HOST_EOF) || \ |
||
154 | (USBHAL_CRC16 != UEIR_CRC16 ) || \ |
||
155 | (USBHAL_DFN8 != UEIR_DFN8 ) || \ |
||
156 | (USBHAL_BTO_ERR != UEIR_BTO_ERR ) || \ |
||
157 | (USBHAL_DMA_ERR != UEIR_DMA_ERR ) || \ |
||
158 | (USBHAL_BTS_ERR != UEIR_BTS_ERR ) ) |
||
159 | #error "USBHAL ErrorHandler must translate error flags" |
||
160 | #endif |
||
161 | |||
162 | // Assumes HAL flags shifted left 8 match core control flags (see USBHALSetEpConfiguration). |
||
163 | #if( ((USB_HAL_HANDSHAKE >> 8) != EP_HSHK) || \ |
||
164 | ((USB_HAL_TRANSMIT >> 8) != EP_EP_TX_EN) || \ |
||
165 | ((USB_HAL_RECEIVE >> 8) != EP_EP_RX_EN) || \ |
||
166 | ((USB_HAL_NO_RETRY >> 8) != EP_RETRY_DIS) || \ |
||
167 | ((USB_HAL_ALLOW_HUB >> 8) != EP_HOST_WOHUB) ) |
||
168 | #error "USBHALSetEpConfiguration must translate control flags" |
||
169 | #endif |
||
170 | |||
171 | #define ERROR_MASK (UEIR_PID_ERR|UEIR_CRC5|UEIR_HOST_EOF|UEIR_CRC16| \ |
||
172 | UEIR_DFN8|UEIR_BTO_ERR|UEIR_DMA_ERR|UEIR_BTS_ERR) |
||
173 | |||
174 | #define CTRL_MASK (EP_HSHK|EP_EP_TX_EN|EP_EP_RX_EN|EP_RETRY_DIS|EP_HOST_WOHUB) |
||
175 | |||
176 | #define RESISTOR_CTRL_MASK (UOTGCTRL_DM_LOW | UOTGCTRL_DP_LOW | \ |
||
177 | UOTGCTRL_DM_HIGH | UOTGCTRL_DP_HIGH) |
||
178 | |||
179 | #define DATA_PTR_SIZE UINT32 |
||
180 | |||
181 | // USBHALConfigureDescriptor flags |
||
182 | #define USBHAL_DESC_BSTALL 0x04 // Stall the endpoint. |
||
183 | #define USBHAL_DESC_DTS 0x08 // Require Data Toggle Synchronization |
||
184 | #define USBHAL_DESC_NINC 0x10 // No Incrementing of DMA address |
||
185 | #define USBHAL_DESC_KEEP 0x20 // HW keeps buffer & descriptor |
||
186 | #define USBHAL_DESC_DATA1 0x40 // Indicates data packet 1 |
||
187 | #define USBHAL_DESC_DATA0 0x00 // Indicates data packet 0 |
||
188 | #define USBHAL_DESC_UOWN 0x80 // USB HW owns buffer & descriptor |
||
189 | |||
190 | /* Buffer Descriptor Table (BDT) definition |
||
191 | ************************************************************************* |
||
192 | * These data structures define the buffer descriptor table used by the |
||
193 | * USB OTG Core to manage endpoint DMA. |
||
194 | */ |
||
195 | |||
196 | /* |
||
197 | * This is union describes the bitmap of |
||
198 | * the Setup & Status entry in the BDT. |
||
199 | */ |
||
200 | typedef union _BDT_SETUP |
||
201 | { |
||
202 | struct // Status Entry |
||
203 | { |
||
204 | #if defined(__18CXX) |
||
205 | unsigned short BC_MSB: 2; |
||
206 | #else |
||
207 | unsigned short spare: 2; |
||
208 | #endif |
||
209 | unsigned short TOK_PID: 4; // Packit Identifier |
||
210 | unsigned short DAT01: 1; // Data-toggle bit |
||
211 | unsigned short UOWN: 1; // Descriptor owner: 0=SW, 1=HW |
||
212 | #if !defined(__18CXX) |
||
213 | unsigned short resvd: 8; |
||
214 | #endif |
||
215 | }; |
||
216 | |||
217 | struct // Setup Entry |
||
218 | { |
||
219 | #if defined(__18CXX) |
||
220 | unsigned short BC_MSB: 2; |
||
221 | #else |
||
222 | unsigned short spare: 2; |
||
223 | #endif |
||
224 | unsigned short BSTALL: 1; // Stalls EP if this descriptor needed |
||
225 | unsigned short DTS: 1; // Require data-toggle sync |
||
226 | unsigned short NINC: 1; // No Increment of DMA address |
||
227 | unsigned short KEEP: 1; // HW Keeps this buffer & descriptor |
||
228 | unsigned short DAT01: 1; // Data-toggle number (0 or 1) |
||
229 | unsigned short UOWN: 1; // Descriptor owner: 0=SW, 1=HW |
||
230 | #if !defined(__18CXX) |
||
231 | unsigned short resvd: 8; |
||
232 | #endif |
||
233 | }; |
||
234 | |||
235 | #if !defined(__18CXX) |
||
236 | WORD Val; |
||
237 | #else |
||
238 | BYTE Val; |
||
239 | #endif |
||
240 | |||
241 | } BDT_SETUP; |
||
242 | |||
243 | /* |
||
244 | * This union describes the byte-count |
||
245 | * entry in the BDT. |
||
246 | */ |
||
247 | typedef union _BYTECOUNT |
||
248 | { |
||
249 | struct // Byte-count bitmap |
||
250 | { |
||
251 | unsigned short BC0: 1; |
||
252 | unsigned short BC1: 1; |
||
253 | unsigned short BC2: 1; |
||
254 | unsigned short BC3: 1; |
||
255 | unsigned short BC4: 1; |
||
256 | unsigned short BC5: 1; |
||
257 | unsigned short BC6: 1; |
||
258 | unsigned short BC7: 1; |
||
259 | #if !defined(__18CXX) |
||
260 | unsigned short BC8: 1; |
||
261 | unsigned short BC9: 1; |
||
262 | unsigned short resvd: 6; |
||
263 | #endif |
||
264 | }; |
||
265 | |||
266 | #if defined(__18CXX) |
||
267 | //TODO: (DF) - C18 does not allow bitfields of > 8 bits. made this a word but that does not mask the upper 6 bits from getting set |
||
268 | struct // Byte-count field |
||
269 | { |
||
270 | unsigned char BC; // Number of bytes in data buffer (really only 10 bits) |
||
271 | }; |
||
272 | #else |
||
273 | struct // Byte-count field |
||
274 | { |
||
275 | unsigned short BC: 10; // Number of bytes in data buffer |
||
276 | unsigned short resvd: 6; |
||
277 | }; |
||
278 | #endif |
||
279 | |||
280 | } BYTECOUNT; |
||
281 | |||
282 | /* |
||
283 | * Buffer Descriptor |
||
284 | * |
||
285 | * This union describes a single buffer descriptor. Each descriptor |
||
286 | * manages a single buffer. Each endpoint has 4 such descriptors, 2 |
||
287 | * for receive and 2 for trasmit. Having two descriptors (odd and even, |
||
288 | * or ping and pong) per direction allows the HW to operate on one |
||
289 | * while the SW operates on the other. |
||
290 | */ |
||
291 | typedef union _BUFFER_DESCRIPTOR |
||
292 | { |
||
293 | UINT32 dword[2]; // Double-word access |
||
294 | |||
295 | UINT16 word[4]; // Word Access |
||
296 | |||
297 | BYTE byte[8]; // Byte Access |
||
298 | |||
299 | struct |
||
300 | { |
||
301 | BDT_SETUP setup; // Setup & status entry |
||
302 | BYTECOUNT byte_cnt; // Byte count entry |
||
303 | unsigned int addr; // Physical address of data buffer |
||
304 | }; |
||
305 | |||
306 | } BUF_DESC, *pBUF_DESC; |
||
307 | |||
308 | |||
309 | /* USB_HAL_PIPE |
||
310 | ************************************************************************* |
||
311 | * A pipe is a virtual connection between two endpoints, one in the host |
||
312 | * and one the device. Data flows through a pipe in a single direction |
||
313 | * from one endpoint to the other. This structure defines the data that |
||
314 | * the USB HAL must track to manage a pipe. |
||
315 | */ |
||
316 | |||
317 | typedef union |
||
318 | { |
||
319 | BYTE bitmap; |
||
320 | |||
321 | struct |
||
322 | { |
||
323 | BYTE zero_pkt: 1; // Ensure transfer ends w/short or zero packet |
||
324 | BYTE data_toggle: 1; // Data toggle: 0=DATA0/1=DATA1 |
||
325 | BYTE ping_pong: 1; // Current ping pong: 0=even/1=odd |
||
326 | BYTE send_0_pkt: 1; // Flag indicating when to send a zero-sized packet |
||
327 | BYTE reserved: 4; // Reserved |
||
328 | |||
329 | }field; |
||
330 | |||
331 | }PIPE_FLAGS; |
||
332 | |||
333 | typedef struct _USB_HAL_PIPE_DATA |
||
334 | { |
||
335 | BYTE *buffer; // Pointer to the buffer |
||
336 | unsigned int max_pkt_size; // Max packet size of EP |
||
337 | unsigned int size; // Total number of bytes to transfer |
||
338 | unsigned int remaining; // Number of bytes remaining to transfer |
||
339 | unsigned int count; // Actual number of bytes transferred. |
||
340 | PIPE_FLAGS flags; |
||
341 | |||
342 | } USB_HAL_PIPE, *PUSB_HAL_PIPE; |
||
343 | |||
344 | |||
345 | /* USB_ROLE |
||
346 | ************************************************************************* |
||
347 | * This enumeration identifies if the USB controller is currently acting |
||
348 | * as a USB device or as a USB host. |
||
349 | */ |
||
350 | |||
351 | typedef enum |
||
352 | { |
||
353 | DEVICE = 0, // USB controller is acting as a USB device |
||
354 | HOST = 1 // USB controller is acting as a USB host |
||
355 | |||
356 | } USB_ROLE; |
||
357 | |||
358 | |||
359 | /****************************************************************************** |
||
360 | Function: |
||
361 | OTGCORE_IdentifyPacket |
||
362 | |||
363 | Summary: |
||
364 | This provides the endpoint number, direction and ping-pong ID and other |
||
365 | information identifying the packet that was just completed. |
||
366 | |||
367 | PreCondition: |
||
368 | Assumes that an UIR_TOK_DNE interrupt has occured. |
||
369 | |||
370 | Parameters: |
||
371 | None |
||
372 | |||
373 | Return Values: |
||
374 | flags Bitmapped flags identifying transfer (see below): |
||
375 | |||
376 | 1 1 1 1 1 1 |
||
377 | 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 |
||
378 | | | \_____/ \_/ \_____/ | | \_/ |
||
379 | | | | | | | | +-- reserved1 |
||
380 | | | | | | | +----- ping_pong |
||
381 | | | | | | +------- direction |
||
382 | | | | | +------------ ep_num |
||
383 | | | | +------------------ reserved2 |
||
384 | | | +------------------------ pid |
||
385 | | +----------------------------- data_toggle |
||
386 | +------------------------------- reserved3 |
||
387 | |||
388 | size Size of data actually transferred (in bytes). |
||
389 | TRUE if successful, FALSE any of the parameters were NULL. |
||
390 | |||
391 | Remarks: |
||
392 | None |
||
393 | |||
394 | ******************************************************************************/ |
||
395 | |||
396 | typedef union |
||
397 | { |
||
398 | UINT16 bitmap; |
||
399 | BYTE byte[2]; |
||
400 | struct |
||
401 | { |
||
402 | // Byte 0 |
||
403 | UINT16 reserved1: 2; // Reserved, ignore |
||
404 | UINT16 ping_pong: 1; // Buffer ping pong: 0=even/1=odd |
||
405 | UINT16 direction: 1; // Transfer direction: 0=Receive, 1=Transmit |
||
406 | UINT16 ep_num: 4; // Endpoint number |
||
407 | |||
408 | // Byte 1 |
||
409 | UINT16 reserved2: 2; // Reserved, ignore |
||
410 | UINT16 pid: 4; // Packet ID (See USBCh9.h, "Packet IDs") |
||
411 | UINT16 data_toggle: 1; // Data toggle: 0=DATA0 packet, 1=DATA1 packet |
||
412 | UINT16 reserved3: 1; // Reserved, ignore |
||
413 | |||
414 | }field; |
||
415 | |||
416 | } TRANSFER_ID_FLAGS; |
||
417 | |||
418 | |||
419 | /* USB Register Macros |
||
420 | ************************************************************************* |
||
421 | * These macros translate core registers across the different controller |
||
422 | * families. |
||
423 | */ |
||
424 | |||
425 | #if defined(__18CXX) |
||
426 | #if defined(__18F4550) || defined(__18F2455) || defined(__18F2550) || defined(__18F4455) |
||
427 | #error "Please define any necessary register translation macros. |
||
428 | #endif |
||
429 | |||
430 | #define EnableUsbModule() |
||
431 | #define SetPingPongMode(m) U1CNFG1 |= (m) |
||
432 | |||
433 | #error "Please define any necessary register translation macros. |
||
434 | #elif defined(__C30__) |
||
435 | |||
436 | #define EnableUsbModule() U1PWRCbits.USBPWR = 1 |
||
437 | #define SetPingPongMode(m) |
||
438 | |||
439 | // Do we need any others??? #error "Please define any necessary register translation macros. |
||
440 | #else |
||
441 | #define EnableUsbModule() U1PWRCbits.USBPWR = 1 |
||
442 | #define SetPingPongMode(m) |
||
443 | #endif |
||
444 | |||
445 | // Misc bits |
||
446 | #ifndef UPWRC_USB_OP_EN |
||
447 | #define UPWRC_USB_OP_EN 0x01 // USB Operation Enable |
||
448 | #endif |
||
449 | |||
450 | #ifndef UPWRC_SUSPEND |
||
451 | #define UPWRC_SUSPEND 0x02 // Suspend bus activity |
||
452 | #endif |
||
453 | |||
454 | |||
455 | |||
456 | /* USB_HAL_DATA |
||
457 | ************************************************************************* |
||
458 | * This structure contains the data that is required to manage an |
||
459 | * instance of the USB HAL. |
||
460 | */ |
||
461 | |||
462 | /*#if defined( USB_SUPPORT_DEVICE ) |
||
463 | |||
464 | typedef struct _USB_HAL_DATA |
||
465 | { |
||
466 | // Data transfer "pipe" array |
||
467 | USB_HAL_PIPE pipe[USB_DEV_HIGHEST_EP_NUMBER+1][2]; // Rx=0, Tx=1 |
||
468 | USB_ROLE current_role; // Acting as host or device? |
||
469 | unsigned long last_error; // Last error state detected |
||
470 | } USB_HAL_DATA, *PUSB_HAL_DATA; |
||
471 | |||
472 | |||
473 | // Macro to get a pointer to the desired pipe data. |
||
474 | #define FindPipe(e,d) &gHALData.pipe[(e)][(d)] |
||
475 | |||
476 | #endif // defined( USB_SUPPORT_DEVICE )*/ |
||
477 | |||
478 | |||
479 | /****************************************************************************** |
||
480 | Function: |
||
481 | USBHALClearStatus |
||
482 | |||
483 | Summary: |
||
484 | This routine clears the OTG Core's current status |
||
485 | |||
486 | PreCondition: |
||
487 | None |
||
488 | |||
489 | Parameters: |
||
490 | status Bitmap of status bits to clear (caller sets bits it |
||
491 | wishes to be cleared). |
||
492 | |||
493 | Return Values: |
||
494 | None |
||
495 | |||
496 | Remarks: |
||
497 | The status indicated have been cleared. |
||
498 | |||
499 | ******************************************************************************/ |
||
500 | |||
501 | #define USBHALClearStatus(s) (U1IR = (s)) |
||
502 | |||
503 | |||
504 | /****************************************************************************** |
||
505 | Function: |
||
506 | USBHALGetStatus |
||
507 | |||
508 | Summary: |
||
509 | This routine reads the OTG Core's current status. |
||
510 | |||
511 | PreCondition: |
||
512 | None |
||
513 | |||
514 | Parameters: |
||
515 | None |
||
516 | |||
517 | Return Values: |
||
518 | The contents of the USB OTG Core's interrupt status register. |
||
519 | |||
520 | Remarks: |
||
521 | None |
||
522 | |||
523 | ******************************************************************************/ |
||
524 | |||
525 | #define USBHALGetStatus() U1IR |
||
526 | |||
527 | |||
528 | /****************************************************************************** |
||
529 | Function: |
||
530 | USBHALGetErrors |
||
531 | |||
532 | Summary: |
||
533 | This routine reads the current error status. |
||
534 | |||
535 | PreCondition: |
||
536 | None |
||
537 | |||
538 | Parameters: |
||
539 | None |
||
540 | |||
541 | Return Values: |
||
542 | The contents of the USB error-interrupt status register. |
||
543 | |||
544 | Remarks: |
||
545 | None |
||
546 | |||
547 | ******************************************************************************/ |
||
548 | #define USBHALGetErrors() U1EIR |
||
549 | |||
550 | |||
551 | /****************************************************************************** |
||
552 | Function: |
||
553 | USBHALClearErrors |
||
554 | |||
555 | Summary: |
||
556 | This clears given error status. |
||
557 | |||
558 | PreCondition: |
||
559 | None |
||
560 | |||
561 | Paramters: |
||
562 | errors - Bitmap of the error status bits (caller sets the bets |
||
563 | it wishes to clear). |
||
564 | |||
565 | Return Values: |
||
566 | None |
||
567 | |||
568 | Side effects: |
||
569 | The errors indicated have been cleared. |
||
570 | |||
571 | Remarks: |
||
572 | None |
||
573 | |||
574 | ******************************************************************************/ |
||
575 | #define USBHALClearErrors(e) (U1EIR = (e)) |
||
576 | |||
577 | |||
578 | #endif // _USB_HAL_LOCAL_H_ |
||
579 | /************************************************************************* |
||
580 | * EOF usb_hal.h |
||
581 | */ |
||
582 |
Powered by WebSVN v2.8.3