2 This file contains the definination for host controller schedule routines.
4 Copyright (c) 2013-2015 Intel Corporation.
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 #include "Descriptor.h"
23 #define HCCA_MEM_SIZE 256
27 typedef struct _INTERRUPT_CONTEXT_ENTRY INTERRUPT_CONTEXT_ENTRY
;
29 struct _INTERRUPT_CONTEXT_ENTRY
{
31 UINT8 EndPointAddress
;
33 TD_DESCRIPTOR
*DataTd
;
35 UINT8 MaxPacketLength
;
36 UINTN PollingInterval
;
37 EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction
;
43 VOID
*UCBufferMapping
;
45 INTERRUPT_CONTEXT_ENTRY
*NextEntry
;
56 Add an item of interrupt context
58 @param Ohc UHC private data
59 @param NewEntry New entry to add
61 @retval EFI_SUCCESS Item successfully added
65 OhciAddInterruptContextEntry (
66 IN USB_OHCI_HC_DEV
*Ohc
,
67 IN INTERRUPT_CONTEXT_ENTRY
*NewEntry
72 Free a interrupt context entry
74 @param Ohc UHC private data
75 @param Entry Pointer to an interrupt context entry
77 @retval EFI_SUCCESS Entry freed
78 @retval EFI_INVALID_PARAMETER Entry is NULL
82 OhciFreeInterruptContextEntry (
83 IN USB_OHCI_HC_DEV
*Ohc
,
84 IN INTERRUPT_CONTEXT_ENTRY
*Entry
89 Free entries match the device address and endpoint address
91 @Param Ohc UHC private date
92 @Param DeviceAddress Item to free must match this device address
93 @Param EndPointAddress Item to free must match this end point address
94 @Param DataToggle DataToggle for output
96 @retval EFI_SUCCESS Items match the requirement removed
100 OhciFreeInterruptContext(
101 IN USB_OHCI_HC_DEV
*Ohc
,
102 IN UINT8 DeviceAddress
,
103 IN UINT8 EndPointAddress
,
104 OUT UINT8
*DataToggle
110 Convert Error code from OHCI format to EFI format
112 @Param ErrorCode ErrorCode in OHCI format
114 @retval ErrorCode in EFI format
127 @Param Ohc UHC private data
128 @Param Td TD_DESCRIPTOR
129 @Param Result Result to return
131 @retval TRUE means OK
132 @retval FLASE means Error or Short packet
136 OhciCheckTDsResults (
137 IN USB_OHCI_HC_DEV
*Ohc
,
138 IN TD_DESCRIPTOR
*Td
,
143 Check the task status on an ED
145 @Param Ed Pointer to the ED task that TD hooked on
146 @Param HeadTd TD header for current transaction
148 @retval Task Status Code
154 IN ED_DESCRIPTOR
*Ed
,
155 IN TD_DESCRIPTOR
*HeadTd
,
156 OUT OHCI_ED_RESULT
*EdResult
160 Check the task status
162 @Param Ohc UHC private data
163 @Param ListType Pipe type
164 @Param Ed Pointer to the ED task hooked on
165 @Param HeadTd Head of TD corresponding to the task
166 @Param ErrorCode return the ErrorCode
168 @retval EFI_SUCCESS Task done
169 @retval EFI_NOT_READY Task on processing
170 @retval EFI_DEVICE_ERROR Some error occured
175 IN USB_OHCI_HC_DEV
*Ohc
,
176 IN DESCRIPTOR_LIST_TYPE ListType
,
177 IN ED_DESCRIPTOR
*Ed
,
178 IN TD_DESCRIPTOR
*HeadTd
,
179 OUT OHCI_ED_RESULT
*EdResult
184 Convert TD condition code to Efi Status
186 @Param ConditionCode Condition code to convert
188 @retval EFI_SUCCESS No error occured
189 @retval EFI_NOT_READY TD still on processing
190 @retval EFI_DEVICE_ERROR Error occured in processing TD
195 OhciTDConditionCodeToStatus (
196 IN UINT32 ConditionCode
201 Invoke callbacks hooked on done TDs
203 @Param Entry Interrupt transfer transaction information data structure
204 @Param Context Ohc private data
209 OhciInvokeInterruptCallBack(
210 IN INTERRUPT_CONTEXT_ENTRY
*Entry
,
217 Timer to submit periodic interrupt transfer, and invoke callbacks hooked on done TDs
219 @param Event Event handle
220 @param Context Device private data