4.115
Last change
on this file since c499856 was
c499856,
checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47
|
Change all references of rtems.com to rtems.org.
|
-
Property mode set to
100644
|
File size:
1015 bytes
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup bsp_kit |
---|
5 | * |
---|
6 | * @brief Output character implementation for standard UARTs. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2010-2011 embedded brains GmbH. All rights reserved. |
---|
11 | * |
---|
12 | * embedded brains GmbH |
---|
13 | * Obere Lagerstr. 30 |
---|
14 | * 82178 Puchheim |
---|
15 | * Germany |
---|
16 | * <rtems@embedded-brains.de> |
---|
17 | * |
---|
18 | * The license and distribution terms for this file may be |
---|
19 | * found in the file LICENSE in this distribution or at |
---|
20 | * http://www.rtems.org/license/LICENSE. |
---|
21 | */ |
---|
22 | |
---|
23 | #include <rtems/bspIo.h> |
---|
24 | |
---|
25 | #include <bsp/uart-output-char.h> |
---|
26 | |
---|
27 | static void uart_output_raw(char c) |
---|
28 | { |
---|
29 | while ((CONSOLE_LSR & CONSOLE_LSR_THRE) == 0) { |
---|
30 | /* Wait */ |
---|
31 | } |
---|
32 | |
---|
33 | CONSOLE_THR = c; |
---|
34 | } |
---|
35 | |
---|
36 | static void uart_output(char c) |
---|
37 | { |
---|
38 | if (c == '\n') { |
---|
39 | uart_output_raw('\r'); |
---|
40 | } |
---|
41 | |
---|
42 | uart_output_raw(c); |
---|
43 | } |
---|
44 | |
---|
45 | static int uart_input(void) |
---|
46 | { |
---|
47 | if ((CONSOLE_LSR & CONSOLE_LSR_RDR) != 0) { |
---|
48 | return CONSOLE_RBR; |
---|
49 | } else { |
---|
50 | return -1; |
---|
51 | } |
---|
52 | } |
---|
53 | |
---|
54 | BSP_output_char_function_type BSP_output_char = uart_output; |
---|
55 | |
---|
56 | BSP_polling_getchar_function_type BSP_poll_char = uart_input; |
---|
Note: See
TracBrowser
for help on using the repository browser.