Home | History | Annotate | Line # | Download | only in tc
sticvar.h revision 1.13.2.4
      1 /* 	$NetBSD: sticvar.h,v 1.13.2.4 2004/11/21 08:53:50 skrll Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Andrew Doran.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *	This product includes software developed by the NetBSD
     21  *	Foundation, Inc. and its contributors.
     22  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  *    contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  * POSSIBILITY OF SUCH DAMAGE.
     37  */
     38 
     39 #ifndef _TC_STICVAR_H_
     40 #define	_TC_STICVAR_H_
     41 
     42 #if defined(pmax)
     43 #define	STIC_KSEG_TO_PHYS(x)	MIPS_KSEG0_TO_PHYS(x)
     44 #elif defined(alpha)
     45 #define	STIC_KSEG_TO_PHYS(x)	ALPHA_K0SEG_TO_PHYS((vaddr_t)x)
     46 #else
     47 #error No support for your architecture
     48 #endif
     49 
     50 #define	STIC_MAXDV	5
     51 
     52 struct stic_hwcmap256 {
     53 #define	CMAP_SIZE	256	/* 256 R/G/B entries */
     54 	u_int8_t	r[CMAP_SIZE];
     55 	u_int8_t	g[CMAP_SIZE];
     56 	u_int8_t	b[CMAP_SIZE];
     57 };
     58 
     59 struct stic_hwcursor64 {
     60 	struct	wsdisplay_curpos cc_pos;
     61 	struct	wsdisplay_curpos cc_hot;
     62 	struct	wsdisplay_curpos cc_size;
     63 #define	CURSOR_MAX_SIZE	64
     64 	u_int8_t	cc_color[6];
     65 	u_int64_t	cc_image[CURSOR_MAX_SIZE];
     66 	u_int64_t	cc_mask[CURSOR_MAX_SIZE];
     67 };
     68 
     69 struct stic_screen {
     70 	struct	stic_info *ss_si;
     71 	u_int16_t	*ss_backing;
     72 	int	ss_flags;
     73 	int	ss_curx;
     74 	int	ss_cury;
     75 };
     76 
     77 #define	SS_ALLOCED		0x01
     78 #define	SS_ACTIVE		0x02
     79 #define	SS_CURENB		0x04
     80 
     81 struct stic_info {
     82 	struct device	*si_dv;
     83 
     84 	u_int32_t	*si_stamp;
     85 	u_int32_t	*si_buf;
     86 	u_int32_t	*si_vdac;
     87 	u_int32_t	*si_vdac_reset;
     88 	volatile struct	stic_regs *si_stic;
     89 	volatile struct stic_xcomm *si_sxc;
     90 
     91 	u_int32_t	*(*si_pbuf_get)(struct stic_info *);
     92 	int	(*si_pbuf_post)(struct stic_info *, u_int32_t *);
     93 	int	(*si_ioctl)(struct stic_info *, u_long, caddr_t, int,
     94 			   struct lwp *);
     95 	int	si_pbuf_select;
     96 	int	si_hwflags;
     97 
     98 	struct	stic_screen *si_curscreen;
     99 	struct	wsdisplay_font *si_font;
    100 
    101 	int	si_consw;
    102 	int	si_consh;
    103 	int	si_fontw;
    104 	int	si_fonth;
    105 	int	si_stamph;
    106 	int	si_stamphm;
    107 	int	si_stampw;
    108 	int	si_depth;
    109 	int	si_disptype;
    110 	int	si_dispmode;
    111 	int	si_unit;
    112 
    113 	tc_addr_t si_slotbase;
    114 	paddr_t	si_buf_phys;
    115 	size_t	si_buf_size;
    116 
    117 	int	si_flags;
    118 	struct	stic_hwcursor64 si_cursor;
    119 	struct	stic_hwcmap256 si_cmap;
    120 
    121 	struct	callout si_switch_callout;
    122 	void	(*si_switchcb)(void *, int, int);
    123 	void	*si_switchcbarg;
    124 };
    125 
    126 #define	SI_CURENB_CHANGED	0x0001
    127 #define	SI_CURCMAP_CHANGED	0x0002
    128 #define	SI_CURSHAPE_CHANGED	0x0004
    129 #define	SI_CMAP_CHANGED		0x0008
    130 #define	SI_ALL_CHANGED		0x000f
    131 #define	SI_DVOPEN		0x0010
    132 
    133 void	stic_init(struct stic_info *);
    134 void	stic_attach(struct device *, struct stic_info *, int);
    135 void	stic_cnattach(struct stic_info *);
    136 void	stic_reset(struct stic_info *);
    137 void	stic_flush(struct stic_info *);
    138 
    139 extern struct stic_info stic_consinfo;
    140 
    141 #endif	/* !_TC_STICVAR_H_ */
    142