Home | History | Annotate | Line # | Download | only in tc
sticreg.h revision 1.4.6.1
      1  1.4.6.1      fvdl /* 	$NetBSD: sticreg.h,v 1.4.6.1 2001/10/01 12:46:28 fvdl Exp $	*/
      2      1.1  jonathan 
      3      1.3        ad /*-
      4      1.4        ad  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
      5      1.1  jonathan  * All rights reserved.
      6      1.1  jonathan  *
      7      1.3        ad  * This code is derived from software contributed to The NetBSD Foundation
      8      1.3        ad  * by Andrew Doran.
      9      1.3        ad  *
     10      1.1  jonathan  * Redistribution and use in source and binary forms, with or without
     11      1.1  jonathan  * modification, are permitted provided that the following conditions
     12      1.1  jonathan  * are met:
     13      1.1  jonathan  * 1. Redistributions of source code must retain the above copyright
     14      1.1  jonathan  *    notice, this list of conditions and the following disclaimer.
     15      1.1  jonathan  * 2. Redistributions in binary form must reproduce the above copyright
     16      1.1  jonathan  *    notice, this list of conditions and the following disclaimer in the
     17      1.1  jonathan  *    documentation and/or other materials provided with the distribution.
     18      1.1  jonathan  * 3. All advertising materials mentioning features or use of this software
     19      1.1  jonathan  *    must display the following acknowledgement:
     20      1.3        ad  *	This product includes software developed by the NetBSD
     21      1.3        ad  *	Foundation, Inc. and its contributors.
     22      1.3        ad  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23      1.3        ad  *    contributors may be used to endorse or promote products derived
     24      1.3        ad  *    from this software without specific prior written permission.
     25      1.3        ad  *
     26      1.3        ad  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27      1.3        ad  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28      1.3        ad  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29      1.3        ad  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30      1.3        ad  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31      1.3        ad  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32      1.3        ad  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33      1.3        ad  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34      1.3        ad  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35      1.3        ad  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36      1.3        ad  * POSSIBILITY OF SUCH DAMAGE.
     37      1.1  jonathan  */
     38      1.1  jonathan 
     39      1.3        ad #ifndef _TC_STICREG_H_
     40      1.1  jonathan #define	_TC_STICREG_H_
     41      1.1  jonathan 
     42      1.3        ad /*
     43      1.3        ad  * PixelStamp command packets take this general format:
     44      1.3        ad  *
     45      1.3        ad  * command word
     46      1.3        ad  * plane mask & primitive count
     47      1.3        ad  * always zero
     48      1.3        ad  * update method
     49      1.3        ad  *
     50      1.3        ad  * per-packet context (optional):
     51      1.3        ad  *      line width
     52      1.3        ad  *      xy mask
     53      1.3        ad  *	cliping rectangle min & max
     54      1.3        ad  *	rgb constant
     55      1.3        ad  *	z constant
     56      1.3        ad  *
     57      1.3        ad  * per-primitive context (optional):
     58      1.3        ad  *      xy mask
     59      1.3        ad  *      xy mask address
     60      1.3        ad  *      primitive data (vertices, spans info, video)
     61      1.3        ad  *      line width
     62      1.3        ad  *      halfspace equals conditions
     63      1.3        ad  *      rgb flat, or rgb{1,2,3} smooth
     64      1.3        ad  *      z flat, or z{1,2,3} smooth
     65      1.3        ad  */
     66      1.3        ad 
     67      1.3        ad /*
     68      1.3        ad  * Command word.
     69      1.3        ad  */
     70  1.4.6.1      fvdl 
     71  1.4.6.1      fvdl /* Base command */
     72      1.3        ad #define	STAMP_CMD_POINTS        (0x0000)
     73      1.3        ad #define	STAMP_CMD_LINES         (0x0001)
     74      1.3        ad #define	STAMP_CMD_TRIANGLES     (0x0002)
     75      1.3        ad #define	STAMP_CMD_COPYSPANS     (0x0005)
     76      1.3        ad #define	STAMP_CMD_READSPANS     (0x0006)
     77      1.3        ad #define	STAMP_CMD_WRITESPANS    (0x0007)
     78      1.3        ad #define	STAMP_CMD_VIDEO         (0x0008)
     79      1.3        ad 
     80  1.4.6.1      fvdl /* Color */
     81      1.3        ad #define	STAMP_RGB_NONE          (0x0000)
     82      1.3        ad #define	STAMP_RGB_CONST         (0x0010)
     83      1.3        ad #define	STAMP_RGB_FLAT          (0x0020)
     84      1.3        ad #define	STAMP_RGB_SMOOTH        (0x0030)
     85      1.3        ad 
     86  1.4.6.1      fvdl /* Z */
     87      1.3        ad #define	STAMP_Z_NONE            (0x0000)
     88      1.3        ad #define	STAMP_Z_CONST           (0x0040)
     89      1.3        ad #define	STAMP_Z_FLAT            (0x0080)
     90      1.3        ad #define	STAMP_Z_SMOOTH          (0x00c0)
     91      1.3        ad 
     92  1.4.6.1      fvdl /* XYMASK */
     93      1.3        ad #define	STAMP_XY_NONE           (0x0000)
     94      1.3        ad #define	STAMP_XY_PERPACKET      (0x0100)
     95      1.3        ad #define	STAMP_XY_PERPRIMATIVE   (0x0200)
     96      1.3        ad 
     97  1.4.6.1      fvdl /* Line width */
     98      1.3        ad #define	STAMP_LW_NONE           (0x0000)
     99      1.3        ad #define	STAMP_LW_PERPACKET      (0x0400)
    100      1.3        ad #define	STAMP_LW_PERPRIMATIVE   (0x0800)
    101      1.3        ad 
    102  1.4.6.1      fvdl /* Miscellaneous flags */
    103      1.3        ad #define	STAMP_CLIPRECT          (0x00080000)
    104      1.3        ad #define	STAMP_MESH              (0x00200000)
    105      1.3        ad #define	STAMP_AALINE            (0x00800000)
    106      1.3        ad #define	STAMP_HS_EQUALS         (0x80000000)
    107      1.3        ad 
    108      1.3        ad /*
    109      1.3        ad  * Update word.
    110      1.3        ad  */
    111  1.4.6.1      fvdl 
    112  1.4.6.1      fvdl /* XXX What does this do? Perhaps for 96-bit boards? */
    113      1.3        ad #define	STAMP_PLANE_8X3		(0 << 5)
    114      1.3        ad #define	STAMP_PLANE_24		(1 << 5)
    115      1.3        ad 
    116      1.3        ad /* Write enable */
    117      1.3        ad #define	STAMP_WE_SIGN		(0x04 << 8)
    118      1.3        ad #define	STAMP_WE_XYMASK		(0x02 << 8)
    119      1.3        ad #define	STAMP_WE_CLIPRECT	(0x01 << 8)
    120      1.3        ad #define	STAMP_WE_NONE		(0x00 << 8)
    121      1.3        ad 
    122  1.4.6.1      fvdl /* Pixel write method */
    123      1.3        ad #define	STAMP_METHOD_CLEAR	(0x60 << 12)
    124      1.3        ad #define	STAMP_METHOD_AND	(0x14 << 12)
    125      1.3        ad #define	STAMP_METHOD_ANDREV	(0x15 << 12)
    126      1.3        ad #define	STAMP_METHOD_COPY	(0x20 << 12)
    127      1.3        ad #define	STAMP_METHOD_ANDINV	(0x16 << 12)
    128      1.3        ad #define	STAMP_METHOD_NOOP	(0x40 << 12)
    129      1.3        ad #define	STAMP_METHOD_XOR	(0x11 << 12)
    130      1.3        ad #define	STAMP_METHOD_OR		(0x0f << 12)
    131      1.3        ad #define	STAMP_METHOD_NOR	(0x17 << 12)
    132      1.3        ad #define	STAMP_METHOD_EQUIV	(0x10 << 12)
    133      1.3        ad #define	STAMP_METHOD_INV	(0x4e << 12)
    134      1.3        ad #define	STAMP_METHOD_ORREV	(0x0e << 12)
    135      1.3        ad #define	STAMP_METHOD_COPYINV	(0x2d << 12)
    136      1.3        ad #define	STAMP_METHOD_ORINV	(0x0d << 12)
    137      1.3        ad #define	STAMP_METHOD_NAND	(0x0c << 12)
    138      1.3        ad #define	STAMP_METHOD_SET	(0x6c << 12)
    139      1.3        ad #define	STAMP_METHOD_SUM	(0x00 << 12)
    140      1.3        ad #define	STAMP_METHOD_DIFF	(0x02 << 12)
    141      1.3        ad #define	STAMP_METHOD_REVDIFF	(0x01 << 12)
    142      1.3        ad 
    143      1.3        ad /* Double buffering */
    144      1.3        ad #define	STAMP_DB_NONE		(0x00 << 28)
    145      1.3        ad #define	STAMP_DB_01		(0x01 << 28)
    146      1.3        ad #define	STAMP_DB_12		(0x02 << 28)
    147      1.3        ad #define	STAMP_DB_02		(0x04 << 28)
    148      1.3        ad 
    149  1.4.6.1      fvdl /* Miscellaneous flags */
    150      1.3        ad #define	STAMP_UPDATE_ENABLE	(1 << 0)
    151      1.3        ad #define	STAMP_SAVE_SIGN		(1 << 6)
    152      1.3        ad #define	STAMP_SAVE_ALPHA	(1 << 7)
    153      1.3        ad #define	STAMP_SUPERSAMPLE	(1 << 11)
    154      1.3        ad #define	STAMP_SPAN		(1 << 19)
    155      1.3        ad #define	STAMP_COPYSPAN_ALIGNED	(1 << 20)
    156      1.3        ad #define	STAMP_MINMAX		(1 << 21)
    157      1.3        ad #define	STAMP_MULT		(1 << 22)
    158      1.3        ad #define	STAMP_MULTACC		(1 << 23)
    159      1.3        ad #define	STAMP_HALF_BUFF		(1 << 27)
    160      1.3        ad #define	STAMP_INITIALIZE	(1 << 31)
    161      1.3        ad 
    162      1.3        ad /*
    163  1.4.6.1      fvdl  * XYMASK address calculation.
    164      1.3        ad  */
    165      1.3        ad #define	XMASKADDR(sw, sx, a)	(((a)-((sx) % (sw))) & 15)
    166      1.3        ad #define	YMASKADDR(sh, sy, b)	(((b)-((sy) % (sh))) & 15)
    167      1.3        ad #define	XYMASKADDR(sw,sh,x,y,a,b)	\
    168      1.3        ad     (XMASKADDR(sw,x,a) << 16 | YMASKADDR(sh,y,b))
    169      1.3        ad 
    170      1.3        ad /*
    171      1.3        ad  * Miscellenous constants.
    172      1.3        ad  */
    173      1.3        ad #define	STIC_MAGIC_X	370
    174      1.3        ad #define	STIC_MAGIC_Y	37
    175      1.3        ad 
    176  1.4.6.1      fvdl /*
    177  1.4.6.1      fvdl  * Poll register magic values.
    178  1.4.6.1      fvdl  */
    179      1.3        ad #define	STAMP_OK		(0)
    180      1.3        ad #define	STAMP_BUSY		(1)
    181      1.4        ad #define	STAMP_RETRIES		(100000)
    182      1.4        ad #define	STAMP_DELAY		(10)
    183      1.3        ad 
    184      1.3        ad /*
    185      1.3        ad  * STIC registers.
    186      1.3        ad  */
    187      1.1  jonathan struct stic_regs {
    188      1.3        ad 	u_int32_t	sr_pad0;
    189      1.3        ad 	u_int32_t	sr_pad1;
    190      1.3        ad 	u_int32_t	sr_hsync;
    191      1.3        ad 	u_int32_t	sr_hsync2;
    192      1.3        ad 	u_int32_t	sr_hblank;
    193      1.3        ad 	u_int32_t	sr_vsync;
    194      1.3        ad 	u_int32_t	sr_vblank;
    195      1.3        ad 	u_int32_t	sr_vtest;
    196      1.3        ad 	u_int32_t	sr_ipdvint;
    197      1.3        ad 	u_int32_t	sr_pad2;
    198      1.3        ad 	u_int32_t	sr_sticsr;
    199      1.3        ad 	u_int32_t	sr_busdat;
    200      1.3        ad 	u_int32_t	sr_busadr;
    201      1.3        ad 	u_int32_t	sr_pad3;
    202      1.3        ad 	u_int32_t	sr_buscsr;
    203      1.3        ad 	u_int32_t	sr_modcl;
    204  1.4.6.1      fvdl } __attribute__ ((__packed__));
    205      1.1  jonathan 
    206      1.1  jonathan /*
    207      1.3        ad  * Bit definitions for stic_regs::sticsr.
    208      1.1  jonathan  */
    209      1.3        ad #define	STIC_CSR_TSTFNC		0x00000003
    210      1.1  jonathan # define STIC_CSR_TSTFNC_NORMAL	0
    211      1.1  jonathan # define STIC_CSR_TSTFNC_PARITY	1
    212      1.1  jonathan # define STIC_CSR_TSTFNC_CNTPIX	2
    213      1.1  jonathan # define STIC_CSR_TSTFNC_TSTDAC	3
    214      1.3        ad #define	STIC_CSR_CHECKPAR	0x00000004
    215      1.3        ad #define	STIC_CSR_STARTVT	0x00000010
    216      1.3        ad #define	STIC_CSR_START		0x00000020
    217      1.3        ad #define	STIC_CSR_RESET		0x00000040
    218      1.3        ad #define	STIC_CSR_STARTST	0x00000080
    219      1.3        ad 
    220      1.3        ad /*
    221      1.3        ad  * Bit definitions for stic_regs::int.  Three four-bit wide fields, for
    222  1.4.6.1      fvdl  * error (E), vertical-blank (V), and packet-done (P) intererupts,
    223  1.4.6.1      fvdl  * respectively.  The low-order three bits of each field are interrupt
    224  1.4.6.1      fvdl  * enable, condition flagged, and nybble write enable.  The top bit of each
    225  1.4.6.1      fvdl  * field is unused.
    226      1.3        ad  */
    227      1.3        ad #define	STIC_INT_E_EN		0x00000001
    228      1.3        ad #define	STIC_INT_E		0x00000002
    229      1.3        ad #define	STIC_INT_E_WE		0x00000004
    230      1.3        ad 
    231      1.3        ad #define	STIC_INT_V_EN		0x00000100
    232      1.3        ad #define	STIC_INT_V		0x00000200
    233      1.3        ad #define	STIC_INT_V_WE		0x00000400
    234      1.3        ad 
    235      1.3        ad #define	STIC_INT_P_EN		0x00010000
    236      1.3        ad #define	STIC_INT_P		0x00020000
    237      1.3        ad #define	STIC_INT_P_WE		0x00040000
    238      1.3        ad 
    239      1.3        ad #define	STIC_INT_E_MASK	(STIC_INT_E_EN | STIC_INT_E | STIC_INT_E_WE)
    240      1.3        ad #define	STIC_INT_V_MASK	(STIC_INT_V_EN | STIC_INT_V | STIC_INT_V_WE)
    241      1.3        ad #define	STIC_INT_P_MASK	(STIC_INT_P_EN | STIC_INT_P | STIC_INT_P_WE)
    242      1.3        ad #define	STIC_INT_MASK	(STIC_INT_E_MASK | STIC_INT_P_MASK | STIC_INT_V_MASK)
    243      1.1  jonathan 
    244      1.3        ad #define	STIC_INT_WE	(STIC_INT_E_WE | STIC_INT_V_WE | STIC_INT_P_WE)
    245      1.3        ad #define	STIC_INT_CLR	(STIC_INT_E_EN | STIC_INT_V_EN | STIC_INT_P_EN)
    246      1.3        ad 
    247      1.3        ad /*
    248      1.3        ad  * On DMA: reading from a STIC poll register causes load & execution of
    249      1.3        ad  * the packet at the correspoinding physical address.  Either STAMP_OK
    250      1.3        ad  * or STAMP_BUSY will be returned to indicate status.
    251      1.3        ad  *
    252      1.3        ad  * The STIC sees only 23-bits (8MB) of address space.  Bits 21-22 in
    253      1.3        ad  * physical address space map to bits 27-28, and bits 15-20 map to bits
    254      1.3        ad  * 18-23 in the STIC's warped view of the word.  On the PXG, the STIC
    255      1.3        ad  * sees only the onboard SRAM (so any `physical addresses' are offsets
    256      1.3        ad  * into the beginning of the SRAM).
    257      1.3        ad  */
    258      1.1  jonathan 
    259      1.1  jonathan #endif	/* _TC_STICREG_H_ */
    260