]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.h
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / EhciDxe / EhciSched.h
1 /** @file
2
3 This file contains the definination for host controller schedule routines.
4
5 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef _EFI_EHCI_SCHED_H_
11 #define _EFI_EHCI_SCHED_H_
12
13 /**
14 Initialize the schedule data structure such as frame list.
15
16 @param Ehc The EHCI device to init schedule data for.
17
18 @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to init schedule data.
19 @retval EFI_SUCCESS The schedule data is initialized.
20
21 **/
22 EFI_STATUS
23 EhcInitSched (
24 IN USB2_HC_DEV *Ehc
25 );
26
27 /**
28 Free the schedule data. It may be partially initialized.
29
30 @param Ehc The EHCI device.
31
32 **/
33 VOID
34 EhcFreeSched (
35 IN USB2_HC_DEV *Ehc
36 );
37
38 /**
39 Link the queue head to the asynchronous schedule list.
40 UEFI only supports one CTRL/BULK transfer at a time
41 due to its interfaces. This simplifies the AsynList
42 management: A reclamation header is always linked to
43 the AsyncListAddr, the only active QH is appended to it.
44
45 @param Ehc The EHCI device.
46 @param Qh The queue head to link.
47
48 **/
49 VOID
50 EhcLinkQhToAsync (
51 IN USB2_HC_DEV *Ehc,
52 IN EHC_QH *Qh
53 );
54
55 /**
56 Unlink a queue head from the asynchronous schedule list.
57 Need to synchronize with hardware.
58
59 @param Ehc The EHCI device.
60 @param Qh The queue head to unlink.
61
62 **/
63 VOID
64 EhcUnlinkQhFromAsync (
65 IN USB2_HC_DEV *Ehc,
66 IN EHC_QH *Qh
67 );
68
69 /**
70 Link a queue head for interrupt transfer to the periodic
71 schedule frame list. This code is very much the same as
72 that in UHCI.
73
74 @param Ehc The EHCI device.
75 @param Qh The queue head to link.
76
77 **/
78 VOID
79 EhcLinkQhToPeriod (
80 IN USB2_HC_DEV *Ehc,
81 IN EHC_QH *Qh
82 );
83
84 /**
85 Unlink an interrupt queue head from the periodic
86 schedule frame list.
87
88 @param Ehc The EHCI device.
89 @param Qh The queue head to unlink.
90
91 **/
92 VOID
93 EhcUnlinkQhFromPeriod (
94 IN USB2_HC_DEV *Ehc,
95 IN EHC_QH *Qh
96 );
97
98 /**
99 Execute the transfer by polling the URB. This is a synchronous operation.
100
101 @param Ehc The EHCI device.
102 @param Urb The URB to execute.
103 @param TimeOut The time to wait before abort, in millisecond.
104
105 @retval EFI_DEVICE_ERROR The transfer failed due to transfer error.
106 @retval EFI_TIMEOUT The transfer failed due to time out.
107 @retval EFI_SUCCESS The transfer finished OK.
108
109 **/
110 EFI_STATUS
111 EhcExecTransfer (
112 IN USB2_HC_DEV *Ehc,
113 IN URB *Urb,
114 IN UINTN TimeOut
115 );
116
117 /**
118 Delete a single asynchronous interrupt transfer for
119 the device and endpoint.
120
121 @param Ehc The EHCI device.
122 @param DevAddr The address of the target device.
123 @param EpNum The endpoint of the target.
124 @param DataToggle Return the next data toggle to use.
125
126 @retval EFI_SUCCESS An asynchronous transfer is removed.
127 @retval EFI_NOT_FOUND No transfer for the device is found.
128
129 **/
130 EFI_STATUS
131 EhciDelAsyncIntTransfer (
132 IN USB2_HC_DEV *Ehc,
133 IN UINT8 DevAddr,
134 IN UINT8 EpNum,
135 OUT UINT8 *DataToggle
136 );
137
138 /**
139 Remove all the asynchronous interrutp transfers.
140
141 @param Ehc The EHCI device.
142
143 **/
144 VOID
145 EhciDelAllAsyncIntTransfers (
146 IN USB2_HC_DEV *Ehc
147 );
148
149 /**
150 Insert a single asynchronous interrupt transfer for
151 the device and endpoint.
152
153 @param Ehc The EHCI device.
154 @param DevAddr The device address.
155 @param EpAddr Endpoint addrress & its direction.
156 @param DevSpeed The device speed.
157 @param Toggle Initial data toggle to use.
158 @param MaxPacket The max packet length of the endpoint.
159 @param Hub The transaction translator to use.
160 @param DataLen The length of data buffer.
161 @param Callback The function to call when data is transferred.
162 @param Context The context to the callback.
163 @param Interval The interval for interrupt transfer.
164
165 @return Created URB or NULL.
166
167 **/
168 URB *
169 EhciInsertAsyncIntTransfer (
170 IN USB2_HC_DEV *Ehc,
171 IN UINT8 DevAddr,
172 IN UINT8 EpAddr,
173 IN UINT8 DevSpeed,
174 IN UINT8 Toggle,
175 IN UINTN MaxPacket,
176 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Hub,
177 IN UINTN DataLen,
178 IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback,
179 IN VOID *Context,
180 IN UINTN Interval
181 );
182
183 /**
184 Interrupt transfer periodic check handler.
185
186 @param Event Interrupt event.
187 @param Context Pointer to USB2_HC_DEV.
188
189 **/
190 VOID
191 EFIAPI
192 EhcMonitorAsyncRequests (
193 IN EFI_EVENT Event,
194 IN VOID *Context
195 );
196
197 #endif