]> begriffs open source - cmsis/blob - CMSIS/Driver/DriverTemplates/Driver_USBD.c
CoreValidation: Test projects.
[cmsis] / CMSIS / Driver / DriverTemplates / Driver_USBD.c
1 /*
2  * Copyright (c) 2013-2016 ARM Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Licensed under the Apache License, Version 2.0 (the License); you may
7  * not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18  
19 #include "Driver_USBD.h"
20
21 #define ARM_USBD_DRV_VERSION    ARM_DRIVER_VERSION_MAJOR_MINOR(2, 0) /* driver version */
22
23 /* Driver Version */
24 static const ARM_DRIVER_VERSION usbd_driver_version = { 
25     ARM_USBD_API_VERSION,
26     ARM_USBD_DRV_VERSION
27 };
28
29 /* Driver Capabilities */
30 static const ARM_USBD_CAPABILITIES usbd_driver_capabilities = {
31     0, /* vbus_detection */
32     0, /* event_vbus_on */
33     0  /* event_vbus_off */
34 };
35
36 //
37 // Functions
38 //
39
40 ARM_DRIVER_VERSION ARM_USBD_GetVersion(void)
41 {
42 }
43
44 ARM_USBD_CAPABILITIES ARM_USBD_GetCapabilities(void)
45 {
46 }
47
48 int32_t ARM_USBD_Initialize(ARM_USBD_SignalDeviceEvent_t cb_device_event,
49                             ARM_USBD_SignalEndpointEvent_t cb_endpoint_event)
50 {
51 }
52
53 int32_t ARM_USBD_Uninitialize(void)
54 {
55 }
56
57 int32_t ARM_USBD_PowerControl(ARM_POWER_STATE state)
58 {
59     switch (state)
60     {
61     case ARM_POWER_OFF:
62         break;
63
64     case ARM_POWER_LOW:
65         break;
66
67     case ARM_POWER_FULL:
68         break;
69
70     default:
71         return ARM_DRIVER_ERROR_UNSUPPORTED;
72     }
73 }
74
75 int32_t ARM_USBD_DeviceConnect(void)
76 {
77 }
78
79 int32_t ARM_USBD_DeviceDisconnect(void)
80 {
81 }
82
83 ARM_USBD_STATE ARM_USBD_DeviceGetState(void)
84 {
85 }
86
87 int32_t ARM_USBD_DeviceRemoteWakeup(void)
88 {
89 }
90
91 int32_t ARM_USBD_DeviceSetAddress(uint8_t dev_addr)
92 {
93 }
94
95 int32_t ARM_USBD_ReadSetupPacket(uint8_t *setup)
96 {
97 }
98
99 int32_t ARM_USBD_EndpointConfigure(uint8_t ep_addr,
100                                    uint8_t ep_type,
101                                    uint16_t ep_max_packet_size)
102 {
103 }
104
105 int32_t ARM_USBD_EndpointUnconfigure(uint8_t ep_addr)
106 {
107 }
108
109 int32_t ARM_USBD_EndpointStall(uint8_t ep_addr, bool stall)
110 {
111 }
112
113 int32_t ARM_USBD_EndpointTransfer(uint8_t ep_addr, uint8_t *data, uint32_t num)
114 {
115 }
116
117 uint32_t ARM_USBD_EndpointTransferGetResult(uint8_t ep_addr)
118 {
119 }
120
121 int32_t ARM_USBD_EndpointTransferAbort(uint8_t ep_addr)
122 {
123 }
124
125 uint16_t ARM_USBD_GetFrameNumber(void)
126 {
127 }
128
129 void ARM_USBD_SignalDeviceEvent(uint32_t event)
130 {
131     // function body
132 }
133
134 void ARM_USBD_SignalEndpointEvent(uint8_t ep_addr, uint32_t ep_event)
135 {
136     // function body
137 }
138
139 // End USBD Interface
140
141 ARM_DRIVER_USBD Driver_USBD =
142 {
143     ARM_USBD_GetVersion,
144     ARM_USBD_GetCapabilities,
145     ARM_USBD_Initialize,
146     ARM_USBD_Uninitialize,
147     ARM_USBD_PowerControl,
148     ARM_USBD_DeviceConnect,
149     ARM_USBD_DeviceDisconnect,
150     ARM_USBD_DeviceGetState,
151     ARM_USBD_DeviceRemoteWakeup,
152     ARM_USBD_DeviceSetAddress,
153     ARM_USBD_ReadSetupPacket,
154     ARM_USBD_EndpointConfigure,
155     ARM_USBD_EndpointUnconfigure,
156     ARM_USBD_EndpointStall,
157     ARM_USBD_EndpointTransfer,
158     ARM_USBD_EndpointTransferGetResult,
159     ARM_USBD_EndpointTransferAbort,
160     ARM_USBD_GetFrameNumber
161 };