Home | History | Annotate | Line # | Download | only in ic
igsfbvar.h revision 1.1
      1 /*	$NetBSD: igsfbvar.h,v 1.1 2002/03/30 19:48:55 uwe Exp $ */
      2 
      3 /*
      4  * Copyright (c) 2002 Valeriy E. Ushakov
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  * 3. The name of the author may not be used to endorse or promote products
     16  *    derived from this software without specific prior written permission
     17  *
     18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     23  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28  */
     29 
     30 /*
     31  * Integraphics Systems IGA 1682 and (untested) CyberPro 2k.
     32  */
     33 #ifndef _DEV_IC_IGSFBVAR_H_
     34 #define _DEV_IC_IGSFBVAR_H_
     35 
     36 
     37 #define	IGS_CMAP_SIZE	256	/* 256 R/G/B entries */
     38 struct igs_hwcmap {
     39 	u_int8_t r[IGS_CMAP_SIZE];
     40 	u_int8_t g[IGS_CMAP_SIZE];
     41 	u_int8_t b[IGS_CMAP_SIZE];
     42 };
     43 
     44 
     45 #define IGS_CURSOR_MAX_SIZE 64	/* 64x64 sprite */
     46 struct igs_hwcursor {
     47 	struct wsdisplay_curpos cc_pos;
     48 	struct wsdisplay_curpos cc_hot;
     49 	struct wsdisplay_curpos cc_size;
     50 	u_int8_t cc_image[512];		/* save copy of image for GCURSOR */
     51 	u_int8_t cc_mask[512];		/* save copy of mask for GCURSOR */
     52 	u_int16_t cc_sprite[512];	/* sprite in device 2bpp format */
     53 	u_int8_t cc_color[6];		/* 2 colors, 3 rgb components */
     54 };
     55 
     56 
     57 /*
     58  * Precomputed bit tables to convert 1bpp image/mask to 2bpp hw cursor
     59  * sprite.  For IGSFB_HW_BSWAP attachments they are pre-bswapped as well.
     60  */
     61 struct igs_bittab {
     62 	u_int16_t iexpand[256];	/* image: 0 -> 00, 1 -> 01 */
     63 	u_int16_t mexpand[256];	/* mask:  0 -> 00, 1 -> 11 */
     64 };
     65 
     66 struct igsfb_softc {
     67 	struct device sc_dev;
     68 
     69 	/* io registers */
     70 	bus_space_tag_t sc_iot;
     71 	bus_space_handle_t sc_ioh;
     72 
     73 	/* linear memory */
     74 	bus_space_tag_t sc_memt;
     75 	bus_addr_t sc_memaddr;		/* memory phys addr */
     76 	bus_size_t sc_memsz;		/* size of linear address space */
     77 	int sc_memflags;
     78 
     79 	/* fb part actually mapped for wsdisplay */
     80 	bus_space_handle_t sc_fbh;
     81 	bus_size_t sc_fbsz;
     82 
     83 	/* 1k of cursor sprite data */
     84 	bus_space_handle_t sc_crh;
     85 
     86 	/*
     87 	 * graphic coprocessor can be accessed either via i/o space or
     88 	 * via memory-mapped i/o access through memory space.
     89 	 */
     90 	bus_space_tag_t sc_copt;
     91 	bus_space_handle_t sc_coph;
     92 
     93 	/* IGA1682 vs CyberPro 2k (use version num. for finer distinction?) */
     94 	int sc_is2k;
     95 
     96 	/* flags that control driver operation */
     97 	int sc_hwflags;
     98 
     99 	struct rasops_info *sc_ri;
    100 
    101 	struct igs_hwcmap sc_cmap;	/* software copy of colormap */
    102 	struct igs_hwcursor sc_cursor;	/* software copy of cursor sprite */
    103 
    104 	/* precomputed bit tables for cursor sprite 1bpp -> 2bpp conversion */
    105 	struct igs_bittab *sc_bittab;
    106 
    107 	int nscreens;
    108 
    109 	int sc_blanked;			/* screen is currently blanked */
    110 	int sc_curenb;			/* cursor sprite enabled */
    111 };
    112 
    113 /* sc_hwflags */
    114 #define IGSFB_HW_BSWAP	1	/* endianness mismatch */
    115 
    116 
    117 /* methods for bus attachment glue */
    118 int	igsfb_io_enable(bus_space_tag_t, bus_addr_t);
    119 void	igsfb_mem_enable(struct igsfb_softc *);
    120 void	igsfb_common_attach(struct igsfb_softc *, int);
    121 
    122 #endif /* _DEV_IC_IGSFBVAR_H_ */
    123