source: rtems/c/src/lib/libbsp/i386/pc386/console/printk_support.c @ becbeda

4.115
Last change on this file since becbeda was 7cdabc49, checked in by Joel Sherrill <joel.sherrill@…>, on 12/14/14 at 22:27:06

pc386: Add Edison base support

The current support for the Edison supports a single polled
UART for input and output plus a simulated clock tick. The
activities forward for supporting the Edison have been posted
on the RTEMS mailing lists and at:

http://rtemsramblings.blogspot.com/2014/12/intel-edison-and-rtems-road-forward.html

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 * @file
3 *
4 * @ingroup Console
5 *
6 * @brief printk support routines
7 *
8 * This file contains the required printk support.
9 */
10
11/*
12 *  COPYRIGHT (c) 1989-2012.
13 *  On-Line Applications Research Corporation (OAR).
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.rtems.org/license/LICENSE.
18 */
19
20#include <rtems.h>
21#include <rtems/bspIo.h>
22#if BSP_ENABLE_VGA
23  #include <rtems/keyboard.h>
24#endif
25#include <bsp.h>
26#include <libchip/serial.h>
27#include <libchip/ns16550.h>
28#include "../../../shared/console_private.h"
29
30rtems_device_minor_number         BSPPrintkPort = 0;
31
32#if (BSP_IS_EDISON == 1)
33void edison_write_polled(int minor, char cChar); /* XXX */
34int edison_inbyte_nonblocking_polled(int minor);
35#endif
36
37#if BSP_ENABLE_COM1_COM4
38int ns16550_inbyte_nonblocking_polled( int minor );
39#endif
40
41void BSP_outch(char ch);
42int BSP_inch(void);
43
44void BSP_outch(char ch)
45{
46  #if BSP_ENABLE_VGA
47    if ( BSPPrintkPort == BSP_CONSOLE_VGA ) {
48      _IBMPC_outch( ch );
49      return;
50    }
51  #endif
52  console_tbl *cptr;
53
54  cptr = &Console_Configuration_Ports[BSPPrintkPort];
55  cptr->pDeviceFns->deviceWritePolled( BSPPrintkPort, ch );
56}
57
58int BSP_inch(void)
59{
60  int           result = -1;
61
62  #if BSP_ENABLE_VGA
63    if ( BSPPrintkPort == BSP_CONSOLE_VGA ) {
64      result = BSP_wait_polled_input();
65    } else
66  #endif
67  #if BSP_ENABLE_COM1_COM4
68    {
69      do {
70        result = ns16550_inbyte_nonblocking_polled( BSPPrintkPort );
71      } while (result == -1);
72    }
73  #endif
74  #if (BSP_IS_EDISON == 1)
75    do {
76      result = edison_inbyte_nonblocking_polled( BSPPrintkPort );
77    } while (result == -1);
78  #endif
79  return result;
80}
81
82BSP_output_char_function_type     BSP_output_char = BSP_outch;
83BSP_polling_getchar_function_type BSP_poll_char = BSP_inch;
84
Note: See TracBrowser for help on using the repository browser.