]> begriffs open source - cmsis/blob - CMSIS/Driver/DriverTemplates/Driver_USBD.c
Possible bugs in MMU_MemorySection(), MMU_MemoryPage() (#219)
[cmsis] / CMSIS / Driver / DriverTemplates / Driver_USBD.c
1 /*
2  * Copyright (c) 2013-2020 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(1, 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     0  /* reserved */
35 };
36
37 //
38 // Functions
39 //
40
41 static ARM_DRIVER_VERSION ARM_USBD_GetVersion(void)
42 {
43   return usbd_driver_version;
44 }
45
46 static ARM_USBD_CAPABILITIES ARM_USBD_GetCapabilities(void)
47 {
48   return usbd_driver_capabilities;
49 }
50
51 static int32_t ARM_USBD_Initialize(ARM_USBD_SignalDeviceEvent_t cb_device_event,
52                                    ARM_USBD_SignalEndpointEvent_t cb_endpoint_event)
53 {
54 }
55
56 static int32_t ARM_USBD_Uninitialize(void)
57 {
58 }
59
60 static int32_t ARM_USBD_PowerControl(ARM_POWER_STATE state)
61 {
62     switch (state)
63     {
64     case ARM_POWER_OFF:
65         break;
66
67     case ARM_POWER_LOW:
68         break;
69
70     case ARM_POWER_FULL:
71         break;
72     }
73     return ARM_DRIVER_OK;
74 }
75
76 static int32_t ARM_USBD_DeviceConnect(void)
77 {
78 }
79
80 static int32_t ARM_USBD_DeviceDisconnect(void)
81 {
82 }
83
84 static ARM_USBD_STATE ARM_USBD_DeviceGetState(void)
85 {
86 }
87
88 static int32_t ARM_USBD_DeviceRemoteWakeup(void)
89 {
90 }
91
92 static int32_t ARM_USBD_DeviceSetAddress(uint8_t dev_addr)
93 {
94 }
95
96 static int32_t ARM_USBD_ReadSetupPacket(uint8_t *setup)
97 {
98 }
99
100 static int32_t ARM_USBD_EndpointConfigure(uint8_t  ep_addr,
101                                           uint8_t  ep_type,
102                                           uint16_t ep_max_packet_size)
103 {
104 }
105
106 static int32_t ARM_USBD_EndpointUnconfigure(uint8_t ep_addr)
107 {
108 }
109
110 static int32_t ARM_USBD_EndpointStall(uint8_t ep_addr, bool stall)
111 {
112 }
113
114 static int32_t ARM_USBD_EndpointTransfer(uint8_t ep_addr, uint8_t *data, uint32_t num)
115 {
116 }
117
118 static uint32_t ARM_USBD_EndpointTransferGetResult(uint8_t ep_addr)
119 {
120 }
121
122 static int32_t ARM_USBD_EndpointTransferAbort(uint8_t ep_addr)
123 {
124 }
125
126 static uint16_t ARM_USBD_GetFrameNumber(void)
127 {
128 }
129
130 static void ARM_USBD_SignalDeviceEvent(uint32_t event)
131 {
132     // function body
133 }
134
135 static void ARM_USBD_SignalEndpointEvent(uint8_t ep_addr, uint32_t ep_event)
136 {
137     // function body
138 }
139
140 // End USBD Interface
141
142 extern \
143 ARM_DRIVER_USBD Driver_USBD0;
144 ARM_DRIVER_USBD Driver_USBD0 =
145 {
146     ARM_USBD_GetVersion,
147     ARM_USBD_GetCapabilities,
148     ARM_USBD_Initialize,
149     ARM_USBD_Uninitialize,
150     ARM_USBD_PowerControl,
151     ARM_USBD_DeviceConnect,
152     ARM_USBD_DeviceDisconnect,
153     ARM_USBD_DeviceGetState,
154     ARM_USBD_DeviceRemoteWakeup,
155     ARM_USBD_DeviceSetAddress,
156     ARM_USBD_ReadSetupPacket,
157     ARM_USBD_EndpointConfigure,
158     ARM_USBD_EndpointUnconfigure,
159     ARM_USBD_EndpointStall,
160     ARM_USBD_EndpointTransfer,
161     ARM_USBD_EndpointTransferGetResult,
162     ARM_USBD_EndpointTransferAbort,
163     ARM_USBD_GetFrameNumber
164 };