source: rtems/c/src/lib/libbsp/powerpc/qemuppc/console/console-io.c @ 6279149

4.115
Last change on this file since 6279149 was 6279149, checked in by Joel Sherrill <joel.sherrill@…>, on 10/08/14 at 21:04:56

Add console-polled.h and update all BSPs that should use it.

The file console-polled.h provides the prototypes for the three
required methods when implementing a single port polled console
driver. This paradigm is common on simulators and simple hardware.

+ Updated the BSPs Makefile.am to make console-polled.h available.
+ Regenerated the BSPs preinstall.sm.
+ Updated console support files to include <bsp/console-polled.h>.
+ Updated console support files to make printk() support method static.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  This file contains the hardware specific portions of the TTY driver
3 *  for the serial ports on the qemuppc.
4 */
5
6/*
7 *  COPYRIGHT (c) 1989-2008.
8 *  On-Line Applications Research Corporation (OAR).
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 <bsp.h>
16#include <bsp/console-polled.h>
17#include <rtems/libio.h>
18#include <stdlib.h>
19#include <assert.h>
20
21static void
22__outb(int port, unsigned char v)
23{
24  *((volatile unsigned char *)(0x80000000 + port)) = v;
25}
26
27static unsigned char
28__inb(int port)
29{
30  return *((volatile unsigned char *)(0x80000000 + port));
31}
32
33/*
34 *  console_initialize_hardware
35 *
36 *  This routine initializes the console hardware.
37 *
38 */
39void console_initialize_hardware(void)
40{
41  return;
42}
43
44/*
45 *  console_outbyte_polled
46 *
47 *  This routine transmits a character using polling.
48 */
49void console_outbyte_polled(
50  int  port,
51  char ch
52)
53{
54  __outb(0x3f8 + 0x00, ch);
55}
56
57/*
58 *  console_inbyte_nonblocking
59 *
60 *  This routine polls for a character.
61 */
62int console_inbyte_nonblocking(
63  int port
64)
65{
66
67  if ( __inb(0x3f8 + 0x05) & 0x01 )
68    return __inb(0x3f8 + 0x00);
69  return -1;
70}
71
72#include <rtems/bspIo.h>
73
74static void simBSP_output_char(char c) { console_outbyte_polled( 0, c ); }
75
76BSP_output_char_function_type           BSP_output_char = simBSP_output_char;
77BSP_polling_getchar_function_type       BSP_poll_char = NULL;
Note: See TracBrowser for help on using the repository browser.