xref: /illumos-gate/usr/src/uts/common/sys/vgasubr.h (revision 581cede61ac9c14d8d4ea452562a567189eead78)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SunOS4.1 1.11 */
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 struct vgaregmap {
37 	uint8_t			*addr;
38 	ddi_acc_handle_t	handle;
39 	boolean_t		mapped;
40 };
41 
42 extern int vga_get_reg(struct vgaregmap *reg, int i);
43 extern void vga_set_reg(struct vgaregmap *reg, int i, int v);
44 extern int vga_get_crtc(struct vgaregmap *reg, int i);
45 extern void vga_set_crtc(struct vgaregmap *reg, int i, int v);
46 extern int vga_get_seq(struct vgaregmap *reg, int i);
47 extern void vga_set_seq(struct vgaregmap *reg, int i, int v);
48 extern int vga_get_grc(struct vgaregmap *reg, int i);
49 extern void vga_set_grc(struct vgaregmap *reg, int i, int v);
50 extern int vga_get_atr(struct vgaregmap *reg, int i);
51 extern void vga_set_atr(struct vgaregmap *reg, int i, int v);
52 extern void vga_put_cmap(struct vgaregmap *reg,
53 	int index, unsigned char r, unsigned char g, unsigned char b);
54 extern void vga_get_cmap(struct vgaregmap *reg,
55 	int index, unsigned char *r, unsigned char *g, unsigned char *b);
56 extern void vga_get_hardware_settings(struct vgaregmap *reg,
57 	int *width, int *height);
58 extern void vga_set_indexed(struct vgaregmap *reg, int indexreg,
59 	int datareg, unsigned char index, unsigned char val);
60 extern int vga_get_indexed(struct vgaregmap *reg, int indexreg,
61 	int datareg, unsigned char index);
62 
63 #define	VGA_MISC_TEXT	0x67
64 #define	NUM_CRTC_REG	25
65 #define	NUM_SEQ_REG    	5
66 #define	NUM_GRC_REG	9
67 #define	NUM_ATR_REG	21
68 
69 extern unsigned char VGA_ATR_TEXT[NUM_ATR_REG];
70 extern unsigned char VGA_SEQ_TEXT[NUM_SEQ_REG];
71 extern unsigned char VGA_CRTC_TEXT[NUM_CRTC_REG];
72 extern unsigned char VGA_GRC_TEXT[NUM_GRC_REG];
73 extern unsigned char VGA_TEXT_PALETTES[64][3];
74 
75 #if	defined(DEBUG)
76 extern void vga_dump_regs(struct vgaregmap *reg,
77 	int maxseq, int maxcrtc, int maxatr, int maxgrc);
78 #endif
79 
80 
81 #ifdef	__cplusplus
82 }
83 #endif
84 
85 #endif /* _SYS_VGASUBR_H */
86