3 The definition for EHCI register operation routines.
5 Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
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.
16 #ifndef _EFI_UHCI_SCHED_H_
17 #define _EFI_UHCI_SCHED_H_
20 #define UHCI_ASYNC_INT_SIGNATURE SIGNATURE_32 ('u', 'h', 'c', 'a')
22 // The failure mask for USB transfer return status. If any of
23 // these bit is set, the transfer failed. EFI_USB_ERR_NOEXECUTE
24 // and EFI_USB_ERR_NAK are not considered as error condition:
25 // the transfer is still going on.
27 #define USB_ERR_FAIL_MASK (EFI_USB_ERR_STALL | EFI_USB_ERR_BUFFER | \
28 EFI_USB_ERR_BABBLE | EFI_USB_ERR_CRC | \
29 EFI_USB_ERR_TIMEOUT | EFI_USB_ERR_BITSTUFF | \
34 // Structure to return the result of UHCI QH execution.
35 // Result is the final result of the QH's QTD. NextToggle
36 // is the next data toggle to use. Complete is the actual
37 // length of data transferred.
45 typedef struct _UHCI_ASYNC_REQUEST UHCI_ASYNC_REQUEST
;
48 // Structure used to manager the asynchronous interrupt transfers.
50 struct _UHCI_ASYNC_REQUEST
{
53 UHCI_ASYNC_REQUEST
*Recycle
;
56 // Endpoint attributes
64 // Data and UHC structures
68 UINT8
*Data
; // Allocated host memory, not mapped memory
73 // User callback and its context
75 EFI_ASYNC_USB_TRANSFER_CALLBACK Callback
;
79 #define UHCI_ASYNC_INT_FROM_LINK(a) \
80 CR (a, UHCI_ASYNC_REQUEST, Link, UHCI_ASYNC_INT_SIGNATURE)
84 Create Frame List Structure.
86 @param Uhc The UHCI device.
88 @return EFI_OUT_OF_RESOURCES Can't allocate memory resources.
89 @return EFI_UNSUPPORTED Map memory fail.
90 @return EFI_SUCCESS Success.
99 Destory FrameList buffer.
101 @param Uhc The UHCI device.
107 UhciDestoryFrameList (
113 Convert the poll rate to the maxium 2^n that is smaller
116 @param Interval The poll rate to convert.
118 @return The converted poll rate.
122 UhciConvertPollRate (
128 Link a queue head (for asynchronous interrupt transfer) to
131 @param Uhc The UHCI device.
132 @param Qh The queue head to link into.
136 UhciLinkQhToFrameList (
143 Unlink QH from the frame list is easier: find all
144 the precedence node, and pointer there next to QhSw's
147 @param Uhc The UHCI device.
148 @param Qh The queue head to unlink.
152 UhciUnlinkQhFromFrameList (
159 Check the result of the transfer.
161 @param Uhc The UHCI device.
162 @param Qh The queue head of the transfer.
163 @param Td The first TDs of the transfer.
164 @param TimeOut TimeOut value in milliseconds.
165 @param IsLow Is Low Speed Device.
166 @param QhResult The variable to return result.
168 @retval EFI_SUCCESS The transfer finished with success.
169 @retval EFI_DEVICE_ERROR Transfer failed.
173 UhciExecuteTransfer (
179 OUT UHCI_QH_RESULT
*QhResult
184 Create Async Request node, and Link to List.
186 @param Uhc The UHCI device.
187 @param Qh The queue head of the transfer.
188 @param FirstTd First TD of the transfer.
189 @param DevAddr Device Address.
190 @param EndPoint EndPoint Address.
191 @param DataLen Data length.
192 @param Interval Polling Interval when inserted to frame list.
193 @param Data Data buffer, unmapped.
194 @param Callback Callback after interrupt transfeer.
195 @param Context Callback Context passed as function parameter.
196 @param IsLow Is Low Speed.
198 @retval EFI_SUCCESS An asynchronous transfer is created.
199 @retval EFI_INVALID_PARAMETER Paremeter is error.
200 @retval EFI_OUT_OF_RESOURCES Failed because of resource shortage.
207 IN UHCI_TD_SW
*FirstTd
,
213 IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback
,
220 Delete Async Interrupt QH and TDs.
222 @param Uhc The UHCI device.
223 @param DevAddr Device Address.
224 @param EndPoint EndPoint Address.
225 @param Toggle The next data toggle to use.
227 @retval EFI_SUCCESS The request is deleted.
228 @retval EFI_INVALID_PARAMETER Paremeter is error.
229 @retval EFI_NOT_FOUND The asynchronous isn't found.
242 Release all the asynchronous transfers on the lsit.
244 @param Uhc The UHCI device.
250 UhciFreeAllAsyncReq (
256 Interrupt transfer periodic check handler.
258 @param Event The event of the time.
259 @param Context Context of the event, pointer to USB_HC_DEV.
266 UhciMonitorAsyncReqList (