summaryrefslogtreecommitdiffstats
path: root/bsps/microblaze/microblaze_fpga/console/debug-io.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bsps/microblaze/microblaze_fpga/console/debug-io.c (renamed from c/src/lib/libbsp/microblaze/microblaze_fpga/console/console-io.c)60
1 files changed, 26 insertions, 34 deletions
diff --git a/c/src/lib/libbsp/microblaze/microblaze_fpga/console/console-io.c b/bsps/microblaze/microblaze_fpga/console/debug-io.c
index 47592967ac..e88f5468a7 100644
--- a/c/src/lib/libbsp/microblaze/microblaze_fpga/console/console-io.c
+++ b/bsps/microblaze/microblaze_fpga/console/debug-io.c
@@ -1,13 +1,16 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
/**
* @file
*
- * @ingroup microblaze_uart
+ * @ingroup RTEMSBSPsMicroblaze
*
- * @brief Console Configuration.
+ * @brief MicroBlaze debug IO support
*/
/*
- * Copyright (C) 2015 Hesham Almatary
+ * Copyright (C) 2015 Hesham Almatary
+ * Copyright (C) 2021 On-Line Applications Research Corporation (OAR)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -15,8 +18,8 @@
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -31,44 +34,33 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <dev/serial/uartlite_l.h>
#include <rtems/bspIo.h>
-#include <libchip/serial.h>
-
#include <bspopts.h>
-#include <bsp/uart.h>
-console_tbl Console_Configuration_Ports [] = {
- {
- .sDeviceName = "/dev/ttyS0",
- .deviceType = SERIAL_CUSTOM,
- .pDeviceFns = &microblaze_uart_fns,
- .deviceProbe = NULL,
- .pDeviceFlow = NULL,
- .ulCtrlPort1 = UART_BASEADDRESS,
- .ulCtrlPort2 = 0,
- .ulClock = 9600,
- .ulIntVector = 0
- }
-};
+static void output_char( char c )
+{
+ if ( c == '\n' ) {
+ XUartLite_SendByte( BSP_MICROBLAZE_FPGA_UART_BASE, '\r' );
+ }
+ XUartLite_SendByte( BSP_MICROBLAZE_FPGA_UART_BASE, c );
+}
-#define PORT_COUNT \
- (sizeof(Console_Configuration_Ports) \
- / sizeof(Console_Configuration_Ports [0]))
+static int xUartLite_RecvByte( int minor )
+{
+ if ( XUartLite_IsReceiveEmpty( BSP_MICROBLAZE_FPGA_UART_BASE ) ) {
+ return -1;
+ }
-unsigned long Console_Configuration_Count = PORT_COUNT;
+ return XUartLite_ReadReg( BSP_MICROBLAZE_FPGA_UART_BASE, XUL_RX_FIFO_OFFSET );
+}
-static void output_char(char c)
+static int get_char( void )
{
- const console_fns *con =
- Console_Configuration_Ports [Console_Port_Minor].pDeviceFns;
-
- if (c == '\n') {
- con->deviceWritePolled((int) Console_Port_Minor, '\r');
- }
- con->deviceWritePolled((int) Console_Port_Minor, c);
+ return xUartLite_RecvByte( 0 );
}
BSP_output_char_function_type BSP_output_char = output_char;
-BSP_polling_getchar_function_type BSP_poll_char = NULL;
+BSP_polling_getchar_function_type BSP_poll_char = get_char;