Home | History | Annotate | Line # | Download | only in dev
      1  1.3  jmcneill /* $NetBSD: vireg.h,v 1.3 2024/10/13 16:21:37 jmcneill Exp $ */
      2  1.1  jmcneill 
      3  1.1  jmcneill /*-
      4  1.1  jmcneill  * Copyright (c) 2024 Jared McNeill <jmcneill (at) invisible.ca>
      5  1.1  jmcneill  * All rights reserved.
      6  1.1  jmcneill  *
      7  1.1  jmcneill  * Redistribution and use in source and binary forms, with or without
      8  1.1  jmcneill  * modification, are permitted provided that the following conditions
      9  1.1  jmcneill  * are met:
     10  1.1  jmcneill  * 1. Redistributions of source code must retain the above copyright
     11  1.1  jmcneill  *    notice, this list of conditions and the following disclaimer.
     12  1.1  jmcneill  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  jmcneill  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  jmcneill  *    documentation and/or other materials provided with the distribution.
     15  1.1  jmcneill  *
     16  1.1  jmcneill  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  1.1  jmcneill  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  1.1  jmcneill  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  1.1  jmcneill  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  1.1  jmcneill  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     21  1.1  jmcneill  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     22  1.1  jmcneill  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     23  1.1  jmcneill  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     24  1.1  jmcneill  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25  1.1  jmcneill  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  1.1  jmcneill  * SUCH DAMAGE.
     27  1.1  jmcneill  */
     28  1.1  jmcneill 
     29  1.1  jmcneill #ifndef _WII_DEV_VIREG_H
     30  1.1  jmcneill #define _WII_DEV_VIREG_H
     31  1.1  jmcneill 
     32  1.1  jmcneill /*
     33  1.1  jmcneill  * Nintendo Wii Video Interface (VI) registers, from
     34  1.1  jmcneill  * https://www.gc-forever.com/yagcd/
     35  1.1  jmcneill  */
     36  1.1  jmcneill 
     37  1.1  jmcneill /* [2B] VTR - Vertical Timing Register */
     38  1.1  jmcneill #define VI_VTR		0x00
     39  1.1  jmcneill #define	 VI_VTR_ACV	__BITS(13,4)
     40  1.1  jmcneill #define	 VI_VTR_EQU	__BITS(3,0)
     41  1.1  jmcneill 
     42  1.1  jmcneill /* [2B] DCR - Display Configuration Register */
     43  1.1  jmcneill #define VI_DCR		0x02
     44  1.1  jmcneill #define	 VI_DCR_FMT	__BITS(9,8)
     45  1.1  jmcneill #define   VI_DCR_FMT_NTSC	0
     46  1.1  jmcneill #define   VI_DCR_FMT_PAL	1
     47  1.1  jmcneill #define   VI_DCR_FMT_MPAL	2
     48  1.1  jmcneill #define   VI_DCR_FMT_DEBUG	3
     49  1.1  jmcneill #define  VI_DCR_LE1	__BITS(7,6)
     50  1.1  jmcneill #define  VI_DCR_LE0	__BITS(5,4)
     51  1.1  jmcneill #define	 VI_DCR_DLR	__BIT(3)
     52  1.1  jmcneill #define  VI_DCR_NIN	__BIT(2)
     53  1.1  jmcneill #define  VI_DCR_RST	__BIT(1)
     54  1.1  jmcneill #define  VI_DCR_ENB	__BIT(0)
     55  1.1  jmcneill 
     56  1.1  jmcneill /* [4B] HTR0 - Horizontal Timing 0 */
     57  1.1  jmcneill #define VI_HTR0		0x04
     58  1.1  jmcneill #define	 VI_HTR0_HCS	__BITS(30,24)
     59  1.1  jmcneill #define	 VI_HTR0_HCE	__BITS(22,16)
     60  1.1  jmcneill #define	 VI_HTR0_HLW	__BITS(8,0)
     61  1.1  jmcneill 
     62  1.1  jmcneill /* [4B] HTR1 - Horizontal Timing 1 */
     63  1.1  jmcneill #define VI_HTR1		0x08
     64  1.1  jmcneill #define	 VI_HTR1_HBS	__BITS(26,17)
     65  1.1  jmcneill #define  VI_HTR1_HBE	__BITS(16,7)
     66  1.1  jmcneill #define	 VI_HTR1_HSY	__BITS(6,0)
     67  1.1  jmcneill 
     68  1.1  jmcneill /* [4B] VTO - Odd Field Vertical Timing Register */
     69  1.1  jmcneill #define VI_VTO		0x0c
     70  1.1  jmcneill #define  VI_VTO_PSB	__BITS(25,16)
     71  1.1  jmcneill #define  VI_VTO_PRB	__BITS(9,0)
     72  1.1  jmcneill 
     73  1.1  jmcneill /* [4B] VTE - Even Field Vertical Timing Register */
     74  1.1  jmcneill #define VI_VTE		0x10
     75  1.1  jmcneill #define  VI_VTE_PSB	__BITS(25,16)
     76  1.1  jmcneill #define  VI_VTE_PRB	__BITS(9,0)
     77  1.1  jmcneill 
     78  1.1  jmcneill /* [4B] BBOI - Odd Field Burst Blanking Interval Register */
     79  1.1  jmcneill #define VI_BBOI		0x14
     80  1.1  jmcneill #define  VI_BBOI_BE3	__BITS(31,21)
     81  1.1  jmcneill #define	 VI_BBOI_BS3	__BITS(20,16)
     82  1.1  jmcneill #define  VI_BBOI_BE1	__BITS(15,5)
     83  1.1  jmcneill #define  VI_BBOI_BS1	__BITS(4,0)
     84  1.1  jmcneill 
     85  1.1  jmcneill /* [4B] BBEI - Even Field Burst Blanking Interval Register */
     86  1.1  jmcneill #define VI_BBEI		0x18
     87  1.1  jmcneill #define  VI_BBEI_BE4	__BITS(31,21)
     88  1.1  jmcneill #define	 VI_BBEI_BS4	__BITS(20,16)
     89  1.1  jmcneill #define  VI_BBEI_BE2	__BITS(15,5)
     90  1.1  jmcneill #define  VI_BBEI_BS2	__BITS(4,0)
     91  1.1  jmcneill 
     92  1.1  jmcneill /* [4B] TFBL - Top Field Base Register (L) */
     93  1.1  jmcneill #define VI_TFBL		0x1c
     94  1.1  jmcneill #define  VI_TFBL_PGOFF	__BIT(28)
     95  1.1  jmcneill #define  VI_TFBL_XOF	__BITS(27,24)
     96  1.1  jmcneill #define  VI_TFBL_FBB	__BITS(23,0)
     97  1.1  jmcneill 
     98  1.1  jmcneill /* [4B] TFBR - Top Field Base Register (R) */
     99  1.1  jmcneill #define VI_TFBR		0x20
    100  1.1  jmcneill #define	 VI_TFBR_FBB	__BITS(23,0)
    101  1.1  jmcneill 
    102  1.1  jmcneill /* [4B] BFBL - Bottom Field Base Register (L) */
    103  1.1  jmcneill #define VI_BFBL		0x24
    104  1.1  jmcneill #define	 VI_BFBL_PGOFF	__BIT(28)
    105  1.1  jmcneill #define  VI_BFBL_XOF	__BITS(27,24)
    106  1.1  jmcneill #define	 VI_BFBL_FBB	__BITS(23,0)
    107  1.1  jmcneill 
    108  1.1  jmcneill /* [4B] BFBR - Bottom Field Base Register (R) */
    109  1.1  jmcneill #define VI_BFBR		0x28
    110  1.1  jmcneill #define	 VI_BFBR_FBB	__BITS(23,0)
    111  1.1  jmcneill 
    112  1.1  jmcneill /* [2B] DPV - Current Vertical Position */
    113  1.1  jmcneill #define VI_DPV		0x2c
    114  1.1  jmcneill #define  VI_DPV_VCT	__BITS(10,0)
    115  1.1  jmcneill 
    116  1.1  jmcneill /* [2B] DPH - Current Horizontal Position */
    117  1.1  jmcneill #define VI_DPH		0x2e
    118  1.1  jmcneill #define	 VI_DPH_HCT	__BITS(10,0)
    119  1.1  jmcneill 
    120  1.1  jmcneill /* [4B] DI[0-3] - Display Interrupt 0-3 */
    121  1.1  jmcneill #define VI_DI0		0x30
    122  1.1  jmcneill #define VI_DI1		0x34
    123  1.1  jmcneill #define	VI_DI2		0x38
    124  1.1  jmcneill #define	VI_DI3		0x3c
    125  1.1  jmcneill #define  VI_DI_INT	__BIT(31)
    126  1.1  jmcneill #define  VI_DI_ENB	__BIT(28)
    127  1.1  jmcneill #define	 VI_DI_VCT	__BITS(25,16)
    128  1.1  jmcneill #define	 VI_DI_HCT	__BITS(9,0)
    129  1.1  jmcneill 
    130  1.1  jmcneill /* [4B] DL[0-1] - Display Latch Register 0-1 */
    131  1.1  jmcneill #define VI_DL0		0x40
    132  1.1  jmcneill #define	VI_DL1		0x44
    133  1.1  jmcneill #define	 VI_DL_TRG	__BIT(31)
    134  1.1  jmcneill #define	 VI_DL_VCT	__BITS(26,16)
    135  1.1  jmcneill #define  VI_DL_HCT	__BITS(10,0)
    136  1.1  jmcneill 
    137  1.1  jmcneill /* [2B] PICCONF - Picture Configuration Register */
    138  1.1  jmcneill #define VI_PICCONF	0x48
    139  1.1  jmcneill #define  VI_PICCONF_READS	__BITS(15,8)
    140  1.1  jmcneill #define	 VI_PICCONF_STRIDES	__BITS(7,0)
    141  1.1  jmcneill 
    142  1.1  jmcneill /* [2B] HSR - Horizontal Scaling Register */
    143  1.1  jmcneill #define VI_HSR		0x4a
    144  1.1  jmcneill #define	 VI_HSR_HS_EN	__BIT(12)
    145  1.1  jmcneill #define	 VI_HSR_STP	__BITS(8,0)
    146  1.1  jmcneill 
    147  1.1  jmcneill /* [4B] FCT[0-6] - Filter Coefficient Table 0-6 */
    148  1.3  jmcneill #define VI_FCT0		0x4c
    149  1.3  jmcneill #define VI_FCT1		0x50
    150  1.3  jmcneill #define VI_FCT2		0x54
    151  1.3  jmcneill #define VI_FCT3		0x58
    152  1.3  jmcneill #define VI_FCT4		0x5c
    153  1.3  jmcneill #define VI_FCT5		0x60
    154  1.3  jmcneill #define VI_FCT6		0x64
    155  1.1  jmcneill 
    156  1.1  jmcneill /* [4B] ??? */
    157  1.1  jmcneill #define VI_UNKNOWN_68H	0x68
    158  1.1  jmcneill 
    159  1.1  jmcneill /* [2B] VICLK - VI Clock Select Register */
    160  1.1  jmcneill #define	VI_VICLK	0x6c
    161  1.1  jmcneill #define	 VI_VICLK_SEL	__BIT(0)
    162  1.1  jmcneill #define	  VI_VICLK_SEL_27MHZ	0
    163  1.1  jmcneill #define	  VI_VICLK_SEL_54MHZ	1
    164  1.1  jmcneill 
    165  1.1  jmcneill /* [2B] VISEL - VI DTV Status Register */
    166  1.1  jmcneill #define VI_VISEL	0x6e
    167  1.2  jmcneill #define	 VI_VISEL_SEL			__BIT(2)
    168  1.2  jmcneill #define	 VI_VISEL_COMPONENT_CABLE	__BIT(0)
    169  1.1  jmcneill 
    170  1.1  jmcneill /* [2B] VI_HSCALINGW - Horizontal Scaling Width */
    171  1.1  jmcneill #define VI_HSCALINGW	0x70
    172  1.1  jmcneill #define  VI_HSCALINGW_WIDTH	__BITS(9,0)
    173  1.1  jmcneill 
    174  1.1  jmcneill /* [2B] HBE - Border HBE */
    175  1.1  jmcneill #define VI_HBE		0x72
    176  1.1  jmcneill #define	 VI_HBE_BRDR_EN	__BIT(15)
    177  1.1  jmcneill #define	 VI_HBE_HBE656	__BITS(9,0)
    178  1.1  jmcneill 
    179  1.1  jmcneill /* [2B] HBS - Border HBS */
    180  1.1  jmcneill #define VI_HBS		0x74
    181  1.1  jmcneill #define  VI_HBS_HBS656	__BITS(9,0)
    182  1.1  jmcneill 
    183  1.1  jmcneill /* [2B] ??? */
    184  1.1  jmcneill #define VI_UNKNOWN_76H	0x76
    185  1.1  jmcneill 
    186  1.1  jmcneill /* [4B] ??? */
    187  1.1  jmcneill #define VI_UNKNOWN_78H	0x78
    188  1.1  jmcneill 
    189  1.1  jmcneill /* [4B] ??? */
    190  1.1  jmcneill #define VI_UNKNOWN_7CH	0x7c
    191  1.1  jmcneill 
    192  1.1  jmcneill #endif /* !_WII_DEV_VIREG_H */
    193