xref: /illumos-gate/usr/src/uts/common/sys/vgasubr.h (revision 8a2b682e57a046b828f37bcde1776f131ef4629f)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_VGASUBR_H
28 #define	_SYS_VGASUBR_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #ifdef _KERNEL
35 
36 struct vgaregmap {
37 	uint8_t			*addr;
38 	ddi_acc_handle_t	handle;
39 	boolean_t		mapped;
40 };
41 typedef struct vgaregmap *vgaregmap_t;
42 
43 #elif defined(_STANDALONE)
44 
45 typedef uint_t vgaregmap_t;
46 
47 #endif
48 
49 extern int vga_get_reg(vgaregmap_t reg, int i);
50 extern void vga_set_reg(vgaregmap_t reg, int i, int v);
51 extern int vga_get_crtc(vgaregmap_t reg, int i);
52 extern void vga_set_crtc(vgaregmap_t reg, int i, int v);
53 extern int vga_get_seq(vgaregmap_t reg, int i);
54 extern void vga_set_seq(vgaregmap_t reg, int i, int v);
55 extern int vga_get_grc(vgaregmap_t reg, int i);
56 extern void vga_set_grc(vgaregmap_t reg, int i, int v);
57 extern int vga_get_atr(vgaregmap_t reg, int i);
58 extern void vga_set_atr(vgaregmap_t reg, int i, int v);
59 extern void vga_put_cmap(vgaregmap_t reg,
60 	int index, unsigned char r, unsigned char g, unsigned char b);
61 extern void vga_get_cmap(vgaregmap_t reg,
62 	int index, unsigned char *r, unsigned char *g, unsigned char *b);
63 extern void vga_get_hardware_settings(vgaregmap_t reg,
64 	int *width, int *height);
65 extern void vga_set_indexed(vgaregmap_t reg, int indexreg,
66 	int datareg, unsigned char index, unsigned char val);
67 extern int vga_get_indexed(vgaregmap_t reg, int indexreg,
68 	int datareg, unsigned char index);
69 
70 #define	VGA_MISC_TEXT	0x67
71 #define	NUM_CRTC_REG	25
72 #define	NUM_SEQ_REG	5
73 #define	NUM_GRC_REG	9
74 #define	NUM_ATR_REG	21
75 
76 extern unsigned char VGA_ATR_TEXT[NUM_ATR_REG];
77 extern unsigned char VGA_SEQ_TEXT[NUM_SEQ_REG];
78 extern unsigned char VGA_CRTC_TEXT[NUM_CRTC_REG];
79 extern unsigned char VGA_GRC_TEXT[NUM_GRC_REG];
80 extern unsigned char VGA_TEXT_PALETTES[64][3];
81 
82 #if	defined(DEBUG)
83 extern void vga_dump_regs(vgaregmap_t reg,
84 	int maxseq, int maxcrtc, int maxatr, int maxgrc);
85 #endif
86 
87 
88 #ifdef	__cplusplus
89 }
90 #endif
91 
92 #endif /* _SYS_VGASUBR_H */
93