ARMEBS4  revision-26.06.2015
usb_dcd.h
1 #include "heivs/config.h"
2 #if (USE_STM32_USB_HOST_MODE || USE_STM32_USB_USE_DEVICE_MODE || USE_STM32_USB_OTG_MODE)
3 /**
4  ******************************************************************************
5  * @file usb_dcd.h
6  * @author MCD Application Team
7  * @version V2.1.0
8  * @date 19-March-2012
9  * @brief Peripheral Driver Header file
10  ******************************************************************************
11  * @attention
12  *
13  * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
14  *
15  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
16  * You may not use this file except in compliance with the License.
17  * You may obtain a copy of the License at:
18  *
19  * http://www.st.com/software_license_agreement_liberty_v2
20  *
21  * Unless required by applicable law or agreed to in writing, software
22  * distributed under the License is distributed on an "AS IS" BASIS,
23  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24  * See the License for the specific language governing permissions and
25  * limitations under the License.
26  *
27  ******************************************************************************
28  */
29 
30 /* Define to prevent recursive inclusion -------------------------------------*/
31 #ifndef __DCD_H__
32 #define __DCD_H__
33 
34 /* Includes ------------------------------------------------------------------*/
35 #include "stm32/usb/usb_core.h"
36 
37 
38 /** @addtogroup USB_OTG_DRIVER
39 * @{
40 */
41 
42 /** @defgroup USB_DCD
43 * @brief This file is the
44 * @{
45 */
46 
47 
48 /** @defgroup USB_DCD_Exported_Defines
49 * @{
50 */
51 #define USB_OTG_EP_CONTROL 0
52 #define USB_OTG_EP_ISOC 1
53 #define USB_OTG_EP_BULK 2
54 #define USB_OTG_EP_INT 3
55 #define USB_OTG_EP_MASK 3
56 
57 /* Device Status */
58 #define USB_OTG_DEFAULT 1
59 #define USB_OTG_ADDRESSED 2
60 #define USB_OTG_CONFIGURED 3
61 #define USB_OTG_SUSPENDED 4
62 
63 /**
64 * @}
65 */
66 
67 
68 /** @defgroup USB_DCD_Exported_Types
69 * @{
70 */
71 /********************************************************************************
72 Data structure type
73 ********************************************************************************/
74 typedef struct
75 {
76  uint8_t bLength;
77  uint8_t bDescriptorType;
78  uint8_t bEndpointAddress;
79  uint8_t bmAttributes;
80  uint16_t wMaxPacketSize;
81  uint8_t bInterval;
82 }
83 EP_DESCRIPTOR , *PEP_DESCRIPTOR;
84 
85 /**
86 * @}
87 */
88 
89 
90 /** @defgroup USB_DCD_Exported_Macros
91 * @{
92 */
93 /**
94 * @}
95 */
96 
97 /** @defgroup USB_DCD_Exported_Variables
98 * @{
99 */
100 /**
101 * @}
102 */
103 
104 /** @defgroup USB_DCD_Exported_FunctionsPrototype
105 * @{
106 */
107 /********************************************************************************
108 EXPORTED FUNCTION FROM THE USB-OTG LAYER
109 ********************************************************************************/
110 void DCD_Init(USB_OTG_CORE_HANDLE *pdev ,
111  USB_OTG_CORE_ID_TypeDef coreID);
112 
113 void DCD_DevConnect (USB_OTG_CORE_HANDLE *pdev);
114 void DCD_DevDisconnect (USB_OTG_CORE_HANDLE *pdev);
115 void DCD_EP_SetAddress (USB_OTG_CORE_HANDLE *pdev,
116  uint8_t address);
117 uint32_t DCD_EP_Open(USB_OTG_CORE_HANDLE *pdev ,
118  uint8_t ep_addr,
119  uint16_t ep_mps,
120  uint8_t ep_type);
121 
122 uint32_t DCD_EP_Close (USB_OTG_CORE_HANDLE *pdev,
123  uint8_t ep_addr);
124 
125 
126 uint32_t DCD_EP_PrepareRx ( USB_OTG_CORE_HANDLE *pdev,
127  uint8_t ep_addr,
128  uint8_t *pbuf,
129  uint16_t buf_len);
130 
131 uint32_t DCD_EP_Tx (USB_OTG_CORE_HANDLE *pdev,
132  uint8_t ep_addr,
133  uint8_t *pbuf,
134  uint32_t buf_len);
135 uint32_t DCD_EP_Stall (USB_OTG_CORE_HANDLE *pdev,
136  uint8_t epnum);
137 uint32_t DCD_EP_ClrStall (USB_OTG_CORE_HANDLE *pdev,
138  uint8_t epnum);
139 uint32_t DCD_EP_Flush (USB_OTG_CORE_HANDLE *pdev,
140  uint8_t epnum);
141 uint32_t DCD_Handle_ISR(USB_OTG_CORE_HANDLE *pdev);
142 
143 uint32_t DCD_GetEPStatus(USB_OTG_CORE_HANDLE *pdev ,
144  uint8_t epnum);
145 
146 void DCD_SetEPStatus (USB_OTG_CORE_HANDLE *pdev ,
147  uint8_t epnum ,
148  uint32_t Status);
149 
150 /**
151 * @}
152 */
153 
154 
155 #endif //__DCD_H__
156 
157 
158 /**
159 * @}
160 */
161 
162 /**
163 * @}
164 */
165 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
166 #endif /* (USE_STM32_USB_HOST_MODE || USE_STM32_USB_USE_DEVICE_MODE || USE_STM32_USB_OTG_MODE) */
libheivs configuration file