Merge pull request #93 from zyp/master
[fw/stlink] / example / stm32f4 / STM32_USB_OTG_Driver / src / usb_bsp_template.c
1 /**
2   ******************************************************************************
3   * @file    usb_bsp.c
4   * @author  MCD Application Team
5   * @version V2.0.0
6   * @date    22-July-2011
7   * @brief   This file is responsible to offer board support package and is
8   *          configurable by user.
9   ******************************************************************************
10   * @attention
11   *
12   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18   *
19   * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
20   ******************************************************************************
21   */ 
22
23 /* Includes ------------------------------------------------------------------*/
24 #include "usb_bsp.h"
25
26 /** @addtogroup USB_OTG_DRIVER
27 * @{
28 */
29
30 /** @defgroup USB_BSP
31   * @brief This file is responsible to offer board support package
32   * @{
33   */ 
34
35 /** @defgroup USB_BSP_Private_Defines
36   * @{
37   */ 
38 /**
39   * @}
40   */ 
41
42
43 /** @defgroup USB_BSP_Private_TypesDefinitions
44   * @{
45   */ 
46 /**
47   * @}
48   */ 
49
50
51
52
53
54 /** @defgroup USB_BSP_Private_Macros
55   * @{
56   */ 
57 /**
58   * @}
59   */ 
60
61 /** @defgroup USBH_BSP_Private_Variables
62   * @{
63   */ 
64
65 /**
66   * @}
67   */ 
68
69 /** @defgroup USBH_BSP_Private_FunctionPrototypes
70   * @{
71   */ 
72 /**
73   * @}
74   */ 
75
76 /** @defgroup USB_BSP_Private_Functions
77   * @{
78   */ 
79
80
81 /**
82   * @brief  USB_OTG_BSP_Init
83   *         Initilizes BSP configurations
84   * @param  None
85   * @retval None
86   */
87
88 void USB_OTG_BSP_Init(void)
89 {
90
91 }
92 /**
93   * @brief  USB_OTG_BSP_EnableInterrupt
94   *         Enabele USB Global interrupt
95   * @param  None
96   * @retval None
97   */
98 void USB_OTG_BSP_EnableInterrupt(void)
99 {
100
101 }
102
103 /**
104   * @brief  BSP_Drive_VBUS
105   *         Drives the Vbus signal through IO
106   * @param  speed : Full, Low 
107   * @param  state : VBUS states
108   * @retval None
109   */
110
111 void USB_OTG_BSP_DriveVBUS(uint32_t speed, uint8_t state)
112 {
113
114 }
115
116 /**
117   * @brief  USB_OTG_BSP_ConfigVBUS
118   *         Configures the IO for the Vbus and OverCurrent
119   * @param  Speed : Full, Low 
120   * @retval None
121   */
122
123 void  USB_OTG_BSP_ConfigVBUS(uint32_t speed)
124 {
125
126 }
127
128 /**
129   * @brief  USB_OTG_BSP_TimeInit
130   *         Initialises delay unit Systick timer /Timer2
131   * @param  None
132   * @retval None
133   */
134 void USB_OTG_BSP_TimeInit ( void )
135 {
136
137 }
138
139 /**
140   * @brief  USB_OTG_BSP_uDelay
141   *         This function provides delay time in micro sec
142   * @param  usec : Value of delay required in micro sec
143   * @retval None
144   */
145 void USB_OTG_BSP_uDelay (const uint32_t usec)
146 {
147
148   uint32_t count = 0;
149   const uint32_t utime = (120 * usec / 7);
150   do
151   {
152     if ( ++count > utime )
153     {
154       return ;
155     }
156   }
157   while (1); 
158   
159 }
160
161
162 /**
163   * @brief  USB_OTG_BSP_mDelay
164   *          This function provides delay time in milli sec
165   * @param  msec : Value of delay required in milli sec
166   * @retval None
167   */
168 void USB_OTG_BSP_mDelay (const uint32_t msec)
169 {
170
171     USB_OTG_BSP_uDelay(msec * 1000);    
172
173 }
174
175
176 /**
177   * @brief  USB_OTG_BSP_TimerIRQ
178   *         Time base IRQ
179   * @param  None
180   * @retval None
181   */
182
183 void USB_OTG_BSP_TimerIRQ (void)
184 {
185
186
187
188 /**
189 * @}
190 */ 
191
192 /**
193 * @}
194 */ 
195
196 /**
197 * @}
198 */
199
200 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/