4.115
Last change
on this file since f619250 was
f619250,
checked in by Sebastian Huber <sebastian.huber@…>, on 10/27/13 at 18:13:47
|
bsps: Add simple console output char
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[f619250] | 1 | /* |
---|
| 2 | * Copyright (c) 2013 embedded brains GmbH. All rights reserved. |
---|
| 3 | * |
---|
| 4 | * embedded brains GmbH |
---|
| 5 | * Dornierstr. 4 |
---|
| 6 | * 82178 Puchheim |
---|
| 7 | * Germany |
---|
| 8 | * <info@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.com/license/LICENSE. |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | #include <libchip/serial.h> |
---|
| 16 | |
---|
| 17 | static void output_char(char c) |
---|
| 18 | { |
---|
| 19 | int minor = (int) Console_Port_Minor; |
---|
| 20 | const console_tbl *ct = Console_Port_Tbl != NULL ? |
---|
| 21 | Console_Port_Tbl[minor] : &Console_Configuration_Ports[minor]; |
---|
| 22 | const console_fns *cf = ct->pDeviceFns; |
---|
| 23 | |
---|
| 24 | if (c == '\n') { |
---|
| 25 | (*cf->deviceWritePolled)(minor, '\r'); |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | (*cf->deviceWritePolled)(minor, c); |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | static void output_char_init(char c) |
---|
| 32 | { |
---|
| 33 | if (Console_Port_Tbl == NULL) { |
---|
| 34 | int minor = (int) Console_Port_Minor; |
---|
| 35 | const console_fns *cf = Console_Configuration_Ports[minor].pDeviceFns; |
---|
| 36 | |
---|
| 37 | (*cf->deviceInitialize)(minor); |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | BSP_output_char = output_char; |
---|
| 41 | output_char(c); |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | BSP_output_char_function_type BSP_output_char = output_char_init; |
---|
| 45 | |
---|
| 46 | BSP_polling_getchar_function_type BSP_poll_char = NULL; |
---|
Note: See
TracBrowser
for help on using the repository browser.