git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4602 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
603771beb4
commit
659ae96925
|
@ -513,8 +513,8 @@ static bool_t otg_txfifo_handler(USBDriver *usbp, usbep_t ep) {
|
|||
if (((usbp->otg->ie[ep].DTXFSTS & DTXFSTS_INEPTFSAV_MASK) * 4) < n)
|
||||
return FALSE;
|
||||
|
||||
#if STM32_USB_FIFO_FILL_PRIORITY_MASK
|
||||
__set_BASEPRI(CORTEX_PRIORITY_MASK(STM32_USB_FIFO_FILL_PRIORITY_MASK));
|
||||
#if STM32_USB_OTGFIFO_FILL_BASEPRI
|
||||
__set_BASEPRI(CORTEX_PRIORITY_MASK(STM32_USB_OTGFIFO_FILL_BASEPRI));
|
||||
#endif
|
||||
/* Handles the two cases: linear buffer or queue.*/
|
||||
if (usbp->epc[ep]->in_state->txqueued) {
|
||||
|
@ -532,7 +532,7 @@ static bool_t otg_txfifo_handler(USBDriver *usbp, usbep_t ep) {
|
|||
}
|
||||
usbp->epc[ep]->in_state->txcnt += n;
|
||||
}
|
||||
#if STM32_USB_FIFO_FILL_PRIORITY_MASK
|
||||
#if STM32_USB_OTGFIFO_FILL_BASEPRI
|
||||
__set_BASEPRI(0);
|
||||
#endif
|
||||
}
|
||||
|
@ -871,7 +871,7 @@ void usb_lld_start(USBDriver *usbp) {
|
|||
if (usbp->thd_ptr == NULL)
|
||||
usbp->thd_ptr = usbp->thd_wait = chThdCreateI(usbp->wa_pump,
|
||||
sizeof usbp->wa_pump,
|
||||
STM32_USB_THREAD_PRIORITY,
|
||||
STM32_USB_OTG_THREAD_PRIO,
|
||||
usb_lld_pump,
|
||||
usbp);
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(STM32_USB_USE_OTG1) || defined(__DOXYGEN__)
|
||||
#define STM32_USB_USE_OTG1 TRUE
|
||||
#define STM32_USB_USE_OTG1 FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -70,7 +70,7 @@
|
|||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(STM32_USB_USE_OTG2) || defined(__DOXYGEN__)
|
||||
#define STM32_USB_USE_OTG2 TRUE
|
||||
#define STM32_USB_USE_OTG2 FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -100,21 +100,21 @@
|
|||
* @note Must be a multiple of 4.
|
||||
*/
|
||||
#if !defined(STM32_USB_OTG2_RX_FIFO_SIZE) || defined(__DOXYGEN__)
|
||||
#define STM32_USB_OTG2_RX_FIFO_SIZE 512
|
||||
#define STM32_USB_OTG2_RX_FIFO_SIZE 1024
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Dedicated data pump threads priority.
|
||||
*/
|
||||
#if !defined(STM32_USB_THREAD_PRIORITY) || defined(__DOXYGEN__)
|
||||
#define STM32_USB_THREAD_PRIORITY LOWPRIO
|
||||
#if !defined(STM32_USB_OTG_THREAD_PRIORITY) || defined(__DOXYGEN__)
|
||||
#define STM32_USB_OTG_THREAD_PRIO LOWPRIO
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Dedicated data pump threads stack size.
|
||||
*/
|
||||
#if !defined(STM32_USB_THREAD_STACK_SIZE) || defined(__DOXYGEN__)
|
||||
#define STM32_USB_THREAD_STACK_SIZE 128
|
||||
#if !defined(STM32_USB_OTG_THREAD_STACK_SIZE) || defined(__DOXYGEN__)
|
||||
#define STM32_USB_OTG_THREAD_STACK_SIZE 128
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -132,8 +132,8 @@
|
|||
* functions is only safe from thread level or from USB
|
||||
* callbacks.
|
||||
*/
|
||||
#if !defined(STM32_USB_FIFO_FILL_PRIORITY_MASK) || defined(__DOXYGEN__)
|
||||
#define STM32_USB_FIFO_FILL_PRIORITY_MASK 0
|
||||
#if !defined(STM32_USB_OTGFIFO_FILL_BASEPRI) || defined(__DOXYGEN__)
|
||||
#define STM32_USB_OTGFIFO_FILL_BASEPRI 0
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
|
@ -447,7 +447,7 @@ struct USBDriver {
|
|||
/**
|
||||
* @brief Working area for the dedicated data pump thread;
|
||||
*/
|
||||
WORKING_AREA(wa_pump, STM32_USB_THREAD_STACK_SIZE);
|
||||
WORKING_AREA(wa_pump, STM32_USB_OTG_THREAD_STACK_SIZE);
|
||||
};
|
||||
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
# List of all the STM32F1xx platform files.
|
||||
PLATFORMSRC = ${CHIBIOS}/os/hal/platforms/STM32F1xx/stm32_dma.c \
|
||||
${CHIBIOS}/os/hal/platforms/STM32F1xx/hal_lld.c \
|
||||
${CHIBIOS}/os/hal/platforms/STM32F1xx/adc_lld.c \
|
||||
${CHIBIOS}/os/hal/platforms/STM32F1xx/ext_lld_isr.c \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/can_lld.c \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/ext_lld.c \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/gpt_lld.c \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/icu_lld.c \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/mac_lld.c \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/pwm_lld.c \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/serial_lld.c \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/sdc_lld.c \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/spi_lld.c \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/GPIOv1/pal_lld.c \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/I2Cv1/i2c_lld.c \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/RTCv1/rtc_lld.c \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/USARTv1/uart_lld.c \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/OTGv1/usb_lld.c
|
||||
|
||||
# Required include directories
|
||||
PLATFORMINC = ${CHIBIOS}/os/hal/platforms/STM32F1xx \
|
||||
${CHIBIOS}/os/hal/platforms/STM32 \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/GPIOv1 \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/I2Cv1 \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/RTCv1 \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/USARTv1 \
|
||||
${CHIBIOS}/os/hal/platforms/STM32/OTGv1
|
||||
|
|
@ -461,6 +461,36 @@
|
|||
#define rccResetI2C2() rccResetAPB1(RCC_APB1RSTR_I2C2RST)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name OTG peripherals specific RCC operations
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Enables the OTG_FS peripheral clock.
|
||||
*
|
||||
* @param[in] lp low power enable flag
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
#define rccEnableOTG_FS(lp) rccEnableAHB(RCC_AHBENR_OTGFSEN, lp)
|
||||
|
||||
/**
|
||||
* @brief Disables the OTG_FS peripheral clock.
|
||||
*
|
||||
* @param[in] lp low power enable flag
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
#define rccDisableOTG_FS(lp) rccDisableAHB(RCC_AHBENR_OTGFSEN, lp)
|
||||
|
||||
/**
|
||||
* @brief Resets the OTG_FS peripheral.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
#define rccResetOTG_FS() rccResetAHB(RCC_AHBRSTR_OTGFSRST)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name SDIO peripheral specific RCC operations
|
||||
* @{
|
||||
|
|
|
@ -237,3 +237,15 @@
|
|||
#define STM32_I2C_I2C2_DMA_ERROR_HOOK() chSysHalt()
|
||||
#define STM32_I2C_I2C3_DMA_ERROR_HOOK() chSysHalt()
|
||||
|
||||
/*
|
||||
* USB driver system settings.
|
||||
*/
|
||||
#define STM32_USB_USE_OTG1 TRUE
|
||||
#define STM32_USB_USE_OTG2 TRUE
|
||||
#define STM32_USB_OTG1_IRQ_PRIORITY 14
|
||||
#define STM32_USB_OTG2_IRQ_PRIORITY 14
|
||||
#define STM32_USB_OTG1_RX_FIFO_SIZE 512
|
||||
#define STM32_USB_OTG2_RX_FIFO_SIZE 1024
|
||||
#define STM32_USB_OTG_THREAD_PRIO LOWPRIO
|
||||
#define STM32_USB_OTG_THREAD_STACK_SIZE 128
|
||||
#define STM32_USB_OTGFIFO_FILL_BASEPRI 0
|
||||
|
|
|
@ -8,7 +8,7 @@ The demo runs on an Olimex STM32-E407 board.
|
|||
|
||||
** The Demo **
|
||||
|
||||
The application demonstrates the use of the STM32 USB driver.
|
||||
The application demonstrates the use of the STM32 USB (OTG) driver.
|
||||
|
||||
** Build Procedure **
|
||||
|
||||
|
|
Loading…
Reference in New Issue