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-1997. |
---|
6 | * On-Line Applications Research Corporation (OAR). |
---|
7 | * Copyright assigned to U.S. Government, 1994. |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.OARcorp.com/rtems/license.html. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #include <bsp.h> |
---|
17 | #include <rtems/libio.h> |
---|
18 | #include <stdlib.h> |
---|
19 | #include <assert.h> |
---|
20 | |
---|
21 | /* external prototypes for monitor interface routines */ |
---|
22 | |
---|
23 | extern int armulator_stdin; |
---|
24 | extern int armulator_stdout; |
---|
25 | extern int armulator_stderr; |
---|
26 | |
---|
27 | /* |
---|
28 | * console_initialize_hardware |
---|
29 | * |
---|
30 | * This routine initializes the console hardware. |
---|
31 | * |
---|
32 | */ |
---|
33 | |
---|
34 | void console_initialize_hardware(void) |
---|
35 | { |
---|
36 | return; |
---|
37 | } |
---|
38 | |
---|
39 | /* |
---|
40 | * console_outbyte_polled |
---|
41 | * |
---|
42 | * This routine transmits a character using polling. |
---|
43 | */ |
---|
44 | |
---|
45 | void console_outbyte_polled( |
---|
46 | int port, |
---|
47 | char ch |
---|
48 | ) |
---|
49 | { |
---|
50 | int nwritten; |
---|
51 | int _swiwrite (int, char *, int); |
---|
52 | |
---|
53 | nwritten = _swiwrite (armulator_stdout, &ch , 1); |
---|
54 | |
---|
55 | /* error if (nwritten == -1 || nwritten == len) */ |
---|
56 | } |
---|
57 | |
---|
58 | /* |
---|
59 | * console_inbyte_nonblocking |
---|
60 | * |
---|
61 | * This routine polls for a character. |
---|
62 | */ |
---|
63 | |
---|
64 | int console_inbyte_nonblocking( |
---|
65 | int port |
---|
66 | ) |
---|
67 | { |
---|
68 | int nread; |
---|
69 | char c; |
---|
70 | int _swiread (int, char *, int); |
---|
71 | |
---|
72 | nread = _swiread (armulator_stdin, &c, 1); |
---|
73 | if ( nread != 1 ) |
---|
74 | return -1; |
---|
75 | |
---|
76 | return c; |
---|
77 | } |
---|
78 | |
---|
79 | #include <bspIo.h> |
---|
80 | |
---|
81 | void Armulator_BSP_output_char(char c) { console_outbyte_polled( 0, c ); } |
---|
82 | |
---|
83 | BSP_output_char_function_type BSP_output_char = Armulator_BSP_output_char; |
---|
84 | BSP_polling_getchar_function_type BSP_poll_char = NULL; |
---|
85 | |
---|