HPM SDK
HPMicro Software Development Kit
hpm_uart_regs.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2021-2025 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
__RW uint32_t ADDR_CFG;
/* 0x8: address match config register */
16
__RW uint32_t IIR2;
/* 0xC: Interrupt Identification Register2 */
17
__RW uint32_t CFG;
/* 0x10: Configuration Register */
18
__RW uint32_t OSCR;
/* 0x14: Over Sample Control Register */
19
__RW uint32_t FCRR;
/* 0x18: FIFO Control Register config */
20
__RW uint32_t MOTO_CFG;
/* 0x1C: moto system control register */
21
union
{
22
__R uint32_t RBR;
/* 0x20: Receiver Buffer Register (when DLAB = 0) */
23
__W uint32_t THR;
/* 0x20: Transmitter Holding Register (when DLAB = 0) */
24
__RW uint32_t DLL;
/* 0x20: Divisor Latch LSB (when DLAB = 1) */
25
};
26
union
{
27
__RW uint32_t IER;
/* 0x24: Interrupt Enable Register (when DLAB = 0) */
28
__RW uint32_t DLM;
/* 0x24: Divisor Latch MSB (when DLAB = 1) */
29
};
30
union
{
31
__RW uint32_t IIR;
/* 0x28: Interrupt Identification Register */
32
__W uint32_t FCR;
/* 0x28: FIFO Control Register */
33
};
34
__RW uint32_t LCR;
/* 0x2C: Line Control Register */
35
__RW uint32_t MCR;
/* 0x30: Modem Control Register ( */
36
__R uint32_t LSR;
/* 0x34: Line Status Register */
37
__R uint32_t MSR;
/* 0x38: Modem Status Register */
38
__RW uint32_t GPR;
/* 0x3C: GPR Register */
39
}
UART_Type
;
40
41
42
/* Bitfield definition for register: IDLE_CFG */
43
/*
44
* TX_IDLE_COND (RW)
45
*
46
* IDLE Detection Condition
47
* 0 - Treat as idle if TX pin is logic one
48
* 1 - Treat as idle if UART state machine state is idle
49
*/
50
#define UART_IDLE_CFG_TX_IDLE_COND_MASK (0x2000000UL)
51
#define UART_IDLE_CFG_TX_IDLE_COND_SHIFT (25U)
52
#define UART_IDLE_CFG_TX_IDLE_COND_SET(x) (((uint32_t)(x) << UART_IDLE_CFG_TX_IDLE_COND_SHIFT) & UART_IDLE_CFG_TX_IDLE_COND_MASK)
53
#define UART_IDLE_CFG_TX_IDLE_COND_GET(x) (((uint32_t)(x) & UART_IDLE_CFG_TX_IDLE_COND_MASK) >> UART_IDLE_CFG_TX_IDLE_COND_SHIFT)
54
55
/*
56
* TX_IDLE_EN (RW)
57
*
58
* UART TX Idle Detect Enable
59
* 0 - Disable
60
* 1 - Enable
61
*/
62
#define UART_IDLE_CFG_TX_IDLE_EN_MASK (0x1000000UL)
63
#define UART_IDLE_CFG_TX_IDLE_EN_SHIFT (24U)
64
#define UART_IDLE_CFG_TX_IDLE_EN_SET(x) (((uint32_t)(x) << UART_IDLE_CFG_TX_IDLE_EN_SHIFT) & UART_IDLE_CFG_TX_IDLE_EN_MASK)
65
#define UART_IDLE_CFG_TX_IDLE_EN_GET(x) (((uint32_t)(x) & UART_IDLE_CFG_TX_IDLE_EN_MASK) >> UART_IDLE_CFG_TX_IDLE_EN_SHIFT)
66
67
/*
68
* TX_IDLE_THR (RW)
69
*
70
* Threshold for UART transmit Idle detection (in terms of bits)
71
*/
72
#define UART_IDLE_CFG_TX_IDLE_THR_MASK (0xFF0000UL)
73
#define UART_IDLE_CFG_TX_IDLE_THR_SHIFT (16U)
74
#define UART_IDLE_CFG_TX_IDLE_THR_SET(x) (((uint32_t)(x) << UART_IDLE_CFG_TX_IDLE_THR_SHIFT) & UART_IDLE_CFG_TX_IDLE_THR_MASK)
75
#define UART_IDLE_CFG_TX_IDLE_THR_GET(x) (((uint32_t)(x) & UART_IDLE_CFG_TX_IDLE_THR_MASK) >> UART_IDLE_CFG_TX_IDLE_THR_SHIFT)
76
77
/*
78
* RXEN (RW)
79
*
80
* UART receive enable.
81
* 0 - hold RX input to high, avoide wrong data input when config pinmux
82
* 1 - bypass RX input from PIN
83
* software should set it after config pinmux
84
*/
85
#define UART_IDLE_CFG_RXEN_MASK (0x800U)
86
#define UART_IDLE_CFG_RXEN_SHIFT (11U)
87
#define UART_IDLE_CFG_RXEN_SET(x) (((uint32_t)(x) << UART_IDLE_CFG_RXEN_SHIFT) & UART_IDLE_CFG_RXEN_MASK)
88
#define UART_IDLE_CFG_RXEN_GET(x) (((uint32_t)(x) & UART_IDLE_CFG_RXEN_MASK) >> UART_IDLE_CFG_RXEN_SHIFT)
89
90
/*
91
* RX_IDLE_COND (RW)
92
*
93
* IDLE Detection Condition
94
* 0 - Treat as idle if RX pin is logic one
95
* 1 - Treat as idle if UART state machine state is idle
96
*/
97
#define UART_IDLE_CFG_RX_IDLE_COND_MASK (0x200U)
98
#define UART_IDLE_CFG_RX_IDLE_COND_SHIFT (9U)
99
#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)
100
#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)
101
102
/*
103
* RX_IDLE_EN (RW)
104
*
105
* UART Idle Detect Enable
106
* 0 - Disable
107
* 1 - Enable
108
* it should be enabled if enable address match feature
109
*/
110
#define UART_IDLE_CFG_RX_IDLE_EN_MASK (0x100U)
111
#define UART_IDLE_CFG_RX_IDLE_EN_SHIFT (8U)
112
#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)
113
#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)
114
115
/*
116
* RX_IDLE_THR (RW)
117
*
118
* Threshold for UART Receive Idle detection (in terms of bits)
119
*/
120
#define UART_IDLE_CFG_RX_IDLE_THR_MASK (0xFFU)
121
#define UART_IDLE_CFG_RX_IDLE_THR_SHIFT (0U)
122
#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)
123
#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)
124
125
/* Bitfield definition for register: ADDR_CFG */
126
/*
127
* TXEN_9BIT (RW)
128
*
129
* set to use 9bit mode for transmitter,
130
* will set the MSB for the first character as address flag, keep 0 for others.
131
*/
132
#define UART_ADDR_CFG_TXEN_9BIT_MASK (0x100000UL)
133
#define UART_ADDR_CFG_TXEN_9BIT_SHIFT (20U)
134
#define UART_ADDR_CFG_TXEN_9BIT_SET(x) (((uint32_t)(x) << UART_ADDR_CFG_TXEN_9BIT_SHIFT) & UART_ADDR_CFG_TXEN_9BIT_MASK)
135
#define UART_ADDR_CFG_TXEN_9BIT_GET(x) (((uint32_t)(x) & UART_ADDR_CFG_TXEN_9BIT_MASK) >> UART_ADDR_CFG_TXEN_9BIT_SHIFT)
136
137
/*
138
* RXEN_ADDR_MSB (RW)
139
*
140
* set to use MSB as address flag at receiver(actually this is done by software set correct MSB in addr0/addr1).
141
* Clr to use first character as address.
142
* Only needed if enable address match feature
143
*/
144
#define UART_ADDR_CFG_RXEN_ADDR_MSB_MASK (0x80000UL)
145
#define UART_ADDR_CFG_RXEN_ADDR_MSB_SHIFT (19U)
146
#define UART_ADDR_CFG_RXEN_ADDR_MSB_SET(x) (((uint32_t)(x) << UART_ADDR_CFG_RXEN_ADDR_MSB_SHIFT) & UART_ADDR_CFG_RXEN_ADDR_MSB_MASK)
147
#define UART_ADDR_CFG_RXEN_ADDR_MSB_GET(x) (((uint32_t)(x) & UART_ADDR_CFG_RXEN_ADDR_MSB_MASK) >> UART_ADDR_CFG_RXEN_ADDR_MSB_SHIFT)
148
149
/*
150
* RXEN_9BIT (RW)
151
*
152
* set to use 9bit mode for receiver, only valid if rxen_addr_msb is set
153
*/
154
#define UART_ADDR_CFG_RXEN_9BIT_MASK (0x40000UL)
155
#define UART_ADDR_CFG_RXEN_9BIT_SHIFT (18U)
156
#define UART_ADDR_CFG_RXEN_9BIT_SET(x) (((uint32_t)(x) << UART_ADDR_CFG_RXEN_9BIT_SHIFT) & UART_ADDR_CFG_RXEN_9BIT_MASK)
157
#define UART_ADDR_CFG_RXEN_9BIT_GET(x) (((uint32_t)(x) & UART_ADDR_CFG_RXEN_9BIT_MASK) >> UART_ADDR_CFG_RXEN_9BIT_SHIFT)
158
159
/*
160
* A1_EN (RW)
161
*
162
* enable addr1 compare for the first character.
163
* If a1_en OR a0_en, then do not receive data if address not match.
164
* If ~a1_en AND ~a0_en, the receive all data like before.
165
* NOTE: should set idle_tmout_en if enable address match feature
166
*/
167
#define UART_ADDR_CFG_A1_EN_MASK (0x20000UL)
168
#define UART_ADDR_CFG_A1_EN_SHIFT (17U)
169
#define UART_ADDR_CFG_A1_EN_SET(x) (((uint32_t)(x) << UART_ADDR_CFG_A1_EN_SHIFT) & UART_ADDR_CFG_A1_EN_MASK)
170
#define UART_ADDR_CFG_A1_EN_GET(x) (((uint32_t)(x) & UART_ADDR_CFG_A1_EN_MASK) >> UART_ADDR_CFG_A1_EN_SHIFT)
171
172
/*
173
* A0_EN (RW)
174
*
175
* enable addr0 compare for the first character
176
*/
177
#define UART_ADDR_CFG_A0_EN_MASK (0x10000UL)
178
#define UART_ADDR_CFG_A0_EN_SHIFT (16U)
179
#define UART_ADDR_CFG_A0_EN_SET(x) (((uint32_t)(x) << UART_ADDR_CFG_A0_EN_SHIFT) & UART_ADDR_CFG_A0_EN_MASK)
180
#define UART_ADDR_CFG_A0_EN_GET(x) (((uint32_t)(x) & UART_ADDR_CFG_A0_EN_MASK) >> UART_ADDR_CFG_A0_EN_SHIFT)
181
182
/*
183
* ADDR1 (RW)
184
*
185
* address 1 fileld.
186
* in 9bit mode, this is the full address byte.
187
* For other mode(8/7/6/5bit), MSB should be set for address flag.
188
* If want address==0 to be matched at 8bit mode, should set addr1=0x80
189
*/
190
#define UART_ADDR_CFG_ADDR1_MASK (0xFF00U)
191
#define UART_ADDR_CFG_ADDR1_SHIFT (8U)
192
#define UART_ADDR_CFG_ADDR1_SET(x) (((uint32_t)(x) << UART_ADDR_CFG_ADDR1_SHIFT) & UART_ADDR_CFG_ADDR1_MASK)
193
#define UART_ADDR_CFG_ADDR1_GET(x) (((uint32_t)(x) & UART_ADDR_CFG_ADDR1_MASK) >> UART_ADDR_CFG_ADDR1_SHIFT)
194
195
/*
196
* ADDR0 (RW)
197
*
198
* address 0 field.
199
*/
200
#define UART_ADDR_CFG_ADDR0_MASK (0xFFU)
201
#define UART_ADDR_CFG_ADDR0_SHIFT (0U)
202
#define UART_ADDR_CFG_ADDR0_SET(x) (((uint32_t)(x) << UART_ADDR_CFG_ADDR0_SHIFT) & UART_ADDR_CFG_ADDR0_MASK)
203
#define UART_ADDR_CFG_ADDR0_GET(x) (((uint32_t)(x) & UART_ADDR_CFG_ADDR0_MASK) >> UART_ADDR_CFG_ADDR0_SHIFT)
204
205
/* Bitfield definition for register: IIR2 */
206
/*
207
* RXIDLE_FLAG (W1C)
208
*
209
* UART RX IDLE Flag, assert after rxd high and then rx idle timeout, write one clear
210
* 0 - UART RX is busy
211
* 1 - UART RX is idle
212
*/
213
#define UART_IIR2_RXIDLE_FLAG_MASK (0x80000000UL)
214
#define UART_IIR2_RXIDLE_FLAG_SHIFT (31U)
215
#define UART_IIR2_RXIDLE_FLAG_SET(x) (((uint32_t)(x) << UART_IIR2_RXIDLE_FLAG_SHIFT) & UART_IIR2_RXIDLE_FLAG_MASK)
216
#define UART_IIR2_RXIDLE_FLAG_GET(x) (((uint32_t)(x) & UART_IIR2_RXIDLE_FLAG_MASK) >> UART_IIR2_RXIDLE_FLAG_SHIFT)
217
218
/*
219
* TXIDLE_FLAG (W1C)
220
*
221
* UART TX IDLE Flag, assert after txd high and then tx idle timeout, write one clear
222
* 0 - UART TX is busy
223
* 1 - UART TX is idle
224
*/
225
#define UART_IIR2_TXIDLE_FLAG_MASK (0x40000000UL)
226
#define UART_IIR2_TXIDLE_FLAG_SHIFT (30U)
227
#define UART_IIR2_TXIDLE_FLAG_SET(x) (((uint32_t)(x) << UART_IIR2_TXIDLE_FLAG_SHIFT) & UART_IIR2_TXIDLE_FLAG_MASK)
228
#define UART_IIR2_TXIDLE_FLAG_GET(x) (((uint32_t)(x) & UART_IIR2_TXIDLE_FLAG_MASK) >> UART_IIR2_TXIDLE_FLAG_SHIFT)
229
230
/*
231
* ADDR_MATCH (W1C)
232
*
233
* address match irq status, assert if either address match(and enabled). Write one clear
234
* NOTE: the address byte may not moved by DMA at this point.
235
* User can wait next addr_match_idle irq for the whole data include address
236
*/
237
#define UART_IIR2_ADDR_MATCH_MASK (0x20000000UL)
238
#define UART_IIR2_ADDR_MATCH_SHIFT (29U)
239
#define UART_IIR2_ADDR_MATCH_SET(x) (((uint32_t)(x) << UART_IIR2_ADDR_MATCH_SHIFT) & UART_IIR2_ADDR_MATCH_MASK)
240
#define UART_IIR2_ADDR_MATCH_GET(x) (((uint32_t)(x) & UART_IIR2_ADDR_MATCH_MASK) >> UART_IIR2_ADDR_MATCH_SHIFT)
241
242
/*
243
* ADDR_MATCH_IDLE (W1C)
244
*
245
* address match and idle irq status, assert at rx bus idle if address match event triggered.
246
* Write one clear;
247
*/
248
#define UART_IIR2_ADDR_MATCH_IDLE_MASK (0x10000000UL)
249
#define UART_IIR2_ADDR_MATCH_IDLE_SHIFT (28U)
250
#define UART_IIR2_ADDR_MATCH_IDLE_SET(x) (((uint32_t)(x) << UART_IIR2_ADDR_MATCH_IDLE_SHIFT) & UART_IIR2_ADDR_MATCH_IDLE_MASK)
251
#define UART_IIR2_ADDR_MATCH_IDLE_GET(x) (((uint32_t)(x) & UART_IIR2_ADDR_MATCH_IDLE_MASK) >> UART_IIR2_ADDR_MATCH_IDLE_SHIFT)
252
253
/*
254
* DATA_LOST (W1C)
255
*
256
* assert if data lost before address match status, write one clear;
257
* It will not assert if no address match occurs
258
*/
259
#define UART_IIR2_DATA_LOST_MASK (0x8000000UL)
260
#define UART_IIR2_DATA_LOST_SHIFT (27U)
261
#define UART_IIR2_DATA_LOST_SET(x) (((uint32_t)(x) << UART_IIR2_DATA_LOST_SHIFT) & UART_IIR2_DATA_LOST_MASK)
262
#define UART_IIR2_DATA_LOST_GET(x) (((uint32_t)(x) & UART_IIR2_DATA_LOST_MASK) >> UART_IIR2_DATA_LOST_SHIFT)
263
264
/*
265
* FIFOED (RO)
266
*
267
* FIFOs enabled
268
* These two bits are 1 when bit 0 of the FIFO Control
269
* Register (FIFOE) is set to 1.
270
*/
271
#define UART_IIR2_FIFOED_MASK (0xC0U)
272
#define UART_IIR2_FIFOED_SHIFT (6U)
273
#define UART_IIR2_FIFOED_GET(x) (((uint32_t)(x) & UART_IIR2_FIFOED_MASK) >> UART_IIR2_FIFOED_SHIFT)
274
275
/*
276
* INTRID (RO)
277
*
278
* Interrupt ID, see IIR2 for detail decoding
279
*/
280
#define UART_IIR2_INTRID_MASK (0xFU)
281
#define UART_IIR2_INTRID_SHIFT (0U)
282
#define UART_IIR2_INTRID_GET(x) (((uint32_t)(x) & UART_IIR2_INTRID_MASK) >> UART_IIR2_INTRID_SHIFT)
283
284
/* Bitfield definition for register: CFG */
285
/*
286
* FIFOSIZE (RO)
287
*
288
* The depth of RXFIFO and TXFIFO
289
* 0: 16-byte FIFO
290
* 1: 32-byte FIFO
291
* 2: 64-byte FIFO
292
* 3: 128-byte FIFO
293
*/
294
#define UART_CFG_FIFOSIZE_MASK (0x3U)
295
#define UART_CFG_FIFOSIZE_SHIFT (0U)
296
#define UART_CFG_FIFOSIZE_GET(x) (((uint32_t)(x) & UART_CFG_FIFOSIZE_MASK) >> UART_CFG_FIFOSIZE_SHIFT)
297
298
/* Bitfield definition for register: OSCR */
299
/*
300
* OSC (RW)
301
*
302
* Over-sample control
303
* The value must be an even number; any odd value
304
* writes to this field will be converted to an even value.
305
* OSC=0: reserved
306
* OSC<=8: The over-sample ratio is 8
307
* 8 < OSC< 32: The over sample ratio is OSC
308
*/
309
#define UART_OSCR_OSC_MASK (0x1FU)
310
#define UART_OSCR_OSC_SHIFT (0U)
311
#define UART_OSCR_OSC_SET(x) (((uint32_t)(x) << UART_OSCR_OSC_SHIFT) & UART_OSCR_OSC_MASK)
312
#define UART_OSCR_OSC_GET(x) (((uint32_t)(x) & UART_OSCR_OSC_MASK) >> UART_OSCR_OSC_SHIFT)
313
314
/* Bitfield definition for register: FCRR */
315
/*
316
* TMOUT_RXDMA_DIS (RW)
317
*
318
* set to disable timeout rx dma request
319
*/
320
#define UART_FCRR_TMOUT_RXDMA_DIS_MASK (0x1000000UL)
321
#define UART_FCRR_TMOUT_RXDMA_DIS_SHIFT (24U)
322
#define UART_FCRR_TMOUT_RXDMA_DIS_SET(x) (((uint32_t)(x) << UART_FCRR_TMOUT_RXDMA_DIS_SHIFT) & UART_FCRR_TMOUT_RXDMA_DIS_MASK)
323
#define UART_FCRR_TMOUT_RXDMA_DIS_GET(x) (((uint32_t)(x) & UART_FCRR_TMOUT_RXDMA_DIS_MASK) >> UART_FCRR_TMOUT_RXDMA_DIS_SHIFT)
324
325
/*
326
* FIFOT4EN (RW)
327
*
328
* set to use new 4bit fifo threshold(TFIFOT4 and RFIFOT4)
329
* clr to use 2bit(TFIFOT and RFIFOT)
330
*/
331
#define UART_FCRR_FIFOT4EN_MASK (0x800000UL)
332
#define UART_FCRR_FIFOT4EN_SHIFT (23U)
333
#define UART_FCRR_FIFOT4EN_SET(x) (((uint32_t)(x) << UART_FCRR_FIFOT4EN_SHIFT) & UART_FCRR_FIFOT4EN_MASK)
334
#define UART_FCRR_FIFOT4EN_GET(x) (((uint32_t)(x) & UART_FCRR_FIFOT4EN_MASK) >> UART_FCRR_FIFOT4EN_SHIFT)
335
336
/*
337
* TFIFOT4 (RW)
338
*
339
* txfifo threshold(0 for 1byte, 0xF for 32bytes), uart will send tx_dma_req when data in fifo is less than threshold.
340
*/
341
#define UART_FCRR_TFIFOT4_MASK (0x1F0000UL)
342
#define UART_FCRR_TFIFOT4_SHIFT (16U)
343
#define UART_FCRR_TFIFOT4_SET(x) (((uint32_t)(x) << UART_FCRR_TFIFOT4_SHIFT) & UART_FCRR_TFIFOT4_MASK)
344
#define UART_FCRR_TFIFOT4_GET(x) (((uint32_t)(x) & UART_FCRR_TFIFOT4_MASK) >> UART_FCRR_TFIFOT4_SHIFT)
345
346
/*
347
* RFIFOT4 (RW)
348
*
349
* rxfifo threshold(0 for 1byte, 0xF for 32bytes).
350
* Uart will send rx_dma_req if data in fifo reachs the threshold, also will set the rxdata irq if enabled
351
*/
352
#define UART_FCRR_RFIFOT4_MASK (0x1F00U)
353
#define UART_FCRR_RFIFOT4_SHIFT (8U)
354
#define UART_FCRR_RFIFOT4_SET(x) (((uint32_t)(x) << UART_FCRR_RFIFOT4_SHIFT) & UART_FCRR_RFIFOT4_MASK)
355
#define UART_FCRR_RFIFOT4_GET(x) (((uint32_t)(x) & UART_FCRR_RFIFOT4_MASK) >> UART_FCRR_RFIFOT4_SHIFT)
356
357
/*
358
* RFIFOT (RW)
359
*
360
* Receiver FIFO trigger level
361
*/
362
#define UART_FCRR_RFIFOT_MASK (0xC0U)
363
#define UART_FCRR_RFIFOT_SHIFT (6U)
364
#define UART_FCRR_RFIFOT_SET(x) (((uint32_t)(x) << UART_FCRR_RFIFOT_SHIFT) & UART_FCRR_RFIFOT_MASK)
365
#define UART_FCRR_RFIFOT_GET(x) (((uint32_t)(x) & UART_FCRR_RFIFOT_MASK) >> UART_FCRR_RFIFOT_SHIFT)
366
367
/*
368
* TFIFOT (RW)
369
*
370
* Transmitter FIFO trigger level
371
*/
372
#define UART_FCRR_TFIFOT_MASK (0x30U)
373
#define UART_FCRR_TFIFOT_SHIFT (4U)
374
#define UART_FCRR_TFIFOT_SET(x) (((uint32_t)(x) << UART_FCRR_TFIFOT_SHIFT) & UART_FCRR_TFIFOT_MASK)
375
#define UART_FCRR_TFIFOT_GET(x) (((uint32_t)(x) & UART_FCRR_TFIFOT_MASK) >> UART_FCRR_TFIFOT_SHIFT)
376
377
/*
378
* DMAE (RW)
379
*
380
* DMA enable
381
* 0: Disable
382
* 1: Enable
383
*/
384
#define UART_FCRR_DMAE_MASK (0x8U)
385
#define UART_FCRR_DMAE_SHIFT (3U)
386
#define UART_FCRR_DMAE_SET(x) (((uint32_t)(x) << UART_FCRR_DMAE_SHIFT) & UART_FCRR_DMAE_MASK)
387
#define UART_FCRR_DMAE_GET(x) (((uint32_t)(x) & UART_FCRR_DMAE_MASK) >> UART_FCRR_DMAE_SHIFT)
388
389
/*
390
* TFIFORST (WO)
391
*
392
* Transmitter FIFO reset
393
* Write 1 to clear all bytes in the TXFIFO and resets its
394
* counter. The Transmitter Shift Register is not cleared.
395
* This bit will automatically be cleared.
396
*/
397
#define UART_FCRR_TFIFORST_MASK (0x4U)
398
#define UART_FCRR_TFIFORST_SHIFT (2U)
399
#define UART_FCRR_TFIFORST_SET(x) (((uint32_t)(x) << UART_FCRR_TFIFORST_SHIFT) & UART_FCRR_TFIFORST_MASK)
400
#define UART_FCRR_TFIFORST_GET(x) (((uint32_t)(x) & UART_FCRR_TFIFORST_MASK) >> UART_FCRR_TFIFORST_SHIFT)
401
402
/*
403
* RFIFORST (WO)
404
*
405
* Receiver FIFO reset
406
* Write 1 to clear all bytes in the RXFIFO and resets its
407
* counter. The Receiver Shift Register is not cleared.
408
* This bit will automatically be cleared.
409
*/
410
#define UART_FCRR_RFIFORST_MASK (0x2U)
411
#define UART_FCRR_RFIFORST_SHIFT (1U)
412
#define UART_FCRR_RFIFORST_SET(x) (((uint32_t)(x) << UART_FCRR_RFIFORST_SHIFT) & UART_FCRR_RFIFORST_MASK)
413
#define UART_FCRR_RFIFORST_GET(x) (((uint32_t)(x) & UART_FCRR_RFIFORST_MASK) >> UART_FCRR_RFIFORST_SHIFT)
414
415
/*
416
* FIFOE (RW)
417
*
418
* FIFO enable
419
* Write 1 to enable both the transmitter and receiver
420
* FIFOs.
421
* The FIFOs are reset when the value of this bit toggles.
422
*/
423
#define UART_FCRR_FIFOE_MASK (0x1U)
424
#define UART_FCRR_FIFOE_SHIFT (0U)
425
#define UART_FCRR_FIFOE_SET(x) (((uint32_t)(x) << UART_FCRR_FIFOE_SHIFT) & UART_FCRR_FIFOE_MASK)
426
#define UART_FCRR_FIFOE_GET(x) (((uint32_t)(x) & UART_FCRR_FIFOE_MASK) >> UART_FCRR_FIFOE_SHIFT)
427
428
/* Bitfield definition for register: MOTO_CFG */
429
/*
430
* SWTRG (WO)
431
*
432
* software trigger. User should avoid use sw/hw trigger at same time, otherwise result unknown.
433
* Hardware auto reset.
434
*/
435
#define UART_MOTO_CFG_SWTRG_MASK (0x80000000UL)
436
#define UART_MOTO_CFG_SWTRG_SHIFT (31U)
437
#define UART_MOTO_CFG_SWTRG_SET(x) (((uint32_t)(x) << UART_MOTO_CFG_SWTRG_SHIFT) & UART_MOTO_CFG_SWTRG_MASK)
438
#define UART_MOTO_CFG_SWTRG_GET(x) (((uint32_t)(x) & UART_MOTO_CFG_SWTRG_MASK) >> UART_MOTO_CFG_SWTRG_SHIFT)
439
440
/*
441
* TXSTP_BITS (RW)
442
*
443
* if TXSTOP_INSERT is enabled, the STOP bits to be inserted between each byte. 0 for 1 bit; 0xFF for 256bits
444
*/
445
#define UART_MOTO_CFG_TXSTP_BITS_MASK (0xFF00U)
446
#define UART_MOTO_CFG_TXSTP_BITS_SHIFT (8U)
447
#define UART_MOTO_CFG_TXSTP_BITS_SET(x) (((uint32_t)(x) << UART_MOTO_CFG_TXSTP_BITS_SHIFT) & UART_MOTO_CFG_TXSTP_BITS_MASK)
448
#define UART_MOTO_CFG_TXSTP_BITS_GET(x) (((uint32_t)(x) & UART_MOTO_CFG_TXSTP_BITS_MASK) >> UART_MOTO_CFG_TXSTP_BITS_SHIFT)
449
450
/*
451
* HWTRG_EN (RW)
452
*
453
* set to enable hardware trigger(trigger from moto is shared by other UART)
454
*/
455
#define UART_MOTO_CFG_HWTRG_EN_MASK (0x80U)
456
#define UART_MOTO_CFG_HWTRG_EN_SHIFT (7U)
457
#define UART_MOTO_CFG_HWTRG_EN_SET(x) (((uint32_t)(x) << UART_MOTO_CFG_HWTRG_EN_SHIFT) & UART_MOTO_CFG_HWTRG_EN_MASK)
458
#define UART_MOTO_CFG_HWTRG_EN_GET(x) (((uint32_t)(x) & UART_MOTO_CFG_HWTRG_EN_MASK) >> UART_MOTO_CFG_HWTRG_EN_SHIFT)
459
460
/*
461
* TRG_MODE (RW)
462
*
463
* set to enable trigger mode.
464
* software should push needed data into txbuffer frist, uart will not start transmission at this time.
465
* User should send trigger signal(by hw or sw), uart will send all data in txfifo till empty
466
* NOTE: the hw_trigger should be pulse signal from trig mux.
467
*/
468
#define UART_MOTO_CFG_TRG_MODE_MASK (0x40U)
469
#define UART_MOTO_CFG_TRG_MODE_SHIFT (6U)
470
#define UART_MOTO_CFG_TRG_MODE_SET(x) (((uint32_t)(x) << UART_MOTO_CFG_TRG_MODE_SHIFT) & UART_MOTO_CFG_TRG_MODE_MASK)
471
#define UART_MOTO_CFG_TRG_MODE_GET(x) (((uint32_t)(x) & UART_MOTO_CFG_TRG_MODE_MASK) >> UART_MOTO_CFG_TRG_MODE_SHIFT)
472
473
/*
474
* TRG_CLR_RFIFO (RW)
475
*
476
* set to enable the feature that, clear rxfifo at tx trigger(sw or hw), avoid unexpected data in rxfifo.
477
*/
478
#define UART_MOTO_CFG_TRG_CLR_RFIFO_MASK (0x20U)
479
#define UART_MOTO_CFG_TRG_CLR_RFIFO_SHIFT (5U)
480
#define UART_MOTO_CFG_TRG_CLR_RFIFO_SET(x) (((uint32_t)(x) << UART_MOTO_CFG_TRG_CLR_RFIFO_SHIFT) & UART_MOTO_CFG_TRG_CLR_RFIFO_MASK)
481
#define UART_MOTO_CFG_TRG_CLR_RFIFO_GET(x) (((uint32_t)(x) & UART_MOTO_CFG_TRG_CLR_RFIFO_MASK) >> UART_MOTO_CFG_TRG_CLR_RFIFO_SHIFT)
482
483
/*
484
* TXSTOP_INSERT (RW)
485
*
486
* set to insert STOP bits between each tx byte till tx fifo empty.
487
* NOTE: there will be no 1.5/2 STOP bits if enabled this feature, LCR.STB should be set to 0 if this bit is set
488
*/
489
#define UART_MOTO_CFG_TXSTOP_INSERT_MASK (0x10U)
490
#define UART_MOTO_CFG_TXSTOP_INSERT_SHIFT (4U)
491
#define UART_MOTO_CFG_TXSTOP_INSERT_SET(x) (((uint32_t)(x) << UART_MOTO_CFG_TXSTOP_INSERT_SHIFT) & UART_MOTO_CFG_TXSTOP_INSERT_MASK)
492
#define UART_MOTO_CFG_TXSTOP_INSERT_GET(x) (((uint32_t)(x) & UART_MOTO_CFG_TXSTOP_INSERT_MASK) >> UART_MOTO_CFG_TXSTOP_INSERT_SHIFT)
493
494
/* Bitfield definition for register: RBR */
495
/*
496
* RBR (RO)
497
*
498
* Receive data read port
499
*/
500
#define UART_RBR_RBR_MASK (0xFFU)
501
#define UART_RBR_RBR_SHIFT (0U)
502
#define UART_RBR_RBR_GET(x) (((uint32_t)(x) & UART_RBR_RBR_MASK) >> UART_RBR_RBR_SHIFT)
503
504
/* Bitfield definition for register: THR */
505
/*
506
* THR (WO)
507
*
508
* Transmit data write port
509
*/
510
#define UART_THR_THR_MASK (0xFFU)
511
#define UART_THR_THR_SHIFT (0U)
512
#define UART_THR_THR_SET(x) (((uint32_t)(x) << UART_THR_THR_SHIFT) & UART_THR_THR_MASK)
513
#define UART_THR_THR_GET(x) (((uint32_t)(x) & UART_THR_THR_MASK) >> UART_THR_THR_SHIFT)
514
515
/* Bitfield definition for register: DLL */
516
/*
517
* DLL (RW)
518
*
519
* Least significant byte of the Divisor Latch
520
*/
521
#define UART_DLL_DLL_MASK (0xFFU)
522
#define UART_DLL_DLL_SHIFT (0U)
523
#define UART_DLL_DLL_SET(x) (((uint32_t)(x) << UART_DLL_DLL_SHIFT) & UART_DLL_DLL_MASK)
524
#define UART_DLL_DLL_GET(x) (((uint32_t)(x) & UART_DLL_DLL_MASK) >> UART_DLL_DLL_SHIFT)
525
526
/* Bitfield definition for register: IER */
527
/*
528
* ERXIDLE (RW)
529
*
530
* Enable Receive Idle interrupt
531
* 0 - Disable Idle interrupt
532
* 1 - Enable Idle interrupt
533
*/
534
#define UART_IER_ERXIDLE_MASK (0x80000000UL)
535
#define UART_IER_ERXIDLE_SHIFT (31U)
536
#define UART_IER_ERXIDLE_SET(x) (((uint32_t)(x) << UART_IER_ERXIDLE_SHIFT) & UART_IER_ERXIDLE_MASK)
537
#define UART_IER_ERXIDLE_GET(x) (((uint32_t)(x) & UART_IER_ERXIDLE_MASK) >> UART_IER_ERXIDLE_SHIFT)
538
539
/*
540
* ETXIDLE (RW)
541
*
542
* enable transmit idle interrupt
543
*/
544
#define UART_IER_ETXIDLE_MASK (0x40000000UL)
545
#define UART_IER_ETXIDLE_SHIFT (30U)
546
#define UART_IER_ETXIDLE_SET(x) (((uint32_t)(x) << UART_IER_ETXIDLE_SHIFT) & UART_IER_ETXIDLE_MASK)
547
#define UART_IER_ETXIDLE_GET(x) (((uint32_t)(x) & UART_IER_ETXIDLE_MASK) >> UART_IER_ETXIDLE_SHIFT)
548
549
/*
550
* EADDRM (RW)
551
*
552
* enable ADDR_MATCH interrupt
553
*/
554
#define UART_IER_EADDRM_MASK (0x20000000UL)
555
#define UART_IER_EADDRM_SHIFT (29U)
556
#define UART_IER_EADDRM_SET(x) (((uint32_t)(x) << UART_IER_EADDRM_SHIFT) & UART_IER_EADDRM_MASK)
557
#define UART_IER_EADDRM_GET(x) (((uint32_t)(x) & UART_IER_EADDRM_MASK) >> UART_IER_EADDRM_SHIFT)
558
559
/*
560
* EADDRM_IDLE (RW)
561
*
562
* enable ADDR_MATCH_IDLE interrupt
563
*/
564
#define UART_IER_EADDRM_IDLE_MASK (0x10000000UL)
565
#define UART_IER_EADDRM_IDLE_SHIFT (28U)
566
#define UART_IER_EADDRM_IDLE_SET(x) (((uint32_t)(x) << UART_IER_EADDRM_IDLE_SHIFT) & UART_IER_EADDRM_IDLE_MASK)
567
#define UART_IER_EADDRM_IDLE_GET(x) (((uint32_t)(x) & UART_IER_EADDRM_IDLE_MASK) >> UART_IER_EADDRM_IDLE_SHIFT)
568
569
/*
570
* EDATLOST (RW)
571
*
572
* enable DATA_LOST interrupt
573
*/
574
#define UART_IER_EDATLOST_MASK (0x8000000UL)
575
#define UART_IER_EDATLOST_SHIFT (27U)
576
#define UART_IER_EDATLOST_SET(x) (((uint32_t)(x) << UART_IER_EDATLOST_SHIFT) & UART_IER_EDATLOST_MASK)
577
#define UART_IER_EDATLOST_GET(x) (((uint32_t)(x) & UART_IER_EDATLOST_MASK) >> UART_IER_EDATLOST_SHIFT)
578
579
/*
580
* EMSI (RW)
581
*
582
* Enable modem status interrupt
583
* The interrupt asserts when the status of one of the
584
* following occurs:
585
* The status of modem_rin, modem_dcdn,
586
* modem_dsrn or modem_ctsn (If the auto-cts mode is
587
* disabled) has been changed.
588
* If the auto-cts mode is enabled (MCR bit4 (AFE) = 1),
589
* modem_ctsn would be used to control the transmitter.
590
*/
591
#define UART_IER_EMSI_MASK (0x8U)
592
#define UART_IER_EMSI_SHIFT (3U)
593
#define UART_IER_EMSI_SET(x) (((uint32_t)(x) << UART_IER_EMSI_SHIFT) & UART_IER_EMSI_MASK)
594
#define UART_IER_EMSI_GET(x) (((uint32_t)(x) & UART_IER_EMSI_MASK) >> UART_IER_EMSI_SHIFT)
595
596
/*
597
* ELSI (RW)
598
*
599
* Enable receiver line status interrupt
600
*/
601
#define UART_IER_ELSI_MASK (0x4U)
602
#define UART_IER_ELSI_SHIFT (2U)
603
#define UART_IER_ELSI_SET(x) (((uint32_t)(x) << UART_IER_ELSI_SHIFT) & UART_IER_ELSI_MASK)
604
#define UART_IER_ELSI_GET(x) (((uint32_t)(x) & UART_IER_ELSI_MASK) >> UART_IER_ELSI_SHIFT)
605
606
/*
607
* ETHEI (RW)
608
*
609
* Enable transmitter holding register interrupt
610
*/
611
#define UART_IER_ETHEI_MASK (0x2U)
612
#define UART_IER_ETHEI_SHIFT (1U)
613
#define UART_IER_ETHEI_SET(x) (((uint32_t)(x) << UART_IER_ETHEI_SHIFT) & UART_IER_ETHEI_MASK)
614
#define UART_IER_ETHEI_GET(x) (((uint32_t)(x) & UART_IER_ETHEI_MASK) >> UART_IER_ETHEI_SHIFT)
615
616
/*
617
* ERBI (RW)
618
*
619
* Enable received data available interrupt and the
620
* character timeout interrupt
621
* 0: Disable
622
* 1: Enable
623
*/
624
#define UART_IER_ERBI_MASK (0x1U)
625
#define UART_IER_ERBI_SHIFT (0U)
626
#define UART_IER_ERBI_SET(x) (((uint32_t)(x) << UART_IER_ERBI_SHIFT) & UART_IER_ERBI_MASK)
627
#define UART_IER_ERBI_GET(x) (((uint32_t)(x) & UART_IER_ERBI_MASK) >> UART_IER_ERBI_SHIFT)
628
629
/* Bitfield definition for register: DLM */
630
/*
631
* DLM (RW)
632
*
633
* Most significant byte of the Divisor Latch
634
*/
635
#define UART_DLM_DLM_MASK (0xFFU)
636
#define UART_DLM_DLM_SHIFT (0U)
637
#define UART_DLM_DLM_SET(x) (((uint32_t)(x) << UART_DLM_DLM_SHIFT) & UART_DLM_DLM_MASK)
638
#define UART_DLM_DLM_GET(x) (((uint32_t)(x) & UART_DLM_DLM_MASK) >> UART_DLM_DLM_SHIFT)
639
640
/* Bitfield definition for register: IIR */
641
/*
642
* RXIDLE_FLAG (W1C)
643
*
644
* UART IDLE Flag
645
* 0 - UART is busy
646
* 1 - UART is idle
647
* NOTE: when write one to clear this bit, avoid changging FCR register since it's same address as IIR
648
*/
649
#define UART_IIR_RXIDLE_FLAG_MASK (0x80000000UL)
650
#define UART_IIR_RXIDLE_FLAG_SHIFT (31U)
651
#define UART_IIR_RXIDLE_FLAG_SET(x) (((uint32_t)(x) << UART_IIR_RXIDLE_FLAG_SHIFT) & UART_IIR_RXIDLE_FLAG_MASK)
652
#define UART_IIR_RXIDLE_FLAG_GET(x) (((uint32_t)(x) & UART_IIR_RXIDLE_FLAG_MASK) >> UART_IIR_RXIDLE_FLAG_SHIFT)
653
654
/*
655
* FIFOED (RO)
656
*
657
* FIFOs enabled
658
* These two bits are 1 when bit 0 of the FIFO Control
659
* Register (FIFOE) is set to 1.
660
*/
661
#define UART_IIR_FIFOED_MASK (0xC0U)
662
#define UART_IIR_FIFOED_SHIFT (6U)
663
#define UART_IIR_FIFOED_GET(x) (((uint32_t)(x) & UART_IIR_FIFOED_MASK) >> UART_IIR_FIFOED_SHIFT)
664
665
/*
666
* INTRID (RO)
667
*
668
* Interrupt ID, see IIR2 for detail decoding
669
*/
670
#define UART_IIR_INTRID_MASK (0xFU)
671
#define UART_IIR_INTRID_SHIFT (0U)
672
#define UART_IIR_INTRID_GET(x) (((uint32_t)(x) & UART_IIR_INTRID_MASK) >> UART_IIR_INTRID_SHIFT)
673
674
/* Bitfield definition for register: FCR */
675
/*
676
* RFIFOT (WO)
677
*
678
* Receiver FIFO trigger level(0 for 1byte, 0x3 for 4bytes). Uart will send rx_dma_req if data in fifo reachs the threshold
679
*/
680
#define UART_FCR_RFIFOT_MASK (0xC0U)
681
#define UART_FCR_RFIFOT_SHIFT (6U)
682
#define UART_FCR_RFIFOT_SET(x) (((uint32_t)(x) << UART_FCR_RFIFOT_SHIFT) & UART_FCR_RFIFOT_MASK)
683
#define UART_FCR_RFIFOT_GET(x) (((uint32_t)(x) & UART_FCR_RFIFOT_MASK) >> UART_FCR_RFIFOT_SHIFT)
684
685
/*
686
* TFIFOT (WO)
687
*
688
* Transmitter FIFO trigger level(0 for 1byte, 0x3 for 4bytes), uart will send tx_dma_req when data in fifo is less than threshold.
689
*/
690
#define UART_FCR_TFIFOT_MASK (0x30U)
691
#define UART_FCR_TFIFOT_SHIFT (4U)
692
#define UART_FCR_TFIFOT_SET(x) (((uint32_t)(x) << UART_FCR_TFIFOT_SHIFT) & UART_FCR_TFIFOT_MASK)
693
#define UART_FCR_TFIFOT_GET(x) (((uint32_t)(x) & UART_FCR_TFIFOT_MASK) >> UART_FCR_TFIFOT_SHIFT)
694
695
/*
696
* DMAE (WO)
697
*
698
* DMA enable
699
* 0: Disable
700
* 1: Enable
701
*/
702
#define UART_FCR_DMAE_MASK (0x8U)
703
#define UART_FCR_DMAE_SHIFT (3U)
704
#define UART_FCR_DMAE_SET(x) (((uint32_t)(x) << UART_FCR_DMAE_SHIFT) & UART_FCR_DMAE_MASK)
705
#define UART_FCR_DMAE_GET(x) (((uint32_t)(x) & UART_FCR_DMAE_MASK) >> UART_FCR_DMAE_SHIFT)
706
707
/*
708
* TFIFORST (WO)
709
*
710
* Transmitter FIFO reset
711
* Write 1 to clear all bytes in the TXFIFO and resets its
712
* counter. The Transmitter Shift Register is not cleared.
713
* This bit will automatically be cleared.
714
*/
715
#define UART_FCR_TFIFORST_MASK (0x4U)
716
#define UART_FCR_TFIFORST_SHIFT (2U)
717
#define UART_FCR_TFIFORST_SET(x) (((uint32_t)(x) << UART_FCR_TFIFORST_SHIFT) & UART_FCR_TFIFORST_MASK)
718
#define UART_FCR_TFIFORST_GET(x) (((uint32_t)(x) & UART_FCR_TFIFORST_MASK) >> UART_FCR_TFIFORST_SHIFT)
719
720
/*
721
* RFIFORST (WO)
722
*
723
* Receiver FIFO reset
724
* Write 1 to clear all bytes in the RXFIFO and resets its
725
* counter. The Receiver Shift Register is not cleared.
726
* This bit will automatically be cleared.
727
*/
728
#define UART_FCR_RFIFORST_MASK (0x2U)
729
#define UART_FCR_RFIFORST_SHIFT (1U)
730
#define UART_FCR_RFIFORST_SET(x) (((uint32_t)(x) << UART_FCR_RFIFORST_SHIFT) & UART_FCR_RFIFORST_MASK)
731
#define UART_FCR_RFIFORST_GET(x) (((uint32_t)(x) & UART_FCR_RFIFORST_MASK) >> UART_FCR_RFIFORST_SHIFT)
732
733
/*
734
* FIFOE (WO)
735
*
736
* FIFO enable
737
* Write 1 to enable both the transmitter and receiver
738
* FIFOs.
739
* The FIFOs are reset when the value of this bit toggles.
740
*/
741
#define UART_FCR_FIFOE_MASK (0x1U)
742
#define UART_FCR_FIFOE_SHIFT (0U)
743
#define UART_FCR_FIFOE_SET(x) (((uint32_t)(x) << UART_FCR_FIFOE_SHIFT) & UART_FCR_FIFOE_MASK)
744
#define UART_FCR_FIFOE_GET(x) (((uint32_t)(x) & UART_FCR_FIFOE_MASK) >> UART_FCR_FIFOE_SHIFT)
745
746
/* Bitfield definition for register: LCR */
747
/*
748
* DLAB (RW)
749
*
750
* Divisor latch access bit
751
*/
752
#define UART_LCR_DLAB_MASK (0x80U)
753
#define UART_LCR_DLAB_SHIFT (7U)
754
#define UART_LCR_DLAB_SET(x) (((uint32_t)(x) << UART_LCR_DLAB_SHIFT) & UART_LCR_DLAB_MASK)
755
#define UART_LCR_DLAB_GET(x) (((uint32_t)(x) & UART_LCR_DLAB_MASK) >> UART_LCR_DLAB_SHIFT)
756
757
/*
758
* BC (RW)
759
*
760
* Break control
761
*/
762
#define UART_LCR_BC_MASK (0x40U)
763
#define UART_LCR_BC_SHIFT (6U)
764
#define UART_LCR_BC_SET(x) (((uint32_t)(x) << UART_LCR_BC_SHIFT) & UART_LCR_BC_MASK)
765
#define UART_LCR_BC_GET(x) (((uint32_t)(x) & UART_LCR_BC_MASK) >> UART_LCR_BC_SHIFT)
766
767
/*
768
* SPS (RW)
769
*
770
* Stick parity
771
* 1: Parity bit is constant 0 or 1, depending on bit4 (EPS).
772
* 0: Disable the sticky bit parity.
773
*/
774
#define UART_LCR_SPS_MASK (0x20U)
775
#define UART_LCR_SPS_SHIFT (5U)
776
#define UART_LCR_SPS_SET(x) (((uint32_t)(x) << UART_LCR_SPS_SHIFT) & UART_LCR_SPS_MASK)
777
#define UART_LCR_SPS_GET(x) (((uint32_t)(x) & UART_LCR_SPS_MASK) >> UART_LCR_SPS_SHIFT)
778
779
/*
780
* EPS (RW)
781
*
782
* Even parity select
783
* 1: Even parity (an even number of logic-1 is in the data
784
* and parity bits)
785
* 0: Old parity.
786
*/
787
#define UART_LCR_EPS_MASK (0x10U)
788
#define UART_LCR_EPS_SHIFT (4U)
789
#define UART_LCR_EPS_SET(x) (((uint32_t)(x) << UART_LCR_EPS_SHIFT) & UART_LCR_EPS_MASK)
790
#define UART_LCR_EPS_GET(x) (((uint32_t)(x) & UART_LCR_EPS_MASK) >> UART_LCR_EPS_SHIFT)
791
792
/*
793
* PEN (RW)
794
*
795
* Parity enable
796
* When this bit is set, a parity bit is generated in
797
* transmitted data before the first STOP bit and the parity
798
* bit would be checked for the received data.
799
*/
800
#define UART_LCR_PEN_MASK (0x8U)
801
#define UART_LCR_PEN_SHIFT (3U)
802
#define UART_LCR_PEN_SET(x) (((uint32_t)(x) << UART_LCR_PEN_SHIFT) & UART_LCR_PEN_MASK)
803
#define UART_LCR_PEN_GET(x) (((uint32_t)(x) & UART_LCR_PEN_MASK) >> UART_LCR_PEN_SHIFT)
804
805
/*
806
* STB (RW)
807
*
808
* Number of STOP bits
809
* 0: 1 bits
810
* 1: The number of STOP bit is based on the WLS setting
811
* When WLS = 0, STOP bit is 1.5 bits
812
* When WLS = 1, 2, 3, STOP bit is 2 bits
813
*/
814
#define UART_LCR_STB_MASK (0x4U)
815
#define UART_LCR_STB_SHIFT (2U)
816
#define UART_LCR_STB_SET(x) (((uint32_t)(x) << UART_LCR_STB_SHIFT) & UART_LCR_STB_MASK)
817
#define UART_LCR_STB_GET(x) (((uint32_t)(x) & UART_LCR_STB_MASK) >> UART_LCR_STB_SHIFT)
818
819
/*
820
* WLS (RW)
821
*
822
* Word length setting
823
* 0: 5 bits
824
* 1: 6 bits
825
* 2: 7 bits
826
* 3: 8 bits
827
*/
828
#define UART_LCR_WLS_MASK (0x3U)
829
#define UART_LCR_WLS_SHIFT (0U)
830
#define UART_LCR_WLS_SET(x) (((uint32_t)(x) << UART_LCR_WLS_SHIFT) & UART_LCR_WLS_MASK)
831
#define UART_LCR_WLS_GET(x) (((uint32_t)(x) & UART_LCR_WLS_MASK) >> UART_LCR_WLS_SHIFT)
832
833
/* Bitfield definition for register: MCR */
834
/*
835
* AFE (RW)
836
*
837
* Auto flow control enable
838
* 0: Disable
839
* 1: The auto-CTS and auto-RTS setting is based on the
840
* RTS bit setting:
841
* When RTS = 0, auto-CTS only
842
* When RTS = 1, auto-CTS and auto-RTS
843
*/
844
#define UART_MCR_AFE_MASK (0x20U)
845
#define UART_MCR_AFE_SHIFT (5U)
846
#define UART_MCR_AFE_SET(x) (((uint32_t)(x) << UART_MCR_AFE_SHIFT) & UART_MCR_AFE_MASK)
847
#define UART_MCR_AFE_GET(x) (((uint32_t)(x) & UART_MCR_AFE_MASK) >> UART_MCR_AFE_SHIFT)
848
849
/*
850
* LOOP (RW)
851
*
852
* Enable loopback mode
853
* 0: Disable
854
* 1: Enable
855
*/
856
#define UART_MCR_LOOP_MASK (0x10U)
857
#define UART_MCR_LOOP_SHIFT (4U)
858
#define UART_MCR_LOOP_SET(x) (((uint32_t)(x) << UART_MCR_LOOP_SHIFT) & UART_MCR_LOOP_MASK)
859
#define UART_MCR_LOOP_GET(x) (((uint32_t)(x) & UART_MCR_LOOP_MASK) >> UART_MCR_LOOP_SHIFT)
860
861
/*
862
* RTS (RW)
863
*
864
* Request to send
865
* This bit controls the modem_rtsn output.
866
* 0: The modem_rtsn output signal will be driven HIGH
867
* 1: The modem_rtsn output signal will be driven LOW
868
*/
869
#define UART_MCR_RTS_MASK (0x2U)
870
#define UART_MCR_RTS_SHIFT (1U)
871
#define UART_MCR_RTS_SET(x) (((uint32_t)(x) << UART_MCR_RTS_SHIFT) & UART_MCR_RTS_MASK)
872
#define UART_MCR_RTS_GET(x) (((uint32_t)(x) & UART_MCR_RTS_MASK) >> UART_MCR_RTS_SHIFT)
873
874
/* Bitfield definition for register: LSR */
875
/*
876
* RXIDLE (RO)
877
*
878
* rxidle after timeout, clear after rx idle condition not match
879
*/
880
#define UART_LSR_RXIDLE_MASK (0x80000000UL)
881
#define UART_LSR_RXIDLE_SHIFT (31U)
882
#define UART_LSR_RXIDLE_GET(x) (((uint32_t)(x) & UART_LSR_RXIDLE_MASK) >> UART_LSR_RXIDLE_SHIFT)
883
884
/*
885
* TXIDLE (RO)
886
*
887
* txidle after timeout, clear after tx idle condition not match
888
*/
889
#define UART_LSR_TXIDLE_MASK (0x40000000UL)
890
#define UART_LSR_TXIDLE_SHIFT (30U)
891
#define UART_LSR_TXIDLE_GET(x) (((uint32_t)(x) & UART_LSR_TXIDLE_MASK) >> UART_LSR_TXIDLE_SHIFT)
892
893
/*
894
* RFIFO_NUM (RO)
895
*
896
* data bytes in rxfifo not read
897
*/
898
#define UART_LSR_RFIFO_NUM_MASK (0x1F0000UL)
899
#define UART_LSR_RFIFO_NUM_SHIFT (16U)
900
#define UART_LSR_RFIFO_NUM_GET(x) (((uint32_t)(x) & UART_LSR_RFIFO_NUM_MASK) >> UART_LSR_RFIFO_NUM_SHIFT)
901
902
/*
903
* TFIFO_NUM (RO)
904
*
905
* data bytes in txfifo not sent
906
*/
907
#define UART_LSR_TFIFO_NUM_MASK (0x1F00U)
908
#define UART_LSR_TFIFO_NUM_SHIFT (8U)
909
#define UART_LSR_TFIFO_NUM_GET(x) (((uint32_t)(x) & UART_LSR_TFIFO_NUM_MASK) >> UART_LSR_TFIFO_NUM_SHIFT)
910
911
/*
912
* ERRF (RO)
913
*
914
* Error in RXFIFO
915
* In the FIFO mode, this bit is set when there is at least
916
* one parity error, framing error, or line break
917
* associated with data in the RXFIFO. It is cleared when
918
* this register is read and there is no more error for the
919
* rest of data in the RXFIFO.
920
*/
921
#define UART_LSR_ERRF_MASK (0x80U)
922
#define UART_LSR_ERRF_SHIFT (7U)
923
#define UART_LSR_ERRF_GET(x) (((uint32_t)(x) & UART_LSR_ERRF_MASK) >> UART_LSR_ERRF_SHIFT)
924
925
/*
926
* TEMT (RO)
927
*
928
* Transmitter empty
929
* This bit is 1 when the THR (TXFIFO in the FIFO
930
* mode) and the Transmitter Shift Register (TSR) are
931
* both empty. Otherwise, it is zero.
932
*/
933
#define UART_LSR_TEMT_MASK (0x40U)
934
#define UART_LSR_TEMT_SHIFT (6U)
935
#define UART_LSR_TEMT_GET(x) (((uint32_t)(x) & UART_LSR_TEMT_MASK) >> UART_LSR_TEMT_SHIFT)
936
937
/*
938
* THRE (RO)
939
*
940
* Transmitter Holding Register empty
941
* This bit is 1 when the THR (TXFIFO in the FIFO
942
* mode) is empty. Otherwise, it is zero.
943
* If the THRE interrupt is enabled, an interrupt is
944
* triggered when THRE becomes 1.
945
*/
946
#define UART_LSR_THRE_MASK (0x20U)
947
#define UART_LSR_THRE_SHIFT (5U)
948
#define UART_LSR_THRE_GET(x) (((uint32_t)(x) & UART_LSR_THRE_MASK) >> UART_LSR_THRE_SHIFT)
949
950
/*
951
* LBREAK (RO)
952
*
953
* Line break
954
* This bit is set when the uart_sin input signal was held
955
* LOWfor longer than the time for a full-word
956
* transmission. A full-word transmission is the
957
* transmission of the START, data, parity, and STOP
958
* bits. It is cleared when this register is read.
959
* In the FIFO mode, this bit indicates the line break for
960
* the received data at the top of the RXFIFO.
961
*/
962
#define UART_LSR_LBREAK_MASK (0x10U)
963
#define UART_LSR_LBREAK_SHIFT (4U)
964
#define UART_LSR_LBREAK_GET(x) (((uint32_t)(x) & UART_LSR_LBREAK_MASK) >> UART_LSR_LBREAK_SHIFT)
965
966
/*
967
* FE (RO)
968
*
969
* Framing error
970
* This bit is set when the received STOP bit is not
971
* HIGH. It is cleared when this register is read.
972
* In the FIFO mode, this bit indicates the framing error
973
* for the received data at the top of the RXFIFO.
974
*/
975
#define UART_LSR_FE_MASK (0x8U)
976
#define UART_LSR_FE_SHIFT (3U)
977
#define UART_LSR_FE_GET(x) (((uint32_t)(x) & UART_LSR_FE_MASK) >> UART_LSR_FE_SHIFT)
978
979
/*
980
* PE (RO)
981
*
982
* Parity error
983
* This bit is set when the received parity does not match
984
* with the parity selected in the LCR[5:4]. It is cleared
985
* when this register is read.
986
* In the FIFO mode, this bit indicates the parity error
987
* for the received data at the top of the RXFIFO.
988
*/
989
#define UART_LSR_PE_MASK (0x4U)
990
#define UART_LSR_PE_SHIFT (2U)
991
#define UART_LSR_PE_GET(x) (((uint32_t)(x) & UART_LSR_PE_MASK) >> UART_LSR_PE_SHIFT)
992
993
/*
994
* OE (RO)
995
*
996
* Overrun error
997
* This bit indicates that data in the Receiver Buffer
998
* Register (RBR) is overrun.
999
*/
1000
#define UART_LSR_OE_MASK (0x2U)
1001
#define UART_LSR_OE_SHIFT (1U)
1002
#define UART_LSR_OE_GET(x) (((uint32_t)(x) & UART_LSR_OE_MASK) >> UART_LSR_OE_SHIFT)
1003
1004
/*
1005
* DR (RO)
1006
*
1007
* Data ready.
1008
* This bit is set when there are incoming received data
1009
* in the Receiver Buffer Register (RBR). It is cleared
1010
* when all of the received data are read.
1011
*/
1012
#define UART_LSR_DR_MASK (0x1U)
1013
#define UART_LSR_DR_SHIFT (0U)
1014
#define UART_LSR_DR_GET(x) (((uint32_t)(x) & UART_LSR_DR_MASK) >> UART_LSR_DR_SHIFT)
1015
1016
/* Bitfield definition for register: MSR */
1017
/*
1018
* CTS (RO)
1019
*
1020
* Clear to send
1021
* 0: The modem_ctsn input signal is HIGH.
1022
* 1: The modem_ctsn input signal is LOW.
1023
*/
1024
#define UART_MSR_CTS_MASK (0x10U)
1025
#define UART_MSR_CTS_SHIFT (4U)
1026
#define UART_MSR_CTS_GET(x) (((uint32_t)(x) & UART_MSR_CTS_MASK) >> UART_MSR_CTS_SHIFT)
1027
1028
/*
1029
* DCTS (RC)
1030
*
1031
* Delta clear to send
1032
* This bit is set when the state of the modem_ctsn input
1033
* signal has been changed since the last time this
1034
* register is read.
1035
*/
1036
#define UART_MSR_DCTS_MASK (0x1U)
1037
#define UART_MSR_DCTS_SHIFT (0U)
1038
#define UART_MSR_DCTS_GET(x) (((uint32_t)(x) & UART_MSR_DCTS_MASK) >> UART_MSR_DCTS_SHIFT)
1039
1040
/* Bitfield definition for register: GPR */
1041
/*
1042
* DATA (RW)
1043
*
1044
* A one-byte storage register
1045
*/
1046
#define UART_GPR_DATA_MASK (0xFFU)
1047
#define UART_GPR_DATA_SHIFT (0U)
1048
#define UART_GPR_DATA_SET(x) (((uint32_t)(x) << UART_GPR_DATA_SHIFT) & UART_GPR_DATA_MASK)
1049
#define UART_GPR_DATA_GET(x) (((uint32_t)(x) & UART_GPR_DATA_MASK) >> UART_GPR_DATA_SHIFT)
1050
1051
1052
1053
1054
#endif
/* HPM_UART_H */
UART_Type
Definition:
hpm_uart_regs.h:12
soc
HPM6P00
ip
hpm_uart_regs.h
Generated on Tue Apr 1 2025 05:30:27 for HPM SDK by
1.9.1