1 /*
2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3 */
4
5 #include "aos/hal/usbd.h"
6
7 /* Initialization */
8 /******************************************************************************************/
9
10 /**
11 * @brief Initialize usb device driver
12 *
13 * @param[in] pdev point to usb device handler
14 *
15 * @return the operation status, USBD_OK is OK, USBD_BUSY is BUSY, others is error
16 */
usbd_hal_init(void * pdev)17 usbd_stat_t usbd_hal_init(void *pdev)
18 {
19 return 0;
20 }
21
22 /**
23 * @brief Deinitialize usb device driver
24 *
25 * @param[in] pdev point to usb device handler
26 *
27 * @return the operation status, USBD_OK is OK, USBD_BUSY is BUSY, others is error
28 */
usbd_hal_deinit(void * pdev)29 usbd_stat_t usbd_hal_deinit(void *pdev)
30 {
31 return 0;
32 }
33
34 /**
35 * @brief enable usb device driver
36 *
37 * @param[in] pdev point to usb device handler
38 *
39 * @return the operation status, USBD_OK is OK, USBD_BUSY is BUSY, others is error
40 */
usbd_hal_start(void * pdev)41 usbd_stat_t usbd_hal_start(void *pdev)
42 {
43 return 0;
44 }
45
46 /**
47 * @brief disable usb device driver
48 *
49 * @param[in] pdev point to usb device handler
50 *
51 * @return the operation status, USBD_OK is OK, USBD_BUSY is BUSY, others is error
52 */
usbd_hal_stop(void * pdev)53 usbd_stat_t usbd_hal_stop(void *pdev)
54 {
55 return 0;
56 }
57
58 /**
59 * @brief enable usb device interrupt
60 */
usbd_hal_connect(void)61 void usbd_hal_connect(void)
62 {
63 return 0;
64 }
65
66 /**
67 * @brief disable usb device interrupt
68 */
usbd_hal_disconnect(void)69 void usbd_hal_disconnect(void)
70 {
71 return 0;
72 }
73
74 /**
75 * @brief configure usb device info
76 */
usbd_hal_configure_device(void)77 void usbd_hal_configure_device(void)
78 {
79 return 0;
80 }
81
82 /**
83 * @brief unconfigure usb device info
84 */
usbd_hal_unconfigure_device(void)85 void usbd_hal_unconfigure_device(void)
86 {
87 return 0;
88 }
89
90 /**
91 * @brief unconfigure usb device info
92 *
93 * @param[in] pdev point to usb device handler
94 * @param[in] address the usb device address
95 *
96 * @return none
97 */
usbd_hal_set_address(void * pdev,uint8_t address)98 void usbd_hal_set_address(void *pdev, uint8_t address)
99 {
100 return 0;
101 }
102
103 /* Endpoint 0 */
104 /******************************************************************************************/
105
106 /**
107 * @brief Endpoint0 setup(read setup packet)
108 *
109 * @param[in] buffer point to usb device handler
110 *
111 * @return none
112 */
usbd_hal_ep0_setup(uint8_t * buffer)113 void usbd_hal_ep0_setup(uint8_t *buffer)
114 {
115 return 0;
116 }
117
118 /**
119 * @brief Endpoint0 read packet
120 *
121 * @param[in] pdev point to usb device handler
122 *
123 * @return none
124 */
usbd_hal_ep0_read(void * pdev)125 void usbd_hal_ep0_read(void *pdev)
126 {
127 return 0;
128 }
129
130 /**
131 * @brief Endpoint0 read stage
132 */
usbd_hal_ep0_read_stage(void)133 void usbd_hal_ep0_read_stage(void)
134 {
135 return 0;
136 }
137
138 /**
139 * @brief Endpoint0 get read result
140 *
141 * @param[in] pdev point to usb device handler
142 * @param[in] buffer point to packet
143 *
144 * @return the length of read packet
145 */
usbd_hal_get_ep0_read_result(void * pdev,uint8_t * buffer)146 uint32_t usbd_hal_get_ep0_read_result(void *pdev, uint8_t *buffer)
147 {
148 return 0;
149 }
150
151 /**
152 * @brief Endpoint0 write
153 *
154 * @param[in] pdev point to usb device handler
155 * @param[in] buffer point to packet
156 * @param[in] size the length of write packet
157 *
158 * @return none
159 */
usbd_hal_ep0_write(void * pdev,uint8_t * buffer,uint32_t size)160 void usbd_hal_ep0_write(void *pdev, uint8_t *buffer, uint32_t size)
161 {
162 return 0;
163 }
164
165 /**
166 * @brief Get endpoint0 write result
167 */
usbd_hal_get_ep0_write_result(void)168 void usbd_hal_get_ep0_write_result(void)
169 {
170 return 0;
171 }
172
173 /**
174 * @brief Stall endpoint0
175 *
176 * @param[in] pdev point to usb device handler
177 *
178 * @return none
179 */
usbd_hal_ep0_stall(void * pdev)180 void usbd_hal_ep0_stall(void *pdev)
181 {
182 return 0;
183 }
184
185 /* Other endpoints */
186 /******************************************************************************************/
187
188 /**
189 * @brief open the endpoint
190 *
191 * @param[in] pdev point to usb device handler
192 * @param[in] endpoint the num of endpoint
193 * @param[in] maxPacket the max size of packet
194 * @param[in] flags options flags for configuring endpoints
195 *
196 * @return true is ok, false is false
197 */
usbd_hal_realise_endpoint(void * pdev,uint8_t endpoint,uint32_t maxPacket,uint32_t flags)198 bool usbd_hal_realise_endpoint(void *pdev, uint8_t endpoint, uint32_t maxPacket, uint32_t flags)
199 {
200 return 0;
201 }
202
203 /**
204 * @brief start read the endpoint data
205 *
206 * @param[in] pdev point to usb device handler
207 * @param[in] endpoint the num of endpoint
208 * @param[in] maximumSize amount of data to be received
209 *
210 * @return endpoint status
211 */
usbd_hal_endpoint_read(void * pdev,uint8_t endpoint,uint32_t maximumSize)212 ep_status usbd_hal_endpoint_read(void *pdev, uint8_t endpoint, uint32_t maximumSize)
213 {
214 return 0;
215 }
216
217 /**
218 * @brief read the endpoint data
219 *
220 * @param[in] pdev point to usb device handler
221 * @param[in] endpoint the num of endpoint
222 * @param[in] data point to receive buffer
223 * @param[in] bytesRead amount of data be received
224 *
225 * @return endpoint status
226 */
usbd_hal_endpoint_read_result(void * pdev,uint8_t endpoint,uint8_t * data,uint32_t * bytesRead)227 ep_status usbd_hal_endpoint_read_result(void *pdev, uint8_t endpoint, uint8_t *data, uint32_t *bytesRead)
228 {
229 return 0;
230 }
231
232 /**
233 * @brief start write the endpoint data
234 *
235 * @param[in] pdev point to usb device handler
236 * @param[in] endpoint the num of endpoint
237 * @param[in] data point to write buffer
238 * @param[in] size amount of data to be write
239 *
240 * @return endpoint status
241 */
usbd_hal_endpoint_write(void * pdev,uint8_t endpoint,uint8_t * data,uint32_t size)242 ep_status usbd_hal_endpoint_write(void *pdev, uint8_t endpoint, uint8_t *data, uint32_t size)
243 {
244 return 0;
245 }
246
247 /**
248 * @brief write the endpoint data
249 *
250 * @param[in] pdev point to usb device handler
251 * @param[in] endpoint the num of endpoint
252 *
253 * @return endpoint status
254 */
usbd_hal_endpoint_write_result(void * pdev,uint8_t endpoint)255 ep_status usbd_hal_endpoint_write_result(void *pdev, uint8_t endpoint)
256 {
257 return 0;
258 }
259
260 /**
261 * @brief stall the endpoint
262 *
263 * @param[in] pdev point to usb device handler
264 * @param[in] endpoint the num of endpoint
265 *
266 * @return none
267 */
usbd_hal_stall_endpoint(void * pdev,uint8_t endpoint)268 void usbd_hal_stall_endpoint(void *pdev, uint8_t endpoint)
269 {
270 return 0;
271 }
272
273 /**
274 * @brief unstall the endpoint
275 *
276 * @param[in] pdev point to usb device handler
277 * @param[in] endpoint the num of endpoint
278 *
279 * @return none
280 */
usbd_hal_unstall_endpoint(void * pdev,uint8_t endpoint)281 void usbd_hal_unstall_endpoint(void *pdev, uint8_t endpoint)
282 {
283 return 0;
284 }
285
286 /**
287 * @brief get the endpoint status of stall
288 *
289 * @param[in] pdev point to usb device handler
290 * @param[in] endpoint the num of endpoint
291 *
292 * @return true is ok, false is false
293 */
usbd_hal_get_endpoint_stall_state(void * pdev,uint8_t endpoint)294 bool usbd_hal_get_endpoint_stall_state(void *pdev, uint8_t endpoint)
295 {
296 return 0;
297 }
298
299