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

4.115
Last change on this file since d1887baf was d1887baf, checked in by Joel Sherrill <joel.sherrill@…>, on Feb 1, 2012 at 9:02:03 PM

Improve comments on console select patch.

  • Property mode set to 100644
File size: 1.3 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.com/license/LICENSE.
18 */
19
20#include <rtems.h>
21#include <rtems/bspIo.h>
22#include <rtems/keyboard.h>
23#include <bsp.h>
24#include <libchip/serial.h>
25#include <libchip/ns16550.h>
26#include "../../../shared/console_private.h"
27
28rtems_device_minor_number         BSPPrintkPort = 0;
29
30int ns16550_inbyte_nonblocking_polled(
31  int minor
32);
33
34void BSP_outch(char ch);
35int BSP_inch(void);
36
37void BSP_outch(char ch)
38{
39  if ( BSPPrintkPort == BSP_CONSOLE_VGA ) {
40    _IBMPC_outch( ch );
41  } else {
42    console_tbl *cptr;
43
44    cptr = &Console_Configuration_Ports[BSPPrintkPort];
45    cptr->pDeviceFns->deviceWritePolled( BSPPrintkPort, ch );
46  }
47}
48
49int BSP_inch(void) 
50{
51  int           result;
52
53  if ( BSPPrintkPort == BSP_CONSOLE_VGA ) {
54    result = BSP_wait_polled_input();
55  } else {
56    do {
57      result = ns16550_inbyte_nonblocking_polled( BSPPrintkPort );
58    } while (result == -1);
59  }
60  return result;
61}
62
63BSP_output_char_function_type     BSP_output_char = BSP_outch;
64BSP_polling_getchar_function_type BSP_poll_char = BSP_inch;
65
Note: See TracBrowser for help on using the repository browser.