1 | /* |
---|
2 | * Copyright (c) 2013, 2017 embedded brains GmbH. All rights reserved. |
---|
3 | * |
---|
4 | * embedded brains GmbH |
---|
5 | * Dornierstr. 4 |
---|
6 | * 82178 Puchheim |
---|
7 | * Germany |
---|
8 | * <rtems@embedded-brains.de> |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.org/license/LICENSE. |
---|
13 | */ |
---|
14 | |
---|
15 | #include <rtems/bspIo.h> |
---|
16 | #include <rtems/sysinit.h> |
---|
17 | |
---|
18 | #include <bsp/zynq-uart.h> |
---|
19 | |
---|
20 | #include <bspopts.h> |
---|
21 | |
---|
22 | static void zynq_debug_console_out(char c) |
---|
23 | { |
---|
24 | rtems_termios_device_context *base = |
---|
25 | &zynq_uart_instances[BSP_CONSOLE_MINOR].base; |
---|
26 | |
---|
27 | zynq_uart_write_polled(base, c); |
---|
28 | } |
---|
29 | |
---|
30 | static void zynq_debug_console_init(void) |
---|
31 | { |
---|
32 | rtems_termios_device_context *base = |
---|
33 | &zynq_uart_instances[BSP_CONSOLE_MINOR].base; |
---|
34 | |
---|
35 | zynq_uart_initialize(base); |
---|
36 | BSP_output_char = zynq_debug_console_out; |
---|
37 | } |
---|
38 | |
---|
39 | static void zynq_debug_console_early_init(char c) |
---|
40 | { |
---|
41 | rtems_termios_device_context *base = |
---|
42 | &zynq_uart_instances[BSP_CONSOLE_MINOR].base; |
---|
43 | |
---|
44 | zynq_uart_initialize(base); |
---|
45 | zynq_debug_console_out(c); |
---|
46 | } |
---|
47 | |
---|
48 | static int zynq_debug_console_in(void) |
---|
49 | { |
---|
50 | rtems_termios_device_context *base = |
---|
51 | &zynq_uart_instances[BSP_CONSOLE_MINOR].base; |
---|
52 | |
---|
53 | return zynq_uart_read_polled(base); |
---|
54 | } |
---|
55 | |
---|
56 | BSP_output_char_function_type BSP_output_char = zynq_debug_console_early_init; |
---|
57 | |
---|
58 | BSP_polling_getchar_function_type BSP_poll_char = zynq_debug_console_in; |
---|
59 | |
---|
60 | RTEMS_SYSINIT_ITEM( |
---|
61 | zynq_debug_console_init, |
---|
62 | RTEMS_SYSINIT_BSP_START, |
---|
63 | RTEMS_SYSINIT_ORDER_LAST |
---|
64 | ); |
---|