3 Copyright (c) 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 The definition for EHCI register operation routines.
25 #ifndef _EFI_UHCI_SCHED_H_
26 #define _EFI_UHCI_SCHED_H_
30 UHCI_ASYNC_INT_SIGNATURE
= EFI_SIGNATURE_32 ('u', 'h', 'c', 'a'),
33 // The failure mask for USB transfer return status. If any of
34 // these bit is set, the transfer failed. EFI_USB_ERR_NOEXECUTE
35 // and EFI_USB_ERR_NAK are not considered as error condition:
36 // the transfer is still going on.
38 USB_ERR_FAIL_MASK
= EFI_USB_ERR_STALL
| EFI_USB_ERR_BUFFER
|
39 EFI_USB_ERR_BABBLE
| EFI_USB_ERR_CRC
|
40 EFI_USB_ERR_TIMEOUT
| EFI_USB_ERR_BITSTUFF
|
46 // Structure to return the result of UHCI QH execution.
47 // Result is the final result of the QH's QTD. NextToggle
48 // is the next data toggle to use. Complete is the actual
49 // length of data transferred.
57 typedef struct _UHCI_ASYNC_REQUEST UHCI_ASYNC_REQUEST
;
60 // Structure used to manager the asynchronous interrupt transfers.
62 struct _UHCI_ASYNC_REQUEST
{
65 UHCI_ASYNC_REQUEST
*Recycle
;
68 // Endpoint attributes
76 // Data and UHC structures
80 UINT8
*Data
; // Allocated host memory, not mapped memory
85 // User callback and its context
87 EFI_ASYNC_USB_TRANSFER_CALLBACK Callback
;
91 #define UHCI_ASYNC_INT_FROM_LINK(a) \
92 CR (a, UHCI_ASYNC_REQUEST, Link, UHCI_ASYNC_INT_SIGNATURE)
102 Create Frame List Structure
110 EFI_OUT_OF_RESOURCES - Can't allocate memory resources
111 EFI_UNSUPPORTED - Map memory fail
112 EFI_SUCCESS - Success
119 Destory FrameList buffer
121 @param Uhc The UHCI device
127 UhciDestoryFrameList (
134 Convert the poll rate to the maxium 2^n that is smaller
137 @param Interval The poll rate to convert
139 @return The converted poll rate
143 UhciConvertPollRate (
150 Link a queue head (for asynchronous interrupt transfer) to
153 @param FrameBase The base of the frame list
154 @param Qh The queue head to link into
160 UhciLinkQhToFrameList (
168 Unlink QH from the frame list is easier: find all
169 the precedence node, and pointer there next to QhSw's
172 @param FrameBase The base address of the frame list
173 @param Qh The queue head to unlink
179 UhciUnlinkQhFromFrameList (
187 Check the result of the transfer
189 @param Uhc The UHCI device
190 @param Td The first TDs of the transfer
191 @param TimeOut TimeOut value in milliseconds
192 @param IsLow Is Low Speed Device
193 @param QhResult The variable to return result
195 @retval EFI_SUCCESS The transfer finished with success
196 @retval EFI_DEVICE_ERROR Transfer failed
200 UhciExecuteTransfer (
206 OUT UHCI_QH_RESULT
*QhResult
212 Create Async Request node, and Link to List
214 @param Uhc The UHCI device
215 @param Qh The queue head of the transfer
216 @param FirstTd First TD of the transfer
217 @param DevAddr Device Address
218 @param EndPoint EndPoint Address
219 @param Toggle Data Toggle
220 @param DataLen Data length
221 @param Interval Polling Interval when inserted to frame list
222 @param Mapping Mapping value
223 @param Data Data buffer, unmapped
224 @param Callback Callback after interrupt transfeer
225 @param Context Callback Context passed as function parameter
226 @param IsLow Is Low Speed
228 @retval EFI_SUCCESS An asynchronous transfer is created
229 @retval EFI_INVALID_PARAMETER Paremeter is error
230 @retval EFI_OUT_OF_RESOURCES Failed because of resource shortage.
237 IN UHCI_TD_SW
*FirstTd
,
244 IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback
,
252 Delete Async Interrupt QH and TDs
254 @param Uhc The UHCI device
255 @param DevAddr Device Address
256 @param EndPoint EndPoint Address
257 @param Toggle The next data toggle to use
259 @retval EFI_SUCCESS The request is deleted
260 @retval EFI_INVALID_PARAMETER Paremeter is error
261 @retval EFI_NOT_FOUND The asynchronous isn't found
275 Release all the asynchronous transfers on the lsit.
277 @param Uhc The UHCI device
283 UhciFreeAllAsyncReq (
290 Interrupt transfer periodic check handler
292 @param Event The event of the time
293 @param Context Context of the event, pointer to USB_HC_DEV
299 UhciMonitorAsyncReqList (