* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "usb_bsp.h"
#include "stm32f10x.h" //固件库头文件
#include "typnumber.h" //数据类型定义头文件
#include "SysTick.h" //滴答时钟,延时函数头文件
#include "stm32f10x_tim.h"
/** @addtogroup USBH_USER
* @{
*/
/** @defgroup USB_BSP
* @brief This file is responsible to offer board support package
* @{
*/
/** @defgroup USB_BSP_Private_Defines
* @{
*/
#define USE_ACCURATE_TIME
#define TIM_MSEC_DELAY 0x01
#define TIM_USEC_DELAY 0x02
#define HOST_OVRCURR_PORT GPIOE
#define HOST_OVRCURR_LINE GPIO_Pin_1
#define HOST_OVRCURR_PORT_SOURCE GPIO_PortSourceGPIOE
#define HOST_OVRCURR_PIN_SOURCE GPIO_PinSource1
#define HOST_OVRCURR_PORT_RCC RCC_APB2Periph_GPIOE
#define HOST_OVRCURR_EXTI_LINE EXTI_Line1
#define HOST_OVRCURR_IRQn EXTI1_IRQn
#ifdef USE_STM3210C_EVAL
#define HOST_POWERSW_PORT_RCC RCC_APB2Periph_GPIOC
#define HOST_POWERSW_PORT GPIOC
#define HOST_POWERSW_VBUS GPIO_Pin_9
#endif
#if defined(USE_STM324x9I_EVAL)
#ifdef USE_USB_OTG_FS
#define HOST_POWERSW_FS1_VBUS IO16_Pin_7
#endif
if(TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET)
{
TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
if (BSP_delay > 0x00)
{
BSP_delay--;
}
else
{
TIM_Cmd(TIM2,DISABLE);
}
}
#endif
}
void USB_OTG_BSP_DriveVBUS(USB_OTG_CORE_HANDLE *pdev, uint8_t state)
{
}
/**
* @brief USB_OTG_BSP_ConfigVBUS
* Configures the IO for the Vbus and OverCurrent
* @param None
* @retval None
*/
void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev)
{
}
/**
* @brief USB_OTG_BSP_TimeInit
* Initializes delay unit using Timer2
* @param None
* @retval None
*/
/**
* @brief USB_OTG_BSP_uDelay
* This function provides delay time in micro sec
* @param usec : Value of delay required in micro sec
* @retval None
*/
void USB_OTG_BSP_uDelay (const uint32_t usec)
{
delay_us(usec);
}
/**
* @brief USB_OTG_BSP_mDelay
* This function provides delay time in milli sec
* @param msec : Value of delay required in milli sec
* @retval None
*/
void USB_OTG_BSP_mDelay (const uint32_t msec)
{
delay_ms(msec);
}