1 | /* dve.c -- I/O code for the Densan DVE-R3900 board. |
---|
2 | * |
---|
3 | * Copyright (c) 1998, 1999 Cygnus Support |
---|
4 | * |
---|
5 | * The authors hereby grant permission to use, copy, modify, distribute, |
---|
6 | * and license this software and its documentation for any purpose, provided |
---|
7 | * that existing copyright notices are retained in all copies and that this |
---|
8 | * notice is included verbatim in any distributions. No written agreement, |
---|
9 | * license, or royalty fee is required for any of the authorized uses. |
---|
10 | * Modifications to this software may be copyrighted by their authors |
---|
11 | * and need not follow the licensing terms described here, provided that |
---|
12 | * the new terms are clearly indicated on the first page of each file where |
---|
13 | * they apply. |
---|
14 | */ |
---|
15 | |
---|
16 | /* Flag indicating that we are being debugged by GDB. If set, |
---|
17 | preceded each character output to the console with a ^O, |
---|
18 | so that GDB will print it instead of discarding it. */ |
---|
19 | |
---|
20 | int output_debug = 1; |
---|
21 | |
---|
22 | /* Monitor "ci" function (console input) */ |
---|
23 | |
---|
24 | typedef int (*cifunc)(int waitflag); |
---|
25 | #ifdef __mips64 |
---|
26 | static cifunc ci = (cifunc) 0xffffffffbfc00010L; |
---|
27 | #else |
---|
28 | static cifunc ci = (cifunc) 0xbfc00010; |
---|
29 | #endif |
---|
30 | |
---|
31 | #define WAIT 1 |
---|
32 | #define NOWAIT 0 |
---|
33 | #define NOCHAR (-1) |
---|
34 | |
---|
35 | /* Monitor "co" function (console output) */ |
---|
36 | |
---|
37 | typedef void (*cofunc)(int c); |
---|
38 | #ifdef __mips64 |
---|
39 | static cofunc co = (cofunc) 0xffffffffbfc00018L; |
---|
40 | #else |
---|
41 | static cofunc co = (cofunc) 0xbfc00018; |
---|
42 | #endif |
---|
43 | |
---|
44 | /* outbyte -- shove a byte out the serial port; used by write.c. */ |
---|
45 | |
---|
46 | int |
---|
47 | outbyte(byte) |
---|
48 | unsigned char byte; |
---|
49 | { |
---|
50 | /* Output a ^O prefix so that GDB won't discard the output. */ |
---|
51 | if (output_debug) |
---|
52 | co (0x0f); |
---|
53 | |
---|
54 | co (byte); |
---|
55 | return byte; |
---|
56 | } |
---|
57 | |
---|
58 | /* inbyte -- get a byte from the serial port; used by read.c. */ |
---|
59 | |
---|
60 | unsigned char |
---|
61 | inbyte() |
---|
62 | { |
---|
63 | return (unsigned char) ci (WAIT); |
---|
64 | } |
---|
65 | |
---|
66 | |
---|
67 | /* Structure filled in by get_mem_info. Only the size field is |
---|
68 | actually used (by sbrk), so the others aren't even filled in. */ |
---|
69 | |
---|
70 | struct s_mem |
---|
71 | { |
---|
72 | unsigned int size; |
---|
73 | unsigned int icsize; |
---|
74 | unsigned int dcsize; |
---|
75 | }; |
---|
76 | |
---|
77 | |
---|
78 | void |
---|
79 | get_mem_info (mem) |
---|
80 | struct s_mem *mem; |
---|
81 | { |
---|
82 | mem->size = 0x1000000; /* DVE-R3900 board has 16 MB of RAM */ |
---|
83 | } |
---|