xref: /illumos-gate/usr/src/uts/common/sys/vgasubr.h (revision 9890ff83)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_SYS_VGASUBR_H
287c478bd9Sstevel@tonic-gate #define	_SYS_VGASUBR_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
317c478bd9Sstevel@tonic-gate extern "C" {
327c478bd9Sstevel@tonic-gate #endif
337c478bd9Sstevel@tonic-gate 
34*9890ff83SToomas Soome #ifdef _KERNEL
35*9890ff83SToomas Soome 
367c478bd9Sstevel@tonic-gate struct vgaregmap {
377c478bd9Sstevel@tonic-gate 	uint8_t			*addr;
387c478bd9Sstevel@tonic-gate 	ddi_acc_handle_t	handle;
397c478bd9Sstevel@tonic-gate 	boolean_t		mapped;
407c478bd9Sstevel@tonic-gate };
41*9890ff83SToomas Soome typedef struct vgaregmap *vgaregmap_t;
42*9890ff83SToomas Soome 
43*9890ff83SToomas Soome #elif defined(_STANDALONE)
44*9890ff83SToomas Soome 
45*9890ff83SToomas Soome typedef uint_t vgaregmap_t;
46*9890ff83SToomas Soome 
47*9890ff83SToomas Soome #endif
487c478bd9Sstevel@tonic-gate 
49*9890ff83SToomas Soome extern int vga_get_reg(vgaregmap_t reg, int i);
50*9890ff83SToomas Soome extern void vga_set_reg(vgaregmap_t reg, int i, int v);
51*9890ff83SToomas Soome extern int vga_get_crtc(vgaregmap_t reg, int i);
52*9890ff83SToomas Soome extern void vga_set_crtc(vgaregmap_t reg, int i, int v);
53*9890ff83SToomas Soome extern int vga_get_seq(vgaregmap_t reg, int i);
54*9890ff83SToomas Soome extern void vga_set_seq(vgaregmap_t reg, int i, int v);
55*9890ff83SToomas Soome extern int vga_get_grc(vgaregmap_t reg, int i);
56*9890ff83SToomas Soome extern void vga_set_grc(vgaregmap_t reg, int i, int v);
57*9890ff83SToomas Soome extern int vga_get_atr(vgaregmap_t reg, int i);
58*9890ff83SToomas Soome extern void vga_set_atr(vgaregmap_t reg, int i, int v);
59*9890ff83SToomas Soome extern void vga_put_cmap(vgaregmap_t reg,
607c478bd9Sstevel@tonic-gate 	int index, unsigned char r, unsigned char g, unsigned char b);
61*9890ff83SToomas Soome extern void vga_get_cmap(vgaregmap_t reg,
627c478bd9Sstevel@tonic-gate 	int index, unsigned char *r, unsigned char *g, unsigned char *b);
63*9890ff83SToomas Soome extern void vga_get_hardware_settings(vgaregmap_t reg,
647c478bd9Sstevel@tonic-gate 	int *width, int *height);
65*9890ff83SToomas Soome extern void vga_set_indexed(vgaregmap_t reg, int indexreg,
667c478bd9Sstevel@tonic-gate 	int datareg, unsigned char index, unsigned char val);
67*9890ff83SToomas Soome extern int vga_get_indexed(vgaregmap_t reg, int indexreg,
687c478bd9Sstevel@tonic-gate 	int datareg, unsigned char index);
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate #define	VGA_MISC_TEXT	0x67
717c478bd9Sstevel@tonic-gate #define	NUM_CRTC_REG	25
72*9890ff83SToomas Soome #define	NUM_SEQ_REG	5
737c478bd9Sstevel@tonic-gate #define	NUM_GRC_REG	9
747c478bd9Sstevel@tonic-gate #define	NUM_ATR_REG	21
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate extern unsigned char VGA_ATR_TEXT[NUM_ATR_REG];
777c478bd9Sstevel@tonic-gate extern unsigned char VGA_SEQ_TEXT[NUM_SEQ_REG];
787c478bd9Sstevel@tonic-gate extern unsigned char VGA_CRTC_TEXT[NUM_CRTC_REG];
797c478bd9Sstevel@tonic-gate extern unsigned char VGA_GRC_TEXT[NUM_GRC_REG];
807c478bd9Sstevel@tonic-gate extern unsigned char VGA_TEXT_PALETTES[64][3];
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate #if	defined(DEBUG)
83*9890ff83SToomas Soome extern void vga_dump_regs(vgaregmap_t reg,
847c478bd9Sstevel@tonic-gate 	int maxseq, int maxcrtc, int maxatr, int maxgrc);
857c478bd9Sstevel@tonic-gate #endif
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
897c478bd9Sstevel@tonic-gate }
907c478bd9Sstevel@tonic-gate #endif
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate #endif /* _SYS_VGASUBR_H */
93