]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Bus/Pci/UhciDxe/UhciSched.h
clean up the un-suitable ';' location when declaring the functions.
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / UhciDxe / UhciSched.h
... / ...
CommitLineData
1/** @file\r
2\r
3 The definition for EHCI register operation routines.\r
4\r
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
14**/\r
15\r
16#ifndef _EFI_UHCI_SCHED_H_\r
17#define _EFI_UHCI_SCHED_H_\r
18\r
19\r
20typedef enum {\r
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
32 EFI_USB_ERR_SYSTEM\r
33\r
34}UHCI_ERR_FAIL_MASK;\r
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
53struct _UHCI_ASYNC_REQUEST{\r
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
80};\r
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
85\r
86/**\r
87 Create Frame List Structure.\r
88\r
89 @param Uhc The UHCI device.\r
90\r
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
94\r
95**/\r
96EFI_STATUS\r
97UhciInitFrameList (\r
98 IN USB_HC_DEV *Uhc\r
99 );\r
100\r
101/**\r
102 Destory FrameList buffer.\r
103\r
104 @param Uhc The UHCI device.\r
105\r
106 @return None.\r
107\r
108**/\r
109VOID\r
110UhciDestoryFrameList (\r
111 IN USB_HC_DEV *Uhc\r
112 );\r
113\r
114\r
115/**\r
116 Convert the poll rate to the maxium 2^n that is smaller\r
117 than Interval.\r
118\r
119 @param Interval The poll rate to convert.\r
120\r
121 @return The converted poll rate.\r
122\r
123**/\r
124UINTN\r
125UhciConvertPollRate (\r
126 IN UINTN Interval\r
127 );\r
128\r
129\r
130/**\r
131 Link a queue head (for asynchronous interrupt transfer) to\r
132 the frame list.\r
133\r
134 @param FrameBase The base of the frame list.\r
135 @param Qh The queue head to link into.\r
136\r
137 @return None.\r
138\r
139**/\r
140VOID\r
141UhciLinkQhToFrameList (\r
142 UINT32 *FrameBase,\r
143 UHCI_QH_SW *Qh\r
144 );\r
145\r
146\r
147/**\r
148 Unlink QH from the frame list is easier: find all\r
149 the precedence node, and pointer there next to QhSw's\r
150 next.\r
151\r
152 @param FrameBase The base address of the frame list.\r
153 @param Qh The queue head to unlink.\r
154\r
155 @return None.\r
156\r
157**/\r
158VOID\r
159UhciUnlinkQhFromFrameList (\r
160 UINT32 *FrameBase,\r
161 UHCI_QH_SW *Qh\r
162 );\r
163\r
164\r
165/**\r
166 Check the result of the transfer.\r
167\r
168 @param Uhc The UHCI device.\r
169 @param Qh The queue head of the transfer.\r
170 @param Td The first TDs of the transfer.\r
171 @param TimeOut TimeOut value in milliseconds.\r
172 @param IsLow Is Low Speed Device.\r
173 @param QhResult The variable to return result.\r
174\r
175 @retval EFI_SUCCESS The transfer finished with success.\r
176 @retval EFI_DEVICE_ERROR Transfer failed.\r
177\r
178**/\r
179EFI_STATUS\r
180UhciExecuteTransfer (\r
181 IN USB_HC_DEV *Uhc,\r
182 IN UHCI_QH_SW *Qh,\r
183 IN UHCI_TD_SW *Td,\r
184 IN UINTN TimeOut,\r
185 IN BOOLEAN IsLow,\r
186 OUT UHCI_QH_RESULT *QhResult\r
187 );\r
188\r
189\r
190/**\r
191 Create Async Request node, and Link to List.\r
192\r
193 @param Uhc The UHCI device.\r
194 @param Qh The queue head of the transfer.\r
195 @param FirstTd First TD of the transfer.\r
196 @param DevAddr Device Address.\r
197 @param EndPoint EndPoint Address.\r
198 @param DataLen Data length.\r
199 @param Interval Polling Interval when inserted to frame list.\r
200 @param Mapping Mapping value.\r
201 @param Data Data buffer, unmapped.\r
202 @param Callback Callback after interrupt transfeer.\r
203 @param Context Callback Context passed as function parameter.\r
204 @param IsLow Is Low Speed.\r
205\r
206 @retval EFI_SUCCESS An asynchronous transfer is created.\r
207 @retval EFI_INVALID_PARAMETER Paremeter is error.\r
208 @retval EFI_OUT_OF_RESOURCES Failed because of resource shortage.\r
209\r
210**/\r
211EFI_STATUS\r
212UhciCreateAsyncReq (\r
213 IN USB_HC_DEV *Uhc,\r
214 IN UHCI_QH_SW *Qh,\r
215 IN UHCI_TD_SW *FirstTd,\r
216 IN UINT8 DevAddr,\r
217 IN UINT8 EndPoint,\r
218 IN UINTN DataLen,\r
219 IN UINTN Interval,\r
220 IN VOID *Mapping,\r
221 IN UINT8 *Data,\r
222 IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback,\r
223 IN VOID *Context,\r
224 IN BOOLEAN IsLow\r
225 );\r
226\r
227\r
228/**\r
229 Delete Async Interrupt QH and TDs.\r
230\r
231 @param Uhc The UHCI device.\r
232 @param DevAddr Device Address.\r
233 @param EndPoint EndPoint Address.\r
234 @param Toggle The next data toggle to use.\r
235\r
236 @retval EFI_SUCCESS The request is deleted.\r
237 @retval EFI_INVALID_PARAMETER Paremeter is error.\r
238 @retval EFI_NOT_FOUND The asynchronous isn't found.\r
239\r
240**/\r
241EFI_STATUS\r
242UhciRemoveAsyncReq (\r
243 IN USB_HC_DEV *Uhc,\r
244 IN UINT8 DevAddr,\r
245 IN UINT8 EndPoint,\r
246 OUT UINT8 *Toggle\r
247 );\r
248\r
249\r
250/**\r
251 Release all the asynchronous transfers on the lsit.\r
252\r
253 @param Uhc The UHCI device.\r
254\r
255 @return None.\r
256\r
257**/\r
258VOID\r
259UhciFreeAllAsyncReq (\r
260 IN USB_HC_DEV *Uhc\r
261 );\r
262\r
263\r
264/**\r
265 Interrupt transfer periodic check handler.\r
266\r
267 @param Event The event of the time.\r
268 @param Context Context of the event, pointer to USB_HC_DEV.\r
269\r
270 @return None.\r
271\r
272**/\r
273VOID\r
274UhciMonitorAsyncReqList (\r
275 IN EFI_EVENT Event,\r
276 IN VOID *Context\r
277 );\r
278\r
279#endif\r