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