Home | History | Annotate | Line # | Download | only in pci
ydsreg.h revision 1.1
      1 /*	$NetBSD: ydsreg.h,v 1.1 2001/03/30 14:32:09 minoura Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 2000, 2001 Kazuki Sakamoto and Minoura Makoto.
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26  */
     27 
     28 /*
     29  * YMF724/740/744/754 registers
     30  */
     31 
     32 #ifndef _DEV_PCI_YDSREG_H_
     33 #define	_DEV_PCI_YDSREG_H_
     34 
     35 /*
     36  * PCI Config Registers
     37  */
     38 #define	YDS_PCI_MBA		0x10
     39 #define	YDS_PCI_LEGACY		0x40
     40 # define YDS_PCI_LEGACY_SBEN	0x0001
     41 # define YDS_PCI_LEGACY_FMEN	0x0002
     42 # define YDS_PCI_LEGACY_JPEN	0x0004
     43 # define YDS_PCI_LEGACY_MEN	0x0008
     44 # define YDS_PCI_LEGACY_MIEN	0x0010
     45 # define YDS_PCI_LEGACY_IO	0x0020
     46 # define YDS_PCI_LEGACY_SDMA0	0x0000
     47 # define YDS_PCI_LEGACY_SDMA1	0x0040
     48 # define YDS_PCI_LEGACY_SDMA3	0x00c0
     49 # define YDS_PCI_LEGACY_SBIRQ5	0x0000
     50 # define YDS_PCI_LEGACY_SBIRQ7	0x0100
     51 # define YDS_PCI_LEGACY_SBIRQ9	0x0200
     52 # define YDS_PCI_LEGACY_SBIRQ10	0x0300
     53 # define YDS_PCI_LEGACY_SBIRQ11	0x0400
     54 # define YDS_PCI_LEGACY_MPUIRQ5	0x0000
     55 # define YDS_PCI_LEGACY_MPUIRQ7	0x0800
     56 # define YDS_PCI_LEGACY_MPUIRQ9	0x1000
     57 # define YDS_PCI_LEGACY_MPUIRQ10 0x1800
     58 # define YDS_PCI_LEGACY_MPUIRQ11 0x2000
     59 # define YDS_PCI_LEGACY_SIEN	0x4000
     60 # define YDS_PCI_LEGACY_LAD	0x8000
     61 
     62 # define YDS_PCI_EX_LEGACY_FMIO_388	(0x0000 << 16)
     63 # define YDS_PCI_EX_LEGACY_FMIO_398	(0x0001 << 16)
     64 # define YDS_PCI_EX_LEGACY_FMIO_3A0	(0x0002 << 16)
     65 # define YDS_PCI_EX_LEGACY_FMIO_3A8	(0x0003 << 16)
     66 # define YDS_PCI_EX_LEGACY_SBIO_220	(0x0000 << 16)
     67 # define YDS_PCI_EX_LEGACY_SBIO_240	(0x0004 << 16)
     68 # define YDS_PCI_EX_LEGACY_SBIO_260	(0x0008 << 16)
     69 # define YDS_PCI_EX_LEGACY_SBIO_280	(0x000c << 16)
     70 # define YDS_PCI_EX_LEGACY_MPUIO_330	(0x0000 << 16)
     71 # define YDS_PCI_EX_LEGACY_MPUIO_300	(0x0010 << 16)
     72 # define YDS_PCI_EX_LEGACY_MPUIO_332	(0x0020 << 16)
     73 # define YDS_PCI_EX_LEGACY_MPUIO_334	(0x0030 << 16)
     74 # define YDS_PCI_EX_LEGACY_JSIO_201	(0x0000 << 16)
     75 # define YDS_PCI_EX_LEGACY_JSIO_202	(0x0040 << 16)
     76 # define YDS_PCI_EX_LEGACY_JSIO_204	(0x0080 << 16)
     77 # define YDS_PCI_EX_LEGACY_JSIO_205	(0x00c0 << 16)
     78 # define YDS_PCI_EX_LEGACY_MAIM		(0x0100 << 16)
     79 # define YDS_PCI_EX_LEGACY_SBMOD_PCI	(0x0000 << 16)
     80 # define YDS_PCI_EX_LEGACY_SBMOD_DDMA	(0x1000 << 16)
     81 # define YDS_PCI_EX_LEGACY_SBVER_3	(0x0000 << 16)
     82 # define YDS_PCI_EX_LEGACY_SBVER_2	(0x2000 << 16)
     83 # define YDS_PCI_EX_LEGACY_SBVER_1	(0x4000 << 16)
     84 # define YDS_PCI_EX_LEGACY_IMOD		(0x8000 << 16)
     85 
     86 #define	YDS_PCI_DSCTRL		0x48
     87 # define YDS_DSCTRL_CRST	0x00000001
     88 # define YDS_DSCTRL_WRST	0x00000004
     89 
     90 #define YDS_PCI_FM_BA		0x60
     91 #define YDS_PCI_SB_BA		0x62
     92 #define YDS_PCI_MPU_BA		0x64
     93 #define YDS_PCI_JS_BA		0x66
     94 
     95 /*
     96  * DS-1 PCI Audio part registers
     97  */
     98 #define YDS_INTERRUPT_FLAGS	0x0004
     99 #define YDS_INTERRUPT_FLAGS_TI	0x0001
    100 #define YDS_ACTIVITY		0x0006
    101 # define YDS_ACTIVITY_DOCKA	0x0010
    102 #define	YDS_GLOBAL_CONTROL	0x0008
    103 # define YDS_GLCTRL_HVE		0x0001
    104 # define YDS_GLCTRL_HVIE	0x0002
    105 
    106 #define YDS_GPIO_IIF		0x0050
    107 # define YDS_GPIO_GIO0		0x0001
    108 # define YDS_GPIO_GIO1		0x0002
    109 # define YDS_GPIO_GIO2		0x0004
    110 #define YDS_GPIO_IIE		0x0052
    111 # define YDS_GPIO_GIE0		0x0001
    112 # define YDS_GPIO_GIE1		0x0002
    113 # define YDS_GPIO_GIE2		0x0004
    114 #define YDS_GPIO_ISTAT		0x0054
    115 # define YDS_GPIO_GPI0		0x0001
    116 # define YDS_GPIO_GPI1		0x0002
    117 # define YDS_GPIO_GPI2		0x0004
    118 #define YDS_GPIO_OCTRL		0x0056
    119 # define YDS_GPIO_GPO0		0x0001
    120 # define YDS_GPIO_GPO1		0x0002
    121 # define YDS_GPIO_GPO2		0x0004
    122 #define YDS_GPIO_FUNCE		0x0058
    123 # define YDS_GPIO_GPC0		0x0001
    124 # define YDS_GPIO_GPC1		0x0002
    125 # define YDS_GPIO_GPC2		0x0004
    126 # define YDS_GPIO_GPE0		0x0010
    127 # define YDS_GPIO_GPE1		0x0020
    128 # define YDS_GPIO_GPE2		0x0040
    129 #define YDS_GPIO_ITYPE		0x005a
    130 # define YDS_GPIO_GPT0_LEVEL	0x0000
    131 # define YDS_GPIO_GPT0_RISE	0x0001
    132 # define YDS_GPIO_GPT0_FALL	0x0002
    133 # define YDS_GPIO_GPT0_BOTH	0x0003
    134 # define YDS_GPIO_GPT0_MASK	0x0003
    135 # define YDS_GPIO_GPT1_LEVEL	0x0004
    136 # define YDS_GPIO_GPT1_RISE	0x0005
    137 # define YDS_GPIO_GPT1_FALL	0x0006
    138 # define YDS_GPIO_GPT1_BOTH	0x0007
    139 # define YDS_GPIO_GPT1_MASK	0x0007
    140 # define YDS_GPIO_GPT2_LEVEL	0x0000
    141 # define YDS_GPIO_GPT2_RISE	0x0010
    142 # define YDS_GPIO_GPT2_FALL	0x0020
    143 # define YDS_GPIO_GPT2_BOTH	0x0030
    144 # define YDS_GPIO_GPT2_MASK	0x0030
    145 
    146 #define	YDS_GLOBAL_CONTROL	0x0008
    147 # define YDS_GLCTRL_HVE		0x0001
    148 # define YDS_GLCTRL_HVIE	0x0002
    149 
    150 #define	AC97_CMD_DATA		0x0060
    151 #define	AC97_CMD_ADDR		0x0062
    152 # define AC97_ID(id)		((id) << 8)
    153 # define AC97_CMD_READ		0x8000
    154 # define AC97_CMD_WRITE		0x0000
    155 #define	AC97_STAT_DATA1		0x0064
    156 #define	AC97_STAT_ADDR1		0x0066
    157 #define	AC97_STAT_DATA2		0x0068
    158 #define	AC97_STAT_ADDR2		0x006a
    159 # define AC97_BUSY		0x8000
    160 
    161 #define	YDS_LEGACY_OUT_VOLUME	0x0080
    162 #define	YDS_DAC_OUT_VOLUME	0x0084
    163 #define	YDS_DAC_OUT_VOL_L	0x0084
    164 #define	YDS_DAC_OUT_VOL_R	0x0086
    165 #define	YDS_ZV_OUT_VOLUME	0x0088
    166 #define	YDS_2ND_OUT_VOLUME	0x008C
    167 #define	YDS_ADC_OUT_VOLUME	0x0090
    168 #define	YDS_LEGACY_REC_VOLUME	0x0094
    169 #define	YDS_DAC_REC_VOLUME	0x0098
    170 #define	YDS_ZV_REC_VOLUME	0x009C
    171 #define	YDS_2ND_REC_VOLUME	0x00A0
    172 #define	YDS_ADC_REC_VOLUME	0x00A4
    173 #define	YDS_ADC_IN_VOLUME	0x00A8
    174 #define	YDS_REC_IN_VOLUME	0x00AC
    175 #define	YDS_P44_OUT_VOLUME	0x00B0
    176 #define	YDS_P44_REC_VOLUME	0x00B4
    177 #define	YDS_SPDIFIN_OUT_VOLUME	0x00B8
    178 #define	YDS_SPDIFIN_REC_VOLUME	0x00BC
    179 
    180 #define	YDS_ADC_SAMPLE_RATE	0x00c0
    181 #define	YDS_REC_SAMPLE_RATE	0x00c4
    182 #define	YDS_ADC_FORMAT		0x00c8
    183 #define	YDS_REC_FORMAT		0x00cc
    184 # define YDS_FORMAT_8BIT	0x01
    185 # define YDS_FORMAT_STEREO	0x02
    186 
    187 #define	YDS_STATUS		0x0100
    188 # define YDS_STAT_ACT		0x00000001
    189 # define YDS_STAT_WORK		0x00000002
    190 # define YDS_STAT_TINT		0x00008000
    191 # define YDS_STAT_INT		0x80000000
    192 #define	YDS_CONTROL_SELECT	0x0104
    193 # define YDS_CSEL		0x00000001
    194 #define	YDS_MODE		0x0108
    195 # define YDS_MODE_ACTV		0x00000001
    196 # define YDS_MODE_ACTV2		0x00000002
    197 # define YDS_MODE_TOUT		0x00008000
    198 # define YDS_MODE_RESET		0x00010000
    199 # define YDS_MODE_AC3		0x40000000
    200 # define YDS_MODE_MUTE		0x80000000
    201 
    202 #define	YDS_CONFIG		0x0114
    203 # define YDS_DSP_DISABLE	0
    204 # define YDS_DSP_SETUP		0x00000001
    205 
    206 #define	YDS_PLAY_CTRLSIZE	0x0140
    207 #define	YDS_REC_CTRLSIZE	0x0144
    208 #define	YDS_EFFECT_CTRLSIZE	0x0148
    209 #define	YDS_WORK_SIZE		0x014c
    210 #define	YDS_MAPOF_REC		0x0150
    211 # define YDS_RECSLOT_VALID	0x00000001
    212 # define YDS_ADCSLOT_VALID	0x00000002
    213 #define	YDS_MAPOF_EFFECT	0x0154
    214 # define YDS_DL_VALID		0x00000001
    215 # define YDS_DR_VALID		0x00000002
    216 # define YDS_EFFECT1_VALID	0x00000004
    217 # define YDS_EFFECT2_VALID	0x00000008
    218 # define YDS_EFFECT3_VALID	0x00000010
    219 
    220 #define	YDS_PLAY_CTRLBASE	0x0158
    221 #define	YDS_REC_CTRLBASE	0x015c
    222 #define	YDS_EFFECT_CTRLBASE	0x0160
    223 #define	YDS_WORK_BASE		0x0164
    224 
    225 #define	YDS_DSP_INSTRAM		0x1000
    226 #define	YDS_CTRL_INSTRAM	0x4000
    227 
    228 typedef enum {
    229 	YDS_DS_1,
    230 	YDS_DS_1E
    231 } yds_dstype_t;
    232 
    233 #define	AC97_TIMEOUT		1000
    234 #define	YDS_WORK_TIMEOUT	250000
    235 
    236 /* slot control data structures */
    237 #define	MAX_PLAY_SLOT_CTRL	64
    238 #define	N_PLAY_SLOT_CTRL_BANK	2
    239 #define	N_REC_SLOT_CTRL		2
    240 #define	N_REC_SLOT_CTRL_BANK	2
    241 
    242 /*
    243  * play slot
    244  */
    245 union play_slot_table {
    246 	u_int32_t numofplay;
    247 	u_int32_t slotbase;
    248 };
    249 
    250 struct play_slot_ctrl_bank {
    251 	u_int32_t format;
    252 #define	PSLT_FORMAT_STEREO	0x00010000
    253 #define	PSLT_FORMAT_8BIT	0x80000000
    254 #define	PSLT_FORMAT_SRC441	0x10000000
    255 #define PSLT_FORMAT_RCH		0x00000001
    256 	u_int32_t loopdefault;
    257 	u_int32_t pgbase;
    258 	u_int32_t pgloop;
    259 	u_int32_t pgloopend;
    260 	u_int32_t pgloopfrac;
    261 	u_int32_t pgdeltaend;
    262 	u_int32_t lpfkend;
    263 	u_int32_t eggainend;
    264 	u_int32_t lchgainend;
    265 	u_int32_t rchgainend;
    266 	u_int32_t effect1gainend;
    267 	u_int32_t effect2gainend;
    268 	u_int32_t effect3gainend;
    269 	u_int32_t lpfq;
    270 	u_int32_t status;
    271 #define	PSLT_STATUS_DEND	0x00000001
    272 	u_int32_t numofframes;
    273 	u_int32_t loopcount;
    274 	u_int32_t pgstart;
    275 	u_int32_t pgstartfrac;
    276 	u_int32_t pgdelta;
    277 	u_int32_t lpfk;
    278 	u_int32_t eggain;
    279 	u_int32_t lchgain;
    280 	u_int32_t rchgain;
    281 	u_int32_t effect1gain;
    282 	u_int32_t effect2gain;
    283 	u_int32_t effect3gain;
    284 	u_int32_t lpfd1;
    285 	u_int32_t lpfd2;
    286 };
    287 
    288 /*
    289  * rec slot
    290  */
    291 struct rec_slot_ctrl_bank {
    292 	u_int32_t pgbase;
    293 	u_int32_t pgloopendadr;
    294 	u_int32_t pgstartadr;
    295 	u_int32_t numofloops;
    296 };
    297 
    298 struct rec_slot {
    299 	struct rec_slot_ctrl {
    300 		struct rec_slot_ctrl_bank bank[N_REC_SLOT_CTRL_BANK];
    301 	} ctrl[N_REC_SLOT_CTRL];
    302 };
    303 
    304 /*
    305  * effect slot
    306  */
    307 struct effect_slot_ctrl_bank {
    308 	u_int32_t pgbase;
    309 	u_int32_t pgloopend;
    310 	u_int32_t pgstart;
    311 	u_int32_t temp;
    312 };
    313 
    314 #endif /* _DEV_PCI_YDSREG_H_ */
    315