1 1.9 macallan /* $NetBSD: cgfourteenreg.h,v 1.9 2025/05/14 06:32:16 macallan Exp $ */ 2 1.1 abrown 3 1.1 abrown /* 4 1.2 uwe * Copyright (c) 1996 5 1.1 abrown * The President and Fellows of Harvard College. All rights reserved. 6 1.1 abrown * 7 1.1 abrown * Redistribution and use in source and binary forms, with or without 8 1.1 abrown * modification, are permitted provided that the following conditions 9 1.1 abrown * are met: 10 1.1 abrown * 1. Redistributions of source code must retain the above copyright 11 1.1 abrown * notice, this list of conditions and the following disclaimer. 12 1.1 abrown * 2. Redistributions in binary form must reproduce the above copyright 13 1.1 abrown * notice, this list of conditions and the following disclaimer in the 14 1.1 abrown * documentation and/or other materials provided with the distribution. 15 1.1 abrown * 3. All advertising materials mentioning features or use of this software 16 1.1 abrown * must display the following acknowledgement: 17 1.1 abrown * This product includes software developed by Harvard University and 18 1.1 abrown * its contributors. 19 1.1 abrown * 4. Neither the name of the University nor the names of its contributors 20 1.1 abrown * may be used to endorse or promote products derived from this software 21 1.1 abrown * without specific prior written permission. 22 1.1 abrown * 23 1.1 abrown * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24 1.1 abrown * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 1.1 abrown * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 1.1 abrown * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 1.1 abrown * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 1.1 abrown * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 1.1 abrown * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 1.1 abrown * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 1.1 abrown * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 1.1 abrown * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 1.1 abrown * SUCH DAMAGE. 34 1.1 abrown */ 35 1.1 abrown 36 1.1 abrown /* 37 1.1 abrown * Register/dac/clut/cursor definitions for cgfourteen frame buffer 38 1.1 abrown */ 39 1.1 abrown 40 1.1 abrown /* Locations of control registers in cg14 register set */ 41 1.1 abrown #define CG14_OFFSET_CURS 0x1000 42 1.1 abrown #define CG14_OFFSET_DAC 0x2000 43 1.1 abrown #define CG14_OFFSET_XLUT 0x3000 44 1.1 abrown #define CG14_OFFSET_CLUT1 0x4000 45 1.1 abrown #define CG14_OFFSET_CLUT2 0x5000 46 1.1 abrown #define CG14_OFFSET_CLUT3 0x6000 47 1.1 abrown #define CG14_OFFSET_CLUTINCR 0xf000 48 1.1 abrown 49 1.5 macallan /* cursor registers */ 50 1.5 macallan #define CG14_CURSOR_PLANE0 0x1000 51 1.5 macallan #define CG14_CURSOR_PLANE1 0x1080 52 1.5 macallan #define CG14_CURSOR_CONTROL 0x1100 53 1.5 macallan #define CG14_CRSR_ENABLE 0x04 54 1.5 macallan #define CG14_CRSR_DBLBUFFER 0x02 55 1.5 macallan #define CG14_CURSOR_X 0x1104 56 1.5 macallan #define CG14_CURSOR_Y 0x1106 57 1.5 macallan #define CG14_CURSOR_COLOR1 0x1108 58 1.5 macallan #define CG14_CURSOR_COLOR2 0x110c 59 1.5 macallan 60 1.4 macallan /* ranges in framebuffer space */ 61 1.4 macallan #define CG14_FB_VRAM 0x00000000 62 1.4 macallan #define CG14_FB_CBGR 0x01000000 63 1.4 macallan #define CG14_FB_PX32 0x03000000 64 1.7 macallan #define CG14_FB_PB32 0x03400000 65 1.4 macallan #define CG14_FB_PG32 0x03800000 66 1.7 macallan #define CG14_FB_PR32 0x03c00000 67 1.4 macallan 68 1.1 abrown /* Main control register set */ 69 1.1 abrown struct cg14ctl { 70 1.2 uwe volatile uint8_t ctl_mctl; /* main control register */ 71 1.4 macallan #define CG14_MCTL 0x00000000 72 1.1 abrown #define CG14_MCTL_ENABLEINTR 0x80 /* interrupts */ 73 1.1 abrown #define CG14_MCTL_ENABLEVID 0x40 /* enable video */ 74 1.2 uwe #define CG14_MCTL_PIXMODE_MASK 0x30 75 1.1 abrown #define CG14_MCTL_PIXMODE_8 0x00 /* data is 16 8-bit pixels */ 76 1.1 abrown #define CG14_MCTL_PIXMODE_16 0x20 /* data is 8 16-bit pixels */ 77 1.1 abrown #define CG14_MCTL_PIXMODE_32 0x30 /* data is 4 32-bit pixels */ 78 1.1 abrown #define CG14_MCTL_PIXMODE_SHIFT 4 79 1.1 abrown #define CG14_MCTL_TMR 0x0c 80 1.1 abrown #define CG14_MCTL_ENABLETMR 0x02 81 1.1 abrown #define CG14_MCTL_rev0RESET 0x01 82 1.1 abrown #define CG14_MCTL_POWERCTL 0x01 83 1.1 abrown 84 1.2 uwe volatile uint8_t ctl_ppr; /* packed pixel register */ 85 1.2 uwe volatile uint8_t ctl_tmsr0; /* test status reg. 0 */ 86 1.2 uwe volatile uint8_t ctl_tmsr1; /* test status reg. 1 */ 87 1.2 uwe volatile uint8_t ctl_msr; /* master status register */ 88 1.2 uwe volatile uint8_t ctl_fsr; /* fault status register */ 89 1.2 uwe volatile uint8_t ctl_rsr; /* revision status register */ 90 1.1 abrown #define CG14_RSR_REVMASK 0xf0 /* mask to get revision */ 91 1.1 abrown #define CG14_RSR_IMPLMASK 0x0f /* mask to get impl. code */ 92 1.2 uwe volatile uint8_t ctl_ccr; /* clock control register */ 93 1.8 macallan #define CCR_SCL 0x01 94 1.8 macallan #define CCR_SDA 0x02 95 1.8 macallan #define CCR_SDA_DIR 0x04 96 1.8 macallan #define CCR_ASXSEL 0x08 /* the ICS1562 has 4 data/address lines and a */ 97 1.8 macallan #define CCR_DATA 0xf0 /* toggle input - I suspect this is it */ 98 1.8 macallan volatile uint32_t ctl_tmr; /* test mode readback */ 99 1.8 macallan volatile uint8_t ctl_mod; /* monitor data register */ 100 1.8 macallan /* reads 0x4 on mine, other bits in the lower half can be written with 101 1.8 macallan no obvious effect ( I suspect monitor ID ), upper half is hard zero 102 1.8 macallan */ 103 1.8 macallan volatile uint8_t ctl_acr; /* aux control register */ 104 1.8 macallan #define ACR_BYTE_PIXEL 0x01 /* if unset pixels are 32bit */ 105 1.8 macallan /* other bits are hard zero */ 106 1.8 macallan uint8_t m_pad0[6]; /* Reserved */ 107 1.8 macallan uint16_t m_hct; /* Horizontal Counter */ 108 1.8 macallan uint16_t m_vct; /* Vertical Counter */ 109 1.8 macallan uint16_t m_hbs; /* Horizontal Blank Start */ 110 1.8 macallan uint16_t m_hbc; /* Horizontal Blank Clear */ 111 1.8 macallan uint16_t m_hss; /* Horizontal Sync Set */ 112 1.8 macallan uint16_t m_hsc; /* Horizontal Sync Set */ 113 1.8 macallan uint16_t m_csc; /* Composite sync clear */ 114 1.8 macallan uint16_t m_vbs; /* Vertical blank start */ 115 1.8 macallan uint16_t m_vbc; /* Vertical Blank Clear */ 116 1.8 macallan uint16_t m_vss; /* Verical Sync Set */ 117 1.8 macallan uint16_t m_vsc; /* Verical Sync Clear */ 118 1.8 macallan uint16_t m_xcs; /* XXX Gone in VSIMM 2 */ 119 1.8 macallan uint16_t m_xcc; /* XXX Gone in VSIMM 2 */ 120 1.8 macallan uint16_t m_fsa; /* Fault status address */ 121 1.8 macallan uint16_t m_adr; /* Address register (autoincrements) */ 122 1.8 macallan uint8_t m_pad2[0xce]; /* Reserved */ 123 1.8 macallan 124 1.8 macallan /* PCG registers */ 125 1.8 macallan uint8_t m_pcg[0x100]; /* Pixel Clock generator regs */ 126 1.1 abrown /* XXX etc. */ 127 1.1 abrown }; 128 1.1 abrown 129 1.1 abrown /* Hardware cursor map */ 130 1.1 abrown #define CG14_CURS_SIZE 32 131 1.1 abrown struct cg14curs { 132 1.2 uwe volatile uint32_t curs_plane0[CG14_CURS_SIZE]; /* plane 0 */ 133 1.2 uwe volatile uint32_t curs_plane1[CG14_CURS_SIZE]; 134 1.2 uwe volatile uint8_t curs_ctl; /* control register */ 135 1.1 abrown #define CG14_CURS_ENABLE 0x4 136 1.1 abrown #define CG14_CURS_DOUBLEBUFFER 0x2 /* use X-channel for curs */ 137 1.2 uwe volatile uint8_t pad0[3]; 138 1.2 uwe volatile uint16_t curs_x; /* x position */ 139 1.2 uwe volatile uint16_t curs_y; /* y position */ 140 1.2 uwe volatile uint32_t curs_color1; /* color register 1 */ 141 1.2 uwe volatile uint32_t curs_color2; /* color register 2 */ 142 1.2 uwe volatile uint32_t pad[444]; /* pad to 2KB boundary */ 143 1.2 uwe volatile uint32_t curs_plane0incr[CG14_CURS_SIZE]; /* autoincr */ 144 1.2 uwe volatile uint32_t curs_plane1incr[CG14_CURS_SIZE]; /* autoincr */ 145 1.1 abrown }; 146 1.1 abrown 147 1.1 abrown /* DAC */ 148 1.1 abrown struct cg14dac { 149 1.2 uwe volatile uint8_t dac_addr; /* address register */ 150 1.2 uwe volatile uint8_t pad0[255]; 151 1.2 uwe volatile uint8_t dac_gammalut; /* gamma LUT */ 152 1.2 uwe volatile uint8_t pad1[255]; 153 1.2 uwe volatile uint8_t dac_regsel; /* register select */ 154 1.2 uwe volatile uint8_t pad2[255]; 155 1.2 uwe volatile uint8_t dac_mode; /* mode register */ 156 1.1 abrown }; 157 1.1 abrown 158 1.1 abrown #define CG14_CLUT_SIZE 256 159 1.1 abrown 160 1.1 abrown /* XLUT registers */ 161 1.1 abrown struct cg14xlut { 162 1.2 uwe volatile uint8_t xlut_lut[CG14_CLUT_SIZE]; /* the LUT */ 163 1.2 uwe volatile uint8_t xlut_lutd[CG14_CLUT_SIZE]; /* ??? */ 164 1.2 uwe volatile uint8_t pad0[0x600]; 165 1.2 uwe volatile uint8_t xlut_lutinc[CG14_CLUT_SIZE]; /* autoincrLUT*/ 166 1.2 uwe volatile uint8_t xlut_lutincd[CG14_CLUT_SIZE]; 167 1.1 abrown }; 168 1.1 abrown 169 1.8 macallan /* 170 1.8 macallan * The XLUT and ctl_ppr bits are the same - in 8bit ppr is used, in 16bit and 171 1.8 macallan * 24bit XLUT 172 1.8 macallan * here we select two colours, either RGB or a component passed through a 173 1.8 macallan * CLUT, and blend them together. The alpha value is taken from the right 174 1.8 macallan * source's CLUT's upper byte, with 0x80 being 1.0 and 0x00 being 0.0 175 1.8 macallan */ 176 1.8 macallan 177 1.8 macallan #define CG14_LEFT_PASSTHROUGH 0x00 178 1.8 macallan #define CG14_LEFT_CLUT1 0x40 179 1.8 macallan #define CG14_LEFT_CLUT2 0x80 180 1.8 macallan #define CG14_LEFT_CLUT3 0xc0 181 1.8 macallan 182 1.8 macallan #define CG14_RIGHT_PASSTHROUGH 0x00 183 1.8 macallan #define CG14_RIGHT_CLUT1 0x10 184 1.8 macallan #define CG14_RIGHT_CLUT2 0x20 185 1.8 macallan #define CG14_RIGHT_CLUT3 0x30 186 1.8 macallan 187 1.8 macallan /* 0 is passthrough again */ 188 1.8 macallan #define CG14_LEFT_B 0x04 189 1.8 macallan #define CG14_LEFT_G 0x08 190 1.8 macallan #define CG14_LEFT_R 0x0c 191 1.8 macallan 192 1.8 macallan /* except here 0 selects the X channel */ 193 1.8 macallan #define CG14_RIGHT_X 0x00 194 1.8 macallan #define CG14_RIGHT_B 0x01 195 1.8 macallan #define CG14_RIGHT_G 0x02 196 1.8 macallan #define CG14_RIGHT_R 0x03 197 1.8 macallan 198 1.1 abrown /* Color Look-Up Table (CLUT) */ 199 1.1 abrown struct cg14clut { 200 1.2 uwe volatile uint32_t clut_lut[CG14_CLUT_SIZE]; /* the LUT */ 201 1.2 uwe volatile uint32_t clut_lutd[CG14_CLUT_SIZE]; /* ??? */ 202 1.2 uwe volatile uint32_t clut_lutinc[CG14_CLUT_SIZE]; /* autoincr */ 203 1.2 uwe volatile uint32_t clut_lutincd[CG14_CLUT_SIZE]; 204 1.1 abrown }; 205