summaryrefslogtreecommitdiffstats
path: root/bsps/microblaze/microblaze_fpga/console/debug-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'bsps/microblaze/microblaze_fpga/console/debug-io.c')
-rw-r--r--bsps/microblaze/microblaze_fpga/console/debug-io.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/bsps/microblaze/microblaze_fpga/console/debug-io.c b/bsps/microblaze/microblaze_fpga/console/debug-io.c
index e88f5468a7..d85229ae9e 100644
--- a/bsps/microblaze/microblaze_fpga/console/debug-io.c
+++ b/bsps/microblaze/microblaze_fpga/console/debug-io.c
@@ -37,23 +37,42 @@
#include <dev/serial/uartlite_l.h>
#include <rtems/bspIo.h>
+#include <bsp.h>
#include <bspopts.h>
+static uint32_t mblaze_uart_base = 0;
+
static void output_char( char c )
{
- if ( c == '\n' ) {
- XUartLite_SendByte( BSP_MICROBLAZE_FPGA_UART_BASE, '\r' );
+ if (mblaze_uart_base == 0 ) {
+ mblaze_uart_base = try_get_prop_from_device_tree(
+ "xlnx,xps-uartlite-1.00.a",
+ "reg",
+ BSP_MICROBLAZE_FPGA_UART_BASE
+ );
+ }
+
+ if ( c == '\n' ) {
+ XUartLite_SendByte( mblaze_uart_base, '\r' );
}
- XUartLite_SendByte( BSP_MICROBLAZE_FPGA_UART_BASE, c );
+ XUartLite_SendByte( mblaze_uart_base, c );
}
static int xUartLite_RecvByte( int minor )
{
- if ( XUartLite_IsReceiveEmpty( BSP_MICROBLAZE_FPGA_UART_BASE ) ) {
+ if (mblaze_uart_base == 0 ) {
+ mblaze_uart_base = try_get_prop_from_device_tree(
+ "xlnx,xps-uartlite-1.00.a",
+ "reg",
+ BSP_MICROBLAZE_FPGA_UART_BASE
+ );
+ }
+
+ if ( XUartLite_IsReceiveEmpty( mblaze_uart_base ) ) {
return -1;
}
- return XUartLite_ReadReg( BSP_MICROBLAZE_FPGA_UART_BASE, XUL_RX_FIFO_OFFSET );
+ return XUartLite_ReadReg( mblaze_uart_base, XUL_RX_FIFO_OFFSET );
}
static int get_char( void )