/*
* Copyright (c) 2002 Valeriy E. Ushakov
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Integraphics Systems IGA 168x and CyberPro series.
* Only tested on IGA 1682 in Krups JavaStation-NC.
*/
#ifndef _DEV_IC_IGSFBREG_H_
#define _DEV_IC_IGSFBREG_H_
/*
* Magic address decoding for memory space accesses in CyberPro.
*/
#define IGS_MEM_MMIO_SELECT 0x00800000 /* memory mapped i/o */
#define IGS_MEM_BE_SELECT 0x00400000 /* endian select */
/*
* Cursor sprite data in linear memory at IGS_EXT_SPRITE_DATA_{LO,HI}.
* 64x64 pixels, 2bpp = 1Kb
*/
#define IGS_CURSOR_DATA_SIZE 1024
/* Video Enable */
#define IGS_VSE 0x102
#define IGS_VSE_ENABLE 0x01
/*
* We map only 32 bytes of actual IGS registers at 0x3c0..0x3df.
* This macro helps to define register names using their "absolute"
* locations - it makes matching defines against docs easier.
*/
#define IGS_REG_BASE 0x3c0
#define IGS_REG_SIZE 0x020
#define IGS_REG_(x) ((x) - IGS_REG_BASE)
/*
* Attribute controller. Flip-flop reset by IGS_INPUT_STATUS1 at 0x3da.
* We don't bother defining actual registers, we only use them once
* during video initialization.
*/
#define IGS_ATTR_IDX IGS_REG_(0x3c0)
#define IGS_ATTR_PORT IGS_REG_(0x3c1)
/*
* Misc output register. We only use the _W register during video
* initialization.
*/
#define IGS_MISC_OUTPUT_W IGS_REG_(0x3c2)
#define IGS_MISC_OUTPUT_R IGS_REG_(0x3cc)
/*
* Palette Read/Write: write palette index to the index port.
* Read/write R/G/B in three consecutive accesses to data port.
* After third access to data the index is autoincremented and you can
* proceed with reading/writing data port for the next entry.
*
* When IGS_EXT_SPRITE_DAC_PEL bit in sprite control is set, these
* registers are used to access sprite (i.e. cursor) 2-color palette.
* (NB: apparently, in this mode index autoincrement doesn't work).
*/
#define IGS_DAC_PEL_READ_IDX IGS_REG_(0x3c7)
#define IGS_DAC_PEL_WRITE_IDX IGS_REG_(0x3c8)
#define IGS_DAC_PEL_DATA IGS_REG_(0x3c9)
/* Hardware cursor data location in linear memory */
#define IGS_EXT_SPRITE_DATA_LO 0x7e
#define IGS_EXT_SPRITE_DATA_HI 0x7f /* bits [3..0] */
#define IGS_EXT_VCLK0 0xb0 /* mult */
#define IGS_EXT_VCLK1 0xb1 /* div */
#define IGS_EXT_MCLK0 0xb2 /* mult */
#define IGS_EXT_MCLK1 0xb3 /* div */
/* ----8<---- end of IGS_EXT registers ----8<---- */
/*
* CRTC can be at 0x3b4/0x3b5 (mono) or 0x3d4/0x3d5 (color)
* controlled by bit 0 in misc output register (r=0x3cc/w=0x3c2).
* We forcibly init it to color.
*/
#define IGS_CRTC_IDX IGS_REG_(0x3d4)
#define IGS_CRTC_PORT IGS_REG_(0x3d5)
/*
* Reading this register resets flip-flop at 0x3c0 (attribute
* controller) to address register.
*/
#define IGS_INPUT_STATUS1 IGS_REG_(0x3da)
/*
* Binary operations are defined below. S - source, D - destination,
* N - not; a - and, o - or, x - xor.
*
* For ternary operations, foreground mix function is one of 256
* ternary raster operations defined by Win32 API; background mix is
* ignored.
*/
#define IGS_COP_FG_MIX_REG 0x048
#define IGS_COP_BG_MIX_REG 0x049
#define IGS_COP_PPM_TEXT 0x10
#define IGS_COP_PPM_TILE 0x20
#define IGS_COP_PPM_LINE 0x30
#define IGS_COP_PPM_TRANSPARENT 0x40 /* "or" with one of the above */