console.h revision 1.1.18.2 1 1.1.18.2 yamt /* $NetBSD: console.h,v 1.1.18.2 2006/06/21 14:51:20 yamt Exp $ */
2 1.1.18.2 yamt
3 1.1.18.2 yamt /*-
4 1.1.18.2 yamt * Copyright (c) 2004, 2005 The NetBSD Foundation, Inc.
5 1.1.18.2 yamt * All rights reserved.
6 1.1.18.2 yamt *
7 1.1.18.2 yamt * This code is derived from software contributed to The NetBSD Foundation
8 1.1.18.2 yamt * by UCHIYAMA Yasushi.
9 1.1.18.2 yamt *
10 1.1.18.2 yamt * Redistribution and use in source and binary forms, with or without
11 1.1.18.2 yamt * modification, are permitted provided that the following conditions
12 1.1.18.2 yamt * are met:
13 1.1.18.2 yamt * 1. Redistributions of source code must retain the above copyright
14 1.1.18.2 yamt * notice, this list of conditions and the following disclaimer.
15 1.1.18.2 yamt * 2. Redistributions in binary form must reproduce the above copyright
16 1.1.18.2 yamt * notice, this list of conditions and the following disclaimer in the
17 1.1.18.2 yamt * documentation and/or other materials provided with the distribution.
18 1.1.18.2 yamt * 3. All advertising materials mentioning features or use of this software
19 1.1.18.2 yamt * must display the following acknowledgement:
20 1.1.18.2 yamt * This product includes software developed by the NetBSD
21 1.1.18.2 yamt * Foundation, Inc. and its contributors.
22 1.1.18.2 yamt * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1.18.2 yamt * contributors may be used to endorse or promote products derived
24 1.1.18.2 yamt * from this software without specific prior written permission.
25 1.1.18.2 yamt *
26 1.1.18.2 yamt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1.18.2 yamt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1.18.2 yamt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1.18.2 yamt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1.18.2 yamt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1.18.2 yamt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1.18.2 yamt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1.18.2 yamt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1.18.2 yamt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1.18.2 yamt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1.18.2 yamt * POSSIBILITY OF SUCH DAMAGE.
37 1.1.18.2 yamt */
38 1.1.18.2 yamt
39 1.1.18.2 yamt #define FB_LINEBYTES 2048
40 1.1.18.2 yamt #define FB_WIDTH 1284
41 1.1.18.2 yamt #define FB_HEIGHT 1024
42 1.1.18.2 yamt
43 1.1.18.2 yamt #define CONS_WIDTH (FB_WIDTH / ROM_FONT_WIDTH)
44 1.1.18.2 yamt #define CONS_HEIGHT (FB_HEIGHT / ROM_FONT_HEIGHT)
45 1.1.18.2 yamt
46 1.1.18.2 yamt #define X_INIT 0
47 1.1.18.2 yamt #define Y_INIT 0
48 1.1.18.2 yamt
49 1.1.18.2 yamt #define CONS_FG 0xff
50 1.1.18.2 yamt #define CONS_BG 0x00
51 1.1.18.2 yamt
52 1.1.18.2 yamt /*
53 1.1.18.2 yamt * TR2, TR2A IPL CLUT.
54 1.1.18.2 yamt *
55 1.1.18.2 yamt * 1 red
56 1.1.18.2 yamt * 2 green
57 1.1.18.2 yamt * 4 blue
58 1.1.18.2 yamt * 8 yellow
59 1.1.18.2 yamt * 16 cyan
60 1.1.18.2 yamt * 32 magenta
61 1.1.18.2 yamt * 64 light gray
62 1.1.18.2 yamt * 128 dark gray
63 1.1.18.2 yamt * 255 white
64 1.1.18.2 yamt * other black
65 1.1.18.2 yamt */
66 1.1.18.2 yamt
67 1.1.18.2 yamt enum console_type {
68 1.1.18.2 yamt CONS_ROM, /* ROM console I/O */
69 1.1.18.2 yamt CONS_FB_KSEG2, /* direct fb device access via KSEG2 */
70 1.1.18.2 yamt CONS_FB_KSEG1, /* direct fb device access via KSEG1 */
71 1.1.18.2 yamt CONS_SIO1, /* serial console port 1 */
72 1.1.18.2 yamt CONS_SIO2, /* serial console port 2 */
73 1.1.18.2 yamt };
74 1.1.18.2 yamt
75 1.1.18.2 yamt struct cons {
76 1.1.18.2 yamt void (*init)(void);
77 1.1.18.2 yamt void (*putc)(int, int, int);
78 1.1.18.2 yamt int (*getc)(void);
79 1.1.18.2 yamt int (*scan)(void);
80 1.1.18.2 yamt void (*scroll)(void);
81 1.1.18.2 yamt void (*cursor)(int, int);
82 1.1.18.2 yamt int x, y;
83 1.1.18.2 yamt enum console_type type;
84 1.1.18.2 yamt boolean_t erace_previous_cursor;
85 1.1.18.2 yamt boolean_t cursor_enable;
86 1.1.18.2 yamt };
87 1.1.18.2 yamt
88 1.1.18.2 yamt struct fb {
89 1.1.18.2 yamt uint8_t *fb_addr;
90 1.1.18.2 yamt uint32_t fb_size;
91 1.1.18.2 yamt uint8_t *font_addr;
92 1.1.18.2 yamt boolean_t active;
93 1.1.18.2 yamt };
94 1.1.18.2 yamt
95 1.1.18.2 yamt struct zskbd {
96 1.1.18.2 yamt volatile uint8_t *status;
97 1.1.18.2 yamt volatile uint8_t *data;
98 1.1.18.2 yamt const uint8_t *normal;
99 1.1.18.2 yamt const uint8_t *shift;
100 1.1.18.2 yamt const uint8_t *ctrl;
101 1.1.18.2 yamt const uint8_t *capslock;
102 1.1.18.2 yamt u_int keymap;
103 1.1.18.2 yamt int print;
104 1.1.18.2 yamt };
105 1.1.18.2 yamt
106 1.1.18.2 yamt struct zs {
107 1.1.18.2 yamt volatile uint8_t *csr;
108 1.1.18.2 yamt volatile uint8_t *data;
109 1.1.18.2 yamt int clock;
110 1.1.18.2 yamt };
111 1.1.18.2 yamt
112 1.1.18.2 yamt void fb_set_addr(uint32_t, uint32_t, uint32_t);
113 1.1.18.2 yamt void *fb_get_addr(void);
114 1.1.18.2 yamt void fb_init(void);
115 1.1.18.2 yamt void fb_scroll(void);
116 1.1.18.2 yamt void fb_drawchar(int, int, int);
117 1.1.18.2 yamt void fb_drawfont(int, int, uint16_t *);
118 1.1.18.2 yamt void fb_drawcursor(int, int);
119 1.1.18.2 yamt void fb_clear(int, int, int, int, int);
120 1.1.18.2 yamt void fb_copy(int, int, int, int, int, int);
121 1.1.18.2 yamt void fb_active(boolean_t);
122 1.1.18.2 yamt
123 1.1.18.2 yamt void zskbd_set_addr(uint32_t, uint32_t);
124 1.1.18.2 yamt int zskbd_getc(void);
125 1.1.18.2 yamt int zskbd_scan(void);
126 1.1.18.2 yamt void zskbd_print_keyscan(int);
127 1.1.18.2 yamt
128 1.1.18.2 yamt void zs_set_addr(uint32_t, uint32_t, int);
129 1.1.18.2 yamt
130 1.1.18.2 yamt void cons_rom_scroll(void);
131 1.1.18.2 yamt void cons_rom_init(void);
132 1.1.18.2 yamt int rom_scan(void);
133 1.1.18.2 yamt
134 1.1.18.2 yamt enum console_type console_type(void);
135 1.1.18.2 yamt void console_init(void);
136 1.1.18.2 yamt void console_cursor(boolean_t);
137 1.1.18.2 yamt
138 1.1.18.2 yamt int cnscan(void);
139 1.1.18.2 yamt
140 1.1.18.2 yamt extern struct cons cons;
141 1.1.18.2 yamt extern struct zskbd zskbd;
142 1.1.18.2 yamt extern struct fb fb;
143 1.1.18.2 yamt extern struct zs zs;
144