1: /* serial IO for the beagle board
2:
3: Copyright (C) 2010 Free Software Foundation, Inc.
4:
5: This file is part of Gforth.
6:
7: Gforth is free software; you can redistribute it and/or
8: modify it under the terms of the GNU General Public License
9: as published by the Free Software Foundation, either version 3
10: of the License, or (at your option) any later version.
11:
12: This program is distributed in the hope that it will be useful,
13: but WITHOUT ANY WARRANTY; without even the implied warranty of
14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: GNU General Public License for more details.
16:
17: You should have received a copy of the GNU General Public License
18: along with this program; if not, see http://www.gnu.org/licenses/.
19: */
20:
21: /* This file is a stub for now */
22:
23: int terminal_prepped = 0;
24:
25: void prep_terminal ()
26: {
27: serial_init();
28:
29: terminal_prepped = 1;
30: }
31:
32: void deprep_terminal ()
33: {
34: terminal_prepped = 0;
35: }
36:
37: long key_avail ()
38: {
39: if(!terminal_prepped) prep_terminal();
40:
41: return serial_tstc();
42: }
43:
44: long getkey()
45: {
46: if(!terminal_prepped) prep_terminal();
47:
48: return key_avail() ? serial_getc() : 0;
49: }
50:
51: void emit_char(char x)
52: {
53: if(!terminal_prepped) prep_terminal();
54:
55: serial_putc(x);
56: }
57:
58: void type_chars(char *addr, unsigned int l)
59: {
60: if(!terminal_prepped) prep_terminal();
61:
62: while(l--) serial_putc(*addr++);
63: }
64:
65: /* Stubs for interrupts */
66:
67: void do_undefined_instruction()
68: {
69: }
70:
71: void do_software_interrupt()
72: {
73: }
74:
75: void do_prefetch_abort()
76: {
77: }
78:
79: void do_data_abort()
80: {
81: }
82:
83: void do_not_used()
84: {
85: }
86:
87: void do_irq()
88: {
89: }
90:
91: void do_fiq()
92: {
93: }
94:
95: #define ADDRLEN(x) x, strlen(x)
96:
97: void start_armboot()
98: {
99: char **argv = { "gforth-ec", 0L };
100:
101: // type_chars(ADDRLEN("Welcome to Gforth on Beagle Board\n"));
102: main(1, argv, 0L);
103: }
104:
105: void lowlevel_init()
106: {
107: }
108:
109: void cpy_clk_code()
110: {
111: }
112:
113: void *memset(char *s, int c, unsigned int n)
114: {
115: while(n--) *s++ = c;
116: return s;
117: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>