3 The definition for EHCI register operation routines.
5 Copyright (c) 2007, Intel Corporation
6 All rights reserved. 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_
21 UHCI_ASYNC_INT_SIGNATURE
= EFI_SIGNATURE_32 ('u', 'h', 'c', 'a'),
24 // The failure mask for USB transfer return status. If any of
25 // these bit is set, the transfer failed. EFI_USB_ERR_NOEXECUTE
26 // and EFI_USB_ERR_NAK are not considered as error condition:
27 // the transfer is still going on.
29 USB_ERR_FAIL_MASK
= EFI_USB_ERR_STALL
| EFI_USB_ERR_BUFFER
|
30 EFI_USB_ERR_BABBLE
| EFI_USB_ERR_CRC
|
31 EFI_USB_ERR_TIMEOUT
| EFI_USB_ERR_BITSTUFF
|
37 // Structure to return the result of UHCI QH execution.
38 // Result is the final result of the QH's QTD. NextToggle
39 // is the next data toggle to use. Complete is the actual
40 // length of data transferred.
48 typedef struct _UHCI_ASYNC_REQUEST UHCI_ASYNC_REQUEST
;
51 // Structure used to manager the asynchronous interrupt transfers.
53 struct _UHCI_ASYNC_REQUEST
{
56 UHCI_ASYNC_REQUEST
*Recycle
;
59 // Endpoint attributes
67 // Data and UHC structures
71 UINT8
*Data
; // Allocated host memory, not mapped memory
76 // User callback and its context
78 EFI_ASYNC_USB_TRANSFER_CALLBACK Callback
;
82 #define UHCI_ASYNC_INT_FROM_LINK(a) \
83 CR (a, UHCI_ASYNC_REQUEST, Link, UHCI_ASYNC_INT_SIGNATURE)
87 Create Frame List Structure.
89 @param Uhc The UHCI device.
91 @return EFI_OUT_OF_RESOURCES Can't allocate memory resources.
92 @return EFI_UNSUPPORTED Map memory fail.
93 @return EFI_SUCCESS Success.
102 Destory FrameList buffer.
104 @param Uhc The UHCI device.
110 UhciDestoryFrameList (
116 Convert the poll rate to the maxium 2^n that is smaller
119 @param Interval The poll rate to convert.
121 @return The converted poll rate.
125 UhciConvertPollRate (
131 Link a queue head (for asynchronous interrupt transfer) to
134 @param FrameBase The base of the frame list.
135 @param Qh The queue head to link into.
141 UhciLinkQhToFrameList (
148 Unlink QH from the frame list is easier: find all
149 the precedence node, and pointer there next to QhSw's
152 @param FrameBase The base address of the frame list.
153 @param Qh The queue head to unlink.
159 UhciUnlinkQhFromFrameList (
166 Check the result of the transfer.
168 @param Uhc The UHCI device.
169 @param Qh The queue head of the transfer.
170 @param Td The first TDs of the transfer.
171 @param TimeOut TimeOut value in milliseconds.
172 @param IsLow Is Low Speed Device.
173 @param QhResult The variable to return result.
175 @retval EFI_SUCCESS The transfer finished with success.
176 @retval EFI_DEVICE_ERROR Transfer failed.
180 UhciExecuteTransfer (
186 OUT UHCI_QH_RESULT
*QhResult
191 Create Async Request node, and Link to List.
193 @param Uhc The UHCI device.
194 @param Qh The queue head of the transfer.
195 @param FirstTd First TD of the transfer.
196 @param DevAddr Device Address.
197 @param EndPoint EndPoint Address.
198 @param DataLen Data length.
199 @param Interval Polling Interval when inserted to frame list.
200 @param Mapping Mapping value.
201 @param Data Data buffer, unmapped.
202 @param Callback Callback after interrupt transfeer.
203 @param Context Callback Context passed as function parameter.
204 @param IsLow Is Low Speed.
206 @retval EFI_SUCCESS An asynchronous transfer is created.
207 @retval EFI_INVALID_PARAMETER Paremeter is error.
208 @retval EFI_OUT_OF_RESOURCES Failed because of resource shortage.
215 IN UHCI_TD_SW
*FirstTd
,
222 IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback
,
229 Delete Async Interrupt QH and TDs.
231 @param Uhc The UHCI device.
232 @param DevAddr Device Address.
233 @param EndPoint EndPoint Address.
234 @param Toggle The next data toggle to use.
236 @retval EFI_SUCCESS The request is deleted.
237 @retval EFI_INVALID_PARAMETER Paremeter is error.
238 @retval EFI_NOT_FOUND The asynchronous isn't found.
251 Release all the asynchronous transfers on the lsit.
253 @param Uhc The UHCI device.
259 UhciFreeAllAsyncReq (
265 Interrupt transfer periodic check handler.
267 @param Event The event of the time.
268 @param Context Context of the event, pointer to USB_HC_DEV.
274 UhciMonitorAsyncReqList (