source: rtems/c/src/lib/libbsp/shared/console-output-char.c @ 8df1f408

4.115
Last change on this file since 8df1f408 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: 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
17static 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
31static 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
44BSP_output_char_function_type BSP_output_char = output_char_init;
45
46BSP_polling_getchar_function_type BSP_poll_char = NULL;
Note: See TracBrowser for help on using the repository browser.