mbed library sources

Dependents:   Nucleo_blink_led

Fork of mbed-src by mbed official

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Fri Feb 20 18:00:08 2015 +0000
Parent:
477:5831be29b0ad
Child:
479:7e81235899b0
Commit message:
Synchronized with git revision 86041dd3983e145ab913b172297848a29804d3bf

Full URL: https://github.com/mbedmicro/mbed/commit/86041dd3983e145ab913b172297848a29804d3bf/

enable the additional uart 7&8 of the STM32F439 in the mbed sdk/api

Changed in this revision

targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/PeripheralNames.h Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/PeripheralPins.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c Show annotated file Show diff for this revision Revisions of this file
--- a/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/PeripheralNames.h	Mon Feb 16 17:15:07 2015 +0000
+++ b/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/PeripheralNames.h	Fri Feb 20 18:00:08 2015 +0000
@@ -53,7 +53,9 @@
     UART_3 = (int)USART3_BASE,
     UART_4 = (int)UART4_BASE,
     UART_5 = (int)UART5_BASE,
-    UART_6 = (int)USART6_BASE
+    UART_6 = (int)USART6_BASE,
+    UART_7 = (int)UART7_BASE,
+    UART_8 = (int)UART8_BASE
 } UARTName;
 
 #define STDIO_UART_TX  PD_8
--- a/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/PeripheralPins.c	Mon Feb 16 17:15:07 2015 +0000
+++ b/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/PeripheralPins.c	Fri Feb 20 18:00:08 2015 +0000
@@ -133,12 +133,14 @@
 const PinMap PinMap_UART_TX[] = {
     {PA_9,  UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
     {PD_8,  UART_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
+    {PF_7,  UART_7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART7)},
     {NC,    NC,     0}
 };
 
 const PinMap PinMap_UART_RX[] = {
     {PA_10, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
     {PD_9,  UART_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
+    {PF_6,  UART_7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART7)},
     {NC,    NC,     0}
 };
 
--- a/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c	Mon Feb 16 17:15:07 2015 +0000
+++ b/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c	Fri Feb 20 18:00:08 2015 +0000
@@ -37,9 +37,9 @@
 #include <string.h>
 #include "PeripheralPins.h"
 
-#define UART_NUM (6)
+#define UART_NUM (8)
 
-static uint32_t serial_irq_ids[UART_NUM] = {0, 0, 0, 0, 0, 0};
+static uint32_t serial_irq_ids[UART_NUM] = {0, 0, 0, 0, 0, 0, 0, 0};
 
 static uart_irq_handler irq_handler;
 
@@ -111,6 +111,18 @@
             __USART6_CLK_ENABLE();
             obj->index = 5;
             break;
+#if defined(UART7_BASE)
+        case UART_7:
+            __UART7_CLK_ENABLE();
+            obj->index = 6;
+            break;
+#endif
+#if defined(UART8_BASE)
+        case UART_8:
+            __UART8_CLK_ENABLE();
+            obj->index = 7;
+            break;
+#endif
     }
 
     // Configure the UART pins
@@ -181,6 +193,20 @@
             __USART6_RELEASE_RESET();
             __USART6_CLK_DISABLE();
             break;
+#if defined(UART7_BASE)
+        case UART_7:
+            __UART7_FORCE_RESET();
+            __UART7_RELEASE_RESET();
+            __UART7_CLK_DISABLE();
+            break;
+#endif
+#if defined(UART8_BASE)
+        case UART_8:
+            __UART8_FORCE_RESET();
+            __UART8_RELEASE_RESET();
+            __UART8_CLK_DISABLE();
+            break;
+#endif
     }
     // Configure GPIOs
     pin_function(obj->pin_tx, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0));
@@ -281,6 +307,20 @@
     uart_irq(UART_6, 5);
 }
 
+#if defined(UART7_BASE)
+static void uart7_irq(void) 
+{
+    uart_irq(UART_7, 6);
+}
+#endif
+
+#if defined(UART8_BASE)
+static void uart8_irq(void) 
+{
+    uart_irq(UART_8, 7);
+}
+#endif
+
 void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id)
 {
     irq_handler = handler;
@@ -326,6 +366,18 @@
             irq_n = USART6_IRQn;
             vector = (uint32_t)&uart6_irq;
             break;
+#if defined(UART7_BASE)
+        case UART_7:
+            irq_n = UART7_IRQn;
+            vector = (uint32_t)&uart7_irq;
+            break;
+#endif
+#if defined(UART8_BASE)
+        case UART_8:
+            irq_n = UART8_IRQn;
+            vector = (uint32_t)&uart8_irq;
+            break;
+#endif
     }
 
     if (enable) {