5
Line | |
---|
1 | /* |
---|
2 | * Copyright (c) 2016 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 <chip.h> |
---|
19 | #include <include/dbg_console.h> |
---|
20 | |
---|
21 | static void atsam_debug_console_out(char c) |
---|
22 | { |
---|
23 | if (c == '\n') { |
---|
24 | DBG_PutChar('\r'); |
---|
25 | } |
---|
26 | |
---|
27 | DBG_PutChar((uint8_t) c); |
---|
28 | } |
---|
29 | |
---|
30 | static void atsam_debug_console_init(void) |
---|
31 | { |
---|
32 | DBG_Configure(115200, BOARD_MCK); |
---|
33 | BSP_output_char = atsam_debug_console_out; |
---|
34 | } |
---|
35 | |
---|
36 | static void atsam_debug_console_early_init(char c) |
---|
37 | { |
---|
38 | atsam_debug_console_init(); |
---|
39 | atsam_debug_console_out(c); |
---|
40 | } |
---|
41 | |
---|
42 | static int atsam_debug_console_in(void) |
---|
43 | { |
---|
44 | return (int) DBG_GetChar(); |
---|
45 | } |
---|
46 | |
---|
47 | BSP_output_char_function_type BSP_output_char = atsam_debug_console_early_init; |
---|
48 | |
---|
49 | BSP_polling_getchar_function_type BSP_poll_char = atsam_debug_console_in; |
---|
50 | |
---|
51 | RTEMS_SYSINIT_ITEM( |
---|
52 | atsam_debug_console_init, |
---|
53 | RTEMS_SYSINIT_BSP_START, |
---|
54 | RTEMS_SYSINIT_ORDER_LAST |
---|
55 | ); |
---|
Note: See
TracBrowser
for help on using the repository browser.