source: rtems/c/src/lib/libbsp/shared/src/uart-output-char.c @ 1bc0ad2

5
Last change on this file since 1bc0ad2 was 1bc0ad2, checked in by Sebastian Huber <sebastian.huber@…>, on 09/08/17 at 08:38:46

Simplify and unify BSP_output_char

The BSP_output_char should output a char and not mingle with high level
processing, e.g. '\n' to '\r\n' translation. Move this translation to
rtems_putc(). Remove it from all the BSP_output_char implementations.

Close #3122.

  • Property mode set to 100644
File size: 964 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
27static 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
36static void uart_output(char c)
37{
38  uart_output_raw(c);
39}
40
41static int uart_input(void)
42{
43  if ((CONSOLE_LSR & CONSOLE_LSR_RDR) != 0) {
44    return CONSOLE_RBR;
45  } else {
46    return -1;
47  }
48}
49
50BSP_output_char_function_type BSP_output_char = uart_output;
51
52BSP_polling_getchar_function_type BSP_poll_char = uart_input;
Note: See TracBrowser for help on using the repository browser.