Redo the way selecting the mode for SB cards is done completely.

It is now table driven since there are so many different variations
of SB cards out there.
Also fix a bug that stopped SB2 and SBPro from working.
This commit is contained in:
augustss 1997-05-23 21:19:59 +00:00
parent 38b3bce886
commit 72b5ba3901
7 changed files with 425 additions and 461 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sb.c,v 1.47 1997/05/23 09:45:40 augustss Exp $ */
/* $NetBSD: sb.c,v 1.48 1997/05/23 21:20:06 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -312,13 +312,13 @@ sb_getdev(addr, retp)
{
struct sbdsp_softc *sc = addr;
if (sc->sc_model & MODEL_JAZZ16)
if (sc->sc_model == SB_JAZZ)
strncpy(retp->name, "MV Jazz16", sizeof(retp->name));
else
strncpy(retp->name, "SoundBlaster", sizeof(retp->name));
sprintf(retp->version, "%d.%02d",
SBVER_MAJOR(sc->sc_model),
SBVER_MINOR(sc->sc_model));
SBVER_MAJOR(sc->sc_version),
SBVER_MINOR(sc->sc_version));
strncpy(retp->config, "sb", sizeof(retp->config));
return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sb_isa.c,v 1.5 1997/05/17 23:26:35 augustss Exp $ */
/* $NetBSD: sb_isa.c,v 1.6 1997/05/23 21:20:09 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -76,8 +76,8 @@ sb_isa_match(parent, match, aux)
/*
* Indirect brokedness!
*/
register struct sbdsp_softc *sc = match;
register struct isa_attach_args *ia = aux;
struct sbdsp_softc *sc = match;
struct isa_attach_args *ia = aux;
if (!SB_BASE_VALID(ia->ia_iobase)) {
printf("sb: configured iobase 0x%x invalid\n", ia->ia_iobase);
@ -86,7 +86,7 @@ sb_isa_match(parent, match, aux)
sc->sc_iot = ia->ia_iot;
/* Map i/o space [we map 24 ports which is the max of the sb and pro */
/* Map i/o space [we map 24 ports which is the max of the sb and pro */
if (bus_space_map(sc->sc_iot, ia->ia_iobase, SBP_NPORT, 0,
&sc->sc_ioh)) {
printf("sb: can't map i/o space 0x%x/%d in probe\n",

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbdspvar.h,v 1.21 1997/05/19 23:14:30 augustss Exp $ */
/* $NetBSD: sbdspvar.h,v 1.22 1997/05/23 21:20:15 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -96,13 +96,15 @@ struct sbdsp_softc {
u_int spkr_state; /* non-null is on */
int sc_irate, sc_itc; /* Sample rate for input */
int sc_orate, sc_otc; /* ...and output */
u_int sc_irate; /* Sample rate for input */
u_int sc_orate; /* ...and output */
u_char sc_itc;
u_char sc_otc;
int sc_imode;
int sc_omode;
#define SB_ADAC_LS 0
#define SB_ADAC_HS 1
struct sbmode *sc_imodep;
struct sbmode *sc_omodep;
u_char sc_ibmode;
u_char sc_obmode;
u_long sc_interrupts; /* number of interrupts taken */
void (*sc_intr)(void*); /* dma completion intr handler */
@ -113,44 +115,35 @@ struct sbdsp_softc {
caddr_t dmaaddr;
vm_size_t dmacnt;
int dmachan; /* active DMA channel */
int sc_last_hs_size; /* last HS dma size */
u_int sc_precision; /* size of samples */
int sc_channels; /* # of channels */
int sc_dmadir; /* DMA direction */
#define SB_DMA_NONE 0
#define SB_DMA_IN 1
#define SB_DMA_OUT 2
u_int sc_model; /* DSP model */
#define SBVER_MAJOR(v) (((v)>>8) & 0xff)
#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
u_int sc_model; /* DSP model */
#define SB_UNK -1
#define SB_1 0 /* original SB */
#define SB_20 1 /* SB 2 */
#define SB_2x 2 /* SB 2, new version */
#define SB_PRO 3 /* SB Pro */
#define SB_JAZZ 4 /* Jazz 16 */
#define SB_16 5 /* SB 16 */
u_int sc_version; /* DSP version */
#define SBVER_MAJOR(v) (((v)>>8) & 0xff)
#define SBVER_MINOR(v) ((v)&0xff)
};
#define ISSB2CLASS(sc) \
(SBVER_MAJOR((sc)->sc_model) >= 2)
#define ISSBPROCLASS(sc) \
(SBVER_MAJOR((sc)->sc_model) > 2)
#define ISSBPRO(sc) \
(SBVER_MAJOR((sc)->sc_model) == 3)
#define ISSB16CLASS(sc) \
(SBVER_MAJOR((sc)->sc_model) > 3)
#define ISJAZZ16(sc) \
((sc)->sc_model & MODEL_JAZZ16)
#define ISSBPRO(sc) ((sc)->sc_model == SB_PRO || (sc)->sc_model == SB_JAZZ)
#define ISSBPROCLASS(sc) ((sc)->sc_model >= SB_PRO)
#define ISSB16CLASS(sc) ((sc)->sc_model == SB_16)
#ifdef _KERNEL
int sbdsp_open __P((struct sbdsp_softc *, dev_t, int));
@ -196,7 +189,6 @@ int sbdsp_wdsp __P((struct sbdsp_softc *, int v));
int sbdsp_rdsp __P((struct sbdsp_softc *));
int sbdsp_intr __P((void *));
short sbversion __P((struct sbdsp_softc *));
int sbdsp_set_sr __P((struct sbdsp_softc *, u_long *, int));
int sbdsp_setfd __P((void *, int));

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbreg.h,v 1.20 1997/05/19 23:14:31 augustss Exp $ */
/* $NetBSD: sbreg.h,v 1.21 1997/05/23 21:20:18 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -106,6 +106,9 @@
#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_IRQ_MPU401 0x04
#define SBP_IRQ_DMA16 0x02
#define SBP_IRQ_DMA8 0x01
#define SB16P_MASTER_L 0x30
#define SB16P_VOICE_L 0x32

View File

@ -187,3 +187,13 @@ swap_bytes_change_sign16(v, p, cc)
swap_bytes(v, p, cc);
change_sign16(v, p, cc);
}
void
change_sign16_swap_bytes(v, p, cc)
void *v;
u_char *p;
int cc;
{
change_sign16(v, p, cc);
swap_bytes(v, p, cc);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mulaw.h,v 1.4 1997/05/13 19:02:12 augustss Exp $ */
/* $NetBSD: mulaw.h,v 1.5 1997/05/23 21:20:02 augustss Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -45,3 +45,4 @@ extern void change_sign16 __P((void *, u_char *buf, int cnt));
/* Convert between little and big endian. */
extern void swap_bytes __P((void *, u_char *buf, int cnt));
extern void swap_bytes_change_sign16 __P((void *, u_char *buf, int cnt));
extern void change_sign16_swap_bytes __P((void *, u_char *buf, int cnt));