Home | History | Annotate | Line # | Download | only in ic
ibm561reg.h revision 1.3
      1 /* $NetBSD: ibm561reg.h,v 1.3 2007/08/27 19:46:45 macallan Exp $ */
      2 
      3 /*-
      4  * Copyright (c) 2001 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Roland C. Dowdeswell of Ponte, Inc.
      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 #define IBM561_ADDR_LOW			0x00
     40 #define IBM561_ADDR_HIGH		0x01
     41 #define IBM561_CMD			0x02
     42 #define IBM561_CMD_FB_WAT		0x03
     43 #define IBM561_CMD_CMAP			0x03
     44 #define IBM561_CMD_GAMMA		0x03
     45 
     46 #define IBM561_CONFIG_REG1		0x0001
     47 	#define CR1_MODEMASK		0xe0
     48 		#define CR1_MODE_5_1_BASIC	0x00
     49 		#define CR1_MODE_4_1_BASIC	0x20
     50 		#define CR1_MODE_4_1_EXTENDED	0x40
     51 		#define CR1_MODE_4_1_SUPER_EXT	0x60
     52 		#define CR1_MODE_5_1_30BPP	0x80
     53 		#define CR1_MODE_8_1_MODE_B	0xa0
     54 		#define CR1_MODE_4_1_30BPP	0xc0
     55 		#define CR1_MODE_8_1_MODE_A	0xe0
     56 	#define CR1_OVL_MASK		0x18
     57 		#define CR1_OVL_NONE		0x00
     58 		#define CR1_OVL_8BPP		0x08
     59 		#define CR1_OVL_16BPP		0x10
     60 		#define CR1_OVL_VARIABLE	0x18
     61 	#define CR1_WID_BITS_MASK	0x07
     62 		#define CR1_WID_0	0x00
     63 		#define CR1_WID_2	0x01
     64 		#define CR1_WID_4	0x02
     65 		#define CR1_WID_6	0x03
     66 		#define CR1_WID_8	0x04
     67 
     68 #define IBM561_CONFIG_REG2		0x0002
     69 	#define CR2_ENABLE_VRAM_MASKING	0x20
     70 	#define CR2_ENABLE_PLL		0x10
     71 	#define CR2_ENABLE_CLC		0x08	/* sane handling of cursor
     72 						 * coordinate updates, without
     73 						 * this updates occur
     74 						 * immediately instead of
     75 						 * waiting for the 2nd byte */
     76 	#define CR2_PLL_REF_SELECT	0x04	/* 0 - REFCLK, 1 - EXTCLK */
     77 	#define CR2_PIXEL_CLOCK_SELECT	0x02	/* 0 - PLL, 1 - EXTCLK */
     78 	#define CR2_ENABLE_RGB_OUTPUT	0x01
     79 
     80 #define IBM561_CONFIG_REG3		0x0003
     81 	#define CR3_ENABLE_INTERLACE	0x80
     82 	#define CR3_SERIAL_CLK_CTRL	0x40	/* 1 - enable output */
     83 	#define CR3_FIELD_POLARITY	0x20	/* 0 - EVEN first */
     84 	#define CR3_ENABLE_MISR		0x10	/* diagnostic mode */
     85 	#define CR3_CURSOR_UPDATE_ASYNC	0x08	/* don't wait for VBLANK */
     86 	#define CR3_ENABLE_VIDEO	0x04	/* AUX video output */
     87 	#define CR3_RGB			0x01	/* 1 - RGB, 0 - BGR */
     88 
     89 #define IBM561_CONFIG_REG4		0x0004
     90 	#define CR4_FB_SLPIT_WID_MASK	0x78	/* number of FB WID bits */
     91 	#define CR4_ENABLE_SPLIT_WID	0x04
     92 	#define CR4_SELECT_OL_WID	0x02	/* 1 - use upper 4 bit for OL */
     93 	#define CR4_SELECT_FB_WID	0x01	/* 1 - use upper 4 bit for FB */
     94 
     95 #define IBM561_SYNC_CNTL		0x0020
     96 	#define SYNC_HSYNC_ENABLE	0x20
     97 	#define SYNC_HSYNC_POLARITY	0x08	/* 1 - active high */
     98 	#define SYNC_SYNC_ON_GREEN	0x02
     99 	#define SYNC_ENABLE_PEDESTAL	0x01
    100 
    101 #define IBM561_PLL_VCO_DIV		0x0021
    102 #define IBM561_PLL_REF_REG		0x0022
    103 #define IBM561_CURS_CNTL_REG		0x0030
    104 	#define CURS_COLOR_3_TRANS	0x80	/* 0 - color 3, 1 - trans */
    105 	#define CURS_SEPARATE		0x40	/* move crosshair separately */
    106 	#define CURS_OVERLAP_MASK	0x30
    107 	#define CURS_OVERLAP_XOR	0x00	/* XOR cursor and xhair */
    108 	#define CURS_OVERLAP_OR		0x10
    109 	#define CURS_OVERLAP_CURSOR	0x20	/* cursor has priority */
    110 	#define CURS_OVERLAP_XHAIR	0x30	/* crosshair has priority */
    111 	#define CURS_XHAIR_BLINK	0x08	/* enable xhair blinking */
    112 	#define CURS_XHAIR_ENABLE	0x04
    113 	#define CURS_BLINK		0x02	/* blink cursor */
    114 	#define CURS_ENABLE		0x01	/* enable cursor */
    115 
    116 #define IBM561_XHAIR_CONTROL_REG	0x0031
    117 	#define XHAIR_PRIORITY		0x80	/* FILL or OUTLINE colour */
    118 	#define XHAIR_WIDTH_MASK	0x60
    119 	#define XHAIR_WIDTH_1		0x00
    120 	#define XHAIR_WIDTH_3		0x20
    121 	#define XHAIR_WIDTH_5		0x40
    122 	#define XHAIR_WIDTH_7		0x60
    123 	#define XHAIR_CLIP_MASK		0x18
    124 	#define XHAIR_CLIP_NONE		0x00
    125 	#define XHAIR_CLIP_SCISSORS	0x08	/* use scissors registers */
    126 	#define XHAIR_CLIP_WINDOW	0x10	/* use window registers */
    127 	#define XHAIR_CLIP_BOTH		0x18	/* window/scissor intersect */
    128 	#define XHAIR_COLOR_MASK	0x06	/* 0 is transparent */
    129 	#define XHAIR_EXT_PATTERN	0x01	/* enables colours, patterns */
    130 
    131 #define IBM561_CURSOR_BLINK_RATE	0x0032
    132 #define IBM561_CURSOR_BLINK_DUTY	0x0033
    133 #define IBM561_HOTSPOT_REG		0x0034
    134 #define IBM561_HOTSPOT_X_REG		0x0034
    135 #define IBM561_HOTSPOT_Y_REG		0x0035
    136 
    137 /* two registers each, low 8 bit first */
    138 #define IBM561_CURSOR_X_REG		0x0036
    139 #define IBM561_CURSOR_Y_REG		0x0038
    140 
    141 #define IBM561_XHAIR_SCISSORS		0x0040
    142 	/*
    143 	 * four 16bit registers, low first
    144 	 * X start, Y start, X end, Y end
    145 	 */
    146 
    147 #define IBM561_XHAIR_LOCATION		0x0048
    148 	/* 2x 16bit, X first, lsb first */
    149 
    150 #define IBM561_XHAIR_PATTERN_CONTROL	0x004c
    151 #define IBM561_XHAIR_PATTERN_HORZ	0x004d
    152 #define IBM561_XHAIR_PATTERN_VERT	0x004e
    153 
    154 #define IBM561_VRAM_MASK_REG		0x0050
    155 
    156 #define IBM561_DAC_CONTROL		0x005f
    157 	#define DAC_DISABLE_OUTPUT	0x08
    158 	#define DAC_10BIT_ENABLE	0x04	/* 0 forces bit 0 to 0 */
    159 	#define DAC_SHUNT_ENABLE	0x02
    160 	#define DAC_SLEW_ENABLE		0x01	/* 0 - 2.5ns, 1 - 7.5ns */
    161 
    162 #define IBM561_CURSOR_LUT		0x0a10
    163 	/*
    164 	 * four blocks of 4, transparent, 1, 2, 3 each
    165 	 * cursor orimary, cursor blink, xhair primary, xhair blink
    166 	 */
    167 
    168 #define IBM561_CURSOR_BITMAP		0x2000
    169 	/* 64x64, 2bit packed, msb first */
    170 
    171 #define IBM561_DIV_DOTCLCK		0x0082
    172 #define IBM561_FB_WINTYPE		0x1000
    173 	#define FB_CLUT_SELECT_MASK	0x03c0	/* selects which 64 entry block
    174 						 * in the CLUT to start with */
    175 	#define FB_PIXEL_FORM_MASK	0x0030
    176 	#define FB_PIXEL_8BIT		0x0000
    177 	#define FB_PIXEL_12BIT		0x0010
    178 	#define FB_PIXEL_16BIT		0x0020
    179 	#define FB_PIXEL_24BIT		0x0030
    180 	#define FB_BUFFER_SELECT	0x0008	/* 1 - buffer B */
    181 	#define FB_MODE_MASK		0x0006
    182 	#define FB_MODE_INDEXED		0x0000
    183 	#define FB_MODE_GREYSCALE	0x0002
    184 	#define FB_MODE_DIRECT		0x0004
    185 	#define FB_MODE_TRUECOLOR	0x0006	/* doesn't work right for me */
    186 	#define FB_MODE_TRANSP_ENABLE	0x0001
    187 
    188 #define IBM561_AUXFB_WINTYPE		0x0e00
    189 	#define AUXFB_BYPASS_GAMMA	0x04
    190 	#define AUXFB_XHAIR_ENABLE	0x02
    191 	#define AUXFB_TRANSPARENT	0x01	/* 0 - 0x00, 1 - 0xff */
    192 
    193 #define IBM561_OL_WINTYPE		0x1400
    194 	#define OL_CLUT_SELECT_MASK	0x03c0	/* selects which 64 entry block
    195 						 * in the CLUT to start with */
    196 	#define OL_PIXEL_FORM_MASK	0x0030
    197 	#define OL_PIXEL_8BIT		0x0000
    198 	#define OL_PIXEL_6_2BIT		0x0010	/* 6 overlay, 2 underlay */
    199 	#define OL_PIXEL_4_4BIT		0x0020
    200 	#define OL_PIXEL_4_DBL		0x0030
    201 	#define OL_BUFFER_SELECT	0x0008	/* 1 - buffer B */
    202 	#define OL_MODE_MASK		0x0006
    203 	#define OL_MODE_INDEXED		0x0000
    204 	#define OL_MODE_GREYSCALE	0x0002
    205 	#define OL_MODE_INDIRECT	0x0004
    206 	#define OL_MODE_DIRECT		0x0006
    207 	#define OL_MODE_TRANSP_ENABLE	0x0001
    208 
    209 #define IBM561_AUXOL_WINTYPE		0x0f00
    210 	#define AUXOL_TRANSP_MASK	0x21
    211 	#define AUXOL_TRANSP_00		0x00
    212 	#define AUXOL_TRANSP_FF		0x01
    213 	#define AUXOL_TRANSP_CHROMA0	0x20
    214 	#define AUXOL_TRANSP_CHROMA1	0x21
    215 	#define AUXOL_UNDERLAY_ENABLE	0x10
    216 	#define AUXOL_OVERLAY_ENABLE	0x08
    217 	#define AUXOL_BYPASS_GAMMA	0x04
    218 	#define AUXOL_XHAIR_ENABLE	0x02
    219 
    220 #define IBM561_CMAP_TABLE		0x4000
    221 #define IBM561_RED_GAMMA_TABLE		0x3000
    222 #define IBM561_GREEN_GAMMA_TABLE	0x3400
    223 #define IBM561_BLUE_GAMMA_TABLE		0x3800
    224 
    225 #define IBM561_CHROMAKEY0		0x0010
    226 #define IBM561_CHROMAKEY1		0x0011
    227 #define IBM561_CHROMAKEYMASK0		0x0012
    228 #define IBM561_CHROMAKEYMASK1		0x0013
    229 
    230 #define IBM561_WAT_SEG_REG		0x0006
    231 
    232 #define IBM561_NCMAP_ENTRIES		1024
    233 #define IBM561_NGAMMA_ENTRIES		256
    234 
    235 /* we actually have 1024 of them, but I am just
    236  * going define a few, so this is good.
    237  */
    238 #define IBM561_NWTYPES			16
    239