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.com/license/LICENSE. |
---|
11 | * |
---|
12 | * $Id$ |
---|
13 | */ |
---|
14 | |
---|
15 | #include <bsp.h> |
---|
16 | #include <rtems/libio.h> |
---|
17 | #include <stdlib.h> |
---|
18 | #include <assert.h> |
---|
19 | |
---|
20 | static void |
---|
21 | __outb(int port, unsigned char v) |
---|
22 | { |
---|
23 | *((volatile unsigned char *)(0x80000000 + port)) = v; |
---|
24 | } |
---|
25 | |
---|
26 | static unsigned char |
---|
27 | __inb(int port) |
---|
28 | { |
---|
29 | return *((volatile unsigned char *)(0x80000000 + port)); |
---|
30 | } |
---|
31 | |
---|
32 | /* |
---|
33 | * console_initialize_hardware |
---|
34 | * |
---|
35 | * This routine initializes the console hardware. |
---|
36 | * |
---|
37 | */ |
---|
38 | void console_initialize_hardware(void) |
---|
39 | { |
---|
40 | return; |
---|
41 | } |
---|
42 | |
---|
43 | /* |
---|
44 | * console_outbyte_polled |
---|
45 | * |
---|
46 | * This routine transmits a character using polling. |
---|
47 | */ |
---|
48 | void console_outbyte_polled( |
---|
49 | int port, |
---|
50 | char ch |
---|
51 | ) |
---|
52 | { |
---|
53 | __outb(0x3f8 + 0x00, ch); |
---|
54 | } |
---|
55 | |
---|
56 | /* |
---|
57 | * console_inbyte_nonblocking |
---|
58 | * |
---|
59 | * This routine polls for a character. |
---|
60 | */ |
---|
61 | int console_inbyte_nonblocking( |
---|
62 | int port |
---|
63 | ) |
---|
64 | { |
---|
65 | |
---|
66 | if ( __inb(0x3f8 + 0x05) & 0x01 ) |
---|
67 | return __inb(0x3f8 + 0x00); |
---|
68 | return -1; |
---|
69 | } |
---|
70 | |
---|
71 | #include <rtems/bspIo.h> |
---|
72 | |
---|
73 | void simBSP_output_char(char c) { console_outbyte_polled( 0, c ); } |
---|
74 | |
---|
75 | BSP_output_char_function_type BSP_output_char = simBSP_output_char; |
---|
76 | BSP_polling_getchar_function_type BSP_poll_char = NULL; |
---|