Added support for USART6 to STM32 serial driver, fixed bug 3434094.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3477 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
2848e99c07
commit
bfcc14cb5c
|
@ -146,11 +146,13 @@
|
|||
#define STM32_SERIAL_USE_USART3 FALSE
|
||||
#define STM32_SERIAL_USE_UART4 FALSE
|
||||
#define STM32_SERIAL_USE_UART5 FALSE
|
||||
#define STM32_SERIAL_USE_USART6 FALSE
|
||||
#define STM32_SERIAL_USART1_PRIORITY 12
|
||||
#define STM32_SERIAL_USART2_PRIORITY 12
|
||||
#define STM32_SERIAL_USART3_PRIORITY 12
|
||||
#define STM32_SERIAL_UART4_PRIORITY 12
|
||||
#define STM32_SERIAL_UART5_PRIORITY 12
|
||||
#define STM32_SERIAL_USART6_PRIORITY 12
|
||||
|
||||
/*
|
||||
* SPI driver system settings.
|
||||
|
|
|
@ -60,6 +60,11 @@ SerialDriver SD4;
|
|||
SerialDriver SD5;
|
||||
#endif
|
||||
|
||||
/** @brief USART6 serial driver identifier.*/
|
||||
#if STM32_SERIAL_USE_USART6 || defined(__DOXYGEN__)
|
||||
SerialDriver SD6;
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local variables. */
|
||||
/*===========================================================================*/
|
||||
|
@ -127,7 +132,7 @@ static void usart_deinit(USART_TypeDef *u) {
|
|||
|
||||
#if STM32_SERIAL_USE_USART1 || STM32_SERIAL_USE_USART2 || \
|
||||
STM32_SERIAL_USE_USART3 || STM32_SERIAL_USE_UART4 || \
|
||||
USE_STM32_USART5
|
||||
STM32_SERIAL_USE_UART5 || STM32_SERIAL_USE_USART6
|
||||
/**
|
||||
* @brief Error handling routine.
|
||||
*
|
||||
|
@ -241,6 +246,14 @@ static void notify5(GenericQueue *qp) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if STM32_SERIAL_USE_USART6 || defined(__DOXYGEN__)
|
||||
static void notify6(GenericQueue *qp) {
|
||||
|
||||
(void)qp;
|
||||
USART6->CR1 |= USART_CR1_TXEIE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver interrupt handlers. */
|
||||
/*===========================================================================*/
|
||||
|
@ -325,6 +338,22 @@ CH_IRQ_HANDLER(UART5_IRQHandler) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if STM32_SERIAL_USE_USART6 || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief USART1 interrupt handler.
|
||||
*
|
||||
* @isr
|
||||
*/
|
||||
CH_IRQ_HANDLER(USART6_IRQHandler) {
|
||||
|
||||
CH_IRQ_PROLOGUE();
|
||||
|
||||
serve_interrupt(&SD6);
|
||||
|
||||
CH_IRQ_EPILOGUE();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
@ -360,6 +389,11 @@ void sd_lld_init(void) {
|
|||
sdObjectInit(&SD5, NULL, notify5);
|
||||
SD5.usart = UART5;
|
||||
#endif
|
||||
|
||||
#if STM32_SERIAL_USE_USART6
|
||||
sdObjectInit(&SD6, NULL, notify6);
|
||||
SD6.usart = USART6;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -412,6 +446,13 @@ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
|
|||
NVICEnableVector(UART5_IRQn,
|
||||
CORTEX_PRIORITY_MASK(STM32_SERIAL_UART5_PRIORITY));
|
||||
}
|
||||
#endif
|
||||
#if STM32_SERIAL_USE_USART6
|
||||
if (&SD6 == sdp) {
|
||||
rccEnableUSART6(FALSE);
|
||||
NVICEnableVector(USART6_IRQn,
|
||||
CORTEX_PRIORITY_MASK(STM32_SERIAL_USART6_PRIORITY));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
usart_init(sdp, config);
|
||||
|
@ -464,6 +505,13 @@ void sd_lld_stop(SerialDriver *sdp) {
|
|||
NVICDisableVector(UART5_IRQn);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#if STM32_SERIAL_USE_USART6
|
||||
if (&SD6 == sdp) {
|
||||
rccDisableUSART6(FALSE);
|
||||
NVICDisableVector(USART6_IRQn);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
/**
|
||||
* @brief USART1 driver enable switch.
|
||||
* @details If set to @p TRUE the support for USART1 is included.
|
||||
* @note The default is @p FALSE.
|
||||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(STM32_SERIAL_USE_USART1) || defined(__DOXYGEN__)
|
||||
#define STM32_SERIAL_USE_USART1 TRUE
|
||||
|
@ -60,7 +60,7 @@
|
|||
/**
|
||||
* @brief USART3 driver enable switch.
|
||||
* @details If set to @p TRUE the support for USART3 is included.
|
||||
* @note The default is @p FALSE.
|
||||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(STM32_SERIAL_USE_USART3) || defined(__DOXYGEN__)
|
||||
#define STM32_SERIAL_USE_USART3 TRUE
|
||||
|
@ -69,7 +69,7 @@
|
|||
/**
|
||||
* @brief UART4 driver enable switch.
|
||||
* @details If set to @p TRUE the support for UART4 is included.
|
||||
* @note The default is @p FALSE.
|
||||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(STM32_SERIAL_USE_UART4) || defined(__DOXYGEN__)
|
||||
#define STM32_SERIAL_USE_UART4 TRUE
|
||||
|
@ -78,12 +78,21 @@
|
|||
/**
|
||||
* @brief UART5 driver enable switch.
|
||||
* @details If set to @p TRUE the support for UART5 is included.
|
||||
* @note The default is @p FALSE.
|
||||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(STM32_SERIAL_USE_UART5) || defined(__DOXYGEN__)
|
||||
#define STM32_SERIAL_USE_UART5 TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USART6 driver enable switch.
|
||||
* @details If set to @p TRUE the support for USART6 is included.
|
||||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(STM32_SERIAL_USE_USART6) || defined(__DOXYGEN__)
|
||||
#define STM32_SERIAL_USE_USART6 TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USART1 interrupt priority level setting.
|
||||
*/
|
||||
|
@ -119,6 +128,13 @@
|
|||
#define STM32_SERIAL_UART5_PRIORITY 12
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USART6 interrupt priority level setting.
|
||||
*/
|
||||
#if !defined(STM32_SERIAL_USART6_PRIORITY) || defined(__DOXYGEN__)
|
||||
#define STM32_SERIAL_USART6_PRIORITY 12
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Derived constants and error checks. */
|
||||
/*===========================================================================*/
|
||||
|
@ -143,9 +159,13 @@
|
|||
#error "UART5 not present in the selected device"
|
||||
#endif
|
||||
|
||||
#if STM32_SERIAL_USE_USART6 && !STM32_HAS_USART6
|
||||
#error "USART6 not present in the selected device"
|
||||
#endif
|
||||
|
||||
#if !STM32_SERIAL_USE_USART1 && !STM32_SERIAL_USE_USART2 && \
|
||||
!STM32_SERIAL_USE_USART3 && !STM32_SERIAL_USE_UART4 && \
|
||||
!STM32_SERIAL_USE_UART5
|
||||
!STM32_SERIAL_USE_UART5 && !STM32_SERIAL_USE_USART6
|
||||
#error "SERIAL driver activated but no USART/UART peripheral assigned"
|
||||
#endif
|
||||
|
||||
|
@ -230,6 +250,9 @@ extern SerialDriver SD4;
|
|||
#if STM32_SERIAL_USE_UART5 && !defined(__DOXYGEN__)
|
||||
extern SerialDriver SD5;
|
||||
#endif
|
||||
#if STM32_SERIAL_USE_USART6 && !defined(__DOXYGEN__)
|
||||
extern SerialDriver SD6;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -74,11 +74,15 @@
|
|||
*****************************************************************************
|
||||
|
||||
*** 2.3.4 ***
|
||||
- FIX: Fixed broken support for UART5 in STM32 serial driver (bug 3434094)
|
||||
(backported to 2.2.8).
|
||||
- FIX: Fixed broken TIM8 support in STM32 PWM driver (bug 3418620).
|
||||
- FIX: Fixed halconf.h file corrupted in some STM32 demos (bug 3418626).
|
||||
- NEW: Reorganized the STM32F1xx hal_lld_xxx.h files in order to distribute
|
||||
the capability macros into the appropriate file (previously those were all
|
||||
in the common hal_lld.h).
|
||||
- NEW: Added HAL support for the STM32F4xx sub-family.
|
||||
- NEW: Added handling of USART6 to the STM32 serial driver.
|
||||
- NEW: Added USE_COPT setting to all makefiles, contributed by Mabl.
|
||||
- NEW: Added EXT driver implementation for AT91SAM7x, contributed by Florian.
|
||||
(TODO: Test application missing).
|
||||
|
@ -111,7 +115,7 @@
|
|||
- FIX: Fixed uninitialized variable in STM32 PWM and ICU drivers (bug 3413558).
|
||||
- FIX: Fixed wrong parameter passed to the DMA error hook in STM32 ADC driver,
|
||||
the DMA error hook has been removed entirely in the new ADC driver model
|
||||
(bug 3413214)(to be fixed in 2.2.8).
|
||||
(bug 3413214).
|
||||
- FIX: The function chThdExit() triggers an error on shell return when the
|
||||
system state checker is enabled (bug 3411207)(backported to 2.2.8).
|
||||
- FIX: Some ARMCMx makefiles refer the file rules.mk in the ARM7 port (bug
|
||||
|
|
Loading…
Reference in New Issue