]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Pci/UhciDxe/UhciSched.h
modify coding style to pass ecc tool and provide comments that complied with Doxgen.
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / UhciDxe / UhciSched.h
CommitLineData
913cb9dc 1/** @file\r
2\r
ab6495ea 3 The definition for EHCI register operation routines.\r
4\r
913cb9dc 5Copyright (c) 2007, Intel Corporation\r
6All rights reserved. This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
913cb9dc 14**/\r
15\r
16#ifndef _EFI_UHCI_SCHED_H_\r
17#define _EFI_UHCI_SCHED_H_\r
18\r
19\r
ab6495ea 20typedef enum {\r
913cb9dc 21 UHCI_ASYNC_INT_SIGNATURE = EFI_SIGNATURE_32 ('u', 'h', 'c', 'a'),\r
22\r
23 //\r
24 // The failure mask for USB transfer return status. If any of\r
25 // these bit is set, the transfer failed. EFI_USB_ERR_NOEXECUTE\r
26 // and EFI_USB_ERR_NAK are not considered as error condition:\r
27 // the transfer is still going on.\r
28 //\r
29 USB_ERR_FAIL_MASK = EFI_USB_ERR_STALL | EFI_USB_ERR_BUFFER |\r
30 EFI_USB_ERR_BABBLE | EFI_USB_ERR_CRC |\r
31 EFI_USB_ERR_TIMEOUT | EFI_USB_ERR_BITSTUFF |\r
c52fa98c 32 EFI_USB_ERR_SYSTEM\r
913cb9dc 33\r
ab6495ea 34}UHCI_ERR_FAIL_MASK;\r
913cb9dc 35\r
36//\r
37// Structure to return the result of UHCI QH execution.\r
38// Result is the final result of the QH's QTD. NextToggle\r
39// is the next data toggle to use. Complete is the actual\r
40// length of data transferred.\r
41//\r
42typedef struct {\r
43 UINT32 Result;\r
44 UINT8 NextToggle;\r
45 UINTN Complete;\r
46} UHCI_QH_RESULT;\r
47\r
48typedef struct _UHCI_ASYNC_REQUEST UHCI_ASYNC_REQUEST;\r
49\r
50//\r
51// Structure used to manager the asynchronous interrupt transfers.\r
52//\r
c52fa98c 53struct _UHCI_ASYNC_REQUEST{\r
913cb9dc 54 UINTN Signature;\r
55 LIST_ENTRY Link;\r
56 UHCI_ASYNC_REQUEST *Recycle;\r
57\r
58 //\r
59 // Endpoint attributes\r
60 //\r
61 UINT8 DevAddr;\r
62 UINT8 EndPoint;\r
63 BOOLEAN IsLow;\r
64 UINTN Interval;\r
65\r
66 //\r
67 // Data and UHC structures\r
68 //\r
69 UHCI_QH_SW *QhSw;\r
70 UHCI_TD_SW *FirstTd;\r
71 UINT8 *Data; // Allocated host memory, not mapped memory\r
72 UINTN DataLen;\r
73 VOID *Mapping;\r
74\r
75 //\r
76 // User callback and its context\r
77 //\r
78 EFI_ASYNC_USB_TRANSFER_CALLBACK Callback;\r
79 VOID *Context;\r
c52fa98c 80};\r
913cb9dc 81\r
82#define UHCI_ASYNC_INT_FROM_LINK(a) \\r
83 CR (a, UHCI_ASYNC_REQUEST, Link, UHCI_ASYNC_INT_SIGNATURE)\r
84\r
913cb9dc 85\r
ab6495ea 86/**\r
87 Create Frame List Structure.\r
913cb9dc 88\r
ab6495ea 89 @param Uhc The UHCI device.\r
913cb9dc 90\r
ab6495ea 91 @return EFI_OUT_OF_RESOURCES Can't allocate memory resources.\r
92 @return EFI_UNSUPPORTED Map memory fail.\r
93 @return EFI_SUCCESS Success.\r
913cb9dc 94\r
ab6495ea 95**/\r
96EFI_STATUS\r
97UhciInitFrameList (\r
98 IN USB_HC_DEV *Uhc\r
99 )\r
913cb9dc 100;\r
101\r
913cb9dc 102/**\r
ab6495ea 103 Destory FrameList buffer.\r
913cb9dc 104\r
ab6495ea 105 @param Uhc The UHCI device.\r
913cb9dc 106\r
ab6495ea 107 @return None.\r
913cb9dc 108\r
109**/\r
110VOID\r
111UhciDestoryFrameList (\r
112 IN USB_HC_DEV *Uhc\r
113 )\r
114;\r
115\r
116\r
117/**\r
118 Convert the poll rate to the maxium 2^n that is smaller\r
ab6495ea 119 than Interval.\r
913cb9dc 120\r
ab6495ea 121 @param Interval The poll rate to convert.\r
913cb9dc 122\r
ab6495ea 123 @return The converted poll rate.\r
913cb9dc 124\r
125**/\r
126UINTN\r
127UhciConvertPollRate (\r
128 IN UINTN Interval\r
129 )\r
130;\r
131\r
132\r
133/**\r
134 Link a queue head (for asynchronous interrupt transfer) to\r
135 the frame list.\r
136\r
ab6495ea 137 @param FrameBase The base of the frame list.\r
138 @param Qh The queue head to link into.\r
913cb9dc 139\r
ab6495ea 140 @return None.\r
913cb9dc 141\r
142**/\r
143VOID\r
144UhciLinkQhToFrameList (\r
145 UINT32 *FrameBase,\r
146 UHCI_QH_SW *Qh\r
147 )\r
148;\r
149\r
150\r
151/**\r
152 Unlink QH from the frame list is easier: find all\r
153 the precedence node, and pointer there next to QhSw's\r
154 next.\r
155\r
ab6495ea 156 @param FrameBase The base address of the frame list.\r
157 @param Qh The queue head to unlink.\r
913cb9dc 158\r
ab6495ea 159 @return None.\r
913cb9dc 160\r
161**/\r
162VOID\r
163UhciUnlinkQhFromFrameList (\r
164 UINT32 *FrameBase,\r
165 UHCI_QH_SW *Qh\r
166 )\r
167;\r
168\r
169\r
170/**\r
ab6495ea 171 Check the result of the transfer.\r
913cb9dc 172\r
ab6495ea 173 @param Uhc The UHCI device.\r
174 @param Qh The queue head of the transfer.\r
175 @param Td The first TDs of the transfer.\r
176 @param TimeOut TimeOut value in milliseconds.\r
177 @param IsLow Is Low Speed Device.\r
178 @param QhResult The variable to return result.\r
913cb9dc 179\r
ab6495ea 180 @retval EFI_SUCCESS The transfer finished with success.\r
181 @retval EFI_DEVICE_ERROR Transfer failed.\r
913cb9dc 182\r
183**/\r
184EFI_STATUS\r
185UhciExecuteTransfer (\r
186 IN USB_HC_DEV *Uhc,\r
187 IN UHCI_QH_SW *Qh,\r
188 IN UHCI_TD_SW *Td,\r
189 IN UINTN TimeOut,\r
190 IN BOOLEAN IsLow,\r
191 OUT UHCI_QH_RESULT *QhResult\r
192 )\r
193;\r
194\r
195\r
196/**\r
ab6495ea 197 Create Async Request node, and Link to List.\r
198\r
199 @param Uhc The UHCI device.\r
200 @param Qh The queue head of the transfer.\r
201 @param FirstTd First TD of the transfer.\r
202 @param DevAddr Device Address.\r
203 @param EndPoint EndPoint Address.\r
204 @param DataLen Data length.\r
205 @param Interval Polling Interval when inserted to frame list.\r
206 @param Mapping Mapping value.\r
207 @param Data Data buffer, unmapped.\r
208 @param Callback Callback after interrupt transfeer.\r
209 @param Context Callback Context passed as function parameter.\r
210 @param IsLow Is Low Speed.\r
211\r
212 @retval EFI_SUCCESS An asynchronous transfer is created.\r
213 @retval EFI_INVALID_PARAMETER Paremeter is error.\r
913cb9dc 214 @retval EFI_OUT_OF_RESOURCES Failed because of resource shortage.\r
215\r
216**/\r
217EFI_STATUS\r
218UhciCreateAsyncReq (\r
219 IN USB_HC_DEV *Uhc,\r
220 IN UHCI_QH_SW *Qh,\r
221 IN UHCI_TD_SW *FirstTd,\r
222 IN UINT8 DevAddr,\r
223 IN UINT8 EndPoint,\r
224 IN UINTN DataLen,\r
225 IN UINTN Interval,\r
226 IN VOID *Mapping,\r
227 IN UINT8 *Data,\r
228 IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback,\r
229 IN VOID *Context,\r
230 IN BOOLEAN IsLow\r
231 )\r
232;\r
233\r
234\r
235/**\r
ab6495ea 236 Delete Async Interrupt QH and TDs.\r
913cb9dc 237\r
ab6495ea 238 @param Uhc The UHCI device.\r
239 @param DevAddr Device Address.\r
240 @param EndPoint EndPoint Address.\r
241 @param Toggle The next data toggle to use.\r
913cb9dc 242\r
ab6495ea 243 @retval EFI_SUCCESS The request is deleted.\r
244 @retval EFI_INVALID_PARAMETER Paremeter is error.\r
245 @retval EFI_NOT_FOUND The asynchronous isn't found.\r
913cb9dc 246\r
247**/\r
248EFI_STATUS\r
249UhciRemoveAsyncReq (\r
250 IN USB_HC_DEV *Uhc,\r
251 IN UINT8 DevAddr,\r
252 IN UINT8 EndPoint,\r
253 OUT UINT8 *Toggle\r
254 )\r
255;\r
256\r
257\r
258/**\r
259 Release all the asynchronous transfers on the lsit.\r
260\r
ab6495ea 261 @param Uhc The UHCI device.\r
913cb9dc 262\r
ab6495ea 263 @return None.\r
913cb9dc 264\r
265**/\r
266VOID\r
267UhciFreeAllAsyncReq (\r
268 IN USB_HC_DEV *Uhc\r
269 )\r
270;\r
271\r
272\r
273/**\r
ab6495ea 274 Interrupt transfer periodic check handler.\r
913cb9dc 275\r
ab6495ea 276 @param Event The event of the time.\r
277 @param Context Context of the event, pointer to USB_HC_DEV.\r
913cb9dc 278\r
ab6495ea 279 @return None.\r
913cb9dc 280\r
281**/\r
282VOID\r
283UhciMonitorAsyncReqList (\r
284 IN EFI_EVENT Event,\r
285 IN VOID *Context\r
286 )\r
287;\r
288\r
289#endif\r