]> git.proxmox.com Git - mirror_edk2.git/blame - QuarkSocPkg/QuarkSouthCluster/Usb/Ohci/Dxe/OhciSched.h
QuarkSocPkg: Add new package for Quark SoC X1000
[mirror_edk2.git] / QuarkSocPkg / QuarkSouthCluster / Usb / Ohci / Dxe / OhciSched.h
CommitLineData
9b6bbcdb
MK
1/** @file\r
2This file contains the definination for host controller schedule routines.\r
3\r
4Copyright (c) 2013-2015 Intel Corporation.\r
5\r
6This 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\r
17\r
18#ifndef _OHCI_SCHED_H\r
19#define _OHCI_SCHED_H\r
20\r
21#include "Descriptor.h"\r
22\r
23#define HCCA_MEM_SIZE 256\r
24#define GRID_SIZE 16\r
25#define GRID_SHIFT 4\r
26\r
27typedef struct _INTERRUPT_CONTEXT_ENTRY INTERRUPT_CONTEXT_ENTRY;\r
28\r
29struct _INTERRUPT_CONTEXT_ENTRY{\r
30 UINT8 DeviceAddress;\r
31 UINT8 EndPointAddress;\r
32 ED_DESCRIPTOR *Ed;\r
33 TD_DESCRIPTOR *DataTd;\r
34 BOOLEAN IsSlowDevice;\r
35 UINT8 MaxPacketLength;\r
36 UINTN PollingInterval;\r
37 EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction;\r
38 VOID *Context;\r
39 BOOLEAN IsPeriodic;\r
40 VOID *Buffer;\r
41 UINTN DataLength;\r
42 VOID *UCBuffer;\r
43 VOID *UCBufferMapping;\r
44 UINT8 *Toggle;\r
45 INTERRUPT_CONTEXT_ENTRY *NextEntry;\r
46};\r
47\r
48\r
49typedef struct {\r
50 UINT32 ErrorCode;\r
51 UINT8 NextToggle;\r
52} OHCI_ED_RESULT;\r
53\r
54/**\r
55\r
56 Add an item of interrupt context\r
57\r
58 @param Ohc UHC private data\r
59 @param NewEntry New entry to add\r
60\r
61 @retval EFI_SUCCESS Item successfully added\r
62\r
63**/\r
64EFI_STATUS\r
65OhciAddInterruptContextEntry (\r
66 IN USB_OHCI_HC_DEV *Ohc,\r
67 IN INTERRUPT_CONTEXT_ENTRY *NewEntry\r
68 );\r
69\r
70/**\r
71\r
72 Free a interrupt context entry\r
73\r
74 @param Ohc UHC private data\r
75 @param Entry Pointer to an interrupt context entry\r
76\r
77 @retval EFI_SUCCESS Entry freed\r
78 @retval EFI_INVALID_PARAMETER Entry is NULL\r
79\r
80**/\r
81EFI_STATUS\r
82OhciFreeInterruptContextEntry (\r
83 IN USB_OHCI_HC_DEV *Ohc,\r
84 IN INTERRUPT_CONTEXT_ENTRY *Entry\r
85 );\r
86\r
87/**\r
88\r
89 Free entries match the device address and endpoint address\r
90\r
91 @Param Ohc UHC private date\r
92 @Param DeviceAddress Item to free must match this device address\r
93 @Param EndPointAddress Item to free must match this end point address\r
94 @Param DataToggle DataToggle for output\r
95\r
96 @retval EFI_SUCCESS Items match the requirement removed\r
97\r
98**/\r
99EFI_STATUS\r
100OhciFreeInterruptContext(\r
101 IN USB_OHCI_HC_DEV *Ohc,\r
102 IN UINT8 DeviceAddress,\r
103 IN UINT8 EndPointAddress,\r
104 OUT UINT8 *DataToggle\r
105 );\r
106\r
107\r
108/**\r
109\r
110 Convert Error code from OHCI format to EFI format\r
111\r
112 @Param ErrorCode ErrorCode in OHCI format\r
113\r
114 @retval ErrorCode in EFI format\r
115\r
116**/\r
117UINT32\r
118ConvertErrorCode (\r
119 IN UINT32 ErrorCode\r
120 );\r
121\r
122\r
123/**\r
124\r
125 Check TDs Results\r
126\r
127 @Param Ohc UHC private data\r
128 @Param Td TD_DESCRIPTOR\r
129 @Param Result Result to return\r
130\r
131 @retval TRUE means OK\r
132 @retval FLASE means Error or Short packet\r
133\r
134**/\r
135BOOLEAN\r
136OhciCheckTDsResults (\r
137 IN USB_OHCI_HC_DEV *Ohc,\r
138 IN TD_DESCRIPTOR *Td,\r
139 OUT UINT32 *Result\r
140 );\r
141/**\r
142\r
143 Check the task status on an ED\r
144\r
145 @Param Ed Pointer to the ED task that TD hooked on\r
146 @Param HeadTd TD header for current transaction\r
147\r
148 @retval Task Status Code\r
149\r
150**/\r
151\r
152UINT32\r
153CheckEDStatus (\r
154 IN ED_DESCRIPTOR *Ed,\r
155 IN TD_DESCRIPTOR *HeadTd,\r
156 OUT OHCI_ED_RESULT *EdResult\r
157 );\r
158/**\r
159\r
160 Check the task status\r
161\r
162 @Param Ohc UHC private data\r
163 @Param ListType Pipe type\r
164 @Param Ed Pointer to the ED task hooked on\r
165 @Param HeadTd Head of TD corresponding to the task\r
166 @Param ErrorCode return the ErrorCode\r
167\r
168 @retval EFI_SUCCESS Task done\r
169 @retval EFI_NOT_READY Task on processing\r
170 @retval EFI_DEVICE_ERROR Some error occured\r
171\r
172**/\r
173EFI_STATUS\r
174CheckIfDone (\r
175 IN USB_OHCI_HC_DEV *Ohc,\r
176 IN DESCRIPTOR_LIST_TYPE ListType,\r
177 IN ED_DESCRIPTOR *Ed,\r
178 IN TD_DESCRIPTOR *HeadTd,\r
179 OUT OHCI_ED_RESULT *EdResult\r
180 );\r
181\r
182/**\r
183\r
184 Convert TD condition code to Efi Status\r
185\r
186 @Param ConditionCode Condition code to convert\r
187\r
188 @retval EFI_SUCCESS No error occured\r
189 @retval EFI_NOT_READY TD still on processing\r
190 @retval EFI_DEVICE_ERROR Error occured in processing TD\r
191\r
192**/\r
193\r
194EFI_STATUS\r
195OhciTDConditionCodeToStatus (\r
196 IN UINT32 ConditionCode\r
197 );\r
198\r
199/**\r
200\r
201 Invoke callbacks hooked on done TDs\r
202\r
203 @Param Entry Interrupt transfer transaction information data structure\r
204 @Param Context Ohc private data\r
205\r
206**/\r
207\r
208VOID\r
209OhciInvokeInterruptCallBack(\r
210 IN INTERRUPT_CONTEXT_ENTRY *Entry,\r
211 IN UINT32 Result\r
212);\r
213\r
214\r
215/**\r
216\r
217 Timer to submit periodic interrupt transfer, and invoke callbacks hooked on done TDs\r
218\r
219 @param Event Event handle\r
220 @param Context Device private data\r
221\r
222**/\r
223\r
224VOID\r
225EFIAPI\r
226OhciHouseKeeper (\r
227 IN EFI_EVENT Event,\r
228 IN VOID *Context\r
229 );\r
230\r
231#endif\r