diff options
-rw-r--r-- | libmaple/libmaple.h | 3 | ||||
-rw-r--r-- | libmaple/nvic.h | 4 | ||||
-rw-r--r-- | libmaple/rcc.c | 4 | ||||
-rw-r--r-- | libmaple/rcc.h | 4 | ||||
-rw-r--r-- | libmaple/usart.c | 28 | ||||
-rw-r--r-- | libmaple/usart.h | 4 |
6 files changed, 24 insertions, 23 deletions
diff --git a/libmaple/libmaple.h b/libmaple/libmaple.h index 417d732..664568f 100644 --- a/libmaple/libmaple.h +++ b/libmaple/libmaple.h @@ -101,7 +101,8 @@ #define NR_GPIO_PORTS 7 #define NR_GPIO_PINS 63 #define NR_TIMERS 8 - #define NR_USART 3 + // 3 USART, plus UART4 and UART5 + #define NR_USART 5 #define NR_FSMC 1 #define NR_DAC_PINS 2 diff --git a/libmaple/nvic.h b/libmaple/nvic.h index 2a54b27..6004c36 100644 --- a/libmaple/nvic.h +++ b/libmaple/nvic.h @@ -63,8 +63,8 @@ enum { NVIC_USART1 = 37, NVIC_USART2 = 38, NVIC_USART3 = 39, - NVIC_USART4 = 52, // high density only - NVIC_USART5 = 53, // high density only + NVIC_UART4 = 52, // high density only + NVIC_UART5 = 53, // high density only NVIC_EXTI0 = 6, NVIC_EXTI1 = 7, diff --git a/libmaple/rcc.c b/libmaple/rcc.c index 8914539..313eaf7 100644 --- a/libmaple/rcc.c +++ b/libmaple/rcc.c @@ -57,8 +57,8 @@ static const struct rcc_dev_info rcc_dev_table[] = { [RCC_USART1] = { .clk_domain = APB2, .line_num = 14 }, [RCC_USART2] = { .clk_domain = APB1, .line_num = 17 }, [RCC_USART3] = { .clk_domain = APB1, .line_num = 18 }, - [RCC_USART4] = { .clk_domain = APB1, .line_num = 19 }, // High-density only - [RCC_USART5] = { .clk_domain = APB1, .line_num = 20 }, // High-density only + [RCC_UART4] = { .clk_domain = APB1, .line_num = 19 }, // High-density only + [RCC_UART5] = { .clk_domain = APB1, .line_num = 20 }, // High-density only [RCC_TIMER1] = { .clk_domain = APB2, .line_num = 11 }, [RCC_TIMER2] = { .clk_domain = APB1, .line_num = 0 }, [RCC_TIMER3] = { .clk_domain = APB1, .line_num = 1 }, diff --git a/libmaple/rcc.h b/libmaple/rcc.h index deb567c..a7c4c53 100644 --- a/libmaple/rcc.h +++ b/libmaple/rcc.h @@ -158,8 +158,8 @@ enum { RCC_USART1, RCC_USART2, RCC_USART3, - RCC_USART4, // High-density devices only (Maple Native) - RCC_USART5, // High-density devices only (Maple Native) + RCC_UART4, // High-density devices only (Maple Native) + RCC_UART5, // High-density devices only (Maple Native) RCC_TIMER1, RCC_TIMER2, RCC_TIMER3, diff --git a/libmaple/usart.c b/libmaple/usart.c index dca7ea5..27aab49 100644 --- a/libmaple/usart.c +++ b/libmaple/usart.c @@ -36,8 +36,8 @@ #define USART1_BASE 0x40013800 #define USART2_BASE 0x40004400 #define USART3_BASE 0x40004800 -#define USART4_BASE 0x40004C00 // High-density devices only (Maple Native) -#define USART5_BASE 0x40005000 // High-density devices only (Maple Native) +#define UART4_BASE 0x40004C00 // High-density devices only (Maple Native) +#define UART5_BASE 0x40005000 // High-density devices only (Maple Native) #define USART_UE BIT(13) #define USART_M BIT(12) @@ -65,15 +65,15 @@ struct usart_dev usart_dev_table[] = { }, #if NR_USART >= 5 /* TODO test */ - [USART4] = { - .base = (usart_port*)USART4_BASE, - .rcc_dev_num = RCC_USART4, - .nvic_dev_num = NVIC_USART4 + [UART4] = { + .base = (usart_port*)UART4_BASE, + .rcc_dev_num = RCC_UART4, + .nvic_dev_num = NVIC_UART4 }, - [USART5] = { - .base = (usart_port*)USART5_BASE, - .rcc_dev_num = RCC_USART5, - .nvic_dev_num = NVIC_USART5 + [UART5] = { + .base = (usart_port*)UART5_BASE, + .rcc_dev_num = RCC_UART5, + .nvic_dev_num = NVIC_UART5 }, #endif }; @@ -107,12 +107,12 @@ void USART3_IRQHandler(void) { } #if NR_USART >= 5 -void USART4_IRQHandler(void) { - usart_irq(USART4); +void UART4_IRQHandler(void) { + usart_irq(UART4); } -void USART5_IRQHandler(void) { - usart_irq(USART5); +void UART5_IRQHandler(void) { + usart_irq(UART5); } #endif diff --git a/libmaple/usart.h b/libmaple/usart.h index 2735ac6..cbc7bde 100644 --- a/libmaple/usart.h +++ b/libmaple/usart.h @@ -42,8 +42,8 @@ enum { USART1, USART2, USART3, - USART4, - USART5, + UART4, + UART5, }; /* peripheral register struct */ |