1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
10 /**************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** USBX Component */
17 /** */
18 /** EHCI Controller Driver */
19 /** */
20 /**************************************************************************/
21 /**************************************************************************/
22
23
24 /* Include necessary system files. */
25
26 #define UX_SOURCE_CODE
27
28 #include "ux_api.h"
29 #include "ux_hcd_ehci.h"
30 #include "ux_host_stack.h"
31
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _ux_hcd_ehci_poll_rate_entry_get PORTABLE C */
38 /* 6.1.2 */
39 /* AUTHOR */
40 /* */
41 /* Chaoqiong Xiao, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This function return a pointer to the first ED in the periodic tree */
46 /* that start specific poll rate. */
47 /* Note that when poll rate is longer, poll depth is smaller and */
48 /* endpoint period interval is larger. */
49 /* PollInterval Depth */
50 /* 1 M */
51 /* 2 M-1 */
52 /* 4 M-2 */
53 /* 8 M-3 */
54 /* ... ... */
55 /* N 0 */
56 /* */
57 /* INPUT */
58 /* */
59 /* hcd_ehci Pointer to EHCI controller */
60 /* ed_list Pointer to ED list to scan */
61 /* poll_depth Poll depth expected */
62 /* */
63 /* OUTPUT */
64 /* */
65 /* UX_EHCI_ED * Pointer to ED */
66 /* */
67 /* CALLS */
68 /* */
69 /* */
70 /* CALLED BY */
71 /* */
72 /* EHCI Controller Driver */
73 /* */
74 /* RELEASE HISTORY */
75 /* */
76 /* DATE NAME DESCRIPTION */
77 /* */
78 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
79 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
80 /* resulting in version 6.1 */
81 /* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
82 /* fixed compile warnings, */
83 /* resulting in version 6.1.2 */
84 /* */
85 /**************************************************************************/
_ux_hcd_ehci_poll_rate_entry_get(UX_HCD_EHCI * hcd_ehci,UX_EHCI_ED * ed_list,ULONG poll_depth)86 UX_EHCI_ED *_ux_hcd_ehci_poll_rate_entry_get(UX_HCD_EHCI *hcd_ehci,
87 UX_EHCI_ED *ed_list, ULONG poll_depth)
88 {
89
90
91 UX_PARAMETER_NOT_USED(hcd_ehci);
92
93 /* Scan the list of ED/iTD/siTDs from the poll rate lowest/interval longest
94 entry until appropriate poll rate node.
95 The depth index is the poll rate EHCI value and the first entry (anchor)
96 is pointed. */
97
98 /* Obtain next link pointer including Typ and T. */
99 while(poll_depth --)
100 {
101 if (ed_list -> REF_AS.ANCHOR.ux_ehci_ed_next_anchor == UX_NULL)
102 break;
103 ed_list = ed_list -> REF_AS.ANCHOR.ux_ehci_ed_next_anchor;
104 }
105
106 /* Return the list entry. */
107 return(ed_list);
108 }
109