cc26x0_uart.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Leon George
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
18 #ifndef CC26x0_UART_H
19 #define CC26x0_UART_H
20 
21 #include "cc26x0.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #define UART_BASE (0x40001000)
32 typedef struct {
33  reg32_t DR;
34  union {
35  reg32_t RSR;
36  reg32_t ECR;
37  };
38  reg32_t __reserved1[4];
39  reg32_t FR;
40  reg32_t __reserved2[2];
41  reg32_t IBRD;
42  reg32_t FBRD;
43  reg32_t LCRH;
44  reg32_t CTL;
45  reg32_t IFLS;
46  reg32_t IMSC;
47  reg32_t RIS;
48  reg32_t MIS;
49  reg32_t ICR;
50  reg32_t DMACTL;
51 } uart_regs_t;
52 
57 #define UART_DR_DATA_mask 0xFF
58 #define UART_DR_FE 0x100
59 #define UART_DR_PE 0x200
60 #define UART_DR_BE 0x400
61 #define UART_DR_OE 0x800
62 
63 #define UART_ECR_FE 0x1
64 #define UART_ECR_PE 0x2
65 #define UART_ECR_BE 0x4
66 #define UART_ECR_OE 0x8
67 
68 #define UART_FR_CTS 0x1
69 #define UART_FR_BUSY 0x4
70 #define UART_FR_RXFE 0x10
71 #define UART_FR_TXFF 0x20
72 #define UART_FR_RXFF 0x40
73 #define UART_FR_TXFE 0x80
74 
75 #define UART_LCRH_PEN 0x1
76 #define UART_LCRH_EPS 0x2
77 #define UART_LCRH_RXFE 0x4
78 #define UART_LCRH_STP2 0x8
79 #define UART_LCRH_FEN 0x10
80 #define UART_LCRH_WLEN_mask 0x60
81 #define UART_LCRH_WLEN_5 0x0
82 #define UART_LCRH_WLEN_6 0x20
83 #define UART_LCRH_WLEN_7 0x40
84 #define UART_LCRH_WLEN_8 0x60
85 #define UART_LCRH_SPS 0x80
86 
87 #define UART_CTL_UARTEN 0x1
88 #define UART_CTL_LBE 0x80
89 #define UART_CTL_TXE 0x100
90 #define UART_CTL_RXE 0x200
91 #define UART_CTL_RTS 0x800
92 #define UART_CTL_RTSEN 0x4000
93 #define UART_CTL_CTSEN 0x8000
94 
95 #define UART_MIS_CTSMMIS 0x1
96 #define UART_MIS_RXMIS 0x10
97 #define UART_MIS_TXMIS 0x20
98 #define UART_MIS_RTMIS 0x40
99 #define UART_MIS_FEMIS 0x80
100 #define UART_MIS_PEMIS 0x100
101 #define UART_MIS_BEMIS 0x200
102 #define UART_MIS_OEMIS 0x400
103 
104 #define UART_IMSC_CTSMIM 0x2
105 #define UART_IMSC_RXIM 0x10
106 #define UART_IMSC_TXIM 0x20
107 #define UART_IMSC_RTIM 0x40
108 #define UART_IMSC_FEIM 0x80
109 #define UART_IMSC_PEIM 0x100
110 #define UART_IMSC_BEIM 0x200
111 #define UART_IMSC_OEIM 0x400
112 
113 #define UART_IFLS_TXSEL_1_8 0x0
114 #define UART_IFLS_TXSEL_2_8 0x1
115 #define UART_IFLS_TXSEL_4_8 0x2
116 #define UART_IFLS_TXSEL_6_8 0x3
117 #define UART_IFLS_TXSEL_7_8 0x4
118 
119 #define UART_IFLS_RXSEL_1_8 0x0
120 #define UART_IFLS_RXSEL_2_8 0x8
121 #define UART_IFLS_RXSEL_4_8 0x10
122 #define UART_IFLS_RXSEL_6_8 0x18
123 #define UART_IFLS_RXSEL_7_8 0x20
124 
126 #define UART ((uart_regs_t *) (UART_BASE))
128 #ifdef __cplusplus
129 } /* end extern "C" */
130 #endif
131 
132 #endif /* CC26x8_UART_H */
133 
UART component registers.
Definition: cc26x0_uart.h:32
reg32_t FR
flag
Definition: cc26x0_uart.h:39
reg32_t IFLS
interrupt fifo level select
Definition: cc26x0_uart.h:45
reg32_t DR
data
Definition: cc26x0_uart.h:33
reg32_t RIS
raw interrupt status
Definition: cc26x0_uart.h:47
reg32_t IMSC
interrupt mask set/clear
Definition: cc26x0_uart.h:46
reg32_t ICR
interrupt clear
Definition: cc26x0_uart.h:49
reg32_t CTL
control
Definition: cc26x0_uart.h:44
reg32_t ECR
error clear
Definition: cc26x0_uart.h:36
reg32_t IBRD
integer baud-rate divisor
Definition: cc26x0_uart.h:41
reg32_t MIS
masked interrupt status
Definition: cc26x0_uart.h:48
reg32_t DMACTL
DMA control.
Definition: cc26x0_uart.h:50
reg32_t FBRD
fractional baud-rate divisor
Definition: cc26x0_uart.h:42
CC26x0 MCU interrupt definitions.
reg32_t RSR
status
Definition: cc26x0_uart.h:35
reg32_t LCRH
line control
Definition: cc26x0_uart.h:43