source: rtems/c/src/lib/libbsp/shared/console-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: 1.1 KB
Line 
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.org/license/LICENSE.
13 */
14
15#include <libchip/serial.h>
16
17#include <rtems/bspIo.h>
18
19static void output_char(char c)
20{
21  int minor = (int) Console_Port_Minor;
22  const console_tbl *ct = Console_Port_Tbl != NULL ?
23    Console_Port_Tbl[minor] : &Console_Configuration_Ports[minor];
24  const console_fns *cf = ct->pDeviceFns;
25
26  (*cf->deviceWritePolled)(minor, c);
27}
28
29static void output_char_init(char c)
30{
31  if (Console_Port_Tbl == NULL) {
32    int minor = (int) Console_Port_Minor;
33    const console_fns *cf = Console_Configuration_Ports[minor].pDeviceFns;
34
35    (*cf->deviceInitialize)(minor);
36  }
37
38  BSP_output_char = output_char;
39  output_char(c);
40}
41
42BSP_output_char_function_type BSP_output_char = output_char_init;
43
44BSP_polling_getchar_function_type BSP_poll_char = NULL;
Note: See TracBrowser for help on using the repository browser.