1 /** @file 2 3 This file contains the definination for host controller schedule routines. 4 5 Copyright (c) 2007 - 2009, 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 10 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. 13 14 **/ 15 16 #ifndef _EFI_EHCI_SCHED_H_ 17 #define _EFI_EHCI_SCHED_H_ 18 19 20 /** 21 Initialize the schedule data structure such as frame list. 22 23 @param Ehc The EHCI device to init schedule data for. 24 25 @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to init schedule data. 26 @retval EFI_SUCCESS The schedule data is initialized. 27 28 **/ 29 EFI_STATUS 30 EhcInitSched ( 31 IN USB2_HC_DEV *Ehc 32 ); 33 34 35 /** 36 Free the schedule data. It may be partially initialized. 37 38 @param Ehc The EHCI device. 39 40 **/ 41 VOID 42 EhcFreeSched ( 43 IN USB2_HC_DEV *Ehc 44 ); 45 46 47 /** 48 Link the queue head to the asynchronous schedule list. 49 UEFI only supports one CTRL/BULK transfer at a time 50 due to its interfaces. This simplifies the AsynList 51 management: A reclamation header is always linked to 52 the AsyncListAddr, the only active QH is appended to it. 53 54 @param Ehc The EHCI device. 55 @param Qh The queue head to link. 56 57 **/ 58 VOID 59 EhcLinkQhToAsync ( 60 IN USB2_HC_DEV *Ehc, 61 IN EHC_QH *Qh 62 ); 63 64 65 /** 66 Unlink a queue head from the asynchronous schedule list. 67 Need to synchronize with hardware. 68 69 @param Ehc The EHCI device. 70 @param Qh The queue head to unlink. 71 72 **/ 73 VOID 74 EhcUnlinkQhFromAsync ( 75 IN USB2_HC_DEV *Ehc, 76 IN EHC_QH *Qh 77 ); 78 79 80 /** 81 Link a queue head for interrupt transfer to the periodic 82 schedule frame list. This code is very much the same as 83 that in UHCI. 84 85 @param Ehc The EHCI device. 86 @param Qh The queue head to link. 87 88 **/ 89 VOID 90 EhcLinkQhToPeriod ( 91 IN USB2_HC_DEV *Ehc, 92 IN EHC_QH *Qh 93 ); 94 95 96 /** 97 Unlink an interrupt queue head from the periodic 98 schedule frame list. 99 100 @param Ehc The EHCI device. 101 @param Qh The queue head to unlink. 102 103 **/ 104 VOID 105 EhcUnlinkQhFromPeriod ( 106 IN USB2_HC_DEV *Ehc, 107 IN EHC_QH *Qh 108 ); 109 110 111 112 /** 113 Execute the transfer by polling the URB. This is a synchronous operation. 114 115 @param Ehc The EHCI device. 116 @param Urb The URB to execute. 117 @param TimeOut The time to wait before abort, in millisecond. 118 119 @retval EFI_DEVICE_ERROR The transfer failed due to transfer error. 120 @retval EFI_TIMEOUT The transfer failed due to time out. 121 @retval EFI_SUCCESS The transfer finished OK. 122 123 **/ 124 EFI_STATUS 125 EhcExecTransfer ( 126 IN USB2_HC_DEV *Ehc, 127 IN URB *Urb, 128 IN UINTN TimeOut 129 ); 130 131 132 /** 133 Delete a single asynchronous interrupt transfer for 134 the device and endpoint. 135 136 @param Ehc The EHCI device. 137 @param DevAddr The address of the target device. 138 @param EpNum The endpoint of the target. 139 @param DataToggle Return the next data toggle to use. 140 141 @retval EFI_SUCCESS An asynchronous transfer is removed. 142 @retval EFI_NOT_FOUND No transfer for the device is found. 143 144 **/ 145 EFI_STATUS 146 EhciDelAsyncIntTransfer ( 147 IN USB2_HC_DEV *Ehc, 148 IN UINT8 DevAddr, 149 IN UINT8 EpNum, 150 OUT UINT8 *DataToggle 151 ); 152 153 154 /** 155 Remove all the asynchronous interrutp transfers. 156 157 @param Ehc The EHCI device. 158 159 **/ 160 VOID 161 EhciDelAllAsyncIntTransfers ( 162 IN USB2_HC_DEV *Ehc 163 ); 164 165 166 /** 167 Interrupt transfer periodic check handler. 168 169 @param Event Interrupt event. 170 @param Context Pointer to USB2_HC_DEV. 171 172 **/ 173 VOID 174 EFIAPI 175 EhcMonitorAsyncRequests ( 176 IN EFI_EVENT Event, 177 IN VOID *Context 178 ); 179 180 #endif 181