Commit | Line | Data |
---|---|---|
73a59c1c | 1 | /* |
73a59c1c SP |
2 | * Copyright (C) 2003-2005 SAN People |
3 | * | |
4 | * Debugging macro include header | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License version 2 as | |
8 | * published by the Free Software Foundation. | |
9 | * | |
10 | */ | |
11 | ||
13079a73 | 12 | #if defined(CONFIG_AT91_DEBUG_LL_DBGU0) |
5f58c970 | 13 | #define AT91_DBGU 0xfffff200 /* AT91_BASE_DBGU0 */ |
726d32bf | 14 | #elif defined(CONFIG_AT91_DEBUG_LL_DBGU1) |
5f58c970 | 15 | #define AT91_DBGU 0xffffee00 /* AT91_BASE_DBGU1 */ |
726d32bf NF |
16 | #else |
17 | /* On sama5d4, use USART3 as low level serial console */ | |
5f58c970 | 18 | #define AT91_DBGU 0xfc00c000 /* SAMA5D4_BASE_USART3 */ |
13079a73 JCPV |
19 | #endif |
20 | ||
5a5a6451 | 21 | #ifdef CONFIG_MMU |
5f58c970 | 22 | #define AT91_IO_P2V(x) ((x) - 0x01000000) |
5a5a6451 AB |
23 | #else |
24 | #define AT91_IO_P2V(x) (x) | |
25 | #endif | |
5f58c970 AB |
26 | |
27 | #define AT91_DBGU_SR (0x14) /* Status Register */ | |
28 | #define AT91_DBGU_THR (0x1c) /* Transmitter Holding Register */ | |
29 | #define AT91_DBGU_TXRDY (1 << 1) /* Transmitter Ready */ | |
30 | #define AT91_DBGU_TXEMPTY (1 << 9) /* Transmitter Empty */ | |
31 | ||
639da5ee | 32 | .macro addruart, rp, rv, tmp |
13079a73 JCPV |
33 | ldr \rp, =AT91_DBGU @ System peripherals (phys address) |
34 | ldr \rv, =AT91_IO_P2V(AT91_DBGU) @ System peripherals (virt address) | |
73a59c1c SP |
35 | .endm |
36 | ||
37 | .macro senduart,rd,rx | |
1ff5b1b4 | 38 | strb \rd, [\rx, #(AT91_DBGU_THR)] @ Write to Transmitter Holding Register |
73a59c1c SP |
39 | .endm |
40 | ||
41 | .macro waituart,rd,rx | |
1ff5b1b4 JCPV |
42 | 1001: ldr \rd, [\rx, #(AT91_DBGU_SR)] @ Read Status Register |
43 | tst \rd, #AT91_DBGU_TXRDY @ DBGU_TXRDY = 1 when ready to transmit | |
73a59c1c SP |
44 | beq 1001b |
45 | .endm | |
46 | ||
47 | .macro busyuart,rd,rx | |
1ff5b1b4 JCPV |
48 | 1001: ldr \rd, [\rx, #(AT91_DBGU_SR)] @ Read Status Register |
49 | tst \rd, #AT91_DBGU_TXEMPTY @ DBGU_TXEMPTY = 1 when transmission complete | |
73a59c1c SP |
50 | beq 1001b |
51 | .endm | |
52 |