1
2
3
4
5
6
7 #define UARTn_CMD 0x000c
8 #define UARTn_CMD_TXEN 0x0004
9
10 #define UARTn_STATUS 0x0010
11 #define UARTn_STATUS_TXC 0x0020
12 #define UARTn_STATUS_TXBL 0x0040
13
14 #define UARTn_TXDATA 0x0034
15
16 .macro addruart, rx, tmp, tmp2
17 ldr \rx, =(CONFIG_DEBUG_UART_PHYS)
18
19
20
21
22
23
24 ldr \tmp, =(UARTn_CMD_TXEN)
25 str \tmp, [\rx, #UARTn_CMD]
26 .endm
27
28 .macro senduart,rd,rx
29 strb \rd, [\rx, #UARTn_TXDATA]
30 .endm
31
32 .macro waituart,rd,rx
33 1001: ldr \rd, [\rx, #UARTn_STATUS]
34 tst \rd, #UARTn_STATUS_TXBL
35 beq 1001b
36 .endm
37
38 .macro busyuart,rd,rx
39 1001: ldr \rd, [\rx, UARTn_STATUS]
40 tst \rd, #UARTn_STATUS_TXC
41 bne 1001b
42 .endm