RTEMS 6.1-rc6
Loading...
Searching...
No Matches
stm32_usart.h
Go to the documentation of this file.
1
7/*
8 * Copyright (c) 2012 Sebastian Huber. All rights reserved.
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#ifndef LIBBSP_ARM_STM32F4_STM32_USART_H
16#define LIBBSP_ARM_STM32F4_STM32_USART_H
17
18#include <bsp/utility.h>
19
27typedef struct {
28 uint32_t sr;
29#define STM32F4_USART_SR_CTS BSP_BIT32(9)
30#define STM32F4_USART_SR_LBD BSP_BIT32(8)
31#define STM32F4_USART_SR_TXE BSP_BIT32(7)
32#define STM32F4_USART_SR_TC BSP_BIT32(6)
33#define STM32F4_USART_SR_RXNE BSP_BIT32(5)
34#define STM32F4_USART_SR_IDLE BSP_BIT32(4)
35#define STM32F4_USART_SR_ORE BSP_BIT32(3)
36#define STM32F4_USART_SR_NF BSP_BIT32(2)
37#define STM32F4_USART_SR_FE BSP_BIT32(1)
38#define STM32F4_USART_SR_PE BSP_BIT32(0)
39 uint32_t dr;
40#define STM32F4_USART_DR(val) BSP_FLD32(val, 0, 7)
41#define STM32F4_USART_DR_GET(reg) BSP_FLD32GET(reg, 0, 7)
42#define STM32F4_USART_DR_SET(reg, val) BSP_FLD32SET(reg, val, 0, 7)
43 uint32_t bbr;
44#define STM32F4_USART_BBR_DIV_MANTISSA(val) BSP_FLD32(val, 4, 15)
45#define STM32F4_USART_BBR_DIV_MANTISSA_GET(reg) BSP_FLD32GET(reg, 4, 15)
46#define STM32F4_USART_BBR_DIV_MANTISSA_SET(reg, val) BSP_FLD32SET(reg, val, 4, 15)
47#define STM32F4_USART_BBR_DIV_FRACTION(val) BSP_FLD32(val, 0, 3)
48#define STM32F4_USART_BBR_DIV_FRACTION_GET(reg) BSP_FLD32GET(reg, 0, 3)
49#define STM32F4_USART_BBR_DIV_FRACTION_SET(reg, val) BSP_FLD32SET(reg, val, 0, 3)
50 uint32_t cr1;
51#define STM32F4_USART_CR1_OVER8 BSP_BIT32(15)
52#define STM32F4_USART_CR1_UE BSP_BIT32(13)
53#define STM32F4_USART_CR1_M BSP_BIT32(12)
54#define STM32F4_USART_CR1_WAKE BSP_BIT32(11)
55#define STM32F4_USART_CR1_PCE BSP_BIT32(10)
56#define STM32F4_USART_CR1_PS BSP_BIT32(9)
57#define STM32F4_USART_CR1_PEIE BSP_BIT32(8)
58#define STM32F4_USART_CR1_TXEIE BSP_BIT32(7)
59#define STM32F4_USART_CR1_TCIE BSP_BIT32(6)
60#define STM32F4_USART_CR1_RXNEIE BSP_BIT32(5)
61#define STM32F4_USART_CR1_IDLEIE BSP_BIT32(4)
62#define STM32F4_USART_CR1_TE BSP_BIT32(3)
63#define STM32F4_USART_CR1_RE BSP_BIT32(2)
64#define STM32F4_USART_CR1_RWU BSP_BIT32(1)
65#define STM32F4_USART_CR1_SBK BSP_BIT32(0)
66 uint32_t cr2;
67#define STM32F4_USART_CR2_LINEN BSP_BIT32(14)
68#define STM32F4_USART_CR2_STOP(val) BSP_FLD32(val, 12, 13)
69#define STM32F4_USART_CR2_STOP_GET(reg) BSP_FLD32GET(reg, 12, 13)
70#define STM32F4_USART_CR2_STOP_SET(reg, val) BSP_FLD32SET(reg, val, 12, 13)
71#define STM32F4_USART_CR2_CLKEN BSP_BIT32(11)
72#define STM32F4_USART_CR2_CPOL BSP_BIT32(10)
73#define STM32F4_USART_CR2_CPHA BSP_BIT32(9)
74#define STM32F4_USART_CR2_LBCL BSP_BIT32(8)
75#define STM32F4_USART_CR2_LBDIE BSP_BIT32(6)
76#define STM32F4_USART_CR2_LBDL BSP_BIT32(5)
77#define STM32F4_USART_CR2_ADD(val) BSP_FLD32(val, 0, 3)
78#define STM32F4_USART_CR2_ADD_GET(reg) BSP_FLD32GET(reg, 0, 3)
79#define STM32F4_USART_CR2_ADD_SET(reg, val) BSP_FLD32SET(reg, val, 0, 3)
80 uint32_t cr3;
81#define STM32F4_USART_CR3_ONEBIT BSP_BIT32(11)
82#define STM32F4_USART_CR3_CTSIE BSP_BIT32(10)
83#define STM32F4_USART_CR3_CTSE BSP_BIT32(9)
84#define STM32F4_USART_CR3_RTSE BSP_BIT32(8)
85#define STM32F4_USART_CR3_DMAT BSP_BIT32(7)
86#define STM32F4_USART_CR3_DMAR BSP_BIT32(6)
87#define STM32F4_USART_CR3_SCEN BSP_BIT32(5)
88#define STM32F4_USART_CR3_NACK BSP_BIT32(4)
89#define STM32F4_USART_CR3_HDSEL BSP_BIT32(3)
90#define STM32F4_USART_CR3_IRLP BSP_BIT32(2)
91#define STM32F4_USART_CR3_IREN BSP_BIT32(1)
92#define STM32F4_USART_CR3_EIE BSP_BIT32(0)
93 uint32_t gtpr;
94#define STM32F4_USART_GTPR_GT(val) BSP_FLD32(val, 8, 15)
95#define STM32F4_USART_GTPR_GT_GET(reg) BSP_FLD32GET(reg, 8, 15)
96#define STM32F4_USART_GTPR_GT_SET(reg, val) BSP_FLD32SET(reg, val, 8, 15)
97#define STM32F4_USART_GTPR_PSC(val) BSP_FLD32(val, 0, 7)
98#define STM32F4_USART_GTPR_PSC_GET(reg) BSP_FLD32GET(reg, 0, 7)
99#define STM32F4_USART_GTPR_PSC_SET(reg, val) BSP_FLD32SET(reg, val, 0, 7)
101
104#endif /* LIBBSP_ARM_STM32F4_STM32_USART_H */
This header file provides utility macros for BSPs.
Definition: stm32_usart.h:27