3 The definition for EHCI register operation routines.
5 Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef _EFI_UHCI_SCHED_H_
11 #define _EFI_UHCI_SCHED_H_
13 #define UHCI_ASYNC_INT_SIGNATURE SIGNATURE_32 ('u', 'h', 'c', 'a')
15 // The failure mask for USB transfer return status. If any of
16 // these bit is set, the transfer failed. EFI_USB_ERR_NOEXECUTE
17 // and EFI_USB_ERR_NAK are not considered as error condition:
18 // the transfer is still going on.
20 #define USB_ERR_FAIL_MASK (EFI_USB_ERR_STALL | EFI_USB_ERR_BUFFER | \
21 EFI_USB_ERR_BABBLE | EFI_USB_ERR_CRC | \
22 EFI_USB_ERR_TIMEOUT | EFI_USB_ERR_BITSTUFF | \
26 // Structure to return the result of UHCI QH execution.
27 // Result is the final result of the QH's QTD. NextToggle
28 // is the next data toggle to use. Complete is the actual
29 // length of data transferred.
37 typedef struct _UHCI_ASYNC_REQUEST UHCI_ASYNC_REQUEST
;
40 // Structure used to manager the asynchronous interrupt transfers.
42 struct _UHCI_ASYNC_REQUEST
{
45 UHCI_ASYNC_REQUEST
*Recycle
;
48 // Endpoint attributes
56 // Data and UHC structures
60 UINT8
*Data
; // Allocated host memory, not mapped memory
65 // User callback and its context
67 EFI_ASYNC_USB_TRANSFER_CALLBACK Callback
;
71 #define UHCI_ASYNC_INT_FROM_LINK(a) \
72 CR (a, UHCI_ASYNC_REQUEST, Link, UHCI_ASYNC_INT_SIGNATURE)
75 Create Frame List Structure.
77 @param Uhc The UHCI device.
79 @return EFI_OUT_OF_RESOURCES Can't allocate memory resources.
80 @return EFI_UNSUPPORTED Map memory fail.
81 @return EFI_SUCCESS Success.
90 Destory FrameList buffer.
92 @param Uhc The UHCI device.
98 UhciDestoryFrameList (
103 Convert the poll rate to the maxium 2^n that is smaller
106 @param Interval The poll rate to convert.
108 @return The converted poll rate.
112 UhciConvertPollRate (
117 Link a queue head (for asynchronous interrupt transfer) to
120 @param Uhc The UHCI device.
121 @param Qh The queue head to link into.
125 UhciLinkQhToFrameList (
131 Unlink QH from the frame list is easier: find all
132 the precedence node, and pointer there next to QhSw's
135 @param Uhc The UHCI device.
136 @param Qh The queue head to unlink.
140 UhciUnlinkQhFromFrameList (
146 Check the result of the transfer.
148 @param Uhc The UHCI device.
149 @param Qh The queue head of the transfer.
150 @param Td The first TDs of the transfer.
151 @param TimeOut TimeOut value in milliseconds.
152 @param IsLow Is Low Speed Device.
153 @param QhResult The variable to return result.
155 @retval EFI_SUCCESS The transfer finished with success.
156 @retval EFI_DEVICE_ERROR Transfer failed.
160 UhciExecuteTransfer (
166 OUT UHCI_QH_RESULT
*QhResult
170 Create Async Request node, and Link to List.
172 @param Uhc The UHCI device.
173 @param Qh The queue head of the transfer.
174 @param FirstTd First TD of the transfer.
175 @param DevAddr Device Address.
176 @param EndPoint EndPoint Address.
177 @param DataLen Data length.
178 @param Interval Polling Interval when inserted to frame list.
179 @param Data Data buffer, unmapped.
180 @param Callback Callback after interrupt transfeer.
181 @param Context Callback Context passed as function parameter.
182 @param IsLow Is Low Speed.
184 @retval EFI_SUCCESS An asynchronous transfer is created.
185 @retval EFI_INVALID_PARAMETER Paremeter is error.
186 @retval EFI_OUT_OF_RESOURCES Failed because of resource shortage.
193 IN UHCI_TD_SW
*FirstTd
,
199 IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback
,
205 Delete Async Interrupt QH and TDs.
207 @param Uhc The UHCI device.
208 @param DevAddr Device Address.
209 @param EndPoint EndPoint Address.
210 @param Toggle The next data toggle to use.
212 @retval EFI_SUCCESS The request is deleted.
213 @retval EFI_INVALID_PARAMETER Paremeter is error.
214 @retval EFI_NOT_FOUND The asynchronous isn't found.
226 Release all the asynchronous transfers on the lsit.
228 @param Uhc The UHCI device.
234 UhciFreeAllAsyncReq (
239 Interrupt transfer periodic check handler.
241 @param Event The event of the time.
242 @param Context Context of the event, pointer to USB_HC_DEV.
249 UhciMonitorAsyncReqList (