HPM SDK
HPMicro Software Development Kit
hpm_uart_regs.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-2024 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 
9 #ifndef HPM_UART_H
10 #define HPM_UART_H
11 
12 typedef struct {
13  __R uint8_t RESERVED0[4]; /* 0x0 - 0x3: Reserved */
14  __RW uint32_t IDLE_CFG; /* 0x4: Idle Configuration Register */
15  __R uint8_t RESERVED1[8]; /* 0x8 - 0xF: Reserved */
16  __RW uint32_t CFG; /* 0x10: Configuration Register */
17  __RW uint32_t OSCR; /* 0x14: Over Sample Control Register */
18  __RW uint32_t FCRR; /* 0x18: FIFO Control Register config */
19  __R uint8_t RESERVED2[4]; /* 0x1C - 0x1F: Reserved */
20  union {
21  __R uint32_t RBR; /* 0x20: Receiver Buffer Register (when DLAB = 0) */
22  __W uint32_t THR; /* 0x20: Transmitter Holding Register (when DLAB = 0) */
23  __RW uint32_t DLL; /* 0x20: Divisor Latch LSB (when DLAB = 1) */
24  };
25  union {
26  __RW uint32_t IER; /* 0x24: Interrupt Enable Register (when DLAB = 0) */
27  __RW uint32_t DLM; /* 0x24: Divisor Latch MSB (when DLAB = 1) */
28  };
29  union {
30  __RW uint32_t IIR; /* 0x28: Interrupt Identification Register */
31  __W uint32_t FCR; /* 0x28: FIFO Control Register */
32  };
33  __RW uint32_t LCR; /* 0x2C: Line Control Register */
34  __RW uint32_t MCR; /* 0x30: Modem Control Register ( */
35  __R uint32_t LSR; /* 0x34: Line Status Register */
36  __R uint32_t MSR; /* 0x38: Modem Status Register */
37  __RW uint32_t GPR; /* 0x3C: GPR Register */
38 } UART_Type;
39 
40 
41 /* Bitfield definition for register: IDLE_CFG */
42 /*
43  * RXEN (RW)
44  *
45  * UART receive enable.
46  * 0 - hold RX input to high, avoide wrong data input when config pinmux
47  * 1 - bypass RX input from PIN
48  * software should set it after config pinmux
49  */
50 #define UART_IDLE_CFG_RXEN_MASK (0x800U)
51 #define UART_IDLE_CFG_RXEN_SHIFT (11U)
52 #define UART_IDLE_CFG_RXEN_SET(x) (((uint32_t)(x) << UART_IDLE_CFG_RXEN_SHIFT) & UART_IDLE_CFG_RXEN_MASK)
53 #define UART_IDLE_CFG_RXEN_GET(x) (((uint32_t)(x) & UART_IDLE_CFG_RXEN_MASK) >> UART_IDLE_CFG_RXEN_SHIFT)
54 
55 /*
56  * RX_IDLE_COND (RW)
57  *
58  * IDLE Detection Condition
59  * 0 - Treat as idle if RX pin is logic one
60  * 1 - Treat as idle if UART state machine state is idle
61  */
62 #define UART_IDLE_CFG_RX_IDLE_COND_MASK (0x200U)
63 #define UART_IDLE_CFG_RX_IDLE_COND_SHIFT (9U)
64 #define UART_IDLE_CFG_RX_IDLE_COND_SET(x) (((uint32_t)(x) << UART_IDLE_CFG_RX_IDLE_COND_SHIFT) & UART_IDLE_CFG_RX_IDLE_COND_MASK)
65 #define UART_IDLE_CFG_RX_IDLE_COND_GET(x) (((uint32_t)(x) & UART_IDLE_CFG_RX_IDLE_COND_MASK) >> UART_IDLE_CFG_RX_IDLE_COND_SHIFT)
66 
67 /*
68  * RX_IDLE_EN (RW)
69  *
70  * UART Idle Detect Enable
71  * 0 - Disable
72  * 1 - Enable
73  * it should be enabled if enable address match feature
74  */
75 #define UART_IDLE_CFG_RX_IDLE_EN_MASK (0x100U)
76 #define UART_IDLE_CFG_RX_IDLE_EN_SHIFT (8U)
77 #define UART_IDLE_CFG_RX_IDLE_EN_SET(x) (((uint32_t)(x) << UART_IDLE_CFG_RX_IDLE_EN_SHIFT) & UART_IDLE_CFG_RX_IDLE_EN_MASK)
78 #define UART_IDLE_CFG_RX_IDLE_EN_GET(x) (((uint32_t)(x) & UART_IDLE_CFG_RX_IDLE_EN_MASK) >> UART_IDLE_CFG_RX_IDLE_EN_SHIFT)
79 
80 /*
81  * RX_IDLE_THR (RW)
82  *
83  * Threshold for UART Receive Idle detection (in terms of bits)
84  */
85 #define UART_IDLE_CFG_RX_IDLE_THR_MASK (0xFFU)
86 #define UART_IDLE_CFG_RX_IDLE_THR_SHIFT (0U)
87 #define UART_IDLE_CFG_RX_IDLE_THR_SET(x) (((uint32_t)(x) << UART_IDLE_CFG_RX_IDLE_THR_SHIFT) & UART_IDLE_CFG_RX_IDLE_THR_MASK)
88 #define UART_IDLE_CFG_RX_IDLE_THR_GET(x) (((uint32_t)(x) & UART_IDLE_CFG_RX_IDLE_THR_MASK) >> UART_IDLE_CFG_RX_IDLE_THR_SHIFT)
89 
90 /* Bitfield definition for register: CFG */
91 /*
92  * FIFOSIZE (RO)
93  *
94  * The depth of RXFIFO and TXFIFO
95  * 0: 16-byte FIFO
96  * 1: 32-byte FIFO
97  * 2: 64-byte FIFO
98  * 3: 128-byte FIFO
99  */
100 #define UART_CFG_FIFOSIZE_MASK (0x3U)
101 #define UART_CFG_FIFOSIZE_SHIFT (0U)
102 #define UART_CFG_FIFOSIZE_GET(x) (((uint32_t)(x) & UART_CFG_FIFOSIZE_MASK) >> UART_CFG_FIFOSIZE_SHIFT)
103 
104 /* Bitfield definition for register: OSCR */
105 /*
106  * OSC (RW)
107  *
108  * Over-sample control
109  * The value must be an even number; any odd value
110  * writes to this field will be converted to an even value.
111  * OSC=0: reserved
112  * OSC<=8: The over-sample ratio is 8
113  * 8 < OSC< 32: The over sample ratio is OSC
114  */
115 #define UART_OSCR_OSC_MASK (0x1FU)
116 #define UART_OSCR_OSC_SHIFT (0U)
117 #define UART_OSCR_OSC_SET(x) (((uint32_t)(x) << UART_OSCR_OSC_SHIFT) & UART_OSCR_OSC_MASK)
118 #define UART_OSCR_OSC_GET(x) (((uint32_t)(x) & UART_OSCR_OSC_MASK) >> UART_OSCR_OSC_SHIFT)
119 
120 /* Bitfield definition for register: FCRR */
121 /*
122  * RFIFOT (RW)
123  *
124  * Receiver FIFO trigger level
125  */
126 #define UART_FCRR_RFIFOT_MASK (0xC0U)
127 #define UART_FCRR_RFIFOT_SHIFT (6U)
128 #define UART_FCRR_RFIFOT_SET(x) (((uint32_t)(x) << UART_FCRR_RFIFOT_SHIFT) & UART_FCRR_RFIFOT_MASK)
129 #define UART_FCRR_RFIFOT_GET(x) (((uint32_t)(x) & UART_FCRR_RFIFOT_MASK) >> UART_FCRR_RFIFOT_SHIFT)
130 
131 /*
132  * TFIFOT (RW)
133  *
134  * Transmitter FIFO trigger level
135  */
136 #define UART_FCRR_TFIFOT_MASK (0x30U)
137 #define UART_FCRR_TFIFOT_SHIFT (4U)
138 #define UART_FCRR_TFIFOT_SET(x) (((uint32_t)(x) << UART_FCRR_TFIFOT_SHIFT) & UART_FCRR_TFIFOT_MASK)
139 #define UART_FCRR_TFIFOT_GET(x) (((uint32_t)(x) & UART_FCRR_TFIFOT_MASK) >> UART_FCRR_TFIFOT_SHIFT)
140 
141 /*
142  * DMAE (RW)
143  *
144  * DMA enable
145  * 0: Disable
146  * 1: Enable
147  */
148 #define UART_FCRR_DMAE_MASK (0x8U)
149 #define UART_FCRR_DMAE_SHIFT (3U)
150 #define UART_FCRR_DMAE_SET(x) (((uint32_t)(x) << UART_FCRR_DMAE_SHIFT) & UART_FCRR_DMAE_MASK)
151 #define UART_FCRR_DMAE_GET(x) (((uint32_t)(x) & UART_FCRR_DMAE_MASK) >> UART_FCRR_DMAE_SHIFT)
152 
153 /*
154  * TFIFORST (WO)
155  *
156  * Transmitter FIFO reset
157  * Write 1 to clear all bytes in the TXFIFO and resets its
158  * counter. The Transmitter Shift Register is not cleared.
159  * This bit will automatically be cleared.
160  */
161 #define UART_FCRR_TFIFORST_MASK (0x4U)
162 #define UART_FCRR_TFIFORST_SHIFT (2U)
163 #define UART_FCRR_TFIFORST_SET(x) (((uint32_t)(x) << UART_FCRR_TFIFORST_SHIFT) & UART_FCRR_TFIFORST_MASK)
164 #define UART_FCRR_TFIFORST_GET(x) (((uint32_t)(x) & UART_FCRR_TFIFORST_MASK) >> UART_FCRR_TFIFORST_SHIFT)
165 
166 /*
167  * RFIFORST (WO)
168  *
169  * Receiver FIFO reset
170  * Write 1 to clear all bytes in the RXFIFO and resets its
171  * counter. The Receiver Shift Register is not cleared.
172  * This bit will automatically be cleared.
173  */
174 #define UART_FCRR_RFIFORST_MASK (0x2U)
175 #define UART_FCRR_RFIFORST_SHIFT (1U)
176 #define UART_FCRR_RFIFORST_SET(x) (((uint32_t)(x) << UART_FCRR_RFIFORST_SHIFT) & UART_FCRR_RFIFORST_MASK)
177 #define UART_FCRR_RFIFORST_GET(x) (((uint32_t)(x) & UART_FCRR_RFIFORST_MASK) >> UART_FCRR_RFIFORST_SHIFT)
178 
179 /*
180  * FIFOE (RW)
181  *
182  * FIFO enable
183  * Write 1 to enable both the transmitter and receiver
184  * FIFOs.
185  * The FIFOs are reset when the value of this bit toggles.
186  */
187 #define UART_FCRR_FIFOE_MASK (0x1U)
188 #define UART_FCRR_FIFOE_SHIFT (0U)
189 #define UART_FCRR_FIFOE_SET(x) (((uint32_t)(x) << UART_FCRR_FIFOE_SHIFT) & UART_FCRR_FIFOE_MASK)
190 #define UART_FCRR_FIFOE_GET(x) (((uint32_t)(x) & UART_FCRR_FIFOE_MASK) >> UART_FCRR_FIFOE_SHIFT)
191 
192 /* Bitfield definition for register: RBR */
193 /*
194  * RBR (RO)
195  *
196  * Receive data read port
197  */
198 #define UART_RBR_RBR_MASK (0xFFU)
199 #define UART_RBR_RBR_SHIFT (0U)
200 #define UART_RBR_RBR_GET(x) (((uint32_t)(x) & UART_RBR_RBR_MASK) >> UART_RBR_RBR_SHIFT)
201 
202 /* Bitfield definition for register: THR */
203 /*
204  * THR (WO)
205  *
206  * Transmit data write port
207  */
208 #define UART_THR_THR_MASK (0xFFU)
209 #define UART_THR_THR_SHIFT (0U)
210 #define UART_THR_THR_SET(x) (((uint32_t)(x) << UART_THR_THR_SHIFT) & UART_THR_THR_MASK)
211 #define UART_THR_THR_GET(x) (((uint32_t)(x) & UART_THR_THR_MASK) >> UART_THR_THR_SHIFT)
212 
213 /* Bitfield definition for register: DLL */
214 /*
215  * DLL (RW)
216  *
217  * Least significant byte of the Divisor Latch
218  */
219 #define UART_DLL_DLL_MASK (0xFFU)
220 #define UART_DLL_DLL_SHIFT (0U)
221 #define UART_DLL_DLL_SET(x) (((uint32_t)(x) << UART_DLL_DLL_SHIFT) & UART_DLL_DLL_MASK)
222 #define UART_DLL_DLL_GET(x) (((uint32_t)(x) & UART_DLL_DLL_MASK) >> UART_DLL_DLL_SHIFT)
223 
224 /* Bitfield definition for register: IER */
225 /*
226  * ERXIDLE (RW)
227  *
228  * Enable Receive Idle interrupt
229  * 0 - Disable Idle interrupt
230  * 1 - Enable Idle interrupt
231  */
232 #define UART_IER_ERXIDLE_MASK (0x80000000UL)
233 #define UART_IER_ERXIDLE_SHIFT (31U)
234 #define UART_IER_ERXIDLE_SET(x) (((uint32_t)(x) << UART_IER_ERXIDLE_SHIFT) & UART_IER_ERXIDLE_MASK)
235 #define UART_IER_ERXIDLE_GET(x) (((uint32_t)(x) & UART_IER_ERXIDLE_MASK) >> UART_IER_ERXIDLE_SHIFT)
236 
237 /*
238  * EMSI (RW)
239  *
240  * Enable modem status interrupt
241  * The interrupt asserts when the status of one of the
242  * following occurs:
243  * The status of modem_rin, modem_dcdn,
244  * modem_dsrn or modem_ctsn (If the auto-cts mode is
245  * disabled) has been changed.
246  * If the auto-cts mode is enabled (MCR bit4 (AFE) = 1),
247  * modem_ctsn would be used to control the transmitter.
248  */
249 #define UART_IER_EMSI_MASK (0x8U)
250 #define UART_IER_EMSI_SHIFT (3U)
251 #define UART_IER_EMSI_SET(x) (((uint32_t)(x) << UART_IER_EMSI_SHIFT) & UART_IER_EMSI_MASK)
252 #define UART_IER_EMSI_GET(x) (((uint32_t)(x) & UART_IER_EMSI_MASK) >> UART_IER_EMSI_SHIFT)
253 
254 /*
255  * ELSI (RW)
256  *
257  * Enable receiver line status interrupt
258  */
259 #define UART_IER_ELSI_MASK (0x4U)
260 #define UART_IER_ELSI_SHIFT (2U)
261 #define UART_IER_ELSI_SET(x) (((uint32_t)(x) << UART_IER_ELSI_SHIFT) & UART_IER_ELSI_MASK)
262 #define UART_IER_ELSI_GET(x) (((uint32_t)(x) & UART_IER_ELSI_MASK) >> UART_IER_ELSI_SHIFT)
263 
264 /*
265  * ETHEI (RW)
266  *
267  * Enable transmitter holding register interrupt
268  */
269 #define UART_IER_ETHEI_MASK (0x2U)
270 #define UART_IER_ETHEI_SHIFT (1U)
271 #define UART_IER_ETHEI_SET(x) (((uint32_t)(x) << UART_IER_ETHEI_SHIFT) & UART_IER_ETHEI_MASK)
272 #define UART_IER_ETHEI_GET(x) (((uint32_t)(x) & UART_IER_ETHEI_MASK) >> UART_IER_ETHEI_SHIFT)
273 
274 /*
275  * ERBI (RW)
276  *
277  * Enable received data available interrupt and the
278  * character timeout interrupt
279  * 0: Disable
280  * 1: Enable
281  */
282 #define UART_IER_ERBI_MASK (0x1U)
283 #define UART_IER_ERBI_SHIFT (0U)
284 #define UART_IER_ERBI_SET(x) (((uint32_t)(x) << UART_IER_ERBI_SHIFT) & UART_IER_ERBI_MASK)
285 #define UART_IER_ERBI_GET(x) (((uint32_t)(x) & UART_IER_ERBI_MASK) >> UART_IER_ERBI_SHIFT)
286 
287 /* Bitfield definition for register: DLM */
288 /*
289  * DLM (RW)
290  *
291  * Most significant byte of the Divisor Latch
292  */
293 #define UART_DLM_DLM_MASK (0xFFU)
294 #define UART_DLM_DLM_SHIFT (0U)
295 #define UART_DLM_DLM_SET(x) (((uint32_t)(x) << UART_DLM_DLM_SHIFT) & UART_DLM_DLM_MASK)
296 #define UART_DLM_DLM_GET(x) (((uint32_t)(x) & UART_DLM_DLM_MASK) >> UART_DLM_DLM_SHIFT)
297 
298 /* Bitfield definition for register: IIR */
299 /*
300  * RXIDLE_FLAG (W1C)
301  *
302  * UART IDLE Flag
303  * 0 - UART is busy
304  * 1 - UART is idle
305  * NOTE: when write one to clear this bit, avoid changging FCR register since it's same address as IIR
306  */
307 #define UART_IIR_RXIDLE_FLAG_MASK (0x80000000UL)
308 #define UART_IIR_RXIDLE_FLAG_SHIFT (31U)
309 #define UART_IIR_RXIDLE_FLAG_SET(x) (((uint32_t)(x) << UART_IIR_RXIDLE_FLAG_SHIFT) & UART_IIR_RXIDLE_FLAG_MASK)
310 #define UART_IIR_RXIDLE_FLAG_GET(x) (((uint32_t)(x) & UART_IIR_RXIDLE_FLAG_MASK) >> UART_IIR_RXIDLE_FLAG_SHIFT)
311 
312 /*
313  * FIFOED (RO)
314  *
315  * FIFOs enabled
316  * These two bits are 1 when bit 0 of the FIFO Control
317  * Register (FIFOE) is set to 1.
318  */
319 #define UART_IIR_FIFOED_MASK (0xC0U)
320 #define UART_IIR_FIFOED_SHIFT (6U)
321 #define UART_IIR_FIFOED_GET(x) (((uint32_t)(x) & UART_IIR_FIFOED_MASK) >> UART_IIR_FIFOED_SHIFT)
322 
323 /*
324  * INTRID (RO)
325  *
326  * Interrupt ID, see IIR2 for detail decoding
327  */
328 #define UART_IIR_INTRID_MASK (0xFU)
329 #define UART_IIR_INTRID_SHIFT (0U)
330 #define UART_IIR_INTRID_GET(x) (((uint32_t)(x) & UART_IIR_INTRID_MASK) >> UART_IIR_INTRID_SHIFT)
331 
332 /* Bitfield definition for register: FCR */
333 /*
334  * RFIFOT (WO)
335  *
336  * Receiver FIFO trigger level(0 for 1byte, 0x3 for 4bytes). Uart will send rx_dma_req if data in fifo reachs the threshold
337  */
338 #define UART_FCR_RFIFOT_MASK (0xC0U)
339 #define UART_FCR_RFIFOT_SHIFT (6U)
340 #define UART_FCR_RFIFOT_SET(x) (((uint32_t)(x) << UART_FCR_RFIFOT_SHIFT) & UART_FCR_RFIFOT_MASK)
341 #define UART_FCR_RFIFOT_GET(x) (((uint32_t)(x) & UART_FCR_RFIFOT_MASK) >> UART_FCR_RFIFOT_SHIFT)
342 
343 /*
344  * TFIFOT (WO)
345  *
346  * Transmitter FIFO trigger level(0 for 1byte, 0x3 for 4bytes), uart will send tx_dma_req when data in fifo is less than threshold.
347  */
348 #define UART_FCR_TFIFOT_MASK (0x30U)
349 #define UART_FCR_TFIFOT_SHIFT (4U)
350 #define UART_FCR_TFIFOT_SET(x) (((uint32_t)(x) << UART_FCR_TFIFOT_SHIFT) & UART_FCR_TFIFOT_MASK)
351 #define UART_FCR_TFIFOT_GET(x) (((uint32_t)(x) & UART_FCR_TFIFOT_MASK) >> UART_FCR_TFIFOT_SHIFT)
352 
353 /*
354  * DMAE (WO)
355  *
356  * DMA enable
357  * 0: Disable
358  * 1: Enable
359  */
360 #define UART_FCR_DMAE_MASK (0x8U)
361 #define UART_FCR_DMAE_SHIFT (3U)
362 #define UART_FCR_DMAE_SET(x) (((uint32_t)(x) << UART_FCR_DMAE_SHIFT) & UART_FCR_DMAE_MASK)
363 #define UART_FCR_DMAE_GET(x) (((uint32_t)(x) & UART_FCR_DMAE_MASK) >> UART_FCR_DMAE_SHIFT)
364 
365 /*
366  * TFIFORST (WO)
367  *
368  * Transmitter FIFO reset
369  * Write 1 to clear all bytes in the TXFIFO and resets its
370  * counter. The Transmitter Shift Register is not cleared.
371  * This bit will automatically be cleared.
372  */
373 #define UART_FCR_TFIFORST_MASK (0x4U)
374 #define UART_FCR_TFIFORST_SHIFT (2U)
375 #define UART_FCR_TFIFORST_SET(x) (((uint32_t)(x) << UART_FCR_TFIFORST_SHIFT) & UART_FCR_TFIFORST_MASK)
376 #define UART_FCR_TFIFORST_GET(x) (((uint32_t)(x) & UART_FCR_TFIFORST_MASK) >> UART_FCR_TFIFORST_SHIFT)
377 
378 /*
379  * RFIFORST (WO)
380  *
381  * Receiver FIFO reset
382  * Write 1 to clear all bytes in the RXFIFO and resets its
383  * counter. The Receiver Shift Register is not cleared.
384  * This bit will automatically be cleared.
385  */
386 #define UART_FCR_RFIFORST_MASK (0x2U)
387 #define UART_FCR_RFIFORST_SHIFT (1U)
388 #define UART_FCR_RFIFORST_SET(x) (((uint32_t)(x) << UART_FCR_RFIFORST_SHIFT) & UART_FCR_RFIFORST_MASK)
389 #define UART_FCR_RFIFORST_GET(x) (((uint32_t)(x) & UART_FCR_RFIFORST_MASK) >> UART_FCR_RFIFORST_SHIFT)
390 
391 /*
392  * FIFOE (WO)
393  *
394  * FIFO enable
395  * Write 1 to enable both the transmitter and receiver
396  * FIFOs.
397  * The FIFOs are reset when the value of this bit toggles.
398  */
399 #define UART_FCR_FIFOE_MASK (0x1U)
400 #define UART_FCR_FIFOE_SHIFT (0U)
401 #define UART_FCR_FIFOE_SET(x) (((uint32_t)(x) << UART_FCR_FIFOE_SHIFT) & UART_FCR_FIFOE_MASK)
402 #define UART_FCR_FIFOE_GET(x) (((uint32_t)(x) & UART_FCR_FIFOE_MASK) >> UART_FCR_FIFOE_SHIFT)
403 
404 /* Bitfield definition for register: LCR */
405 /*
406  * DLAB (RW)
407  *
408  * Divisor latch access bit
409  */
410 #define UART_LCR_DLAB_MASK (0x80U)
411 #define UART_LCR_DLAB_SHIFT (7U)
412 #define UART_LCR_DLAB_SET(x) (((uint32_t)(x) << UART_LCR_DLAB_SHIFT) & UART_LCR_DLAB_MASK)
413 #define UART_LCR_DLAB_GET(x) (((uint32_t)(x) & UART_LCR_DLAB_MASK) >> UART_LCR_DLAB_SHIFT)
414 
415 /*
416  * BC (RW)
417  *
418  * Break control
419  */
420 #define UART_LCR_BC_MASK (0x40U)
421 #define UART_LCR_BC_SHIFT (6U)
422 #define UART_LCR_BC_SET(x) (((uint32_t)(x) << UART_LCR_BC_SHIFT) & UART_LCR_BC_MASK)
423 #define UART_LCR_BC_GET(x) (((uint32_t)(x) & UART_LCR_BC_MASK) >> UART_LCR_BC_SHIFT)
424 
425 /*
426  * SPS (RW)
427  *
428  * Stick parity
429  * 1: Parity bit is constant 0 or 1, depending on bit4 (EPS).
430  * 0: Disable the sticky bit parity.
431  */
432 #define UART_LCR_SPS_MASK (0x20U)
433 #define UART_LCR_SPS_SHIFT (5U)
434 #define UART_LCR_SPS_SET(x) (((uint32_t)(x) << UART_LCR_SPS_SHIFT) & UART_LCR_SPS_MASK)
435 #define UART_LCR_SPS_GET(x) (((uint32_t)(x) & UART_LCR_SPS_MASK) >> UART_LCR_SPS_SHIFT)
436 
437 /*
438  * EPS (RW)
439  *
440  * Even parity select
441  * 1: Even parity (an even number of logic-1 is in the data
442  * and parity bits)
443  * 0: Old parity.
444  */
445 #define UART_LCR_EPS_MASK (0x10U)
446 #define UART_LCR_EPS_SHIFT (4U)
447 #define UART_LCR_EPS_SET(x) (((uint32_t)(x) << UART_LCR_EPS_SHIFT) & UART_LCR_EPS_MASK)
448 #define UART_LCR_EPS_GET(x) (((uint32_t)(x) & UART_LCR_EPS_MASK) >> UART_LCR_EPS_SHIFT)
449 
450 /*
451  * PEN (RW)
452  *
453  * Parity enable
454  * When this bit is set, a parity bit is generated in
455  * transmitted data before the first STOP bit and the parity
456  * bit would be checked for the received data.
457  */
458 #define UART_LCR_PEN_MASK (0x8U)
459 #define UART_LCR_PEN_SHIFT (3U)
460 #define UART_LCR_PEN_SET(x) (((uint32_t)(x) << UART_LCR_PEN_SHIFT) & UART_LCR_PEN_MASK)
461 #define UART_LCR_PEN_GET(x) (((uint32_t)(x) & UART_LCR_PEN_MASK) >> UART_LCR_PEN_SHIFT)
462 
463 /*
464  * STB (RW)
465  *
466  * Number of STOP bits
467  * 0: 1 bits
468  * 1: The number of STOP bit is based on the WLS setting
469  * When WLS = 0, STOP bit is 1.5 bits
470  * When WLS = 1, 2, 3, STOP bit is 2 bits
471  */
472 #define UART_LCR_STB_MASK (0x4U)
473 #define UART_LCR_STB_SHIFT (2U)
474 #define UART_LCR_STB_SET(x) (((uint32_t)(x) << UART_LCR_STB_SHIFT) & UART_LCR_STB_MASK)
475 #define UART_LCR_STB_GET(x) (((uint32_t)(x) & UART_LCR_STB_MASK) >> UART_LCR_STB_SHIFT)
476 
477 /*
478  * WLS (RW)
479  *
480  * Word length setting
481  * 0: 5 bits
482  * 1: 6 bits
483  * 2: 7 bits
484  * 3: 8 bits
485  */
486 #define UART_LCR_WLS_MASK (0x3U)
487 #define UART_LCR_WLS_SHIFT (0U)
488 #define UART_LCR_WLS_SET(x) (((uint32_t)(x) << UART_LCR_WLS_SHIFT) & UART_LCR_WLS_MASK)
489 #define UART_LCR_WLS_GET(x) (((uint32_t)(x) & UART_LCR_WLS_MASK) >> UART_LCR_WLS_SHIFT)
490 
491 /* Bitfield definition for register: MCR */
492 /*
493  * AFE (RW)
494  *
495  * Auto flow control enable
496  * 0: Disable
497  * 1: The auto-CTS and auto-RTS setting is based on the
498  * RTS bit setting:
499  * When RTS = 0, auto-CTS only
500  * When RTS = 1, auto-CTS and auto-RTS
501  */
502 #define UART_MCR_AFE_MASK (0x20U)
503 #define UART_MCR_AFE_SHIFT (5U)
504 #define UART_MCR_AFE_SET(x) (((uint32_t)(x) << UART_MCR_AFE_SHIFT) & UART_MCR_AFE_MASK)
505 #define UART_MCR_AFE_GET(x) (((uint32_t)(x) & UART_MCR_AFE_MASK) >> UART_MCR_AFE_SHIFT)
506 
507 /*
508  * LOOP (RW)
509  *
510  * Enable loopback mode
511  * 0: Disable
512  * 1: Enable
513  */
514 #define UART_MCR_LOOP_MASK (0x10U)
515 #define UART_MCR_LOOP_SHIFT (4U)
516 #define UART_MCR_LOOP_SET(x) (((uint32_t)(x) << UART_MCR_LOOP_SHIFT) & UART_MCR_LOOP_MASK)
517 #define UART_MCR_LOOP_GET(x) (((uint32_t)(x) & UART_MCR_LOOP_MASK) >> UART_MCR_LOOP_SHIFT)
518 
519 /*
520  * RTS (RW)
521  *
522  * Request to send
523  * This bit controls the modem_rtsn output.
524  * 0: The modem_rtsn output signal will be driven HIGH
525  * 1: The modem_rtsn output signal will be driven LOW
526  */
527 #define UART_MCR_RTS_MASK (0x2U)
528 #define UART_MCR_RTS_SHIFT (1U)
529 #define UART_MCR_RTS_SET(x) (((uint32_t)(x) << UART_MCR_RTS_SHIFT) & UART_MCR_RTS_MASK)
530 #define UART_MCR_RTS_GET(x) (((uint32_t)(x) & UART_MCR_RTS_MASK) >> UART_MCR_RTS_SHIFT)
531 
532 /* Bitfield definition for register: LSR */
533 /*
534  * ERRF (RO)
535  *
536  * Error in RXFIFO
537  * In the FIFO mode, this bit is set when there is at least
538  * one parity error, framing error, or line break
539  * associated with data in the RXFIFO. It is cleared when
540  * this register is read and there is no more error for the
541  * rest of data in the RXFIFO.
542  */
543 #define UART_LSR_ERRF_MASK (0x80U)
544 #define UART_LSR_ERRF_SHIFT (7U)
545 #define UART_LSR_ERRF_GET(x) (((uint32_t)(x) & UART_LSR_ERRF_MASK) >> UART_LSR_ERRF_SHIFT)
546 
547 /*
548  * TEMT (RO)
549  *
550  * Transmitter empty
551  * This bit is 1 when the THR (TXFIFO in the FIFO
552  * mode) and the Transmitter Shift Register (TSR) are
553  * both empty. Otherwise, it is zero.
554  */
555 #define UART_LSR_TEMT_MASK (0x40U)
556 #define UART_LSR_TEMT_SHIFT (6U)
557 #define UART_LSR_TEMT_GET(x) (((uint32_t)(x) & UART_LSR_TEMT_MASK) >> UART_LSR_TEMT_SHIFT)
558 
559 /*
560  * THRE (RO)
561  *
562  * Transmitter Holding Register empty
563  * This bit is 1 when the THR (TXFIFO in the FIFO
564  * mode) is empty. Otherwise, it is zero.
565  * If the THRE interrupt is enabled, an interrupt is
566  * triggered when THRE becomes 1.
567  */
568 #define UART_LSR_THRE_MASK (0x20U)
569 #define UART_LSR_THRE_SHIFT (5U)
570 #define UART_LSR_THRE_GET(x) (((uint32_t)(x) & UART_LSR_THRE_MASK) >> UART_LSR_THRE_SHIFT)
571 
572 /*
573  * LBREAK (RO)
574  *
575  * Line break
576  * This bit is set when the uart_sin input signal was held
577  * LOWfor longer than the time for a full-word
578  * transmission. A full-word transmission is the
579  * transmission of the START, data, parity, and STOP
580  * bits. It is cleared when this register is read.
581  * In the FIFO mode, this bit indicates the line break for
582  * the received data at the top of the RXFIFO.
583  */
584 #define UART_LSR_LBREAK_MASK (0x10U)
585 #define UART_LSR_LBREAK_SHIFT (4U)
586 #define UART_LSR_LBREAK_GET(x) (((uint32_t)(x) & UART_LSR_LBREAK_MASK) >> UART_LSR_LBREAK_SHIFT)
587 
588 /*
589  * FE (RO)
590  *
591  * Framing error
592  * This bit is set when the received STOP bit is not
593  * HIGH. It is cleared when this register is read.
594  * In the FIFO mode, this bit indicates the framing error
595  * for the received data at the top of the RXFIFO.
596  */
597 #define UART_LSR_FE_MASK (0x8U)
598 #define UART_LSR_FE_SHIFT (3U)
599 #define UART_LSR_FE_GET(x) (((uint32_t)(x) & UART_LSR_FE_MASK) >> UART_LSR_FE_SHIFT)
600 
601 /*
602  * PE (RO)
603  *
604  * Parity error
605  * This bit is set when the received parity does not match
606  * with the parity selected in the LCR[5:4]. It is cleared
607  * when this register is read.
608  * In the FIFO mode, this bit indicates the parity error
609  * for the received data at the top of the RXFIFO.
610  */
611 #define UART_LSR_PE_MASK (0x4U)
612 #define UART_LSR_PE_SHIFT (2U)
613 #define UART_LSR_PE_GET(x) (((uint32_t)(x) & UART_LSR_PE_MASK) >> UART_LSR_PE_SHIFT)
614 
615 /*
616  * OE (RO)
617  *
618  * Overrun error
619  * This bit indicates that data in the Receiver Buffer
620  * Register (RBR) is overrun.
621  */
622 #define UART_LSR_OE_MASK (0x2U)
623 #define UART_LSR_OE_SHIFT (1U)
624 #define UART_LSR_OE_GET(x) (((uint32_t)(x) & UART_LSR_OE_MASK) >> UART_LSR_OE_SHIFT)
625 
626 /*
627  * DR (RO)
628  *
629  * Data ready.
630  * This bit is set when there are incoming received data
631  * in the Receiver Buffer Register (RBR). It is cleared
632  * when all of the received data are read.
633  */
634 #define UART_LSR_DR_MASK (0x1U)
635 #define UART_LSR_DR_SHIFT (0U)
636 #define UART_LSR_DR_GET(x) (((uint32_t)(x) & UART_LSR_DR_MASK) >> UART_LSR_DR_SHIFT)
637 
638 /* Bitfield definition for register: MSR */
639 /*
640  * CTS (RO)
641  *
642  * Clear to send
643  * 0: The modem_ctsn input signal is HIGH.
644  * 1: The modem_ctsn input signal is LOW.
645  */
646 #define UART_MSR_CTS_MASK (0x10U)
647 #define UART_MSR_CTS_SHIFT (4U)
648 #define UART_MSR_CTS_GET(x) (((uint32_t)(x) & UART_MSR_CTS_MASK) >> UART_MSR_CTS_SHIFT)
649 
650 /*
651  * DCTS (RC)
652  *
653  * Delta clear to send
654  * This bit is set when the state of the modem_ctsn input
655  * signal has been changed since the last time this
656  * register is read.
657  */
658 #define UART_MSR_DCTS_MASK (0x1U)
659 #define UART_MSR_DCTS_SHIFT (0U)
660 #define UART_MSR_DCTS_GET(x) (((uint32_t)(x) & UART_MSR_DCTS_MASK) >> UART_MSR_DCTS_SHIFT)
661 
662 /* Bitfield definition for register: GPR */
663 /*
664  * DATA (RW)
665  *
666  * A one-byte storage register
667  */
668 #define UART_GPR_DATA_MASK (0xFFU)
669 #define UART_GPR_DATA_SHIFT (0U)
670 #define UART_GPR_DATA_SET(x) (((uint32_t)(x) << UART_GPR_DATA_SHIFT) & UART_GPR_DATA_MASK)
671 #define UART_GPR_DATA_GET(x) (((uint32_t)(x) & UART_GPR_DATA_MASK) >> UART_GPR_DATA_SHIFT)
672 
673 
674 
675 
676 #endif /* HPM_UART_H */
Definition: hpm_uart_regs.h:12