2006-01-10 00:05:41 +07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2003-2005 SAN People
|
|
|
|
*
|
|
|
|
* Debugging macro include header
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-03-04 21:41:27 +07:00
|
|
|
#ifdef CONFIG_MMU
|
2015-01-13 01:42:14 +07:00
|
|
|
#define AT91_IO_P2V(x) ((x) - 0x01000000)
|
2015-03-04 21:41:27 +07:00
|
|
|
#else
|
|
|
|
#define AT91_IO_P2V(x) (x)
|
|
|
|
#endif
|
2015-01-13 01:42:14 +07:00
|
|
|
|
2016-02-23 21:39:38 +07:00
|
|
|
#define AT91_DEBUG_UART_VIRT AT91_IO_P2V(CONFIG_DEBUG_UART_PHYS)
|
2015-08-08 17:11:11 +07:00
|
|
|
|
2015-01-13 01:42:14 +07:00
|
|
|
#define AT91_DBGU_SR (0x14) /* Status Register */
|
|
|
|
#define AT91_DBGU_THR (0x1c) /* Transmitter Holding Register */
|
|
|
|
#define AT91_DBGU_TXRDY (1 << 1) /* Transmitter Ready */
|
|
|
|
#define AT91_DBGU_TXEMPTY (1 << 9) /* Transmitter Empty */
|
|
|
|
|
2011-09-01 09:55:46 +07:00
|
|
|
.macro addruart, rp, rv, tmp
|
2015-08-08 17:11:11 +07:00
|
|
|
ldr \rp, =CONFIG_DEBUG_UART_PHYS @ System peripherals (phys address)
|
2016-02-23 21:39:38 +07:00
|
|
|
ldr \rv, =AT91_DEBUG_UART_VIRT @ System peripherals (virt address)
|
2006-01-10 00:05:41 +07:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro senduart,rd,rx
|
2011-05-03 00:11:25 +07:00
|
|
|
strb \rd, [\rx, #(AT91_DBGU_THR)] @ Write to Transmitter Holding Register
|
2006-01-10 00:05:41 +07:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro waituart,rd,rx
|
2011-05-03 00:11:25 +07:00
|
|
|
1001: ldr \rd, [\rx, #(AT91_DBGU_SR)] @ Read Status Register
|
|
|
|
tst \rd, #AT91_DBGU_TXRDY @ DBGU_TXRDY = 1 when ready to transmit
|
2006-01-10 00:05:41 +07:00
|
|
|
beq 1001b
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro busyuart,rd,rx
|
2011-05-03 00:11:25 +07:00
|
|
|
1001: ldr \rd, [\rx, #(AT91_DBGU_SR)] @ Read Status Register
|
|
|
|
tst \rd, #AT91_DBGU_TXEMPTY @ DBGU_TXEMPTY = 1 when transmission complete
|
2006-01-10 00:05:41 +07:00
|
|
|
beq 1001b
|
|
|
|
.endm
|
|
|
|
|