aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32/serial_lld.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-01-23 18:32:02 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-01-23 18:32:02 +0000
commitedc56330a91f1f646d8b78ead8a89c46a5d841e6 (patch)
treeb41391451de8eae9eb9d659cfe512b2ddefc7a3c /os/hal/platforms/STM32/serial_lld.c
parent461b44091f45dd6fded72222f08ba2fd652cffd3 (diff)
downloadChibiOS-edc56330a91f1f646d8b78ead8a89c46a5d841e6.tar.gz
ChibiOS-edc56330a91f1f646d8b78ead8a89c46a5d841e6.tar.bz2
ChibiOS-edc56330a91f1f646d8b78ead8a89c46a5d841e6.zip
Merged Egon's patch.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1542 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32/serial_lld.c')
-rw-r--r--os/hal/platforms/STM32/serial_lld.c94
1 files changed, 94 insertions, 0 deletions
diff --git a/os/hal/platforms/STM32/serial_lld.c b/os/hal/platforms/STM32/serial_lld.c
index 8077aa3f3..92ee6609e 100644
--- a/os/hal/platforms/STM32/serial_lld.c
+++ b/os/hal/platforms/STM32/serial_lld.c
@@ -48,6 +48,18 @@ SerialDriver SD2;
SerialDriver SD3;
#endif
+#if defined(STM32F10X_HD) || defined(STM32F10X_CL) || defined(__DOXYGEN__)
+/** @brief UART4 serial driver identifier.*/
+#if USE_STM32_UART4 || defined(__DOXYGEN__)
+SerialDriver SD4;
+#endif
+
+/** @brief UART5 serial driver identifier.*/
+#if USE_STM32_UART5 || defined(__DOXYGEN__)
+SerialDriver SD5;
+#endif
+#endif
+
/*===========================================================================*/
/* Driver local variables. */
/*===========================================================================*/
@@ -187,6 +199,22 @@ static void notify3(void) {
}
#endif
+#if defined(STM32F10X_HD) || defined(STM32F10X_CL) || defined(__DOXYGEN__)
+#if USE_STM32_UART4 || defined(__DOXYGEN__)
+static void notify4(void) {
+
+ UART4->CR1 |= USART_CR1_TXEIE;
+}
+#endif
+
+#if USE_STM32_UART5 || defined(__DOXYGEN__)
+static void notify5(void) {
+
+ UART5->CR1 |= USART_CR1_TXEIE;
+}
+#endif
+#endif
+
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
@@ -224,6 +252,30 @@ CH_IRQ_HANDLER(VectorDC) {
}
#endif
+#if defined(STM32F10X_HD) || defined(STM32F10X_CL) || defined(__DOXYGEN__)
+#if USE_STM32_UART4 || defined(__DOXYGEN__)
+CH_IRQ_HANDLER(Vector110) {
+
+ CH_IRQ_PROLOGUE();
+
+ serve_interrupt(&SD4);
+
+ CH_IRQ_EPILOGUE();
+}
+#endif
+
+#if USE_STM32_UART5 || defined(__DOXYGEN__)
+CH_IRQ_HANDLER(Vector114) {
+
+ CH_IRQ_PROLOGUE();
+
+ serve_interrupt(&SD5);
+
+ CH_IRQ_EPILOGUE();
+}
+#endif
+#endif
+
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
@@ -247,6 +299,18 @@ void sd_lld_init(void) {
sdObjectInit(&SD3, NULL, notify3);
SD3.usart = USART3;
#endif
+
+#if defined(STM32F10X_HD) || defined(STM32F10X_CL)
+#if USE_STM32_UART4
+ sdObjectInit(&SD4, NULL, notify4);
+ SD4.usart = UART4;
+#endif
+
+#if USE_STM32_UART5
+ sdObjectInit(&SD5, NULL, notify5);
+ SD5.usart = UART5;
+#endif
+#endif
}
/**
@@ -278,6 +342,20 @@ void sd_lld_start(SerialDriver *sdp) {
NVICEnableVector(USART3_IRQn, STM32_USART3_PRIORITY);
}
#endif
+#if defined(STM32F10X_HD) || defined(STM32F10X_CL)
+#if USE_STM32_UART4
+ if (&SD4 == sdp) {
+ RCC->APB1ENR |= RCC_APB1ENR_UART4EN;
+ NVICEnableVector(UART4_IRQn, STM32_UART4_PRIORITY);
+ }
+#endif
+#if USE_STM32_UART5
+ if (&SD5 == sdp) {
+ RCC->APB1ENR |= RCC_APB1ENR_UART5EN;
+ NVICEnableVector(UART5_IRQn, STM32_UART5_PRIORITY);
+ }
+#endif
+#endif
}
usart_init(sdp);
}
@@ -314,6 +392,22 @@ void sd_lld_stop(SerialDriver *sdp) {
return;
}
#endif
+#if defined(STM32F10X_HD) || defined(STM32F10X_CL)
+#if USE_STM32_UART4
+ if (&SD4 == sdp) {
+ RCC->APB1ENR &= ~RCC_APB1ENR_UART4EN;
+ NVICDisableVector(UART4_IRQn);
+ return;
+ }
+#endif
+#if USE_STM32_UART5
+ if (&SD5 == sdp) {
+ RCC->APB1ENR &= ~RCC_APB1ENR_UART5EN;
+ NVICDisableVector(UART5_IRQn);
+ return;
+ }
+#endif
+#endif
}
}