-
Notifications
You must be signed in to change notification settings - Fork 40
/
Driver_USBD.c
164 lines (135 loc) · 3.47 KB
/
Driver_USBD.c
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
/*
* Copyright (c) 2013-2020 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "Driver_USBD.h"
#define ARM_USBD_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(1, 0) /* driver version */
/* Driver Version */
static const ARM_DRIVER_VERSION usbd_driver_version = {
ARM_USBD_API_VERSION,
ARM_USBD_DRV_VERSION
};
/* Driver Capabilities */
static const ARM_USBD_CAPABILITIES usbd_driver_capabilities = {
0, /* vbus_detection */
0, /* event_vbus_on */
0, /* event_vbus_off */
0 /* reserved */
};
//
// Functions
//
static ARM_DRIVER_VERSION ARM_USBD_GetVersion(void)
{
return usbd_driver_version;
}
static ARM_USBD_CAPABILITIES ARM_USBD_GetCapabilities(void)
{
return usbd_driver_capabilities;
}
static int32_t ARM_USBD_Initialize(ARM_USBD_SignalDeviceEvent_t cb_device_event,
ARM_USBD_SignalEndpointEvent_t cb_endpoint_event)
{
}
static int32_t ARM_USBD_Uninitialize(void)
{
}
static int32_t ARM_USBD_PowerControl(ARM_POWER_STATE state)
{
switch (state)
{
case ARM_POWER_OFF:
break;
case ARM_POWER_LOW:
break;
case ARM_POWER_FULL:
break;
}
return ARM_DRIVER_OK;
}
static int32_t ARM_USBD_DeviceConnect(void)
{
}
static int32_t ARM_USBD_DeviceDisconnect(void)
{
}
static ARM_USBD_STATE ARM_USBD_DeviceGetState(void)
{
}
static int32_t ARM_USBD_DeviceRemoteWakeup(void)
{
}
static int32_t ARM_USBD_DeviceSetAddress(uint8_t dev_addr)
{
}
static int32_t ARM_USBD_ReadSetupPacket(uint8_t *setup)
{
}
static int32_t ARM_USBD_EndpointConfigure(uint8_t ep_addr,
uint8_t ep_type,
uint16_t ep_max_packet_size)
{
}
static int32_t ARM_USBD_EndpointUnconfigure(uint8_t ep_addr)
{
}
static int32_t ARM_USBD_EndpointStall(uint8_t ep_addr, bool stall)
{
}
static int32_t ARM_USBD_EndpointTransfer(uint8_t ep_addr, uint8_t *data, uint32_t num)
{
}
static uint32_t ARM_USBD_EndpointTransferGetResult(uint8_t ep_addr)
{
}
static int32_t ARM_USBD_EndpointTransferAbort(uint8_t ep_addr)
{
}
static uint16_t ARM_USBD_GetFrameNumber(void)
{
}
static void ARM_USBD_SignalDeviceEvent(uint32_t event)
{
// function body
}
static void ARM_USBD_SignalEndpointEvent(uint8_t ep_addr, uint32_t ep_event)
{
// function body
}
// End USBD Interface
extern \
ARM_DRIVER_USBD Driver_USBD0;
ARM_DRIVER_USBD Driver_USBD0 =
{
ARM_USBD_GetVersion,
ARM_USBD_GetCapabilities,
ARM_USBD_Initialize,
ARM_USBD_Uninitialize,
ARM_USBD_PowerControl,
ARM_USBD_DeviceConnect,
ARM_USBD_DeviceDisconnect,
ARM_USBD_DeviceGetState,
ARM_USBD_DeviceRemoteWakeup,
ARM_USBD_DeviceSetAddress,
ARM_USBD_ReadSetupPacket,
ARM_USBD_EndpointConfigure,
ARM_USBD_EndpointUnconfigure,
ARM_USBD_EndpointStall,
ARM_USBD_EndpointTransfer,
ARM_USBD_EndpointTransferGetResult,
ARM_USBD_EndpointTransferAbort,
ARM_USBD_GetFrameNumber
};