1*2a1ad637SFrançois Tigeot /*- 2*2a1ad637SFrançois Tigeot * Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk> 3*2a1ad637SFrançois Tigeot * Copyright (c) 2003-2006 Yuriy Tsibizov <yuriy.tsibizov@gfk.ru> 4*2a1ad637SFrançois Tigeot * All rights reserved. 5*2a1ad637SFrançois Tigeot * 6*2a1ad637SFrançois Tigeot * Redistribution and use in source and binary forms, with or without 7*2a1ad637SFrançois Tigeot * modification, are permitted provided that the following conditions 8*2a1ad637SFrançois Tigeot * are met: 9*2a1ad637SFrançois Tigeot * 1. Redistributions of source code must retain the above copyright 10*2a1ad637SFrançois Tigeot * notice, this list of conditions and the following disclaimer. 11*2a1ad637SFrançois Tigeot * 2. Redistributions in binary form must reproduce the above copyright 12*2a1ad637SFrançois Tigeot * notice, this list of conditions and the following disclaimer in the 13*2a1ad637SFrançois Tigeot * documentation and/or other materials provided with the distribution. 14*2a1ad637SFrançois Tigeot * 15*2a1ad637SFrançois Tigeot * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16*2a1ad637SFrançois Tigeot * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17*2a1ad637SFrançois Tigeot * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18*2a1ad637SFrançois Tigeot * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19*2a1ad637SFrançois Tigeot * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20*2a1ad637SFrançois Tigeot * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21*2a1ad637SFrançois Tigeot * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22*2a1ad637SFrançois Tigeot * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT 23*2a1ad637SFrançois Tigeot * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24*2a1ad637SFrançois Tigeot * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25*2a1ad637SFrançois Tigeot * SUCH DAMAGE. 26*2a1ad637SFrançois Tigeot * 27*2a1ad637SFrançois Tigeot * $FreeBSD: head/sys/dev/sound/pci/emu10kx.h 229981 2012-01-11 21:17:14Z pfg $ 28*2a1ad637SFrançois Tigeot */ 29*2a1ad637SFrançois Tigeot 30*2a1ad637SFrançois Tigeot #ifndef EMU10KX_H 31*2a1ad637SFrançois Tigeot #define EMU10KX_H 32*2a1ad637SFrançois Tigeot 33*2a1ad637SFrançois Tigeot #define SND_EMU10KX_MINVER 1 34*2a1ad637SFrançois Tigeot #define SND_EMU10KX_PREFVER 1 35*2a1ad637SFrançois Tigeot #define SND_EMU10KX_MAXVER 1 36*2a1ad637SFrançois Tigeot 37*2a1ad637SFrançois Tigeot #ifdef _KERNEL 38*2a1ad637SFrançois Tigeot 39*2a1ad637SFrançois Tigeot #define EMUPAGESIZE 4096 40*2a1ad637SFrançois Tigeot #define NUM_G 64 41*2a1ad637SFrançois Tigeot /* XXX some (empty) samples are played when play buffer is > EMUPAGESIZE */ 42*2a1ad637SFrançois Tigeot #define EMU_PLAY_BUFSZ EMUPAGESIZE 43*2a1ad637SFrançois Tigeot /* Recording is limited by EMUPAGESIZE*16=64K buffer */ 44*2a1ad637SFrançois Tigeot #define EMU_REC_BUFSZ EMUPAGESIZE*16 45*2a1ad637SFrançois Tigeot #define EMU_MAX_BUFSZ EMUPAGESIZE*16 46*2a1ad637SFrançois Tigeot #define EMU_MAXPAGES 8192 47*2a1ad637SFrançois Tigeot 48*2a1ad637SFrançois Tigeot 49*2a1ad637SFrançois Tigeot #define EMU_VAR_FUNC 0 50*2a1ad637SFrançois Tigeot #define EMU_VAR_ROUTE 1 51*2a1ad637SFrançois Tigeot #define EMU_VAR_ISEMU10K1 2 52*2a1ad637SFrançois Tigeot #define EMU_VAR_MCH_DISABLED 3 53*2a1ad637SFrançois Tigeot #define EMU_VAR_MCH_REC 4 54*2a1ad637SFrançois Tigeot 55*2a1ad637SFrançois Tigeot #define EMU_A_IOCFG_DISABLE_ANALOG 0x0040 /* = 'enable' for Audigy2 */ 56*2a1ad637SFrançois Tigeot #define EMU_A_IOCFG_GPOUT2 0x0001 57*2a1ad637SFrançois Tigeot #define EMU_AC97SLOT_REAR_RIGHT 0x01 58*2a1ad637SFrançois Tigeot #define EMU_AC97SLOT_REAR_LEFT 0x02 59*2a1ad637SFrançois Tigeot #define EMU_HCFG_GPOUT0 0x00001000 60*2a1ad637SFrançois Tigeot #define EMU_HCFG_GPOUT1 0x00000800 61*2a1ad637SFrançois Tigeot #define EMU_HCFG_GPOUT2 0x00000400 62*2a1ad637SFrançois Tigeot 63*2a1ad637SFrançois Tigeot #define RT_FRONT 0 64*2a1ad637SFrançois Tigeot #define RT_REAR 1 65*2a1ad637SFrançois Tigeot #define RT_CENTER 2 66*2a1ad637SFrançois Tigeot #define RT_SUB 3 67*2a1ad637SFrançois Tigeot #define RT_SIDE 4 68*2a1ad637SFrançois Tigeot #define RT_MCHRECORD 5 69*2a1ad637SFrançois Tigeot #define RT_COUNT 6 70*2a1ad637SFrançois Tigeot 71*2a1ad637SFrançois Tigeot /* mixer controls */ 72*2a1ad637SFrançois Tigeot /* fx play */ 73*2a1ad637SFrançois Tigeot #define M_FX0_FRONT_L 0 74*2a1ad637SFrançois Tigeot #define M_FX1_FRONT_R 1 75*2a1ad637SFrançois Tigeot #define M_FX2_REAR_L 2 76*2a1ad637SFrançois Tigeot #define M_FX3_REAR_R 3 77*2a1ad637SFrançois Tigeot #define M_FX4_CENTER 4 78*2a1ad637SFrançois Tigeot #define M_FX5_SUBWOOFER 5 79*2a1ad637SFrançois Tigeot #define M_FX6_SIDE_L 6 80*2a1ad637SFrançois Tigeot #define M_FX7_SIDE_R 7 81*2a1ad637SFrançois Tigeot /* fx rec */ 82*2a1ad637SFrançois Tigeot #define M_FX0_REC_L 8 83*2a1ad637SFrançois Tigeot #define M_FX1_REC_R 9 84*2a1ad637SFrançois Tigeot /* inputs play */ 85*2a1ad637SFrançois Tigeot #define M_IN0_FRONT_L 10 86*2a1ad637SFrançois Tigeot #define M_IN0_FRONT_R 11 87*2a1ad637SFrançois Tigeot #define M_IN1_FRONT_L 12 88*2a1ad637SFrançois Tigeot #define M_IN1_FRONT_R 13 89*2a1ad637SFrançois Tigeot #define M_IN2_FRONT_L 14 90*2a1ad637SFrançois Tigeot #define M_IN2_FRONT_R 15 91*2a1ad637SFrançois Tigeot #define M_IN3_FRONT_L 16 92*2a1ad637SFrançois Tigeot #define M_IN3_FRONT_R 17 93*2a1ad637SFrançois Tigeot #define M_IN4_FRONT_L 18 94*2a1ad637SFrançois Tigeot #define M_IN4_FRONT_R 19 95*2a1ad637SFrançois Tigeot #define M_IN5_FRONT_L 20 96*2a1ad637SFrançois Tigeot #define M_IN5_FRONT_R 21 97*2a1ad637SFrançois Tigeot #define M_IN6_FRONT_L 22 98*2a1ad637SFrançois Tigeot #define M_IN6_FRONT_R 23 99*2a1ad637SFrançois Tigeot #define M_IN7_FRONT_L 24 100*2a1ad637SFrançois Tigeot #define M_IN7_FRONT_R 25 101*2a1ad637SFrançois Tigeot /* inputs rec */ 102*2a1ad637SFrançois Tigeot #define M_IN0_REC_L 26 103*2a1ad637SFrançois Tigeot #define M_IN0_REC_R 27 104*2a1ad637SFrançois Tigeot #define M_IN1_REC_L 28 105*2a1ad637SFrançois Tigeot #define M_IN1_REC_R 29 106*2a1ad637SFrançois Tigeot #define M_IN2_REC_L 30 107*2a1ad637SFrançois Tigeot #define M_IN2_REC_R 31 108*2a1ad637SFrançois Tigeot #define M_IN3_REC_L 32 109*2a1ad637SFrançois Tigeot #define M_IN3_REC_R 33 110*2a1ad637SFrançois Tigeot #define M_IN4_REC_L 34 111*2a1ad637SFrançois Tigeot #define M_IN4_REC_R 35 112*2a1ad637SFrançois Tigeot #define M_IN5_REC_L 36 113*2a1ad637SFrançois Tigeot #define M_IN5_REC_R 37 114*2a1ad637SFrançois Tigeot #define M_IN6_REC_L 38 115*2a1ad637SFrançois Tigeot #define M_IN6_REC_R 39 116*2a1ad637SFrançois Tigeot #define M_IN7_REC_L 40 117*2a1ad637SFrançois Tigeot #define M_IN7_REC_R 41 118*2a1ad637SFrançois Tigeot /* master volume */ 119*2a1ad637SFrançois Tigeot #define M_MASTER_FRONT_L 42 120*2a1ad637SFrançois Tigeot #define M_MASTER_FRONT_R 43 121*2a1ad637SFrançois Tigeot #define M_MASTER_REAR_L 44 122*2a1ad637SFrançois Tigeot #define M_MASTER_REAR_R 45 123*2a1ad637SFrançois Tigeot #define M_MASTER_CENTER 46 124*2a1ad637SFrançois Tigeot #define M_MASTER_SUBWOOFER 47 125*2a1ad637SFrançois Tigeot #define M_MASTER_SIDE_L 48 126*2a1ad637SFrançois Tigeot #define M_MASTER_SIDE_R 49 127*2a1ad637SFrançois Tigeot /* master rec volume */ 128*2a1ad637SFrançois Tigeot #define M_MASTER_REC_L 50 129*2a1ad637SFrançois Tigeot #define M_MASTER_REC_R 51 130*2a1ad637SFrançois Tigeot 131*2a1ad637SFrançois Tigeot #define NUM_MIXERS 52 132*2a1ad637SFrançois Tigeot 133*2a1ad637SFrançois Tigeot struct emu_sc_info; 134*2a1ad637SFrançois Tigeot 135*2a1ad637SFrançois Tigeot /* MIDI device parameters */ 136*2a1ad637SFrançois Tigeot struct emu_midiinfo { 137*2a1ad637SFrançois Tigeot struct emu_sc_info *card; 138*2a1ad637SFrançois Tigeot int port; 139*2a1ad637SFrançois Tigeot int portnr; 140*2a1ad637SFrançois Tigeot }; 141*2a1ad637SFrançois Tigeot 142*2a1ad637SFrançois Tigeot /* PCM device parameters */ 143*2a1ad637SFrançois Tigeot struct emu_pcminfo { 144*2a1ad637SFrançois Tigeot struct emu_sc_info *card; 145*2a1ad637SFrançois Tigeot int route; 146*2a1ad637SFrançois Tigeot }; 147*2a1ad637SFrançois Tigeot 148*2a1ad637SFrançois Tigeot int emu_intr_register(struct emu_sc_info *sc, uint32_t inte_mask, uint32_t intr_mask, uint32_t(*func) (void *softc, uint32_t irq), void *isc); 149*2a1ad637SFrançois Tigeot int emu_intr_unregister(struct emu_sc_info *sc, int ihandle); 150*2a1ad637SFrançois Tigeot 151*2a1ad637SFrançois Tigeot uint32_t emu_rd(struct emu_sc_info *sc, unsigned int regno, unsigned int size); 152*2a1ad637SFrançois Tigeot void emu_wr(struct emu_sc_info *sc, unsigned int regno, uint32_t data, unsigned int size); 153*2a1ad637SFrançois Tigeot 154*2a1ad637SFrançois Tigeot uint32_t emu_rdptr(struct emu_sc_info *sc, unsigned int chn, unsigned int reg); 155*2a1ad637SFrançois Tigeot void emu_wrptr(struct emu_sc_info *sc, unsigned int chn, unsigned int reg, uint32_t data); 156*2a1ad637SFrançois Tigeot 157*2a1ad637SFrançois Tigeot uint32_t emu_rd_p16vptr(struct emu_sc_info *sc, uint16_t chn, uint16_t reg); 158*2a1ad637SFrançois Tigeot void emu_wr_p16vptr(struct emu_sc_info *sc, uint16_t chn, uint16_t reg, uint32_t data); 159*2a1ad637SFrançois Tigeot 160*2a1ad637SFrançois Tigeot int emu_timer_create(struct emu_sc_info *sc); 161*2a1ad637SFrançois Tigeot int emu_timer_set(struct emu_sc_info *sc, int timer, int delay); 162*2a1ad637SFrançois Tigeot int emu_timer_enable(struct emu_sc_info *sc, int timer, int go); 163*2a1ad637SFrançois Tigeot int emu_timer_clear(struct emu_sc_info *sc, int timer); 164*2a1ad637SFrançois Tigeot 165*2a1ad637SFrançois Tigeot struct emu_voice; 166*2a1ad637SFrançois Tigeot 167*2a1ad637SFrançois Tigeot struct emu_route { 168*2a1ad637SFrançois Tigeot int routing_left[8]; 169*2a1ad637SFrançois Tigeot int amounts_left[8]; 170*2a1ad637SFrançois Tigeot int routing_right[8]; 171*2a1ad637SFrançois Tigeot int amounts_right[8]; 172*2a1ad637SFrançois Tigeot }; 173*2a1ad637SFrançois Tigeot 174*2a1ad637SFrançois Tigeot struct emu_voice* emu_valloc(struct emu_sc_info *sc); 175*2a1ad637SFrançois Tigeot void emu_vfree(struct emu_sc_info *sc, struct emu_voice *v); 176*2a1ad637SFrançois Tigeot int emu_vinit(struct emu_sc_info *sc, struct emu_voice *m, struct emu_voice *s, 177*2a1ad637SFrançois Tigeot uint32_t sz, struct snd_dbuf *b); 178*2a1ad637SFrançois Tigeot void emu_vroute(struct emu_sc_info *sc, struct emu_route *rt, struct emu_voice *v); 179*2a1ad637SFrançois Tigeot void emu_vsetup(struct emu_voice *v, int fmt, int spd); 180*2a1ad637SFrançois Tigeot void emu_vwrite(struct emu_sc_info *sc, struct emu_voice *v); 181*2a1ad637SFrançois Tigeot void emu_vtrigger(struct emu_sc_info *sc, struct emu_voice *v, int go); 182*2a1ad637SFrançois Tigeot int emu_vpos(struct emu_sc_info *sc, struct emu_voice *v); 183*2a1ad637SFrançois Tigeot 184*2a1ad637SFrançois Tigeot bus_dma_tag_t emu_gettag(struct emu_sc_info *sc); 185*2a1ad637SFrançois Tigeot 186*2a1ad637SFrançois Tigeot void emumix_set_volume(struct emu_sc_info *sc, int mixer_idx, int volume); 187*2a1ad637SFrançois Tigeot int emumix_get_volume(struct emu_sc_info *sc, int mixer_idx); 188*2a1ad637SFrançois Tigeot 189*2a1ad637SFrançois Tigeot void emu_enable_ir(struct emu_sc_info *sc); 190*2a1ad637SFrançois Tigeot #endif /* _KERNEL */ 191*2a1ad637SFrançois Tigeot #endif /* EMU10K1_H */ 192