Blame view

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