Redo the SB mixer code. The driver can now distinguish between the

four different mixer options: none, CT1335, CT1345, and CT1745.
It should now be possible to access most of the SB16 functionality.
This commit is contained in:
augustss 1997-05-19 23:14:29 +00:00
parent 604e6c4091
commit 0db08d11e6
3 changed files with 615 additions and 365 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbdspvar.h,v 1.20 1997/05/09 22:16:42 augustss Exp $ */
/* $NetBSD: sbdspvar.h,v 1.21 1997/05/19 23:14:30 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -34,29 +34,27 @@
*
*/
#define SB_MIC_PORT 0
#define SB_SPEAKER 1
#define SB_INPUT_CLASS 2
#define SB_OUTPUT_CLASS 3
#define SB_LINE_IN_PORT 4
#define SB_DAC_PORT 5
#define SB_FM_PORT 6
#define SB_CD_PORT 7
#define SB_MASTER_VOL 8
#define SB_TREBLE 9
#define SB_BASS 10
#define SB_NDEVS 11 /* XXX include classes above for
contiguous number space on
original SB */
#define SB_MASTER_VOL 0
#define SB_MIDI_VOL 1
#define SB_CD_VOL 2
#define SB_VOICE_VOL 3
#define SB_OUTPUT_CLASS 4
/*#define SB_OUTPUT_MODE 9
#define SB_SPKR_MONO 0
#define SB_SPKR_STEREO 1*/
#define SB_MIC_VOL 5
#define SB_LINE_IN_VOL 6
#define SB_RECORD_SOURCE 7
#define SB_TREBLE 8
#define SB_BASS 9
#define SB_RECORD_CLASS 10
#define SB_RECORD_SOURCE 11
#define SB_RECORD_CLASS 12
#define SB_PCSPEAKER 11
#define SB_INPUT_GAIN 12
#define SB_OUTPUT_GAIN 13
#define SB_AGC 14
#define SB_INPUT_CLASS 15
#define SB_EQUALIZATION_CLASS 16
#define SB_NDEVS 17
/*
* Software state, per SoundBlaster card.
@ -87,11 +85,13 @@ struct sbdsp_softc {
u_short sc_open; /* reference count of open calls */
u_int gain[SB_NDEVS]; /* kept in SB levels: right/left each
in a nibble */
u_char gain[SB_NDEVS][2]; /* kept in input levels */
#define SB_LEFT 0
#define SB_RIGHT 1
u_int out_port; /* output port */
u_int in_port; /* input port */
u_int in_mask; /* input ports */
u_int in_port; /* XXX needed for MI interface */
u_int in_filter; /* one of SB_TREBLE_EQ, SB_BASS_EQ, 0 */
u_int spkr_state; /* non-null is on */
@ -128,6 +128,12 @@ struct sbdsp_softc {
#define SBVER_MINOR(v) ((v)&0xff)
#define MODEL_JAZZ16 0x80000000
u_int sc_mixer_model;
#define SBM_NONE 0
#define SBM_CT1335 1
#define SBM_CT1345 2
#define SBM_CT1745 3
};
#define ISSB2CLASS(sc) \
@ -163,8 +169,6 @@ int sbdsp_set_monitor_gain __P((void *, u_int));
int sbdsp_get_monitor_gain __P((void *));
int sbdsp_query_encoding __P((void *, struct audio_encoding *));
int sbdsp_set_params __P((void *, int, struct audio_params *, struct audio_params *));
int sbdsp_set_ifilter __P((void *, int));
int sbdsp_get_ifilter __P((void *));
int sbdsp_round_blocksize __P((void *, int));
int sbdsp_set_out_port __P((void *, int));
int sbdsp_get_out_port __P((void *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbreg.h,v 1.19 1997/05/18 00:36:04 augustss Exp $ */
/* $NetBSD: sbreg.h,v 1.20 1997/05/19 23:14:31 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -70,21 +70,19 @@
#define SBP_FM_DATA 9 /* RW FM data port */
#define SBP_MIXER_ADDR 4 /* W mixer address register */
#define SBP_MIXER_DATA 5 /* RW mixer data port */
#define SBP_MIX_RESET 0 /* mixer reset port, value */
#define SBP_MIX_RESET 0x00 /* mixer reset port, value */
#define SBP_1335_MASTER_VOL 0x02
#define SBP_1335_MIDI_VOL 0x06
#define SBP_1335_CD_VOL 0x08
#define SBP_1335_VOICE_VOL 0x0A
#define SBP_VOICE_VOL 0x04
#define SBP_MIC_VOL 0x0A /* warning: only one channel of volume... */
#define SBP_MASTER_VOL 0x22
#define SBP_FM_VOL 0x26
#define SBP_MIDI_VOL 0x26
#define SBP_CD_VOL 0x28
#define SBP_LINE_VOL 0x2E
#define SBP_DAC_VOL 0x04
#define SBP_MIC_VOL 0x0A /* warning: only one channel of
volume... */
#define SBP_SPEAKER_VOL 0x42
#define SBP_TREBLE_EQ 0x44
#define SBP_BASS_EQ 0x46
#define SBP_SET_IRQ 0x80 /* Soft-configured irq (SB16-) */
#define SBP_SET_DRQ 0x81 /* Soft-configured drq (SB16-) */
#define SBP_IRQ_STATUS 0x82 /* Pending IRQ status (SB16-) */
#define SBP_RECORD_SOURCE 0x0C
#define SBP_STEREO 0x0E
@ -104,17 +102,42 @@
#define SBP_FROM_MIC 0x00
#define SBP_FROM_CD 0x02
#define SBP_FROM_LINE 0x06
#define sbdsp_mono_vol(left) ((((left) << 4) | (left)) & 0xee)
#define sbdsp_stereo_vol(left, right) ((((left) << 4) | (right)) & 0xee)
#define SBP_MAXVOL 0xf /* per channel */
#define SBP_MINVOL 0x0 /* per channel */
#define SBP_AGAIN_TO_SBGAIN(again) ((again) >> 4) /* per channel */
#define SBP_AGAIN_TO_MICGAIN(again) ((again) >> 5) /* mic has only 3 bits,
sorry! */
#define SBP_LEFTGAIN(sbgain) (sbgain & 0xf0) /* left channel */
#define SBP_RIGHTGAIN(sbgain) ((sbgain & 0xf) << 4) /* right channel */
#define SBP_SBGAIN_TO_AGAIN(sbgain) SBP_LEFTGAIN(sbgain)
#define SBP_MICGAIN_TO_AGAIN(micgain) (micgain << 5)
#define SBP_SET_IRQ 0x80 /* Soft-configured irq (SB16-) */
#define SBP_SET_DRQ 0x81 /* Soft-configured drq (SB16-) */
#define SBP_IRQ_STATUS 0x82 /* Pending IRQ status (SB16-) */
#define SB16P_MASTER_L 0x30
#define SB16P_VOICE_L 0x32
#define SB16P_MIDI_L 0x34
#define SB16P_CD_L 0x36
#define SB16P_LINE_L 0x38
#define SB16P_MIC_L 0x3a
#define SB16P_PCSPEAKER 0x3b
#define SB16P_INPUT_GAIN_L 0x3f
#define SB16P_OUTPUT_GAIN_L 0x41
#define SB16P_TREBLE_L 0x44
#define SB16P_BASS_L 0x46
#define SB16P_L_TO_R(l) ((l)+1)
#define SB16P_AGC 0x43
#define SBP_RECORD_SOURCE_L 0x3d
#define SBP_RECORD_SOURCE_R 0x3e
#define SBP_MIDI_SRC_R 0x20
#define SBP_LINE_SRC_R 0x08
#define SBP_CD_SRC_R 0x02
#define SBP_MIC_SRC 0x01
#define SB_SRC_R_TO_L(x) ((x) << 1)
#define SB_STEREO_GAIN(left, right) ((left) | ((right) >> 4))
#define SB_MIC_GAIN(v) ((v) >> 5)
#define SB_ADJUST_MIC_GAIN(sc, x) (ISSB16CLASS(sc) ? (x) & 0xf8 : (x) & 0xc0)
#define SB_ADJUST_GAIN(sc, x) (ISSB16CLASS(sc) ? (x) & 0xf8 : (x) & 0xe0)
#define SB_ADJUST_2_GAIN(sc, x) (x & 0xc0)
#define SB_1335_GAIN(x) ((x) >> 4)
#define SB_1335_MASTER_GAIN(x) ((x) >> 5)
#define SBP_DSP_RESET 6 /* W reset port */
#define SB_MAGIC 0xaa /* card outputs on successful reset */
#define SBP_DSP_READ 10 /* R read port */