Line No. | Rev | Author | Line |
---|---|---|---|
1 | 32 | kaklik | /******************************************************************************* |
2 | |||
3 | USB OTG (Header File) |
||
4 | |||
5 | Description: |
||
6 | This file provides the interface for a USB OTG |
||
7 | application. |
||
8 | |||
9 | This header file must be included after the application-specific |
||
10 | usb_config.h file, as usb_config.h configures parts of this file. |
||
11 | |||
12 | Summary: |
||
13 | This file provides the interface for a USB OTG |
||
14 | application. |
||
15 | |||
16 | *******************************************************************************/ |
||
17 | //DOM-IGNORE-BEGIN |
||
18 | /****************************************************************************** |
||
19 | |||
20 | * FileName: usb_otg.h |
||
21 | * Dependencies: None |
||
22 | * Processor: PIC24/dsPIC30/dsPIC33/PIC32MX |
||
23 | * Compiler: C30 v2.01/C32 v0.00.18 |
||
24 | * Company: Microchip Technology, Inc. |
||
25 | |||
26 | Software License Agreement |
||
27 | |||
28 | The software supplied herewith by Microchip Technology Incorporated |
||
29 | (the Company) for its PICmicro® Microcontroller is intended and |
||
30 | supplied to you, the Companys customer, for use solely and |
||
31 | exclusively on Microchip PICmicro Microcontroller products. The |
||
32 | software is owned by the Company and/or its supplier, and is |
||
33 | protected under applicable copyright laws. All rights are reserved. |
||
34 | Any use in violation of the foregoing restrictions may subject the |
||
35 | user to criminal sanctions under applicable laws, as well as to |
||
36 | civil liability for the breach of the terms and conditions of this |
||
37 | license. |
||
38 | |||
39 | THIS SOFTWARE IS PROVIDED IN AN AS IS CONDITION. NO WARRANTIES, |
||
40 | WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED |
||
41 | TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
||
42 | PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, |
||
43 | IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR |
||
44 | CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
||
45 | |||
46 | Change History: |
||
47 | Rev Description |
||
48 | ---- ------------------------------ |
||
49 | 2.6a- No change |
||
50 | 2.7a |
||
51 | *******************************************************************************/ |
||
52 | |||
53 | #ifndef __USBOTG_H__ |
||
54 | #define __USBOTG_H__ |
||
55 | //DOM-IGNORE-END |
||
56 | |||
57 | // ***************************************************************************** |
||
58 | // ***************************************************************************** |
||
59 | // Section: OTG Firmware Version |
||
60 | // ***************************************************************************** |
||
61 | // ***************************************************************************** |
||
62 | |||
63 | #define USB_OTG_FW_MAJOR_VER 1 // Firmware version, major release number. |
||
64 | #define USB_OTG_FW_MINOR_VER 0 // Firmware version, minor release number. |
||
65 | #define USB_OTG_FW_DOT_VER 0 // Firmware version, dot release number. |
||
66 | |||
67 | // ***************************************************************************** |
||
68 | // ***************************************************************************** |
||
69 | // Section: USB Constants |
||
70 | // ***************************************************************************** |
||
71 | // ***************************************************************************** |
||
72 | |||
73 | //OTG Events |
||
74 | #define OTG_EVENT_DISCONNECT 0 |
||
75 | #define OTG_EVENT_CONNECT 1 |
||
76 | #define OTG_EVENT_NONE 2 |
||
77 | #define OTG_EVENT_SRP_DPLUS_HIGH 3 |
||
78 | #define OTG_EVENT_SRP_DPLUS_LOW 4 |
||
79 | #define OTG_EVENT_SRP_VBUS_HIGH 5 |
||
80 | #define OTG_EVENT_SRP_VBUS_LOW 6 |
||
81 | #define OTG_EVENT_SRP_CONNECT 7 |
||
82 | #define OTG_EVENT_HNP_ABORT 8 |
||
83 | #define OTG_EVENT_HNP_FAILED 9 |
||
84 | #define OTG_EVENT_SRP_FAILED 10 |
||
85 | #define OTG_EVENT_RESUME_SIGNALING 11 |
||
86 | |||
87 | |||
88 | //Role Defines |
||
89 | #define ROLE_DEVICE 0 |
||
90 | #define ROLE_HOST 1 |
||
91 | |||
92 | //Cable Defines |
||
93 | #define CABLE_A_SIDE 0 |
||
94 | #define CABLE_B_SIDE 1 |
||
95 | |||
96 | //Session Defines |
||
97 | #define START_SESSION 0 |
||
98 | #define END_SESSION 1 |
||
99 | #define TOGGLE_SESSION 2 |
||
100 | |||
101 | //USB OTG Timing Parameter Defines |
||
102 | #define DELAY_TB_AIDL_BDIS 10 //100 |
||
103 | #define DELAY_TA_BIDL_ADIS 10//150 |
||
104 | #define DELAY_TB_ASE0_BRST 100 |
||
105 | #define DELAY_TB_SE0_SRP 2 |
||
106 | #define DELAY_TB_DATA_PLS 6 |
||
107 | #define DELAY_TB_SRP_FAIL 5100 |
||
108 | #define DELAY_TA_WAIT_VRISE 100 |
||
109 | #define DELAY_TA_WAIT_BCON 1100 |
||
110 | #define DELAY_TA_BDIS_ACON 1 |
||
111 | #define DELAY_VBUS_SETTLE 500 |
||
112 | #define DELAY_TA_AIDL_BDIS 255 |
||
113 | |||
114 | // ***************************************************************************** |
||
115 | // ***************************************************************************** |
||
116 | // Section: HNP Event Flow |
||
117 | // ***************************************************************************** |
||
118 | // ***************************************************************************** |
||
119 | /* |
||
120 | // ***************************************************************************** |
||
121 | (A becomes Device, B becomes Host) |
||
122 | A side(Host) B side(Device) |
||
123 | // ***************************************************************************** |
||
124 | Suspend-SelectRole(ROLE_DEVICE) -------> Idle-SelectRole(ROLE_HOST) |
||
125 | Detach - OTG_EVENT_DISCONNECT <------- D+ Pullup Disabled |
||
126 | D+ Pullup Enabled -------> Attach - OTG_EVENT_CONNECT |
||
127 | |||
128 | // ***************************************************************************** |
||
129 | (A becomes Host, B becomes Device) |
||
130 | A side(Device) B side(Host) |
||
131 | // ***************************************************************************** |
||
132 | Idle-SelectRole(ROLE_HOST) <------- Suspend-SelectRole(ROLE_DEVICE) |
||
133 | D+ Pullup Disabled -------> Detach - OTG_EVENT_DISCONNECT |
||
134 | USGOTGInitializeHostStack() |
||
135 | */ |
||
136 | |||
137 | // ***************************************************************************** |
||
138 | // ***************************************************************************** |
||
139 | // Section: USB OTG Function Prototypes |
||
140 | // ***************************************************************************** |
||
141 | // ***************************************************************************** |
||
142 | |||
143 | //DOM-IGNORE-BEGIN |
||
144 | /**************************************************************************** |
||
145 | Function: |
||
146 | void InitializeHostStack() |
||
147 | |||
148 | Description: |
||
149 | This function initializes the host stack for use in an OTG application |
||
150 | |||
151 | Precondition: |
||
152 | None |
||
153 | |||
154 | Parameters: |
||
155 | None |
||
156 | |||
157 | Return Values: |
||
158 | None |
||
159 | |||
160 | Remarks: |
||
161 | None |
||
162 | ***************************************************************************/ |
||
163 | void USBOTGInitializeHostStack(); |
||
164 | //DOM-IGNORE-END |
||
165 | |||
166 | |||
167 | //DOM-IGNORE-BEGIN |
||
168 | /**************************************************************************** |
||
169 | Function: |
||
170 | void InitializeDeviceStack() |
||
171 | |||
172 | Description: |
||
173 | This function initializes the device stack for use in an OTG application |
||
174 | |||
175 | Precondition: |
||
176 | None |
||
177 | |||
178 | Parameters: |
||
179 | None |
||
180 | |||
181 | Return Values: |
||
182 | None |
||
183 | |||
184 | Remarks: |
||
185 | None |
||
186 | ***************************************************************************/ |
||
187 | void USBOTGInitializeDeviceStack(); |
||
188 | //DOM-IGNORE-END |
||
189 | |||
190 | |||
191 | /**************************************************************************** |
||
192 | Function: |
||
193 | BOOL USBOTGRoleSwitch() |
||
194 | |||
195 | Description: |
||
196 | This function returns whether a role switch occurred or not. This is used by the main application function |
||
197 | to determine when to reinitialize the system (InitializeSystem()) |
||
198 | |||
199 | Precondition: |
||
200 | None |
||
201 | |||
202 | Parameters: |
||
203 | None |
||
204 | |||
205 | Return Values: |
||
206 | BOOL - TRUE or FALSE |
||
207 | |||
208 | Remarks: |
||
209 | None |
||
210 | ***************************************************************************/ |
||
211 | BOOL USBOTGRoleSwitch(); |
||
212 | |||
213 | |||
214 | /**************************************************************************** |
||
215 | Function: |
||
216 | void USBOTGClearRoleSwitch() |
||
217 | |||
218 | Description: |
||
219 | This function clears the RoleSwitch variable. After the main function detects the RoleSwitch |
||
220 | and re-initializes the system, this function should be called to clear the RoleSwitch flag |
||
221 | |||
222 | Precondition: |
||
223 | None |
||
224 | |||
225 | Parameters: |
||
226 | None |
||
227 | |||
228 | Return Values: |
||
229 | None |
||
230 | |||
231 | Remarks: |
||
232 | None |
||
233 | ***************************************************************************/ |
||
234 | void USBOTGClearRoleSwitch(); |
||
235 | |||
236 | |||
237 | /**************************************************************************** |
||
238 | Function: |
||
239 | void USBOTGInitialize() |
||
240 | |||
241 | Description: |
||
242 | This function initializes an OTG application and initializes a default role of Host or Device |
||
243 | |||
244 | Precondition: |
||
245 | None |
||
246 | |||
247 | Parameters: |
||
248 | None |
||
249 | |||
250 | Return Values: |
||
251 | None |
||
252 | |||
253 | Remarks: |
||
254 | #define USB_MICRO_AB_OTG_CABLE should be commented out in usb_config.h |
||
255 | if not using a micro AB OTG cable |
||
256 | ***************************************************************************/ |
||
257 | void USBOTGInitialize(); |
||
258 | |||
259 | |||
260 | /**************************************************************************** |
||
261 | Function: |
||
262 | void USBOTGSelectRole(BOOL role) |
||
263 | |||
264 | Description: |
||
265 | This function initiates a role switch via the Host Negotiation Protocol (HNP). |
||
266 | The parameter role that is passed to this function is the desired role to switch to. |
||
267 | |||
268 | Precondition: |
||
269 | None |
||
270 | |||
271 | Parameters: |
||
272 | BOOL role - ROLE_DEVICE or ROLE_HOST |
||
273 | |||
274 | Return Values: |
||
275 | None |
||
276 | |||
277 | Remarks: |
||
278 | None |
||
279 | ***************************************************************************/ |
||
280 | void USBOTGSelectRole(BOOL role); |
||
281 | |||
282 | |||
283 | //DOM-IGNORE-BEGIN |
||
284 | /**************************************************************************** |
||
285 | Function: |
||
286 | BOOL USBOTGHnpIsEnabled() |
||
287 | |||
288 | Description: |
||
289 | This function returns TRUE if HNP is enabled, FALSE otherwise |
||
290 | |||
291 | Precondition: |
||
292 | None |
||
293 | |||
294 | Parameters: |
||
295 | BOOL - TRUE or FALSE |
||
296 | |||
297 | Return Values: |
||
298 | None |
||
299 | |||
300 | Remarks: |
||
301 | None |
||
302 | ***************************************************************************/ |
||
303 | BOOL USBOTGHnpIsEnabled(); |
||
304 | //DOM-IGNORE-END |
||
305 | |||
306 | |||
307 | //DOM-IGNORE-BEGIN |
||
308 | /**************************************************************************** |
||
309 | Function: |
||
310 | BOOL USBOTGHnpIsActive() |
||
311 | |||
312 | Description: |
||
313 | This function returns TRUE if HNP is active, FALSE otherwise. |
||
314 | |||
315 | Precondition: |
||
316 | None |
||
317 | |||
318 | Parameters: |
||
319 | BOOL - TRUE or FALSE |
||
320 | |||
321 | Return Values: |
||
322 | None |
||
323 | |||
324 | Remarks: |
||
325 | HNP will become active on the host when it suspends the bus and HNP was enabled |
||
326 | by an acknowledegement of the SET_FEATURE(b_hnp_enable) by the peripheral. |
||
327 | |||
328 | HNP will become active on the peripheral side when it receives a bus idle condition |
||
329 | and HNP was enabled by a SET_FEATURE(b_hnp_enable) from the host |
||
330 | ***************************************************************************/ |
||
331 | BOOL USBOTGHnpIsActive(); |
||
332 | //DOM-IGNORE-END |
||
333 | |||
334 | |||
335 | /**************************************************************************** |
||
336 | Function: |
||
337 | void USBOTGSession(BYTE Value) |
||
338 | |||
339 | Description: |
||
340 | This function starts, ends, or toggles a VBUS session. |
||
341 | |||
342 | Precondition: |
||
343 | This function assumes I/O controlling DC/DC converter has already been initialized |
||
344 | |||
345 | Parameters: |
||
346 | Value - START_SESSION, END_SESSION, TOGGLE_SESSION |
||
347 | |||
348 | Return Values: |
||
349 | TRUE - Session Started, FALSE - Session Not Started |
||
350 | |||
351 | Remarks: |
||
352 | This function should only be called by an A-side Host |
||
353 | ***************************************************************************/ |
||
354 | BOOL USBOTGSession(BYTE Value); |
||
355 | |||
356 | |||
357 | //DOM-IGNORE-BEGIN |
||
358 | /**************************************************************************** |
||
359 | Function: |
||
360 | void USBOTGEnableHnp() |
||
361 | |||
362 | Description: |
||
363 | This function enables HNP |
||
364 | |||
365 | Precondition: |
||
366 | None |
||
367 | |||
368 | Parameters: |
||
369 | None |
||
370 | |||
371 | Return Values: |
||
372 | None |
||
373 | |||
374 | Remarks: |
||
375 | None |
||
376 | ***************************************************************************/ |
||
377 | void USBOTGEnableHnp(); |
||
378 | //DOM-IGNORE-END |
||
379 | |||
380 | |||
381 | //DOM-IGNORE-BEGIN |
||
382 | /**************************************************************************** |
||
383 | Function: |
||
384 | void USBOTGDisableHnp() |
||
385 | |||
386 | Description: |
||
387 | This function disables HNP |
||
388 | |||
389 | Precondition: |
||
390 | None |
||
391 | |||
392 | Parameters: |
||
393 | None |
||
394 | |||
395 | Return Values: |
||
396 | None |
||
397 | |||
398 | Remarks: |
||
399 | None |
||
400 | ***************************************************************************/ |
||
401 | void USBOTGDisableHnp(); |
||
402 | //DOM-IGNORE-END |
||
403 | |||
404 | |||
405 | //DOM-IGNORE-BEGIN |
||
406 | /**************************************************************************** |
||
407 | Function: |
||
408 | void void USBOTGEnableAltHnp() |
||
409 | |||
410 | Description: |
||
411 | This function enables Alt HNP |
||
412 | |||
413 | Precondition: |
||
414 | None |
||
415 | |||
416 | Parameters: |
||
417 | None |
||
418 | |||
419 | Return Values: |
||
420 | None |
||
421 | |||
422 | Remarks: |
||
423 | None |
||
424 | ***************************************************************************/ |
||
425 | void USBOTGEnableAltHnp(); |
||
426 | //DOM-IGNORE-END |
||
427 | |||
428 | |||
429 | //DOM-IGNORE-BEGIN |
||
430 | /**************************************************************************** |
||
431 | Function: |
||
432 | void USBOTGDisableAltHnp() |
||
433 | |||
434 | Description: |
||
435 | This function disables Alt HNP |
||
436 | |||
437 | Precondition: |
||
438 | None |
||
439 | |||
440 | Parameters: |
||
441 | None |
||
442 | |||
443 | Return Values: |
||
444 | None |
||
445 | |||
446 | Remarks: |
||
447 | None |
||
448 | ***************************************************************************/ |
||
449 | void USBOTGDisableAltHnp(); |
||
450 | //DOM-IGNORE-END |
||
451 | |||
452 | |||
453 | //DOM-IGNORE-BEGIN |
||
454 | /**************************************************************************** |
||
455 | Function: |
||
456 | void USBOTGEnableSupportHnp() |
||
457 | |||
458 | Description: |
||
459 | This function enables HNP Support |
||
460 | |||
461 | Precondition: |
||
462 | None |
||
463 | |||
464 | Parameters: |
||
465 | None |
||
466 | |||
467 | Return Values: |
||
468 | None |
||
469 | |||
470 | Remarks: |
||
471 | None |
||
472 | ***************************************************************************/ |
||
473 | void USBOTGEnableSupportHnp(); |
||
474 | //DOM-IGNORE-END |
||
475 | |||
476 | |||
477 | //DOM-IGNORE-BEGIN |
||
478 | /**************************************************************************** |
||
479 | Function: |
||
480 | void USBOTGDisableSupportHnp() |
||
481 | |||
482 | Description: |
||
483 | This function disables HNP Support |
||
484 | |||
485 | Precondition: |
||
486 | None |
||
487 | |||
488 | Parameters: |
||
489 | None |
||
490 | |||
491 | Return Values: |
||
492 | None |
||
493 | |||
494 | Remarks: |
||
495 | None |
||
496 | ***************************************************************************/ |
||
497 | void USBOTGDisableSupportHnp(); |
||
498 | //DOM-IGNORE-END |
||
499 | |||
500 | |||
501 | //DOM-IGNORE-BEGIN |
||
502 | /**************************************************************************** |
||
503 | Function: |
||
504 | BOOL USBOTGSrpIsActive() |
||
505 | |||
506 | Description: |
||
507 | This function returns TRUE if SRP is active, FALSE otherwise |
||
508 | |||
509 | Precondition: |
||
510 | None |
||
511 | |||
512 | Parameters: |
||
513 | BOOL - TRUE or FALSE |
||
514 | |||
515 | Return Values: |
||
516 | None |
||
517 | |||
518 | Remarks: |
||
519 | None |
||
520 | ***************************************************************************/ |
||
521 | BOOL USBOTGSrpIsActive(); |
||
522 | //DOM-IGNORE-END |
||
523 | |||
524 | //DOM-IGNORE-BEGIN |
||
525 | /**************************************************************************** |
||
526 | Function: |
||
527 | void USBOTGDeactivateHnp() |
||
528 | |||
529 | Description: |
||
530 | This function deactivates HNP |
||
531 | |||
532 | Precondition: |
||
533 | None |
||
534 | |||
535 | Parameters: |
||
536 | None |
||
537 | |||
538 | Return Values: |
||
539 | None |
||
540 | |||
541 | Remarks: |
||
542 | None |
||
543 | ***************************************************************************/ |
||
544 | void USBOTGDeactivateHnp(); |
||
545 | //DOM-IGNORE-END |
||
546 | |||
547 | |||
548 | /**************************************************************************** |
||
549 | Function: |
||
550 | BYTE USBOTGCurrentRoleIs() |
||
551 | |||
552 | Description: |
||
553 | This function returns whether the current role is ROLE_HOST or ROLE_DEVICE |
||
554 | |||
555 | Precondition: |
||
556 | None |
||
557 | |||
558 | Parameters: |
||
559 | None |
||
560 | |||
561 | Return Values: |
||
562 | BYTE - ROLE_HOST or ROLE_DEVICE |
||
563 | |||
564 | Remarks: |
||
565 | None |
||
566 | ***************************************************************************/ |
||
567 | BYTE USBOTGCurrentRoleIs(); |
||
568 | |||
569 | |||
570 | |||
571 | /**************************************************************************** |
||
572 | Function: |
||
573 | BYTE USBOTGDefaultRoleIs() |
||
574 | |||
575 | Description: |
||
576 | This function returns whether the default role is ROLE_HOST or ROLE_DEVICE |
||
577 | |||
578 | Precondition: |
||
579 | None |
||
580 | |||
581 | Parameters: |
||
582 | None |
||
583 | |||
584 | Return Values: |
||
585 | BYTE - ROLE_HOST or ROLE_DEVICE |
||
586 | |||
587 | Remarks: |
||
588 | If using a Micro AB USB OTG Cable, the A-side plug of the cable when plugged in |
||
589 | will assign a default role of ROLE_HOST. The B-side plug of the cable when plugged in |
||
590 | will assign a default role of ROLE_DEVICE. |
||
591 | |||
592 | If using a Standard USB Cable, ROLE_HOST or ROLE_DEVICE needs to be manually configured in |
||
593 | usb_config.h. |
||
594 | |||
595 | Both of these items can be easily configured using the USB Config Tool which will automatically |
||
596 | generate the apropriate information for your application |
||
597 | ***************************************************************************/ |
||
598 | BYTE USBOTGDefaultRoleIs(); |
||
599 | |||
600 | |||
601 | /**************************************************************************** |
||
602 | Function: |
||
603 | void USBOTGRequestSession() |
||
604 | |||
605 | Description: |
||
606 | This function requests a Session from an A side Host using the Session Request Protocol (SRP). |
||
607 | The function will return TRUE if the request was successful or FALSE otherwise. |
||
608 | |||
609 | Precondition: |
||
610 | None |
||
611 | |||
612 | Parameters: |
||
613 | None |
||
614 | |||
615 | Return Values: |
||
616 | TRUE or FALSE |
||
617 | |||
618 | Remarks: |
||
619 | This function should only be called by a B side Device. |
||
620 | ***************************************************************************/ |
||
621 | BOOL USBOTGRequestSession(); |
||
622 | |||
623 | |||
624 | //DOM-IGNORE-BEGIN |
||
625 | /**************************************************************************** |
||
626 | Function: |
||
627 | BOOL USBOTGGetSessionStatus() |
||
628 | |||
629 | Description: |
||
630 | This function gets a session status. The function will return |
||
631 | TRUE if VBUS > Session Valid Voltage or FALSE if VBUS < Session Valid Voltage. |
||
632 | |||
633 | Precondition: |
||
634 | None |
||
635 | |||
636 | Parameters: |
||
637 | None |
||
638 | |||
639 | Return Values: |
||
640 | TRUE or FALSE |
||
641 | |||
642 | Remarks: |
||
643 | |||
644 | ***************************************************************************/ |
||
645 | BOOL USBOTGGetSessionStatus(); |
||
646 | //DOM-IGNORE-END |
||
647 | |||
648 | |||
649 | //DOM-IGNORE-BEGIN |
||
650 | /**************************************************************************** |
||
651 | Function: |
||
652 | void USBOTGDischargeVBus() |
||
653 | |||
654 | Description: |
||
655 | This function discharges VBUS. |
||
656 | |||
657 | Precondition: |
||
658 | None |
||
659 | |||
660 | Parameters: |
||
661 | None |
||
662 | |||
663 | Return Values: |
||
664 | None |
||
665 | |||
666 | Remarks: |
||
667 | |||
668 | ***************************************************************************/ |
||
669 | void USBOTGDischargeVBus(); |
||
670 | //DOM-IGNORE-END |
||
671 | |||
672 | |||
673 | //DOM-IGNORE-BEGIN |
||
674 | /**************************************************************************** |
||
675 | Function: |
||
676 | void USB_OTGEventHandler ( BYTE address, BYTE event, void *data, DWORD size ) |
||
677 | |||
678 | Description: |
||
679 | This function is the event handler used by both the Host and Device stacks for calling the OTG layer |
||
680 | when SRP and HNP events occur |
||
681 | |||
682 | Precondition: |
||
683 | None |
||
684 | |||
685 | Parameters: |
||
686 | BYTE event - |
||
687 | OTG_EVENT_SRP_DPLUS_HIGH |
||
688 | OTG_EVENT_SRP_DPLUS_LOW |
||
689 | OTG_EVENT_SRP_VBUS_HIGH |
||
690 | OTG_EVENT_SRP_VBUS_LOW |
||
691 | OTG_EVENT_DISCONNECT |
||
692 | OTG_EVENT_CONNECT |
||
693 | OTG_EVENT_HNP_ABORT |
||
694 | OTG_EVENT_HNP_FAILED |
||
695 | |||
696 | Return Values: |
||
697 | None |
||
698 | |||
699 | Remarks: |
||
700 | None |
||
701 | ***************************************************************************/ |
||
702 | void USB_OTGEventHandler ( BYTE address, BYTE event, void *data, DWORD size ); |
||
703 | //DOM-IGNORE-END |
||
704 | |||
705 | |||
706 | //DOM-IGNORE-BEGIN |
||
707 | /**************************************************************************** |
||
708 | Function: |
||
709 | void USBOTGDelayMs(WORD time) |
||
710 | |||
711 | Description: |
||
712 | This function will delay a given amount of time in milliseconds determined by the time parameter |
||
713 | passed to this function. The function uses the hardware based 1 millisecond timer. |
||
714 | |||
715 | Precondition: |
||
716 | USB Module Must Be Enabled Prior To Calling This Function (U1PWRCbits.USBPWR = 1) |
||
717 | |||
718 | Parameters: |
||
719 | WORD time - The time to delay in milliseconds |
||
720 | |||
721 | Return Values: |
||
722 | BOOL - TRUE - Time Not Expired |
||
723 | FALSE - Time Expired |
||
724 | |||
725 | Remarks: |
||
726 | Assumes USB Interrupt Is Disabled |
||
727 | ***************************************************************************/ |
||
728 | void USBOTGDelayMs(WORD time); |
||
729 | //DOM-IGNORE-END |
||
730 | |||
731 | |||
732 | |||
733 | //DOM-IGNORE-BEGIN |
||
734 | /**************************************************************************** |
||
735 | Function: |
||
736 | BOOL USBOTGIsHNPTimeOutExpired() |
||
737 | |||
738 | Description: |
||
739 | This function decrements HNPTimeOut and checks to see if HNPTimeOut has expired. This function |
||
740 | returns TRUE if HNPTimeOut has expired, FALSE otherwise. |
||
741 | |||
742 | Precondition: |
||
743 | None |
||
744 | |||
745 | Parameters: |
||
746 | None |
||
747 | |||
748 | Return Values: |
||
749 | BOOL - TRUE - Time Expired |
||
750 | FALSE - Time Not Expired |
||
751 | |||
752 | Remarks: |
||
753 | HNPTimeOut value should be > 0 |
||
754 | ***************************************************************************/ |
||
755 | BOOL USBOTGIsHNPTimeOutExpired(); |
||
756 | //DOM-IGNORE-END |
||
757 | |||
758 | |||
759 | //DOM-IGNORE-BEGIN |
||
760 | /**************************************************************************** |
||
761 | Function: |
||
762 | BOOL USBOTGGetHNPTimeOutFlag() |
||
763 | |||
764 | Description: |
||
765 | This function returns the HNPTimeOutFlag. This flag is used for timing the TB_ASE0_BRST USB OTG |
||
766 | Timing parameter. This flag is checked in the 1ms Timer interrupt handler. |
||
767 | |||
768 | Precondition: |
||
769 | None |
||
770 | |||
771 | Parameters: |
||
772 | None |
||
773 | |||
774 | Return Values: |
||
775 | BOOL - TRUE or FALSE |
||
776 | |||
777 | Remarks: |
||
778 | None |
||
779 | ***************************************************************************/ |
||
780 | BOOL USBOTGGetHNPTimeOutFlag(); |
||
781 | //DOM-IGNORE-END |
||
782 | |||
783 | |||
784 | //DOM-IGNORE-BEGIN |
||
785 | /**************************************************************************** |
||
786 | Function: |
||
787 | BOOL USBOTGIsSRPTimeOutExpired() |
||
788 | |||
789 | Description: |
||
790 | This function decrements SRPTimeOut and checks to see if SRPTimeOut has expired. This function |
||
791 | returns TRUE if SRPTimeOut has expired, FALSE otherwise. |
||
792 | |||
793 | Precondition: |
||
794 | None |
||
795 | |||
796 | Parameters: |
||
797 | None |
||
798 | |||
799 | Return Values: |
||
800 | BOOL - TRUE - Time Expired |
||
801 | FALSE - Time Not Expired |
||
802 | |||
803 | Remarks: |
||
804 | HNPTimeOut value should be > 0 |
||
805 | ***************************************************************************/ |
||
806 | BOOL USBOTGIsSRPTimeOutExpired(); |
||
807 | //DOM-IGNORE-END |
||
808 | |||
809 | |||
810 | |||
811 | //DOM-IGNORE-BEGIN |
||
812 | /**************************************************************************** |
||
813 | Function: |
||
814 | BOOL USBOTGGetSRPTimeOutFlag() |
||
815 | |||
816 | Description: |
||
817 | This function returns the SRPTimeOutFlag. This flag is used for timing the TA_WAIT_BCON USB OTG |
||
818 | Timing parameter. This flag is checked in the 1ms Timer interrupt handler. |
||
819 | |||
820 | Precondition: |
||
821 | None |
||
822 | |||
823 | Parameters: |
||
824 | None |
||
825 | |||
826 | Return Values: |
||
827 | BOOL - TRUE or FALSE |
||
828 | |||
829 | Remarks: |
||
830 | None |
||
831 | ***************************************************************************/ |
||
832 | BOOL USBOTGGetSRPTimeOutFlag(); |
||
833 | //DOM-IGNORE-END |
||
834 | |||
835 | |||
836 | //DOM-IGNORE-BEGIN |
||
837 | /**************************************************************************** |
||
838 | Function: |
||
839 | void USBOTGClearSRPTimeOutFlag() |
||
840 | |||
841 | Description: |
||
842 | This function clears the SRPTimeOutFlag. This flag is checked in the 1ms |
||
843 | Timer interrupt handler. |
||
844 | |||
845 | Precondition: |
||
846 | None |
||
847 | |||
848 | Parameters: |
||
849 | None |
||
850 | |||
851 | Return Values: |
||
852 | None |
||
853 | |||
854 | Remarks: |
||
855 | None |
||
856 | ***************************************************************************/ |
||
857 | void USBOTGClearSRPTimeOutFlag(); |
||
858 | //DOM-IGNORE-END |
||
859 | |||
860 | |||
861 | //DOM-IGNORE-BEGIN |
||
862 | /**************************************************************************** |
||
863 | Function: |
||
864 | BOOL USBOTGSRPIsReady() |
||
865 | |||
866 | Description: |
||
867 | This function returns the value of SRPReady. This flag is set after the B-device finishes SRP |
||
868 | and the A-device is ready for the B-device to connect |
||
869 | |||
870 | Precondition: |
||
871 | None |
||
872 | |||
873 | Parameters: |
||
874 | None |
||
875 | |||
876 | Return Values: |
||
877 | BOOL - TRUE or FALSE |
||
878 | |||
879 | Remarks: |
||
880 | None |
||
881 | ***************************************************************************/ |
||
882 | BOOL USBOTGSRPIsReady(); |
||
883 | //DOM-IGNORE-END |
||
884 | |||
885 | |||
886 | //DOM-IGNORE-BEGIN |
||
887 | /**************************************************************************** |
||
888 | Function: |
||
889 | void USBOTGClearSRPReady() |
||
890 | |||
891 | Description: |
||
892 | This function clears SRPReady. |
||
893 | |||
894 | Precondition: |
||
895 | None |
||
896 | |||
897 | Parameters: |
||
898 | None |
||
899 | |||
900 | Return Values: |
||
901 | None |
||
902 | |||
903 | Remarks: |
||
904 | None |
||
905 | ***************************************************************************/ |
||
906 | void USBOTGClearSRPReady(); |
||
907 | //DOM-IGNORE-END |
||
908 | |||
909 | |||
910 | |||
911 | #endif |
Powered by WebSVN v2.8.3