1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 
5 #include "aos/hal/usbh.h"
6 
7 
8 /**
9  * @brief Initialize The USB Host Controller
10  *
11  * @param[in]  phost  pointer to the usb host handler
12  * @param[in]  phcd   pointer to the usb hcd pointer
13  *
14  * @return 0:success, otherwise is failed
15  */
hal_usbh_init(void * phost,void ** phcd)16 int hal_usbh_init(void *phost, void **phcd)
17 {
18 	return 0;
19 }
20 
21 /**
22  * @brief Finalize The USB Host Controller
23  *
24  * @param[in]  hcd  pointer to the usb hcd
25  *
26  * @return 0:success, otherwise is failed
27  */
hal_usbh_finalize(void * hcd)28 int hal_usbh_finalize(void *hcd)
29 {
30 	return 0;
31 }
32 
33 /**
34  * @brief Reset Host Controller's Port
35  *
36  * @param[in]  hcd  pointer to the usb hcd
37  *
38  * @return 0:success, otherwise is failed
39  */
hal_usbh_port_reset(void * hcd)40 int hal_usbh_port_reset(void *hcd)
41 {
42 	return 0;
43 }
44 
45 /**
46  * @brief Get Device Speed
47  *
48  * @param[in]  hcd  pointer to the usb hcd
49  *
50  * @return the usb host controller's speed (0, 1, 2)
51  */
hal_usbh_get_speed(void * hcd)52 int hal_usbh_get_speed(void *hcd)
53 {
54 	return 0;
55 }
56 
57 /**
58  * @brief Free The Host Controll's Pipe
59  *
60  * @param[in]  hcd       pointer to the usb hcd
61  * @param[in]  pipe_num  the index of the pipe
62  *
63  * @return 0:success, otherwise is failed
64  */
hal_usbh_pipe_free(void * hcd,uint8_t pipe_num)65 int hal_usbh_pipe_free(void *hcd, uint8_t pipe_num)
66 {
67 	return 0;
68 }
69 
70 /**
71  * @brief Configure The Host Controller's Pipe
72  *
73  * @param[in]  hcd       pointer to the usb hcd
74  * @param[in]  index     the index of the pipe
75  * @param[in]  ep_addr   the endpoint address
76  * @param[in]  dev_addr  the device address
77  * @param[in]  speed     the device speed
78  * @param[in]  token     the transmit token
79  * @param[in]  ep_type   the endpoint type
80  * @param[in]  mps       the max packet size
81  *
82  * @return 0:success, otherwise is failed
83  */
hal_usbh_pipe_configure(void * hcd,uint8_t index,uint8_t ep_addr,uint8_t dev_addr,uint8_t speed,uint8_t ep_type,uint16_t mps)84 int hal_usbh_pipe_configure(void *hcd, uint8_t index, uint8_t ep_addr, uint8_t dev_addr,
85                             uint8_t speed, uint8_t ep_type, uint16_t mps)
86 {
87 	return 0;
88 }
89 
90 /**
91  * @brief Submit The Urb
92  *
93  * @param[in]      hcd        pointer to the usb hcd
94  * @param[in]      pipe_num   the index of the pipe
95  * @param[in]      direction  the transmit direction
96  * @param[in]      ep_type    the endpoint type
97  * @param[in]      token      the transmit token
98  * @param[in/out]  buf        pointer to the buffer which will be send or recv
99  * @param[in]      length     the length of buffer
100  *
101  * @return 0:success, otherwise is failed
102  */
hal_usbh_submit_urb(void * hcd,uint8_t pipe_num,uint8_t direction,uint8_t ep_type,uint8_t token,uint8_t * buf,uint16_t length)103 int hal_usbh_submit_urb(void *hcd, uint8_t pipe_num, uint8_t direction, uint8_t ep_type,
104                         uint8_t token, uint8_t *buf, uint16_t length)
105 {
106 	return 0;
107 }
108 
109 /**
110  * @brief Get The Urb Transmit State
111  *
112  * @param[in]  hcd       pointer to the usb hcd
113  * @param[in]  pipe_num  the index of the pipe
114  *
115  * @return 0:Idle, 1:Done, 2:Not Ready, 3:Nyet, 4:Error, 5:Stall
116  */
hal_usbh_get_urb_state(void * hcd,uint8_t pipe_num)117 int hal_usbh_get_urb_state(void *hcd, uint8_t pipe_num)
118 {
119 	return 0;
120 }
121 
122