1 | /* |
---|
2 | * This file contains the hardware specific portions of the TTY driver |
---|
3 | * for the simulators stdin/out. |
---|
4 | * |
---|
5 | * Logic based on newlib-1.8.2/newlib/libc/sys/sh/syscalls.c |
---|
6 | * |
---|
7 | * COPYRIGHT (c) 1989-2000. |
---|
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.OARcorp.com/rtems/license.html. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #include <bsp.h> |
---|
18 | #include <rtems/libio.h> |
---|
19 | #include <stdlib.h> |
---|
20 | #include <assert.h> |
---|
21 | |
---|
22 | |
---|
23 | #define SYS_exit 1 |
---|
24 | #define SYS_read 3 |
---|
25 | #define SYS_write 4 |
---|
26 | |
---|
27 | int errno ; |
---|
28 | |
---|
29 | extern int __trap34(int, int, void*, int ); |
---|
30 | |
---|
31 | /* |
---|
32 | * console_initialize_hardware |
---|
33 | * |
---|
34 | * This routine initializes the console hardware. |
---|
35 | * |
---|
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 | |
---|
49 | void console_outbyte_polled( |
---|
50 | int port, |
---|
51 | char ch |
---|
52 | ) |
---|
53 | { |
---|
54 | __trap34 (SYS_write, 1, &ch, 1); |
---|
55 | return; |
---|
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 | unsigned char c; |
---|
69 | |
---|
70 | return __trap34 (SYS_read, 0, &c, 1); |
---|
71 | } |
---|
72 | |
---|
73 | /* XXX wrong place for this */ |
---|
74 | _sys_exit (n) |
---|
75 | { |
---|
76 | return __trap34 (SYS_exit, n, 0, 0); |
---|
77 | } |
---|
78 | |
---|