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