summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Aberg <maberg@gaisler.com>2017-04-27 13:14:53 +0200
committerDaniel Hellstrom <daniel@gaisler.com>2017-05-14 12:31:57 +0200
commit229c42499ea44865acb1fb9308a9656d99dbe85e (patch)
treee47b5bb69e9e90853fc349ca59ddc4bd53ad62d7
parentleon, irq: single CPU SMP configuration does not need IPI ISR (diff)
downloadrtems-229c42499ea44865acb1fb9308a9656d99dbe85e.tar.bz2
bsp/leon3: Cleaner namespace for LEON3 debug UART
Prefix BSP specific symbols with BSP name: dbg_uart -> leon3_debug_uart debug_uart_index -> leon3_debug_uart_index
-rw-r--r--c/src/lib/libbsp/sparc/leon3/console/printk_support.c34
-rw-r--r--c/src/lib/libbsp/sparc/leon3/include/leon.h2
-rw-r--r--c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c8
3 files changed, 23 insertions, 21 deletions
diff --git a/c/src/lib/libbsp/sparc/leon3/console/printk_support.c b/c/src/lib/libbsp/sparc/leon3/console/printk_support.c
index 27c2a72465..f7e1fb683f 100644
--- a/c/src/lib/libbsp/sparc/leon3/console/printk_support.c
+++ b/c/src/lib/libbsp/sparc/leon3/console/printk_support.c
@@ -25,8 +25,8 @@
#include <bsp/apbuart.h>
#include <bsp/apbuart_termios.h>
-int debug_uart_index __attribute__((weak)) = 0;
-struct apbuart_regs *dbg_uart = NULL;
+int leon3_debug_uart_index __attribute__((weak)) = 0;
+struct apbuart_regs *leon3_debug_uart = NULL;
/* Before UART driver has registered (or when no UART is available), calls to
* printk that gets to bsp_out_char() will be filling data into the
@@ -45,24 +45,24 @@ static void bsp_debug_uart_init(void)
struct ambapp_dev *adev;
struct ambapp_apb_info *apb;
- /* Update debug_uart_index to index used as debug console.
- * Let user select Debug console by setting debug_uart_index. If the
- * BSP is to provide the default UART (debug_uart_index==0):
+ /* Update leon3_debug_uart_index to index used as debug console. Let user
+ * select Debug console by setting leon3_debug_uart_index. If the BSP is to
+ * provide the default UART (leon3_debug_uart_index==0):
* non-MP: APBUART[0] is debug console
* MP: LEON CPU index select UART
*/
- if (debug_uart_index == 0) {
+ if (leon3_debug_uart_index == 0) {
#if defined(RTEMS_MULTIPROCESSING)
- debug_uart_index = LEON3_Cpu_Index;
+ leon3_debug_uart_index = LEON3_Cpu_Index;
#else
- debug_uart_index = 0;
+ leon3_debug_uart_index = 0;
#endif
} else {
- debug_uart_index = debug_uart_index - 1; /* User selected dbg-console */
+ leon3_debug_uart_index--; /* User selected dbg-console */
}
/* Find APBUART core for System Debug Console */
- i = debug_uart_index;
+ i = leon3_debug_uart_index;
adev = (void *)ambapp_for_each(&ambapp_plb, (OPTIONS_ALL|OPTIONS_APB_SLVS),
VENDOR_GAISLER, GAISLER_APBUART,
ambapp_find_by_idx, (void *)&i);
@@ -71,9 +71,9 @@ static void bsp_debug_uart_init(void)
* for printk
*/
apb = (struct ambapp_apb_info *)adev->devinfo;
- dbg_uart = (struct apbuart_regs *)apb->start;
- dbg_uart->ctrl |= APBUART_CTRL_RE | APBUART_CTRL_TE;
- dbg_uart->status = 0;
+ leon3_debug_uart = (struct apbuart_regs *)apb->start;
+ leon3_debug_uart->ctrl |= APBUART_CTRL_RE | APBUART_CTRL_TE;
+ leon3_debug_uart->status = 0;
}
}
@@ -86,14 +86,14 @@ RTEMS_SYSINIT_ITEM(
/* putchar/getchar for printk */
static void bsp_out_char(char c)
{
- if (dbg_uart == NULL) {
+ if (leon3_debug_uart == NULL) {
/* Local debug buffer when UART driver has not registered */
pre_printk_dbgbuf[pre_printk_pos++] = c;
pre_printk_pos = pre_printk_pos & (sizeof(pre_printk_dbgbuf)-1);
return;
}
- apbuart_outbyte_polled(dbg_uart, c, 1, 1);
+ apbuart_outbyte_polled(leon3_debug_uart, c, 1, 1);
}
/*
@@ -108,10 +108,10 @@ static int bsp_in_char(void)
{
int tmp;
- if (dbg_uart == NULL)
+ if (leon3_debug_uart == NULL)
return EOF;
- while ((tmp = apbuart_inbyte_nonblocking(dbg_uart)) < 0)
+ while ((tmp = apbuart_inbyte_nonblocking(leon3_debug_uart)) < 0)
;
return tmp;
}
diff --git a/c/src/lib/libbsp/sparc/leon3/include/leon.h b/c/src/lib/libbsp/sparc/leon3/include/leon.h
index 36f94951f1..9b2597f79f 100644
--- a/c/src/lib/libbsp/sparc/leon3/include/leon.h
+++ b/c/src/lib/libbsp/sparc/leon3/include/leon.h
@@ -364,7 +364,7 @@ extern int syscon_uart_index;
* 3 = APBUART[2]
* ...
*/
-extern int debug_uart_index;
+extern int leon3_debug_uart_index;
/* Let user override which on-chip TIMER core will be used for system clock
* timer. This controls which timer core will be accociated with
diff --git a/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c b/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c
index c79d4084eb..e406bc01b7 100644
--- a/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c
+++ b/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c
@@ -48,7 +48,9 @@ extern void apbuart_outbyte_polled(
int do_cr_on_newline,
int wait_sent);
extern int apbuart_inbyte_nonblocking(struct apbuart_regs *regs);
-extern struct apbuart_regs *dbg_uart; /* The debug UART */
+#ifdef LEON3
+extern struct apbuart_regs *leon3_debug_uart; /* The debug UART */
+#endif
/* Probed hardware capabilities */
enum {
@@ -263,7 +265,7 @@ int apbuart_init1(struct drvmgr_dev *dev)
*/
db = 0;
#ifdef LEON3
- if (priv->regs == dbg_uart) {
+ if (priv->regs == leon3_debug_uart) {
db = priv->regs->ctrl & (LEON_REG_UART_CTRL_RE |
LEON_REG_UART_CTRL_TE |
LEON_REG_UART_CTRL_PE |
@@ -510,7 +512,7 @@ static void last_close(
#ifdef LEON3
/* Disable TX/RX if not used for DEBUG */
- if (uart->regs != dbg_uart)
+ if (uart->regs != leon3_debug_uart)
uart->regs->ctrl &= ~(APBUART_CTRL_RE | APBUART_CTRL_TE);
#endif
}