Date: Fri, 3 Feb 2012 23:00:28 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r230965 - in stable/8/sys: conf dev/sound/pci gnu/dev/sound/pci modules/sound/driver/emu10kx Message-ID: <201202032300.q13N0S9P008255@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Fri Feb 3 23:00:28 2012 New Revision: 230965 URL: http://svn.freebsd.org/changeset/base/230965 Log: MFC: r229981, r230898 Replace a GPL'd header in the emu10kx snd driver code. This uses the emuxkireg.h already used in the emu10k1 snd driver. Special thanks go to Alexander Motin as he was able to find some errors and reverse engineer some wrong values in the emuxkireg header. While here also merge some cleanups to the module Makefile. PR: 153901 Obtained from: NetBSD Approved by: core (mentor implicit) Deleted: stable/8/sys/gnu/dev/sound/pci/emu10k1-alsa.h stable/8/sys/gnu/dev/sound/pci/p16v-alsa.h stable/8/sys/gnu/dev/sound/pci/p17v-alsa.h Modified: stable/8/sys/conf/files stable/8/sys/dev/sound/pci/emu10kx-midi.c stable/8/sys/dev/sound/pci/emu10kx-pcm.c stable/8/sys/dev/sound/pci/emu10kx.c stable/8/sys/dev/sound/pci/emu10kx.h stable/8/sys/dev/sound/pci/emuxkireg.h stable/8/sys/modules/sound/driver/emu10kx/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/modules/sound/driver/emu10kx/ (props changed) Modified: stable/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Fri Feb 3 22:39:04 2012 (r230964) +++ stable/8/sys/conf/files Fri Feb 3 23:00:28 2012 (r230965) @@ -50,21 +50,6 @@ aic79xx_reg_print.c optional ahd pci aic79xx_reg_print.o optional ahd pci ahd_reg_pretty_print \ compile-with "${NORMAL_C}" \ no-implicit-rule local -emu10k1-alsa%diked.h optional snd_emu10kx \ - dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h" \ - compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h emu10k1-alsa%diked.h" \ - no-obj no-implicit-rule before-depend \ - clean "emu10k1-alsa%diked.h" -p16v-alsa%diked.h optional snd_emu10kx pci \ - dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p16v-alsa.h" \ - compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p16v-alsa.h p16v-alsa%diked.h" \ - no-obj no-implicit-rule before-depend \ - clean "p16v-alsa%diked.h" -p17v-alsa%diked.h optional snd_emu10kx pci \ - dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p17v-alsa.h" \ - compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p17v-alsa.h p17v-alsa%diked.h" \ - no-obj no-implicit-rule before-depend \ - clean "p17v-alsa%diked.h" feeder_eq_gen.h optional sound \ dependency "$S/tools/sound/feeder_eq_mkfilter.awk" \ compile-with "${AWK} -f $S/tools/sound/feeder_eq_mkfilter.awk -- ${FEEDER_EQ_PRESETS} > feeder_eq_gen.h" \ @@ -1602,19 +1587,9 @@ dev/sound/pci/csa.c optional snd_csa pc dev/sound/pci/csapcm.c optional snd_csa pci dev/sound/pci/ds1.c optional snd_ds1 pci dev/sound/pci/emu10k1.c optional snd_emu10k1 pci -dev/sound/pci/emu10kx.c optional snd_emu10kx pci \ - dependency "emu10k1-alsa%diked.h" \ - dependency "p16v-alsa%diked.h" \ - dependency "p17v-alsa%diked.h" \ - warning "kernel contains GPL contaminated emu10kx headers" -dev/sound/pci/emu10kx-pcm.c optional snd_emu10kx pci \ - dependency "emu10k1-alsa%diked.h" \ - dependency "p16v-alsa%diked.h" \ - dependency "p17v-alsa%diked.h" \ - warning "kernel contains GPL contaminated emu10kx headers" -dev/sound/pci/emu10kx-midi.c optional snd_emu10kx pci \ - dependency "emu10k1-alsa%diked.h" \ - warning "kernel contains GPL contaminated emu10kx headers" +dev/sound/pci/emu10kx.c optional snd_emu10kx pci +dev/sound/pci/emu10kx-pcm.c optional snd_emu10kx pci +dev/sound/pci/emu10kx-midi.c optional snd_emu10kx pci dev/sound/pci/envy24.c optional snd_envy24 pci dev/sound/pci/envy24ht.c optional snd_envy24ht pci dev/sound/pci/es137x.c optional snd_es137x pci Modified: stable/8/sys/dev/sound/pci/emu10kx-midi.c ============================================================================== --- stable/8/sys/dev/sound/pci/emu10kx-midi.c Fri Feb 3 22:39:04 2012 (r230964) +++ stable/8/sys/dev/sound/pci/emu10kx-midi.c Fri Feb 3 23:00:28 2012 (r230965) @@ -50,8 +50,8 @@ #include <dev/sound/midi/mpu401.h> #include "mpufoi_if.h" +#include <dev/sound/pci/emuxkireg.h> #include <dev/sound/pci/emu10kx.h> -#include "emu10k1-alsa%diked.h" struct emu_midi_softc { struct mtx mtx; @@ -176,25 +176,25 @@ emu_midi_attach(device_t dev) if (scp->is_emu10k1) { /* SB Live! - only one MIDI device here */ inte_val = 0; - /* inte_val |= INTE_MIDITXENABLE;*/ - inte_val |= INTE_MIDIRXENABLE; - ipr_val = IPR_MIDITRANSBUFEMPTY; - ipr_val |= IPR_MIDIRECVBUFEMPTY; + /* inte_val |= EMU_INTE_MIDITXENABLE;*/ + inte_val |= EMU_INTE_MIDIRXENABLE; + ipr_val = EMU_IPR_MIDITRANSBUFE; + ipr_val |= EMU_IPR_MIDIRECVBUFE; } else { - if (scp->port == A_MUDATA1) { + if (scp->port == EMU_A_MUDATA1) { /* EXTERNAL MIDI (AudigyDrive) */ inte_val = 0; - /* inte_val |= A_INTE_MIDITXENABLE1;*/ - inte_val |= INTE_MIDIRXENABLE; - ipr_val = IPR_MIDITRANSBUFEMPTY; - ipr_val |= IPR_MIDIRECVBUFEMPTY; + /* inte_val |= A_EMU_INTE_MIDITXENABLE1;*/ + inte_val |= EMU_INTE_MIDIRXENABLE; + ipr_val = EMU_IPR_MIDITRANSBUFE; + ipr_val |= EMU_IPR_MIDIRECVBUFE; } else { /* MIDI hw config port 2 */ inte_val = 0; - /* inte_val |= A_INTE_MIDITXENABLE2;*/ - inte_val |= INTE_A_MIDIRXENABLE2; - ipr_val = IPR_A_MIDITRANSBUFEMPTY2; - ipr_val |= IPR_A_MIDIRECVBUFEMPTY2; + /* inte_val |= A_EMU_INTE_MIDITXENABLE2;*/ + inte_val |= EMU_INTE_A_MIDIRXENABLE2; + ipr_val = EMU_IPR_A_MIDITRANSBUFE2; + ipr_val |= EMU_IPR_A_MIDIRECBUFE2; } } @@ -214,7 +214,7 @@ emu_midi_attach(device_t dev) if (scp->is_emu10k1) emu_enable_ir(scp->card); else { - if (scp->port == A_MUDATA1) + if (scp->port == EMU_A_MUDATA1) emu_enable_ir(scp->card); } Modified: stable/8/sys/dev/sound/pci/emu10kx-pcm.c ============================================================================== --- stable/8/sys/dev/sound/pci/emu10kx-pcm.c Fri Feb 3 22:39:04 2012 (r230964) +++ stable/8/sys/dev/sound/pci/emu10kx-pcm.c Fri Feb 3 23:00:28 2012 (r230965) @@ -49,8 +49,8 @@ #include "mixer_if.h" +#include <dev/sound/pci/emuxkireg.h> #include <dev/sound/pci/emu10kx.h> -#include "emu10k1-alsa%diked.h" struct emu_pcm_pchinfo { int spd; @@ -555,8 +555,8 @@ emu_ac97_read_emulation(struct emu_pcm_i break; } - emu_wr(sc->card, AC97ADDRESS, regno, 1); - tmp = emu_rd(sc->card, AC97DATA, 2); + emu_wr(sc->card, EMU_AC97ADDR, regno, 1); + tmp = emu_rd(sc->card, EMU_AC97DATA, 2); if (use_ac97) emulated = tmp; @@ -621,8 +621,8 @@ emu_ac97_write_emulation(struct emu_pcm_ break; } if (write_ac97) { - emu_wr(sc->card, AC97ADDRESS, regno, 1); - emu_wr(sc->card, AC97DATA, data, 2); + emu_wr(sc->card, EMU_AC97ADDR, regno, 1); + emu_wr(sc->card, EMU_AC97DATA, data, 2); } } @@ -658,8 +658,8 @@ emu_rdcd(kobj_t obj __unused, void *devi struct emu_pcm_info *sc = (struct emu_pcm_info *)devinfo; KASSERT(sc->card != NULL, ("emu_rdcd: no soundcard")); - emu_wr(sc->card, AC97ADDRESS, regno, 1); - rd = emu_rd(sc->card, AC97DATA, 2); + emu_wr(sc->card, EMU_AC97ADDR, regno, 1); + rd = emu_rd(sc->card, EMU_AC97DATA, 2); return (rd); } @@ -669,8 +669,8 @@ emu_wrcd(kobj_t obj __unused, void *devi struct emu_pcm_info *sc = (struct emu_pcm_info *)devinfo; KASSERT(sc->card != NULL, ("emu_wrcd: no soundcard")); - emu_wr(sc->card, AC97ADDRESS, regno, 1); - emu_wr(sc->card, AC97DATA, data, 2); + emu_wr(sc->card, EMU_AC97ADDR, regno, 1); + emu_wr(sc->card, EMU_AC97DATA, data, 2); return (0); } @@ -870,12 +870,12 @@ emurchan_init(kobj_t obj __unused, void ch->blksz = sc->bufsz / 2; /* We rise interrupt for half-full buffer */ ch->fmt = SND_FORMAT(AFMT_U8, 1, 0); ch->spd = 8000; - ch->idxreg = sc->is_emu10k1 ? ADCIDX : A_ADCIDX; - ch->basereg = ADCBA; - ch->sizereg = ADCBS; - ch->setupreg = ADCCR; - ch->irqmask = INTE_ADCBUFENABLE; - ch->iprmask = IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL; + ch->idxreg = sc->is_emu10k1 ? EMU_ADCIDX : EMU_A_ADCIDX; + ch->basereg = EMU_ADCBA; + ch->sizereg = EMU_ADCBS; + ch->setupreg = EMU_ADCCR; + ch->irqmask = EMU_INTE_ADCBUFENABLE; + ch->iprmask = EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL; if (sndbuf_alloc(ch->buffer, emu_gettag(sc->card), 0, sc->bufsz) != 0) return (NULL); @@ -953,22 +953,22 @@ emurchan_trigger(kobj_t obj __unused, vo switch (sc->bufsz) { case 4096: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; break; case 8192: - sz = ADCBS_BUFSIZE_8192; + sz = EMU_RECBS_BUFSIZE_8192; break; case 16384: - sz = ADCBS_BUFSIZE_16384; + sz = EMU_RECBS_BUFSIZE_16384; break; case 32768: - sz = ADCBS_BUFSIZE_32768; + sz = EMU_RECBS_BUFSIZE_32768; break; case 65536: - sz = ADCBS_BUFSIZE_65536; + sz = EMU_RECBS_BUFSIZE_65536; break; default: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; } snd_mtxlock(sc->lock); @@ -976,9 +976,9 @@ emurchan_trigger(kobj_t obj __unused, vo case PCMTRIG_START: ch->run = 1; emu_wrptr(sc->card, 0, ch->sizereg, sz); - val = sc->is_emu10k1 ? ADCCR_LCHANENABLE : A_ADCCR_LCHANENABLE; + val = sc->is_emu10k1 ? EMU_ADCCR_LCHANENABLE : EMU_A_ADCCR_LCHANENABLE; if (AFMT_CHANNEL(ch->fmt) > 1) - val |= sc->is_emu10k1 ? ADCCR_RCHANENABLE : A_ADCCR_RCHANENABLE; + val |= sc->is_emu10k1 ? EMU_ADCCR_RCHANENABLE : EMU_A_ADCCR_RCHANENABLE; val |= sc->is_emu10k1 ? emu_k1_recval(ch->spd) : emu_k2_recval(ch->spd); emu_wrptr(sc->card, 0, ch->setupreg, 0); emu_wrptr(sc->card, 0, ch->setupreg, val); @@ -1049,11 +1049,11 @@ emufxrchan_init(kobj_t obj __unused, voi ch = &(sc->rch_efx); ch->fmt = SND_FORMAT(AFMT_S16_LE, 1, 0); ch->spd = sc->is_emu10k1 ? 48000*32 : 48000 * 64; - ch->idxreg = FXIDX; - ch->basereg = FXBA; - ch->sizereg = FXBS; - ch->irqmask = INTE_EFXBUFENABLE; - ch->iprmask = IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL; + ch->idxreg = EMU_FXIDX; + ch->basereg = EMU_FXBA; + ch->sizereg = EMU_FXBS; + ch->irqmask = EMU_INTE_EFXBUFENABLE; + ch->iprmask = EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL; ch->buffer = b; ch->pcm = sc; ch->channel = c; @@ -1113,22 +1113,22 @@ emufxrchan_trigger(kobj_t obj __unused, switch (sc->bufsz) { case 4096: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; break; case 8192: - sz = ADCBS_BUFSIZE_8192; + sz = EMU_RECBS_BUFSIZE_8192; break; case 16384: - sz = ADCBS_BUFSIZE_16384; + sz = EMU_RECBS_BUFSIZE_16384; break; case 32768: - sz = ADCBS_BUFSIZE_32768; + sz = EMU_RECBS_BUFSIZE_32768; break; case 65536: - sz = ADCBS_BUFSIZE_65536; + sz = EMU_RECBS_BUFSIZE_65536; break; default: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; } snd_mtxlock(sc->lock); @@ -1140,14 +1140,14 @@ emufxrchan_trigger(kobj_t obj __unused, /* * SB Live! is limited to 32 mono channels. Audigy * has 64 mono channels. Channels are enabled - * by setting a bit in A_FXWC[1|2] registers. + * by setting a bit in EMU_A_FXWC[1|2] registers. */ /* XXX there is no way to demultiplex this streams for now */ if (sc->is_emu10k1) { - emu_wrptr(sc->card, 0, FXWC, 0xffffffff); + emu_wrptr(sc->card, 0, EMU_FXWC, 0xffffffff); } else { - emu_wrptr(sc->card, 0, A_FXWC1, 0xffffffff); - emu_wrptr(sc->card, 0, A_FXWC2, 0xffffffff); + emu_wrptr(sc->card, 0, EMU_A_FXWC1, 0xffffffff); + emu_wrptr(sc->card, 0, EMU_A_FXWC2, 0xffffffff); } break; case PCMTRIG_STOP: @@ -1155,10 +1155,10 @@ emufxrchan_trigger(kobj_t obj __unused, case PCMTRIG_ABORT: ch->run = 0; if (sc->is_emu10k1) { - emu_wrptr(sc->card, 0, FXWC, 0x0); + emu_wrptr(sc->card, 0, EMU_FXWC, 0x0); } else { - emu_wrptr(sc->card, 0, A_FXWC1, 0x0); - emu_wrptr(sc->card, 0, A_FXWC2, 0x0); + emu_wrptr(sc->card, 0, EMU_A_FXWC1, 0x0); + emu_wrptr(sc->card, 0, EMU_A_FXWC2, 0x0); } emu_wrptr(sc->card, 0, ch->sizereg, 0); (void)emu_intr_unregister(sc->card, ch->ihandle); @@ -1238,8 +1238,8 @@ emu_pcm_intr(void *pcm, uint32_t stat) snd_mtxlock(sc->lock); - if (stat & IPR_INTERVALTIMER) { - ack |= IPR_INTERVALTIMER; + if (stat & EMU_IPR_INTERVALTIMER) { + ack |= EMU_IPR_INTERVALTIMER; for (i = 0; i < MAX_CHANNELS; i++) if (sc->pch[i].channel) { if (sc->pch[i].run == 1) { @@ -1262,8 +1262,8 @@ emu_pcm_intr(void *pcm, uint32_t stat) } - if (stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL)) { - ack |= stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL); + if (stat & (EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL)) { + ack |= stat & (EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL); if (sc->rch_adc.channel) { snd_mtxunlock(sc->lock); chn_intr(sc->rch_adc.channel); @@ -1271,8 +1271,8 @@ emu_pcm_intr(void *pcm, uint32_t stat) } } - if (stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL)) { - ack |= stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL); + if (stat & (EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL)) { + ack |= stat & (EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL); if (sc->rch_efx.channel) { snd_mtxunlock(sc->lock); chn_intr(sc->rch_efx.channel); @@ -1450,8 +1450,8 @@ emu_pcm_attach(device_t dev) goto bad; } - inte = INTE_INTERVALTIMERENB; - ipr = IPR_INTERVALTIMER; /* Used by playback & ADC */ + inte = EMU_INTE_INTERTIMERENB; + ipr = EMU_IPR_INTERVALTIMER; /* Used by playback & ADC */ sc->ihandle = emu_intr_register(sc->card, inte, ipr, &emu_pcm_intr, sc); if (emu_pcm_init(sc) == -1) { Modified: stable/8/sys/dev/sound/pci/emu10kx.c ============================================================================== --- stable/8/sys/dev/sound/pci/emu10kx.c Fri Feb 3 22:39:04 2012 (r230964) +++ stable/8/sys/dev/sound/pci/emu10kx.c Fri Feb 3 23:00:28 2012 (r230965) @@ -53,6 +53,7 @@ #include <dev/sound/pcm/sound.h> #include <dev/sound/pcm/ac97.h> +#include <dev/sound/pci/emuxkireg.h> #include <dev/sound/pci/emu10kx.h> /* hw flags */ @@ -181,7 +182,7 @@ #define A_IN_AUX2_R 0x0d #define A_IN_AUX2 A_IN_AUX2_L -/* Audigiy Outputs */ +/* Audigy Outputs */ #define A_OUT_D_FRONT_L 0x00 #define A_OUT_D_FRONT_R 0x01 #define A_OUT_D_FRONT A_OUT_D_FRONT_L @@ -217,9 +218,19 @@ #define A_OUT_ADC_REC_R 0x17 #define A_OUT_ADC_REC A_OUT_ADC_REC_L -#include "emu10k1-alsa%diked.h" -#include "p16v-alsa%diked.h" -#include "p17v-alsa%diked.h" +#define EMU_DATA2 0x24 +#define EMU_IPR2 0x28 +#define EMU_INTE2 0x2c +#define EMU_IPR3 0x38 +#define EMU_INTE3 0x3c + +#define EMU_A2_SRCSel 0x60 +#define EMU_A2_SRCMULTI_ENABLE 0x6e + +#define EMU_A_I2S_CAPTURE_96000 0x00000400 + +#define EMU_A2_MIXER_I2S_ENABLE 0x7B +#define EMU_A2_MIXER_SPDIF_ENABLE 0x7A #define C_FRONT_L 0 #define C_FRONT_R 1 @@ -630,7 +641,7 @@ emu_wr_nolock(struct emu_sc_info *sc, un } } /* - * PTR / DATA interface. Access to EMU10Kx is made + * EMU_PTR / EMU_DATA interface. Access to EMU10Kx is made * via (channel, register) pair. Some registers are channel-specific, * some not. */ @@ -639,11 +650,11 @@ emu_rdptr(struct emu_sc_info *sc, unsign { uint32_t ptr, val, mask, size, offset; - ptr = ((reg << 16) & sc->address_mask) | (chn & PTR_CHANNELNUM_MASK); + ptr = ((reg << 16) & sc->address_mask) | (chn & EMU_PTR_CHNO_MASK); EMU_RWLOCK(); - emu_wr_nolock(sc, PTR, ptr, 4); - val = emu_rd_nolock(sc, DATA, 4); + emu_wr_nolock(sc, EMU_PTR, ptr, 4); + val = emu_rd_nolock(sc, EMU_DATA, 4); EMU_RWUNLOCK(); /* @@ -666,10 +677,10 @@ emu_wrptr(struct emu_sc_info *sc, unsign { uint32_t ptr, mask, size, offset; - ptr = ((reg << 16) & sc->address_mask) | (chn & PTR_CHANNELNUM_MASK); + ptr = ((reg << 16) & sc->address_mask) | (chn & EMU_PTR_CHNO_MASK); EMU_RWLOCK(); - emu_wr_nolock(sc, PTR, ptr, 4); + emu_wr_nolock(sc, EMU_PTR, ptr, 4); /* * XXX Another kind of magic encoding in register number. This can * give you side effect - it will read previous data from register @@ -681,13 +692,13 @@ emu_wrptr(struct emu_sc_info *sc, unsign mask = ((1 << size) - 1) << offset; data <<= offset; data &= mask; - data |= emu_rd_nolock(sc, DATA, 4) & ~mask; + data |= emu_rd_nolock(sc, EMU_DATA, 4) & ~mask; } - emu_wr_nolock(sc, DATA, data, 4); + emu_wr_nolock(sc, EMU_DATA, data, 4); EMU_RWUNLOCK(); } /* - * PTR2 / DATA2 interface. Access to P16v is made + * EMU_A2_PTR / EMU_DATA2 interface. Access to P16v is made * via (channel, register) pair. Some registers are channel-specific, * some not. This interface is supported by CA0102 and CA0108 chips only. */ @@ -698,8 +709,8 @@ emu_rd_p16vptr(struct emu_sc_info *sc, u /* XXX separate lock? */ EMU_RWLOCK(); - emu_wr_nolock(sc, PTR2, (reg << 16) | chn, 4); - val = emu_rd_nolock(sc, DATA2, 4); + emu_wr_nolock(sc, EMU_A2_PTR, (reg << 16) | chn, 4); + val = emu_rd_nolock(sc, EMU_DATA2, 4); EMU_RWUNLOCK(); @@ -711,8 +722,8 @@ emu_wr_p16vptr(struct emu_sc_info *sc, u { EMU_RWLOCK(); - emu_wr_nolock(sc, PTR2, (reg << 16) | chn, 4); - emu_wr_nolock(sc, DATA2, data, 4); + emu_wr_nolock(sc, EMU_A2_PTR, (reg << 16) | chn, 4); + emu_wr_nolock(sc, EMU_DATA2, data, 4); EMU_RWUNLOCK(); } /* @@ -737,13 +748,13 @@ emu_wr_cbptr(struct emu_sc_info *sc, uin /* * Direct hardware register access - * Assume that it is never used to access PTR-based registers and can run unlocked. + * Assume that it is never used to access EMU_PTR-based registers and can run unlocked. */ void emu_wr(struct emu_sc_info *sc, unsigned int regno, uint32_t data, unsigned int size) { - KASSERT(regno != PTR, ("emu_wr: attempt to write to PTR")); - KASSERT(regno != PTR2, ("emu_wr: attempt to write to PTR2")); + KASSERT(regno != EMU_PTR, ("emu_wr: attempt to write to EMU_PTR")); + KASSERT(regno != EMU_A2_PTR, ("emu_wr: attempt to write to EMU_A2_PTR")); emu_wr_nolock(sc, regno, data, size); } @@ -753,8 +764,8 @@ emu_rd(struct emu_sc_info *sc, unsigned { uint32_t rd; - KASSERT(regno != DATA, ("emu_rd: attempt to read DATA")); - KASSERT(regno != DATA2, ("emu_rd: attempt to read DATA2")); + KASSERT(regno != EMU_DATA, ("emu_rd: attempt to read DATA")); + KASSERT(regno != EMU_DATA2, ("emu_rd: attempt to read DATA2")); rd = emu_rd_nolock(sc, regno, size); return (rd); @@ -770,24 +781,24 @@ emu_enable_ir(struct emu_sc_info *sc) uint32_t iocfg; if (sc->is_emu10k2 || sc->is_ca0102) { - iocfg = emu_rd_nolock(sc, A_IOCFG, 2); - emu_wr_nolock(sc, A_IOCFG, iocfg | A_IOCFG_GPOUT2, 2); + iocfg = emu_rd_nolock(sc, EMU_A_IOCFG, 2); + emu_wr_nolock(sc, EMU_A_IOCFG, iocfg | EMU_A_IOCFG_GPOUT2, 2); DELAY(500); - emu_wr_nolock(sc, A_IOCFG, iocfg | A_IOCFG_GPOUT1 | A_IOCFG_GPOUT2, 2); + emu_wr_nolock(sc, EMU_A_IOCFG, iocfg | EMU_A_IOCFG_GPOUT1 | EMU_A_IOCFG_GPOUT2, 2); DELAY(500); - emu_wr_nolock(sc, A_IOCFG, iocfg | A_IOCFG_GPOUT1, 2); + emu_wr_nolock(sc, EMU_A_IOCFG, iocfg | EMU_A_IOCFG_GPOUT1, 2); DELAY(100); - emu_wr_nolock(sc, A_IOCFG, iocfg, 2); + emu_wr_nolock(sc, EMU_A_IOCFG, iocfg, 2); device_printf(sc->dev, "Audigy IR MIDI events enabled.\n"); sc->enable_ir = 1; } if (sc->is_emu10k1) { - iocfg = emu_rd_nolock(sc, HCFG, 4); - emu_wr_nolock(sc, HCFG, iocfg | HCFG_GPOUT2, 4); + iocfg = emu_rd_nolock(sc, EMU_HCFG, 4); + emu_wr_nolock(sc, EMU_HCFG, iocfg | EMU_HCFG_GPOUT2, 4); DELAY(500); - emu_wr_nolock(sc, HCFG, iocfg | HCFG_GPOUT1 | HCFG_GPOUT2, 4); + emu_wr_nolock(sc, EMU_HCFG, iocfg | EMU_HCFG_GPOUT1 | EMU_HCFG_GPOUT2, 4); DELAY(100); - emu_wr_nolock(sc, HCFG, iocfg, 4); + emu_wr_nolock(sc, EMU_HCFG, iocfg, 4); device_printf(sc->dev, "SB Live! IR MIDI events enabled.\n"); sc->enable_ir = 1; } @@ -835,7 +846,7 @@ emu_timer_set(struct emu_sc_info *sc, in sc->timerinterval = sc->timer[i]; /* XXX */ - emu_wr(sc, TIMER, sc->timerinterval & 0x03ff, 2); + emu_wr(sc, EMU_TIMER, sc->timerinterval & 0x03ff, 2); mtx_unlock(&sc->lock); return (timer); @@ -868,16 +879,16 @@ emu_timer_enable(struct emu_sc_info *sc, ena_int = 1; } - emu_wr(sc, TIMER, sc->timerinterval & 0x03ff, 2); + emu_wr(sc, EMU_TIMER, sc->timerinterval & 0x03ff, 2); if (ena_int == 1) { - x = emu_rd(sc, INTE, 4); - x |= INTE_INTERVALTIMERENB; - emu_wr(sc, INTE, x, 4); + x = emu_rd(sc, EMU_INTE, 4); + x |= EMU_INTE_INTERTIMERENB; + emu_wr(sc, EMU_INTE, x, 4); } else { - x = emu_rd(sc, INTE, 4); - x &= ~INTE_INTERVALTIMERENB; - emu_wr(sc, INTE, x, 4); + x = emu_rd(sc, EMU_INTE, 4); + x &= ~EMU_INTE_INTERTIMERENB; + emu_wr(sc, EMU_INTE, x, 4); } mtx_unlock(&sc->lock); return (0); @@ -917,9 +928,9 @@ emu_intr_register(struct emu_sc_info *sc sc->ihandler[i].intr_mask = intr_mask; sc->ihandler[i].softc = isc; sc->ihandler[i].irq_func = func; - x = emu_rd(sc, INTE, 4); + x = emu_rd(sc, EMU_INTE, 4); x |= inte_mask; - emu_wr(sc, INTE, x, 4); + emu_wr(sc, EMU_INTE, x, 4); mtx_unlock(&sc->lock); if (sc->dbg_level > 1) device_printf(sc->dev, "ihandle %d registered\n", i); @@ -946,7 +957,7 @@ emu_intr_unregister(struct emu_sc_info * return (-1); } - x = emu_rd(sc, INTE, 4); + x = emu_rd(sc, EMU_INTE, 4); x &= ~sc->ihandler[hnumber].inte_mask; sc->ihandler[hnumber].inte_mask = 0; @@ -954,12 +965,12 @@ emu_intr_unregister(struct emu_sc_info * sc->ihandler[hnumber].softc = NULL; sc->ihandler[hnumber].irq_func = NULL; - /* other interrupt handlers may use this INTE value */ + /* other interrupt handlers may use this EMU_INTE value */ for (i = 0; i < EMU_MAX_IRQ_CONSUMERS; i++) if (sc->ihandler[i].inte_mask != 0) x |= sc->ihandler[i].inte_mask; - emu_wr(sc, INTE, x, 4); + emu_wr(sc, EMU_INTE, x, 4); mtx_unlock(&sc->lock); return (hnumber); @@ -973,11 +984,11 @@ emu_intr(void *p) int i; for (;;) { - stat = emu_rd(sc, IPR, 4); + stat = emu_rd(sc, EMU_IPR, 4); ack = 0; if (stat == 0) break; - emu_wr(sc, IPR, stat, 4); + emu_wr(sc, EMU_IPR, stat, 4); for (i = 0; i < EMU_MAX_IRQ_CONSUMERS; i++) { if ((((sc->ihandler[i].intr_mask) & stat) != 0) && (((void *)sc->ihandler[i].irq_func) != NULL)) { @@ -993,13 +1004,13 @@ emu_intr(void *p) if ((sc->is_ca0102) || (sc->is_ca0108)) for (;;) { - stat = emu_rd(sc, IPR2, 4); + stat = emu_rd(sc, EMU_IPR2, 4); ack = 0; if (stat == 0) break; - emu_wr(sc, IPR2, stat, 4); + emu_wr(sc, EMU_IPR2, stat, 4); if (sc->dbg_level > 1) - device_printf(sc->dev, "IPR2: %08x\n", stat); + device_printf(sc->dev, "EMU_IPR2: %08x\n", stat); break; /* to avoid infinite loop. shoud be removed * after completion of P16V interface. */ @@ -1007,13 +1018,13 @@ emu_intr(void *p) if (sc->is_ca0102) for (;;) { - stat = emu_rd(sc, IPR3, 4); + stat = emu_rd(sc, EMU_IPR3, 4); ack = 0; if (stat == 0) break; - emu_wr(sc, IPR3, stat, 4); + emu_wr(sc, EMU_IPR3, stat, 4); if (sc->dbg_level > 1) - device_printf(sc->dev, "IPR3: %08x\n", stat); + device_printf(sc->dev, "EMU_IPR3: %08x\n", stat); break; /* to avoid infinite loop. should be removed * after completion of S/PDIF interface */ @@ -1374,61 +1385,61 @@ emu_vwrite(struct emu_sc_info *sc, struc if (v->stereo) { - emu_wrptr(sc, v->vnum, CPF, CPF_STEREO_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF, EMU_CHAN_CPF_STEREO_MASK); } else { - emu_wrptr(sc, v->vnum, CPF, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF, 0); } val = v->stereo ? 28 : 30; val *= v->b16 ? 1 : 2; start = v->sa + val; if (sc->is_emu10k1) { - emu_wrptr(sc, v->vnum, FXRT, ((v->routing[3] << 12) | + emu_wrptr(sc, v->vnum, EMU_CHAN_FXRT, ((v->routing[3] << 12) | (v->routing[2] << 8) | (v->routing[1] << 4) | (v->routing[0] << 0)) << 16); } else { - emu_wrptr(sc, v->vnum, A_FXRT1, (v->routing[3] << 24) | + emu_wrptr(sc, v->vnum, EMU_A_CHAN_FXRT1, (v->routing[3] << 24) | (v->routing[2] << 16) | (v->routing[1] << 8) | (v->routing[0] << 0)); - emu_wrptr(sc, v->vnum, A_FXRT2, (v->routing[7] << 24) | + emu_wrptr(sc, v->vnum, EMU_A_CHAN_FXRT2, (v->routing[7] << 24) | (v->routing[6] << 16) | (v->routing[5] << 8) | (v->routing[4] << 0)); - emu_wrptr(sc, v->vnum, A_SENDAMOUNTS, (v->amounts[7] << 24) | + emu_wrptr(sc, v->vnum, EMU_A_CHAN_SENDAMOUNTS, (v->amounts[7] << 24) | (v->amounts[6] << 26) | (v->amounts[5] << 8) | (v->amounts[4] << 0)); } - emu_wrptr(sc, v->vnum, PTRX, (v->amounts[0] << 8) | (v->amounts[1] << 0)); - emu_wrptr(sc, v->vnum, DSL, v->ea | (v->amounts[3] << 24)); - emu_wrptr(sc, v->vnum, PSST, v->sa | (v->amounts[2] << 24)); - - emu_wrptr(sc, v->vnum, CCCA, start | (v->b16 ? 0 : CCCA_8BITSELECT)); - emu_wrptr(sc, v->vnum, Z1, 0); - emu_wrptr(sc, v->vnum, Z2, 0); - - silent_page = ((uint32_t) (sc->mem.silent_page_addr) << 1) | MAP_PTI_MASK; - emu_wrptr(sc, v->vnum, MAPA, silent_page); - emu_wrptr(sc, v->vnum, MAPB, silent_page); - - emu_wrptr(sc, v->vnum, CVCF, CVCF_CURRENTFILTER_MASK); - emu_wrptr(sc, v->vnum, VTFT, VTFT_FILTERTARGET_MASK); - emu_wrptr(sc, v->vnum, ATKHLDM, 0); - emu_wrptr(sc, v->vnum, DCYSUSM, DCYSUSM_DECAYTIME_MASK); - emu_wrptr(sc, v->vnum, LFOVAL1, 0x8000); - emu_wrptr(sc, v->vnum, LFOVAL2, 0x8000); - emu_wrptr(sc, v->vnum, FMMOD, 0); - emu_wrptr(sc, v->vnum, TREMFRQ, 0); - emu_wrptr(sc, v->vnum, FM2FRQ2, 0); - emu_wrptr(sc, v->vnum, ENVVAL, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX, (v->amounts[0] << 8) | (v->amounts[1] << 0)); + emu_wrptr(sc, v->vnum, EMU_CHAN_DSL, v->ea | (v->amounts[3] << 24)); + emu_wrptr(sc, v->vnum, EMU_CHAN_PSST, v->sa | (v->amounts[2] << 24)); + + emu_wrptr(sc, v->vnum, EMU_CHAN_CCCA, start | (v->b16 ? 0 : EMU_CHAN_CCCA_8BITSELECT)); + emu_wrptr(sc, v->vnum, EMU_CHAN_Z1, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_Z2, 0); + + silent_page = ((uint32_t) (sc->mem.silent_page_addr) << 1) | EMU_CHAN_MAP_PTI_MASK; + emu_wrptr(sc, v->vnum, EMU_CHAN_MAPA, silent_page); + emu_wrptr(sc, v->vnum, EMU_CHAN_MAPB, silent_page); + + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, EMU_CHAN_CVCF_CURRFILTER_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, EMU_CHAN_VTFT_FILTERTARGET_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_ATKHLDM, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_DCYSUSM, EMU_CHAN_DCYSUSM_DECAYTIME_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_LFOVAL1, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_LFOVAL2, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_FMMOD, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_TREMFRQ, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_FM2FRQ2, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_ENVVAL, 0x8000); - emu_wrptr(sc, v->vnum, ATKHLDV, ATKHLDV_HOLDTIME_MASK | ATKHLDV_ATTACKTIME_MASK); - emu_wrptr(sc, v->vnum, ENVVOL, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_ATKHLDV, EMU_CHAN_ATKHLDV_HOLDTIME_MASK | EMU_CHAN_ATKHLDV_ATTACKTIME_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_ENVVOL, 0x8000); - emu_wrptr(sc, v->vnum, PEFE_FILTERAMOUNT, 0x7f); - emu_wrptr(sc, v->vnum, PEFE_PITCHAMOUNT, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_PEFE_FILTERAMOUNT, 0x7f); + emu_wrptr(sc, v->vnum, EMU_CHAN_PEFE_PITCHAMOUNT, 0); if ((v->stereo) && (v->slave != NULL)) emu_vwrite(sc, v->slave); } @@ -1438,7 +1449,7 @@ emu_vstop(struct emu_sc_info *sc, char c { int reg; - reg = (channel & 0x20) ? SOLEH : SOLEL; + reg = (channel & 0x20) ? EMU_SOLEH : EMU_SOLEL; channel &= 0x1f; reg |= 1 << 24; reg |= channel << 16; @@ -1459,29 +1470,29 @@ emu_vtrigger(struct emu_sc_info *sc, str ccis *= v->b16 ? 1 : 2; sample = v->b16 ? 0x00000000 : 0x80808080; for (i = 0; i < cs; i++) - emu_wrptr(sc, v->vnum, CD0 + i, sample); - emu_wrptr(sc, v->vnum, CCR_CACHEINVALIDSIZE, 0); - emu_wrptr(sc, v->vnum, CCR_READADDRESS, cra); - emu_wrptr(sc, v->vnum, CCR_CACHEINVALIDSIZE, ccis); - - emu_wrptr(sc, v->vnum, IFATN, 0xff00); - emu_wrptr(sc, v->vnum, VTFT, 0xffffffff); - emu_wrptr(sc, v->vnum, CVCF, 0xffffffff); - emu_wrptr(sc, v->vnum, DCYSUSV, 0x00007f7f); + emu_wrptr(sc, v->vnum, EMU_CHAN_CD0 + i, sample); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_CACHEINVALIDSIZE, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_READADDRESS, cra); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_CACHEINVALIDSIZE, ccis); + + emu_wrptr(sc, v->vnum, EMU_CHAN_IFATN, 0xff00); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, 0xffffffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, 0xffffffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_DCYSUSV, 0x00007f7f); emu_vstop(sc, v->vnum, 0); pitch_target = emu_rate_to_linearpitch(v->speed); initial_pitch = emu_rate_to_pitch(v->speed) >> 8; - emu_wrptr(sc, v->vnum, PTRX_PITCHTARGET, pitch_target); - emu_wrptr(sc, v->vnum, CPF_CURRENTPITCH, pitch_target); - emu_wrptr(sc, v->vnum, IP, initial_pitch); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX_PITCHTARGET, pitch_target); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF_PITCH, pitch_target); + emu_wrptr(sc, v->vnum, EMU_CHAN_IP, initial_pitch); } else { - emu_wrptr(sc, v->vnum, PTRX_PITCHTARGET, 0); - emu_wrptr(sc, v->vnum, CPF_CURRENTPITCH, 0); - emu_wrptr(sc, v->vnum, IFATN, 0xffff); - emu_wrptr(sc, v->vnum, VTFT, 0x0000ffff); - emu_wrptr(sc, v->vnum, CVCF, 0x0000ffff); - emu_wrptr(sc, v->vnum, IP, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX_PITCHTARGET, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF_PITCH, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_IFATN, 0xffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, 0x0000ffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, 0x0000ffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_IP, 0); emu_vstop(sc, v->vnum, 1); } if ((v->stereo) && (v->slave != NULL)) @@ -1494,7 +1505,7 @@ emu_vpos(struct emu_sc_info *sc, struct int s, ptr; s = (v->b16 ? 1 : 0) + (v->stereo ? 1 : 0); - ptr = (emu_rdptr(sc, v->vnum, CCCA_CURRADDR) - (v->start >> s)) << s; + ptr = (emu_rdptr(sc, v->vnum, EMU_CHAN_CCCA_CURRADDR) - (v->start >> s)) << s; return (ptr & ~0x0000001f); } @@ -1694,9 +1705,9 @@ emu_initefx(struct emu_sc_info *sc) /* stop DSP */ if (sc->is_emu10k1) { - emu_wrptr(sc, 0, DBG, EMU10K1_DBG_SINGLE_STEP); + emu_wrptr(sc, 0, EMU_DBG, EMU_DBG_SINGLE_STEP); } else { - emu_wrptr(sc, 0, A_DBG, A_DBG_SINGLE_STEP); + emu_wrptr(sc, 0, EMU_A_DBG, EMU_A_DBG_SINGLE_STEP); } /* code size is in instructions */ @@ -2162,9 +2173,9 @@ emu_initefx(struct emu_sc_info *sc) /* start DSP */ if (sc->is_emu10k1) { - emu_wrptr(sc, 0, DBG, 0); + emu_wrptr(sc, 0, EMU_DBG, 0); } else { - emu_wrptr(sc, 0, A_DBG, 0); + emu_wrptr(sc, 0, EMU_A_DBG, 0); } } @@ -2450,24 +2461,24 @@ emumix_set_mode(struct emu_sc_info *sc, return; } - hcfg = HCFG_AUDIOENABLE | HCFG_AUTOMUTE; + hcfg = EMU_HCFG_AUDIOENABLE | EMU_HCFG_AUTOMUTE; a_iocfg = 0; if (sc->rev >= 6) - hcfg |= HCFG_JOYENABLE; + hcfg |= EMU_HCFG_JOYENABLE; if (sc->is_emu10k1) - hcfg |= HCFG_LOCKTANKCACHE_MASK; + hcfg |= EMU_HCFG_LOCKTANKCACHE_MASK; else - hcfg |= HCFG_CODECFORMAT_I2S | HCFG_JOYENABLE; + hcfg |= EMU_HCFG_CODECFMT_I2S | EMU_HCFG_JOYENABLE; if (mode == MODE_DIGITAL) { if (sc->broken_digital) { device_printf(sc->dev, "Digital mode is reported as broken on this card.\n"); } - a_iocfg |= A_IOCFG_ENABLE_DIGITAL; - hcfg |= HCFG_GPOUT0; + a_iocfg |= EMU_A_IOCFG_GPOUT1; + hcfg |= EMU_HCFG_GPOUT0; } if (mode == MODE_ANALOG) @@ -2478,12 +2489,12 @@ emumix_set_mode(struct emu_sc_info *sc, if ((sc->is_ca0102) || (sc->is_ca0108)) /* - * Setting A_IOCFG_DISABLE_ANALOG will do opposite things + * Setting EMU_A_IOCFG_DISABLE_ANALOG will do opposite things * on diffrerent cards. * "don't disable analog outs" on Audigy 2 (ca0102/ca0108) * "disable analog outs" on Audigy (emu10k2) */ - a_iocfg |= A_IOCFG_DISABLE_ANALOG; + a_iocfg |= EMU_A_IOCFG_DISABLE_ANALOG; if (sc->is_ca0108) a_iocfg |= 0x20; /* XXX */ @@ -2492,12 +2503,12 @@ emumix_set_mode(struct emu_sc_info *sc, if (mode == MODE_DIGITAL) emumix_set_gpr(sc, sc->mute_gpr[ANALOGMUTE], 1); - emu_wr(sc, HCFG, hcfg, 4); + emu_wr(sc, EMU_HCFG, hcfg, 4); if ((sc->is_emu10k2) || (sc->is_ca0102) || (sc->is_ca0108)) { - tmp = emu_rd(sc, A_IOCFG, 2); + tmp = emu_rd(sc, EMU_A_IOCFG, 2); tmp = a_iocfg; - emu_wr(sc, A_IOCFG, tmp, 2); + emu_wr(sc, EMU_A_IOCFG, tmp, 2); } /* Unmute if we have changed mode to analog. */ @@ -2523,16 +2534,16 @@ emumix_set_spdif_mode(struct emu_sc_info return; } - spcs = SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | - SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | - SPCS_GENERATIONSTATUS | 0x00001200 | 0x00000000 | - SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT; + spcs = EMU_SPCS_CLKACCY_1000PPM | EMU_SPCS_SAMPLERATE_48 | + EMU_SPCS_CHANNELNUM_LEFT | EMU_SPCS_SOURCENUM_UNSPEC | + EMU_SPCS_GENERATIONSTATUS | 0x00001200 | 0x00000000 | + EMU_SPCS_EMPHASIS_NONE | EMU_SPCS_COPYRIGHT; mode = SPDIF_MODE_PCM; - emu_wrptr(sc, 0, SPCS0, spcs); - emu_wrptr(sc, 0, SPCS1, spcs); - emu_wrptr(sc, 0, SPCS2, spcs); + emu_wrptr(sc, 0, EMU_SPCS0, spcs); + emu_wrptr(sc, 0, EMU_SPCS1, spcs); + emu_wrptr(sc, 0, EMU_SPCS2, spcs); } #define L2L_POINTS 10 @@ -2635,8 +2646,8 @@ emu_cardbus_init(struct emu_sc_info *sc) { /* - * XXX May not need this if we have IPR3 handler. - * Is it a real init calls, or IPR3 interrupt acknowledgments? + * XXX May not need this if we have EMU_IPR3 handler. + * Is it a real init calls, or EMU_IPR3 interrupt acknowledgments? * Looks much like "(data << 16) | register". */ emu_wr_cbptr(sc, (0x00d0 << 16) | 0x0000); @@ -2660,42 +2671,42 @@ emu_init(struct emu_sc_info *sc) int i; /* disable audio and lock cache */ - emu_wr(sc, HCFG, HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, 4); + emu_wr(sc, EMU_HCFG, EMU_HCFG_LOCKSOUNDCACHE | EMU_HCFG_LOCKTANKCACHE_MASK | EMU_HCFG_MUTEBUTTONENABLE, 4); /* reset recording buffers */ - emu_wrptr(sc, 0, MICBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, MICBA, 0); - emu_wrptr(sc, 0, FXBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, FXBA, 0); - emu_wrptr(sc, 0, ADCBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, ADCBA, 0); + emu_wrptr(sc, 0, EMU_MICBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_MICBA, 0); + emu_wrptr(sc, 0, EMU_FXBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_FXBA, 0); + emu_wrptr(sc, 0, EMU_ADCBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_ADCBA, 0); /* disable channel interrupt */ - emu_wr(sc, INTE, INTE_INTERVALTIMERENB | INTE_SAMPLERATETRACKER | INTE_PCIERRORENABLE, 4); - emu_wrptr(sc, 0, CLIEL, 0); - emu_wrptr(sc, 0, CLIEH, 0); - emu_wrptr(sc, 0, SOLEL, 0); - emu_wrptr(sc, 0, SOLEH, 0); + emu_wr(sc, EMU_INTE, EMU_INTE_INTERTIMERENB | EMU_INTE_SAMPLERATER | EMU_INTE_PCIERRENABLE, 4); + emu_wrptr(sc, 0, EMU_CLIEL, 0); + emu_wrptr(sc, 0, EMU_CLIEH, 0); + emu_wrptr(sc, 0, EMU_SOLEL, 0); + emu_wrptr(sc, 0, EMU_SOLEH, 0); /* disable P16V and S/PDIF interrupts */ if ((sc->is_ca0102) || (sc->is_ca0108)) - emu_wr(sc, INTE2, 0, 4); + emu_wr(sc, EMU_INTE2, 0, 4); if (sc->is_ca0102) - emu_wr(sc, INTE3, 0, 4); + emu_wr(sc, EMU_INTE3, 0, 4); /* init phys inputs and outputs */ ac97slot = 0; if (sc->has_51) - ac97slot = AC97SLOT_CNTR | AC97SLOT_LFE; + ac97slot = EMU_AC97SLOT_CENTER | EMU_AC97SLOT_LFE; if (sc->has_71) - ac97slot = AC97SLOT_CNTR | AC97SLOT_LFE | AC97SLOT_REAR_LEFT | AC97SLOT_REAR_RIGHT; + ac97slot = EMU_AC97SLOT_CENTER | EMU_AC97SLOT_LFE | EMU_AC97SLOT_REAR_LEFT | EMU_AC97SLOT_REAR_RIGHT; if (sc->is_emu10k2) ac97slot |= 0x40; - emu_wrptr(sc, 0, AC97SLOT, ac97slot); + emu_wrptr(sc, 0, EMU_AC97SLOT, ac97slot); if (sc->is_emu10k2) /* XXX for later cards? */ - emu_wrptr(sc, 0, SPBYPASS, 0xf00); /* What will happen if + emu_wrptr(sc, 0, EMU_SPBYPASS, 0xf00); /* What will happen if * we write 1 here? */ if (bus_dma_tag_create( /* parent */ bus_get_dma_tag(sc->dev), @@ -2729,61 +2740,61 @@ emu_init(struct emu_sc_info *sc) sc->mem.ptb_pages[i] = tmp | i; for (ch = 0; ch < NUM_G; ch++) { - emu_wrptr(sc, ch, MAPA, tmp | MAP_PTI_MASK); - emu_wrptr(sc, ch, MAPB, tmp | MAP_PTI_MASK); + emu_wrptr(sc, ch, EMU_CHAN_MAPA, tmp | EMU_CHAN_MAP_PTI_MASK); + emu_wrptr(sc, ch, EMU_CHAN_MAPB, tmp | EMU_CHAN_MAP_PTI_MASK); } - emu_wrptr(sc, 0, PTB, (sc->mem.ptb_pages_addr)); - emu_wrptr(sc, 0, TCB, 0); /* taken from original driver */ - emu_wrptr(sc, 0, TCBS, 0); /* taken from original driver */ + emu_wrptr(sc, 0, EMU_PTB, (sc->mem.ptb_pages_addr)); + emu_wrptr(sc, 0, EMU_TCB, 0); /* taken from original driver */ + emu_wrptr(sc, 0, EMU_TCBS, 0); /* taken from original driver */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202032300.q13N0S9P008255>