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

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on Mar 20, 2014 at 9:10:47 PM

Change all references of rtems.com to rtems.org.

  • 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 erc32.
4 *
5 *  COPYRIGHT (c) 1989-2008.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.org/license/LICENSE.
11 */
12
13#include <bsp.h>
14#include <rtems/libio.h>
15#include <stdlib.h>
16#include <assert.h>
17
18static void
19__outb(int port, unsigned char v)
20{
21  *((volatile unsigned char *)(0x80000000 + port)) = v;
22}
23
24static unsigned char
25__inb(int port)
26{
27  return *((volatile unsigned char *)(0x80000000 + port));
28}
29
30/*
31 *  console_initialize_hardware
32 *
33 *  This routine initializes the console hardware.
34 *
35 */
36void console_initialize_hardware(void)
37{
38  return;
39}
40
41/*
42 *  console_outbyte_polled
43 *
44 *  This routine transmits a character using polling.
45 */
46void console_outbyte_polled(
47  int  port,
48  char ch
49)
50{
51  __outb(0x3f8 + 0x00, ch);
52}
53
54/*
55 *  console_inbyte_nonblocking
56 *
57 *  This routine polls for a character.
58 */
59int console_inbyte_nonblocking(
60  int port
61)
62{
63
64  if ( __inb(0x3f8 + 0x05) & 0x01 )
65    return __inb(0x3f8 + 0x00);
66  return -1;
67}
68
69#include <rtems/bspIo.h>
70
71void simBSP_output_char(char c) { console_outbyte_polled( 0, c ); }
72
73BSP_output_char_function_type           BSP_output_char = simBSP_output_char;
74BSP_polling_getchar_function_type       BSP_poll_char = NULL;
Note: See TracBrowser for help on using the repository browser.