21 #include <rtems/sysinit.h> 24 int leon3_debug_uart_index __attribute__((weak)) = 0;
32 static char pre_printk_dbgbuf[32] = {0};
33 static int pre_printk_pos = 0;
38 static void bsp_debug_uart_init(
void)
50 if (leon3_debug_uart_index == 0) {
51 #if defined(RTEMS_MULTIPROCESSING) 52 leon3_debug_uart_index = LEON3_Cpu_Index;
54 leon3_debug_uart_index = 0;
57 leon3_debug_uart_index--;
61 i = leon3_debug_uart_index;
62 adev = (
void *)ambapp_for_each(&ambapp_plb, (OPTIONS_ALL|OPTIONS_APB_SLVS),
63 VENDOR_GAISLER, GAISLER_APBUART,
64 ambapp_find_by_idx, (
void *)&i);
71 leon3_debug_uart->ctrl |= APBUART_CTRL_RE | APBUART_CTRL_TE;
72 leon3_debug_uart->status = 0;
78 RTEMS_SYSINIT_BSP_START,
79 RTEMS_SYSINIT_ORDER_FOURTH
83 static void bsp_out_char(
char c)
85 if (leon3_debug_uart == NULL) {
87 pre_printk_dbgbuf[pre_printk_pos++] = c;
88 pre_printk_pos = pre_printk_pos & (
sizeof(pre_printk_dbgbuf)-1);
92 apbuart_outbyte_polled(leon3_debug_uart, c, 1, 1);
101 static int bsp_in_char(
void)
105 if (leon3_debug_uart == NULL)
108 while ((tmp = apbuart_inbyte_nonblocking(leon3_debug_uart)) < 0)
BSP_polling_getchar_function_type BSP_poll_char
LEON3 BSP data types and macros.
Interface to Kernel Print Methods.
BSP_output_char_function_type BSP_output_char
int(* BSP_polling_getchar_function_type)(void)
void(* BSP_output_char_function_type)(char c)