summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/leon3/console/debugputs.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-05-24 15:05:19 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-05-24 15:05:19 +0000
commitd17733ccd8ebc56809aec8dd6bb681ff6f23b673 (patch)
tree3f74c53181b626b226660c8f6c8d6b241132532f /c/src/lib/libbsp/sparc/leon3/console/debugputs.c
parentRegenerate. (diff)
downloadrtems-d17733ccd8ebc56809aec8dd6bb681ff6f23b673.tar.bz2
2010-05-24 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, amba/amba.c, console/console.c, console/debugputs.c, startup/bspstart.c: Rework initialization order so AMBA bus is scanned earlier. This lets us look for UARTs earlier and support printk as early as bsp_start() returning.
Diffstat (limited to 'c/src/lib/libbsp/sparc/leon3/console/debugputs.c')
-rw-r--r--c/src/lib/libbsp/sparc/leon3/console/debugputs.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/sparc/leon3/console/debugputs.c b/c/src/lib/libbsp/sparc/leon3/console/debugputs.c
index b6276930d3..2cd0d136e1 100644
--- a/c/src/lib/libbsp/sparc/leon3/console/debugputs.c
+++ b/c/src/lib/libbsp/sparc/leon3/console/debugputs.c
@@ -27,6 +27,38 @@
*/
extern int uarts;
+static int isinit = 0;
+
+/*
+ * Scan for UARTS in configuration
+ */
+int scan_uarts(void)
+{
+ int i;
+ amba_apb_device apbuarts[LEON3_APBUARTS];
+
+ if (isinit == 0) {
+ i = 0;
+ uarts = 0;
+
+ uarts = amba_find_apbslvs(
+ &amba_conf, VENDOR_GAISLER, GAISLER_APBUART, apbuarts, LEON3_APBUARTS);
+ for(i=0; i<uarts; i++) {
+ LEON3_Console_Uart[i] = (volatile LEON3_UART_Regs_Map *)apbuarts[i].start;
+ }
+
+ /* initialize uart 0 if present for printk */
+ if ( uarts ) {
+ LEON3_Console_Uart[0]->ctrl |=
+ LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE;
+ LEON3_Console_Uart[0]->status = 0;
+ }
+ isinit = 1;
+ }
+
+ return uarts;
+}
+
/*
* console_outbyte_polled
*