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-2011. |
---|
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.com/license/LICENSE. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #include <bsp.h> |
---|
18 | #include <rtems/libio.h> |
---|
19 | #include <stdlib.h> |
---|
20 | #include <assert.h> |
---|
21 | |
---|
22 | #include <bsp/syscall.h> |
---|
23 | |
---|
24 | int errno; |
---|
25 | |
---|
26 | extern int __trap34(int, int, void*, int ); |
---|
27 | |
---|
28 | /* |
---|
29 | * console_initialize_hardware |
---|
30 | * |
---|
31 | * This routine initializes the console hardware. |
---|
32 | * |
---|
33 | */ |
---|
34 | |
---|
35 | void console_initialize_hardware(void) |
---|
36 | { |
---|
37 | return; |
---|
38 | } |
---|
39 | |
---|
40 | /* |
---|
41 | * console_outbyte_polled |
---|
42 | * |
---|
43 | * This routine transmits a character using polling. |
---|
44 | */ |
---|
45 | |
---|
46 | void console_outbyte_polled( |
---|
47 | int port, |
---|
48 | char ch |
---|
49 | ) |
---|
50 | { |
---|
51 | __trap34 (SYS_write, 1, &ch, 1); |
---|
52 | return; |
---|
53 | } |
---|
54 | |
---|
55 | /* |
---|
56 | * console_inbyte_nonblocking |
---|
57 | * |
---|
58 | * This routine polls for a character. |
---|
59 | */ |
---|
60 | |
---|
61 | int console_inbyte_nonblocking( |
---|
62 | int port |
---|
63 | ) |
---|
64 | { |
---|
65 | unsigned char c; |
---|
66 | |
---|
67 | return __trap34 (SYS_read, 0, &c, 1); |
---|
68 | } |
---|
69 | |
---|
70 | /* XXX wrong place for this */ |
---|
71 | int _sys_exit (int n) |
---|
72 | { |
---|
73 | return __trap34 (SYS_exit, n, 0, 0); |
---|
74 | } |
---|