NavHAL 0.1.0
NAVRobotec's architecture-agnostic HAL for embedded systems.
Loading...
Searching...
No Matches
uart_reg.h
Go to the documentation of this file.
1
9#ifndef CORTEX_M4_UART_REG_H
10#define CORTEX_M4_UART_REG_H
11
12#include "common/hal_types.h"
13#include <stdint.h>
14
15typedef struct {
16 __IO uint32_t SR;
19 __IO uint32_t DR;
22 __IO uint32_t BRR;
25 __IO uint32_t CR1;
28 __IO uint32_t
32 __IO uint32_t CR3;
35 __IO uint32_t GTPR;
39
40#define USART1_BASE 0x40011000
41#define USART2_BASE 0x40004400
42#define USART6_BASE 0x40011400
43
44#define GET_USARTx_BASE(n) \
45 ((UARTx_Reg_Typedef *)(n == 1 \
46 ? (USART1_BASE) \
47 : (n == 2 ? (USART2_BASE) \
48 : (n == 6 ? (USART6_BASE) : (NULL)))))
49
50
51/* Clock enable bits */
52#define RCC_APB1ENR_USART2EN (1 << 17)
53#define RCC_APB2ENR_USART1EN (1 << 4)
54#define RCC_APB2ENR_USART6EN (1 << 5)
55
56
57/* Control register bits */
58#define USART_CR1_UE (1 << 13)
59#define USART_CR1_TE (1 << 3)
60#define USART_CR1_RE (1 << 2)
61
62/* Status register bits */
63#define USART_SR_TXE (1 << 7)
64#define USART_SR_RXNE (1 << 5)
65
66#endif // !CORTEX_M4_UART_REG_H
Hardware Abstraction Layer (HAL) common type definitions.
#define __IO
Definition hal_types.h:20
UART peripheral register map for STM32F4.
Definition uart_reg.h:15
__IO uint32_t CR3
Definition uart_reg.h:32
__IO uint32_t GTPR
Definition uart_reg.h:35
__IO uint32_t BRR
Definition uart_reg.h:22
__IO uint32_t SR
Definition uart_reg.h:16
__IO uint32_t CR1
Definition uart_reg.h:25
__IO uint32_t CR2
Definition uart_reg.h:29
__IO uint32_t DR
Definition uart_reg.h:19