git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8172 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
Giovanni Di Sirio 2015-08-06 13:26:44 +00:00
parent f8cb6e81ea
commit 5605e7420d
10 changed files with 258 additions and 28 deletions

View File

@ -238,12 +238,16 @@
#define STM32_SERIAL_USE_UART4 FALSE
#define STM32_SERIAL_USE_UART5 FALSE
#define STM32_SERIAL_USE_USART6 FALSE
#define STM32_SERIAL_USE_UART7 FALSE
#define STM32_SERIAL_USE_UART8 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
#define STM32_SERIAL_UART7_PRIORITY 12
#define STM32_SERIAL_UART8_PRIORITY 12
/*
* SPI driver system settings.

View File

@ -64,6 +64,16 @@ SerialDriver SD5;
SerialDriver SD6;
#endif
/** @brief UART7 serial driver identifier.*/
#if STM32_SERIAL_USE_UART7 || defined(__DOXYGEN__)
SerialDriver SD7;
#endif
/** @brief UART8 serial driver identifier.*/
#if STM32_SERIAL_USE_UART8 || defined(__DOXYGEN__)
SerialDriver SD8;
#endif
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
@ -252,6 +262,22 @@ static void notify6(io_queue_t *qp) {
}
#endif
#if STM32_SERIAL_USE_UART7 || defined(__DOXYGEN__)
static void notify7(io_queue_t *qp) {
(void)qp;
UART7->CR1 |= USART_CR1_TXEIE;
}
#endif
#if STM32_SERIAL_USE_UART8 || defined(__DOXYGEN__)
static void notify8(io_queue_t *qp) {
(void)qp;
UART8->CR1 |= USART_CR1_TXEIE;
}
#endif
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
@ -356,7 +382,7 @@ OSAL_IRQ_HANDLER(STM32_UART5_HANDLER) {
#error "STM32_USART6_HANDLER not defined"
#endif
/**
* @brief USART1 interrupt handler.
* @brief USART6 interrupt handler.
*
* @isr
*/
@ -370,6 +396,44 @@ OSAL_IRQ_HANDLER(STM32_USART6_HANDLER) {
}
#endif
#if STM32_SERIAL_USE_UART7 || defined(__DOXYGEN__)
#if !defined(STM32_UART7_HANDLER)
#error "STM32_UART7_HANDLER not defined"
#endif
/**
* @brief UART7 interrupt handler.
*
* @isr
*/
OSAL_IRQ_HANDLER(STM32_UART7_HANDLER) {
OSAL_IRQ_PROLOGUE();
serve_interrupt(&SD7);
OSAL_IRQ_EPILOGUE();
}
#endif
#if STM32_SERIAL_USE_UART8 || defined(__DOXYGEN__)
#if !defined(STM32_UART8_HANDLER)
#error "STM32_UART8_HANDLER not defined"
#endif
/**
* @brief UART8 interrupt handler.
*
* @isr
*/
OSAL_IRQ_HANDLER(STM32_UART8_HANDLER) {
OSAL_IRQ_PROLOGUE();
serve_interrupt(&SD8);
OSAL_IRQ_EPILOGUE();
}
#endif
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
@ -410,6 +474,16 @@ void sd_lld_init(void) {
sdObjectInit(&SD6, NULL, notify6);
SD6.usart = USART6;
#endif
#if STM32_SERIAL_USE_UART7
sdObjectInit(&SD7, NULL, notify7);
SD7.usart = UART7;
#endif
#if STM32_SERIAL_USE_UART8
sdObjectInit(&SD8, NULL, notify8);
SD8.usart = UART8;
#endif
}
/**
@ -463,6 +537,18 @@ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
rccEnableUSART6(FALSE);
nvicEnableVector(STM32_USART6_NUMBER, STM32_SERIAL_USART6_PRIORITY);
}
#endif
#if STM32_SERIAL_USE_UART7
if (&SD7 == sdp) {
rccEnableUART7(FALSE);
nvicEnableVector(STM32_UART7_NUMBER, STM32_SERIAL_UART7_PRIORITY);
}
#endif
#if STM32_SERIAL_USE_UART8
if (&SD8 == sdp) {
rccEnableUART8(FALSE);
nvicEnableVector(STM32_UART8_NUMBER, STM32_SERIAL_UART8_PRIORITY);
}
#endif
}
usart_init(sdp, config);
@ -522,6 +608,20 @@ void sd_lld_stop(SerialDriver *sdp) {
nvicDisableVector(STM32_USART6_NUMBER);
return;
}
#endif
#if STM32_SERIAL_USE_UART7
if (&SD7 == sdp) {
rccDisableUART7(FALSE);
nvicDisableVector(STM32_UART7_NUMBER);
return;
}
#endif
#if STM32_SERIAL_USE_UART8
if (&SD8 == sdp) {
rccDisableUART8(FALSE);
nvicDisableVector(STM32_UART8_NUMBER);
return;
}
#endif
}
}

View File

@ -93,6 +93,24 @@
#define STM32_SERIAL_USE_USART6 FALSE
#endif
/**
* @brief UART7 driver enable switch.
* @details If set to @p TRUE the support for UART7 is included.
* @note The default is @p TRUE.
*/
#if !defined(STM32_SERIAL_USE_UART7) || defined(__DOXYGEN__)
#define STM32_SERIAL_USE_UART7 FALSE
#endif
/**
* @brief UART8 driver enable switch.
* @details If set to @p TRUE the support for UART8 is included.
* @note The default is @p TRUE.
*/
#if !defined(STM32_SERIAL_USE_UART8) || defined(__DOXYGEN__)
#define STM32_SERIAL_USE_UART8 FALSE
#endif
/**
* @brief USART1 interrupt priority level setting.
*/
@ -134,6 +152,20 @@
#if !defined(STM32_SERIAL_USART6_PRIORITY) || defined(__DOXYGEN__)
#define STM32_SERIAL_USART6_PRIORITY 12
#endif
/**
* @brief UART7 interrupt priority level setting.
*/
#if !defined(STM32_SERIAL_UART7_PRIORITY) || defined(__DOXYGEN__)
#define STM32_SERIAL_UART7_PRIORITY 12
#endif
/**
* @brief UART8 interrupt priority level setting.
*/
#if !defined(STM32_SERIAL_UART8_PRIORITY) || defined(__DOXYGEN__)
#define STM32_SERIAL_UART8_PRIORITY 12
#endif
/** @} */
/*===========================================================================*/
@ -164,9 +196,18 @@
#error "USART6 not present in the selected device"
#endif
#if STM32_SERIAL_USE_UART7 && !STM32_HAS_UART7
#error "UART7 not present in the selected device"
#endif
#if STM32_SERIAL_USE_UART8 && !STM32_HAS_UART8
#error "UART8 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_USART6
!STM32_SERIAL_USE_UART5 && !STM32_SERIAL_USE_USART6 && \
!STM32_SERIAL_USE_UART7 && !STM32_SERIAL_USE_UART8
#error "SERIAL driver activated but no USART/UART peripheral assigned"
#endif
@ -200,6 +241,16 @@
#error "Invalid IRQ priority assigned to USART6"
#endif
#if STM32_SERIAL_USE_UART7 && \
!OSAL_IRQ_IS_VALID_PRIORITY(STM32_SERIAL_UART7_PRIORITY)
#error "Invalid IRQ priority assigned to UART7"
#endif
#if STM32_SERIAL_USE_UART8 && \
!OSAL_IRQ_IS_VALID_PRIORITY(STM32_SERIAL_UART8_PRIORITY)
#error "Invalid IRQ priority assigned to UART8"
#endif
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
@ -285,6 +336,12 @@ extern SerialDriver SD5;
#if STM32_SERIAL_USE_USART6 && !defined(__DOXYGEN__)
extern SerialDriver SD6;
#endif
#if STM32_SERIAL_USE_UART7 && !defined(__DOXYGEN__)
extern SerialDriver SD7;
#endif
#if STM32_SERIAL_USE_UART8 && !defined(__DOXYGEN__)
extern SerialDriver SD8;
#endif
#ifdef __cplusplus
extern "C" {

View File

@ -377,7 +377,7 @@ OSAL_IRQ_HANDLER(STM32_UART5_HANDLER) {
#error "STM32_USART6_HANDLER not defined"
#endif
/**
* @brief USART1 interrupt handler.
* @brief USART6 interrupt handler.
*
* @isr
*/

View File

@ -196,8 +196,8 @@
#error "USART6 not present in the selected device"
#endif
#if STM32_SERIAL_USE_UART5 && !STM32_HAS_UART5
#error "UART5 not present in the selected device"
#if STM32_SERIAL_USE_UART7 && !STM32_HAS_UART7
#error "UART7 not present in the selected device"
#endif
#if STM32_SERIAL_USE_UART8 && !STM32_HAS_UART8

View File

@ -138,6 +138,8 @@
#define STM32_UART4_HANDLER Vector110
#define STM32_UART5_HANDLER Vector114
#define STM32_USART6_HANDLER Vector15C
#define STM32_UART7_HANDLER Vector188
#define STM32_UART8_HANDLER Vector18C
#define STM32_USART1_NUMBER 37
#define STM32_USART2_NUMBER 38
@ -145,6 +147,8 @@
#define STM32_UART4_NUMBER 52
#define STM32_UART5_NUMBER 53
#define STM32_USART6_NUMBER 71
#define STM32_UART7_NUMBER 82
#define STM32_UART8_NUMBER 83
/*
* Ethernet

View File

@ -1358,24 +1358,6 @@
*/
#define rccResetUSART3() rccResetAPB1(RCC_APB1RSTR_USART3RST)
/**
* @brief Enables the USART6 peripheral clock.
*
* @param[in] lp low power enable flag
*
* @api
*/
#define rccEnableUSART6(lp) rccEnableAPB2(RCC_APB2ENR_USART6EN, lp)
/**
* @brief Disables the USART6 peripheral clock.
*
* @param[in] lp low power enable flag
*
* @api
*/
#define rccDisableUSART6(lp) rccDisableAPB2(RCC_APB2ENR_USART6EN, lp)
/**
* @brief Enables the UART4 peripheral clock.
* @note The @p lp parameter is ignored in this family.
@ -1430,12 +1412,84 @@
*/
#define rccResetUART5() rccResetAPB1(RCC_APB1RSTR_UART5RST)
/**
* @brief Enables the USART6 peripheral clock.
*
* @param[in] lp low power enable flag
*
* @api
*/
#define rccEnableUSART6(lp) rccEnableAPB2(RCC_APB2ENR_USART6EN, lp)
/**
* @brief Disables the USART6 peripheral clock.
*
* @param[in] lp low power enable flag
*
* @api
*/
#define rccDisableUSART6(lp) rccDisableAPB2(RCC_APB2ENR_USART6EN, lp)
/**
* @brief Resets the USART6 peripheral.
*
* @api
*/
#define rccResetUSART6() rccResetAPB2(RCC_APB2RSTR_USART6RST)
/**
* @brief Enables the UART7 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
#define rccEnableUART7(lp) rccEnableAPB1(RCC_APB1ENR_UART7EN, lp)
/**
* @brief Disables the UART7 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
#define rccDisableUART7(lp) rccDisableAPB1(RCC_APB1ENR_UART7EN, lp)
/**
* @brief Resets the UART7 peripheral.
*
* @api
*/
#define rccResetUART7() rccResetAPB1(RCC_APB1RSTR_UART7RST)
/**
* @brief Enables the UART8 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
#define rccEnableUART8(lp) rccEnableAPB1(RCC_APB1ENR_UART8EN, lp)
/**
* @brief Disables the UART8 peripheral clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
#define rccDisableUART8(lp) rccDisableAPB1(RCC_APB1ENR_UART8EN, lp)
/**
* @brief Resets the UART8 peripheral.
*
* @api
*/
#define rccResetUART8() rccResetAPB1(RCC_APB1RSTR_UART8RST)
/** @} */
/**

View File

@ -66,7 +66,8 @@
/*===========================================================================*/
/* STM32F439xx, STM32F429xx, STM32F437xx, STM32F427xx. */
/*===========================================================================*/
#if defined(STM32F429_439xx) || defined(STM32F427_437xx)
#if defined(STM32F429_439xx) || defined(STM32F427_437xx) || \
defined(__DOXYGEN__)
/* ADC attributes.*/
#define STM32_ADC_HANDLER Vector88
#define STM32_ADC_NUMBER 18
@ -364,8 +365,17 @@
STM32_DMA_STREAM_ID_MSK(2, 7))
#define STM32_USART6_TX_DMA_CHN 0x55000000
#define STM32_HAS_UART7 FALSE
#define STM32_HAS_UART8 FALSE
#define STM32_HAS_UART7 TRUE
#define STM32_UART7_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
#define STM32_UART7_RX_DMA_CHN 0x00005000
#define STM32_UART7_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 1)
#define STM32_UART7_TX_DMA_CHN 0x00000050
#define STM32_HAS_UART8 TRUE
#define STM32_UART8_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 6)
#define STM32_UART8_RX_DMA_CHN 0x05000000
#define STM32_UART8_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 0)
#define STM32_UART8_TX_DMA_CHN 0x00000005
/* USB attributes.*/
#define STM32_HAS_USB FALSE
@ -1271,7 +1281,7 @@
#define STM32_HAS_CRC TRUE
#define STM32_CRC_PROGRAMMABLE FALSE
#endif
#endif /* defined(STM32F411xx) */
/** @} */
#endif /* _STM32_REGISTRY_H_ */

View File

@ -429,7 +429,7 @@
#define STM32_HAS_UART7 TRUE
#define STM32_UART7_HANDLER Vector188
#define STM32_UART7_NUMBER 83
#define STM32_UART7_NUMBER 82
#define STM32_UART7_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
#define STM32_UART7_RX_DMA_CHN 0x00005000
#define STM32_UART7_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 1)

View File

@ -113,6 +113,7 @@
(bug #617)(backported to 3.0.1 and 2.6.9).
- HAL: Fixed rtcConvertDateTimeToFAT() incorrect conversion (bug #615)
(backported to 3.0.1).
- HAL: Fixed missing UART7 and UART8 support on STM32F4xx family (bug #612).
*** 3.0.0 ***
- NEW: Added an initialization function to the lwIP bindings, now it is