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