From 6af0806da3d9df7ea9f6410a74ad8c864926bd7f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 20 Jun 2012 08:39:04 +0000 Subject: Fixed bugs 3536522 and 3536523. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4309 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/STM32/gpt_lld.c | 2 +- os/hal/platforms/STM32/icu_lld.c | 48 ++++++++++++++++++++++++++++++++++++---- os/hal/platforms/STM32/stm32.h | 18 +++++++++++++++ os/hal/src/serial.c | 6 ++--- os/hal/src/serial_usb.c | 6 ++--- 5 files changed, 69 insertions(+), 11 deletions(-) (limited to 'os') diff --git a/os/hal/platforms/STM32/gpt_lld.c b/os/hal/platforms/STM32/gpt_lld.c index e0685b75c..d36e3e26d 100644 --- a/os/hal/platforms/STM32/gpt_lld.c +++ b/os/hal/platforms/STM32/gpt_lld.c @@ -196,7 +196,7 @@ CH_IRQ_HANDLER(TIM5_IRQHandler) { * * @isr */ -CH_IRQ_HANDLER(TIM8_IRQHandler) { +CH_IRQ_HANDLER(TIM8_UP_IRQHandler) { CH_IRQ_PROLOGUE(); diff --git a/os/hal/platforms/STM32/icu_lld.c b/os/hal/platforms/STM32/icu_lld.c index d5511ec01..22ec30487 100644 --- a/os/hal/platforms/STM32/icu_lld.c +++ b/os/hal/platforms/STM32/icu_lld.c @@ -141,11 +141,28 @@ CH_IRQ_HANDLER(TIM1_CC_IRQHandler) { CH_IRQ_EPILOGUE(); } + +/** + * @brief TIM1 compare interrupt handler. + * @note It is assumed that the various sources are only activated if the + * associated callback pointer is not equal to @p NULL in order to not + * perform an extra check in a potentially critical interrupt handler. + * + * @isr + */ +CH_IRQ_HANDLER(TIM1_UP_IRQHandler) { + + CH_IRQ_PROLOGUE(); + + icu_lld_serve_interrupt(&ICUD1); + + CH_IRQ_EPILOGUE(); +} #endif /* STM32_ICU_USE_TIM1 */ #if STM32_ICU_USE_TIM2 /** - * @brief TIM2 compare interrupt handler. + * @brief TIM2 interrupt handler. * @note It is assumed that the various sources are only activated if the * associated callback pointer is not equal to @p NULL in order to not * perform an extra check in a potentially critical interrupt handler. @@ -164,7 +181,7 @@ CH_IRQ_HANDLER(TIM2_IRQHandler) { #if STM32_ICU_USE_TIM3 /** - * @brief TIM3 compare interrupt handler. + * @brief TIM3 interrupt handler. * @note It is assumed that the various sources are only activated if the * associated callback pointer is not equal to @p NULL in order to not * perform an extra check in a potentially critical interrupt handler. @@ -183,7 +200,7 @@ CH_IRQ_HANDLER(TIM3_IRQHandler) { #if STM32_ICU_USE_TIM4 /** - * @brief TIM4 compare interrupt handler. + * @brief TIM4 interrupt handler. * @note It is assumed that the various sources are only activated if the * associated callback pointer is not equal to @p NULL in order to not * perform an extra check in a potentially critical interrupt handler. @@ -202,7 +219,7 @@ CH_IRQ_HANDLER(TIM4_IRQHandler) { #if STM32_ICU_USE_TIM5 /** - * @brief TIM5 compare interrupt handler. + * @brief TIM5 interrupt handler. * @note It is assumed that the various sources are only activated if the * associated callback pointer is not equal to @p NULL in order to not * perform an extra check in a potentially critical interrupt handler. @@ -236,6 +253,23 @@ CH_IRQ_HANDLER(TIM8_CC_IRQHandler) { CH_IRQ_EPILOGUE(); } + +/** + * @brief TIM8 compare interrupt handler. + * @note It is assumed that the various sources are only activated if the + * associated callback pointer is not equal to @p NULL in order to not + * perform an extra check in a potentially critical interrupt handler. + * + * @isr + */ +CH_IRQ_HANDLER(TIM8_UP_IRQHandler) { + + CH_IRQ_PROLOGUE(); + + icu_lld_serve_interrupt(&ICUD8); + + CH_IRQ_EPILOGUE(); +} #endif /* STM32_ICU_USE_TIM8 */ /*===========================================================================*/ @@ -308,6 +342,8 @@ void icu_lld_start(ICUDriver *icup) { rccResetTIM1(); nvicEnableVector(TIM1_CC_IRQn, CORTEX_PRIORITY_MASK(STM32_ICU_TIM1_IRQ_PRIORITY)); + nvicEnableVector(TIM1_UP_IRQn, + CORTEX_PRIORITY_MASK(STM32_ICU_TIM1_IRQ_PRIORITY)); icup->clock = STM32_TIMCLK2; } #endif @@ -354,6 +390,8 @@ void icu_lld_start(ICUDriver *icup) { rccResetTIM8(); nvicEnableVector(TIM8_CC_IRQn, CORTEX_PRIORITY_MASK(STM32_ICU_TIM8_IRQ_PRIORITY)); + nvicEnableVector(TIM8_UP_IRQn, + CORTEX_PRIORITY_MASK(STM32_ICU_TIM1_IRQ_PRIORITY)); icup->clock = STM32_TIMCLK2; } #endif @@ -443,6 +481,7 @@ void icu_lld_stop(ICUDriver *icup) { #if STM32_ICU_USE_TIM1 if (&ICUD1 == icup) { nvicDisableVector(TIM1_CC_IRQn); + nvicDisableVector(TIM1_UP_IRQn); rccDisableTIM1(FALSE); } #endif @@ -474,6 +513,7 @@ void icu_lld_stop(ICUDriver *icup) { #if STM32_ICU_USE_TIM8 if (&ICUD8 == icup) { nvicDisableVector(TIM8_CC_IRQn); + nvicDisableVector(TIM8_UP_IRQn); rccDisableTIM8(FALSE); } #endif diff --git a/os/hal/platforms/STM32/stm32.h b/os/hal/platforms/STM32/stm32.h index a872a2a00..97858e07d 100644 --- a/os/hal/platforms/STM32/stm32.h +++ b/os/hal/platforms/STM32/stm32.h @@ -47,6 +47,9 @@ #if defined(STM32F0XX) #include "stm32f0xx.h" +/* Resolving naming anomalies related to the STM32F0xx sub-family.*/ +#define TIM1_UP_IRQn TIM1_BRK_UP_TRG_COM_IRQn + #elif defined(STM32F10X_LD_VL) || defined(STM32F10X_MD_VL) || \ defined(STM32F10X_HD_VL) || defined(STM32F10X_LD) || \ defined(STM32F10X_MD) || defined(STM32F10X_HD) || \ @@ -57,13 +60,28 @@ /* Resolving naming anomalies related to the STM32F1xx sub-family.*/ #define CAN1_TX_IRQn USB_HP_CAN1_TX_IRQn #define CAN1_RX0_IRQn USB_LP_CAN1_RX0_IRQn +#if defined(STM32F10X_XL) +#define TIM1_UP_IRQn TIM1_UP_TIM16_IRQn +#define TIM8_UP_IRQn TIM8_UP_TIM13_IRQn +#elif defined(STM32F10X_LD_VL) || defined(STM32F10X_MD_VL) || \ + defined(STM32F10X_HD_VL) +#define TIM1_UP_IRQn TIM1_UP_TIM16_IRQn +#endif #elif defined(STM32F2XX) #include "stm32f2xx.h" +/* Resolving naming anomalies related to the STM32F2xx sub-family.*/ +#define TIM1_UP_IRQn TIM1_UP_TIM10_IRQn +#define TIM8_UP_IRQn TIM8_UP_TIM13_IRQn + #elif defined(STM32F4XX) #include "stm32f4xx.h" +/* Resolving naming anomalies related to the STM32F4xx sub-family.*/ +#define TIM1_UP_IRQn TIM1_UP_TIM10_IRQn +#define TIM8_UP_IRQn TIM8_UP_TIM13_IRQn + #elif defined(STM32L1XX_MD) #include "stm32l1xx.h" diff --git a/os/hal/src/serial.c b/os/hal/src/serial.c index 8b0d7c8cf..2bf7f396b 100644 --- a/os/hal/src/serial.c +++ b/os/hal/src/serial.c @@ -52,13 +52,13 @@ * queue-level function or macro. */ -static size_t writes(void *ip, const uint8_t *bp, size_t n) { +static size_t write(void *ip, const uint8_t *bp, size_t n) { return chOQWriteTimeout(&((SerialDriver *)ip)->oqueue, bp, n, TIME_INFINITE); } -static size_t reads(void *ip, uint8_t *bp, size_t n) { +static size_t read(void *ip, uint8_t *bp, size_t n) { return chIQReadTimeout(&((SerialDriver *)ip)->iqueue, bp, n, TIME_INFINITE); @@ -99,7 +99,7 @@ static chnflags_t getflags(void *ip) { } static const struct SerialDriverVMT vmt = { - writes, reads, put, get, + write, read, put, get, putt, gett, writet, readt, getflags }; diff --git a/os/hal/src/serial_usb.c b/os/hal/src/serial_usb.c index 466b65b0a..c3e9ae184 100644 --- a/os/hal/src/serial_usb.c +++ b/os/hal/src/serial_usb.c @@ -61,13 +61,13 @@ static cdc_linecoding_t linecoding = { * Interface implementation. */ -static size_t writes(void *ip, const uint8_t *bp, size_t n) { +static size_t write(void *ip, const uint8_t *bp, size_t n) { return chOQWriteTimeout(&((SerialUSBDriver *)ip)->oqueue, bp, n, TIME_INFINITE); } -static size_t reads(void *ip, uint8_t *bp, size_t n) { +static size_t read(void *ip, uint8_t *bp, size_t n) { return chIQReadTimeout(&((SerialUSBDriver *)ip)->iqueue, bp, n, TIME_INFINITE); @@ -108,7 +108,7 @@ static chnflags_t getflags(void *ip) { } static const struct SerialUSBDriverVMT vmt = { - writes, reads, put, get, + write, read, put, get, putt, gett, writet, readt, getflags }; -- cgit v1.2.3