summaryrefslogtreecommitdiff
path: root/Platform/BroxtonPlatformPkg/Common/Features/UsbDeviceDxe/XdciInterface.h
blob: 93eb77367f60f97b72ddd4deac26b0894947589c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
/** @file
  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>

  This program and the accompanying materials
  are licensed and made available under the terms and conditions of the BSD License
  which accompanies this distribution.  The full text of the license may be found at
  http://opensource.org/licenses/bsd-license.php.

  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

**/

#ifndef _USB_DCD_IF_H_
#define _USB_DCD_IF_H_

/* Core driver for device controller
 * @DevCoreInit: Intializes device controller
 * @DevCoreDeinit: De-initializes device controller
 * @DevCoreRegisterCallback: Registers callback function for
 * an event to be called by the controller driver
 * @DevCoreUnregisterCallback: Unregisters callback function
 * for an event
 * @DevCoreIsrRoutine: core interrupt service routine for
 * device controller to be used by OS/stack-i/f layer
 * @DevCoreConnect: Enable device controller to connect to USB host
 * @DevCoreDisconnect: Soft disconnect device controller from
 * USB host
 * @DevCoreGetSpeed: Get USB bus Speed on which device controller
 * is attached
 * @DevCoreSetAddress: Set USB device address in device controller
 * @DevCoreSetConfig: Set configuration number for device controller
 * @DevCoreSetLinkState: Set link state for device controller
 * @DevCoreInitEp: Initialize non-EP0 endpoint
 * @DevCoreEpEnable: Enable endpoint
 * @DevCoreEpDisable: Disable endpoint
 * @DevCoreEpStall: Stall/Halt endpoint
 * @DevCoreEpClearStall: Clear Stall/Halt on endpoint
 * @DevCoreEpSetNrdy: Set endpoint to not ready state
 * @DevCoreEp0RxSetupPkt: Receive SETUP packet on EP0
 * @DevCoreEp0RxStatusPkt: Receive status packet on EP0
 * @DevCoreEp0TxStatusPkt: Transmit status packet from EP0
 * @DevCoreEpTxData: Transmit data from EP
 * @DevCoreEpRxData: Received data on EP
 * @DevCoreEpCancelTransfer: Cancel transfer on EP
 */

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_INIT) (
  IN USB_DEV_CONFIG_PARAMS     *ConfigParams,
  IN VOID                      *ParentHandle,
  IN VOID                      **CoreHandle
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_DEINIT) (
  IN VOID                      *CoreHandle,
  IN UINT32                    Flags
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_REG_CALLBACK) (
  IN VOID                      *CoreHandle,
  IN USB_DEVICE_EVENT_ID       Event,
  IN USB_DEVICE_CALLBACK_FUNC  CallbackFn
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_UNREG_CALLBACK) (
  IN VOID                      *CoreHandle,
  IN USB_DEVICE_EVENT_ID       Event
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_ISR_ROUTINE) (
  IN VOID                      *CoreHandle
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_CONNECT) (
  IN VOID                      *CoreHandle
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_DISCONNECT) (
  IN VOID                      *CoreHandle
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_GET_SPEED) (
  IN VOID                      *CoreHandle,
  IN USB_SPEED                 *Speed
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_SET_ADDRESS) (
  IN VOID                      *CoreHandle,
  IN UINT32                    Address
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_SET_CONFIG) (
  IN VOID                      *CoreHandle,
  IN UINT32                    ConfigNum
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_SET_LINK_STATE) (
  IN VOID                      *CoreHandle,
  IN USB_DEVICE_SS_LINK_STATE  State
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_INIT_EP) (
  IN VOID                      *CoreHandle,
  IN USB_EP_INFO               *EpInfo
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_EP_ENABLE) (
  IN VOID                      *CoreHandle,
  IN USB_EP_INFO               *EpInfo
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_EP_DISABLE) (
  IN VOID                      *CoreHandle,
  IN USB_EP_INFO               *EpInfo
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_EP_STALL) (
  IN VOID                      *CoreHandle,
  IN USB_EP_INFO               *EpInfo
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_EP_CLEAR_STALL) (
  IN VOID                      *CoreHandle,
  IN USB_EP_INFO               *EpInfo
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_EP_SET_NRDY) (
  IN VOID                      *CoreHandle,
  IN USB_EP_INFO               *EpInfo
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_EP0_RX_SETUP_PKT) (
  IN VOID                      *CoreHandle,
  IN UINT8                     *Buffer
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_EP0_RX_STATUS_PKT) (
  IN VOID                      *CoreHandle
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_EP0_TX_STATUS_PKT) (
  IN VOID                      *CoreHandle
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_EP_TX_DATA) (
  IN VOID                      *CoreHandle,
  IN USB_XFER_REQUEST          *XferHandle
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_EP_RX_DATA) (
  IN VOID                      *CoreHandle,
  IN USB_XFER_REQUEST          *XferHandle
  );

typedef
EFI_STATUS
(EFIAPI *DEV_CORE_EP_CANCEL_TRANSFER) (
  IN VOID                      *CoreHandle,
  IN USB_EP_INFO               *EpInfo
  );

struct UsbDeviceCoreDriver {
  DEV_CORE_INIT                 DevCoreInit;
  DEV_CORE_DEINIT               DevCoreDeinit;
  DEV_CORE_REG_CALLBACK         DevCoreRegisterCallback;
  DEV_CORE_UNREG_CALLBACK       DevCoreUnregisterCallback;
  DEV_CORE_ISR_ROUTINE          DevCoreIsrRoutine;
  DEV_CORE_ISR_ROUTINE          DevCoreIsrRoutineTimerBased;
  DEV_CORE_CONNECT              DevCoreConnect;
  DEV_CORE_DISCONNECT           DevCoreDisconnect;
  DEV_CORE_GET_SPEED            DevCoreGetSpeed;
  DEV_CORE_SET_ADDRESS          DevCoreSetAddress;
  DEV_CORE_SET_CONFIG           DevCoreSetConfig;
  DEV_CORE_SET_LINK_STATE       DevCoreSetLinkState;
  DEV_CORE_INIT_EP              DevCoreInitEp;
  DEV_CORE_EP_ENABLE            DevCoreEpEnable;
  DEV_CORE_EP_DISABLE           DevCoreEpDisable;
  DEV_CORE_EP_STALL             DevCoreEpStall;
  DEV_CORE_EP_CLEAR_STALL       DevCoreEpClearStall;
  DEV_CORE_EP_SET_NRDY          DevCoreEpSetNrdy;
  DEV_CORE_EP0_RX_SETUP_PKT     DevCoreEp0RxSetupPkt;
  DEV_CORE_EP0_RX_STATUS_PKT    DevCoreEp0RxStatusPkt;
  DEV_CORE_EP0_TX_STATUS_PKT    DevCoreEp0TxStatusPkt;
  DEV_CORE_EP_TX_DATA           DevCoreEpTxData;
  DEV_CORE_EP_RX_DATA           DevCoreEpRxData;
  DEV_CORE_EP_CANCEL_TRANSFER   DevCoreEpCancelTransfer;
};

//
// This API is used to obtain the driver handle for HW-independent API
// @id: The ID of the core for which this driver is requested
//
const struct UsbDeviceCoreDriver *UsbDeviceGetCoreDriver(
  USB_CONTROLLER_ID id);

#endif