2 This file contains the definination for host controller schedule routines.
4 Copyright (c) 2013-2015 Intel Corporation.
6 SPDX-License-Identifier: BSD-2-Clause-Patent
15 #include "Descriptor.h"
17 #define HCCA_MEM_SIZE 256
21 typedef struct _INTERRUPT_CONTEXT_ENTRY INTERRUPT_CONTEXT_ENTRY
;
23 struct _INTERRUPT_CONTEXT_ENTRY
{
25 UINT8 EndPointAddress
;
27 TD_DESCRIPTOR
*DataTd
;
29 UINT8 MaxPacketLength
;
30 UINTN PollingInterval
;
31 EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction
;
37 VOID
*UCBufferMapping
;
39 INTERRUPT_CONTEXT_ENTRY
*NextEntry
;
50 Add an item of interrupt context
52 @param Ohc UHC private data
53 @param NewEntry New entry to add
55 @retval EFI_SUCCESS Item successfully added
59 OhciAddInterruptContextEntry (
60 IN USB_OHCI_HC_DEV
*Ohc
,
61 IN INTERRUPT_CONTEXT_ENTRY
*NewEntry
66 Free a interrupt context entry
68 @param Ohc UHC private data
69 @param Entry Pointer to an interrupt context entry
71 @retval EFI_SUCCESS Entry freed
72 @retval EFI_INVALID_PARAMETER Entry is NULL
76 OhciFreeInterruptContextEntry (
77 IN USB_OHCI_HC_DEV
*Ohc
,
78 IN INTERRUPT_CONTEXT_ENTRY
*Entry
83 Free entries match the device address and endpoint address
85 @Param Ohc UHC private date
86 @Param DeviceAddress Item to free must match this device address
87 @Param EndPointAddress Item to free must match this end point address
88 @Param DataToggle DataToggle for output
90 @retval EFI_SUCCESS Items match the requirement removed
94 OhciFreeInterruptContext(
95 IN USB_OHCI_HC_DEV
*Ohc
,
96 IN UINT8 DeviceAddress
,
97 IN UINT8 EndPointAddress
,
104 Convert Error code from OHCI format to EFI format
106 @Param ErrorCode ErrorCode in OHCI format
108 @retval ErrorCode in EFI format
121 @Param Ohc UHC private data
122 @Param Td TD_DESCRIPTOR
123 @Param Result Result to return
125 @retval TRUE means OK
126 @retval FLASE means Error or Short packet
130 OhciCheckTDsResults (
131 IN USB_OHCI_HC_DEV
*Ohc
,
132 IN TD_DESCRIPTOR
*Td
,
137 Check the task status on an ED
139 @Param Ed Pointer to the ED task that TD hooked on
140 @Param HeadTd TD header for current transaction
142 @retval Task Status Code
148 IN ED_DESCRIPTOR
*Ed
,
149 IN TD_DESCRIPTOR
*HeadTd
,
150 OUT OHCI_ED_RESULT
*EdResult
154 Check the task status
156 @Param Ohc UHC private data
157 @Param ListType Pipe type
158 @Param Ed Pointer to the ED task hooked on
159 @Param HeadTd Head of TD corresponding to the task
160 @Param ErrorCode return the ErrorCode
162 @retval EFI_SUCCESS Task done
163 @retval EFI_NOT_READY Task on processing
164 @retval EFI_DEVICE_ERROR Some error occured
169 IN USB_OHCI_HC_DEV
*Ohc
,
170 IN DESCRIPTOR_LIST_TYPE ListType
,
171 IN ED_DESCRIPTOR
*Ed
,
172 IN TD_DESCRIPTOR
*HeadTd
,
173 OUT OHCI_ED_RESULT
*EdResult
178 Convert TD condition code to Efi Status
180 @Param ConditionCode Condition code to convert
182 @retval EFI_SUCCESS No error occured
183 @retval EFI_NOT_READY TD still on processing
184 @retval EFI_DEVICE_ERROR Error occured in processing TD
189 OhciTDConditionCodeToStatus (
190 IN UINT32 ConditionCode
195 Invoke callbacks hooked on done TDs
197 @Param Entry Interrupt transfer transaction information data structure
198 @Param Context Ohc private data
203 OhciInvokeInterruptCallBack(
204 IN INTERRUPT_CONTEXT_ENTRY
*Entry
,
211 Timer to submit periodic interrupt transfer, and invoke callbacks hooked on done TDs
213 @param Event Event handle
214 @param Context Device private data