use pcm_getbuffersize()
This commit is contained in:
parent
4d81d1c598
commit
2c46a9f5ab
@ -84,7 +84,7 @@ SYSCTL_INT(_debug, OID_AUTO, es_debug, CTLFLAG_RW, &debug, 0, "");
|
||||
#define CT5880REV_CT5880_C 0x02
|
||||
#define CT5880REV_CT5880_D 0x03
|
||||
|
||||
#define ES_BUFFSIZE 4096
|
||||
#define ES_DEFAULT_BUFSZ 4096
|
||||
|
||||
/* device private data */
|
||||
struct es_info;
|
||||
@ -108,6 +108,8 @@ struct es_info {
|
||||
|
||||
device_t dev;
|
||||
int num;
|
||||
unsigned int bufsz;
|
||||
|
||||
/* Contents of board's registers */
|
||||
u_long ctrl;
|
||||
u_long sctrl;
|
||||
@ -265,7 +267,7 @@ eschan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c
|
||||
ch->parent = es;
|
||||
ch->channel = c;
|
||||
ch->buffer = b;
|
||||
ch->bufsz = ES_BUFFSIZE;
|
||||
ch->bufsz = es->bufsz;
|
||||
ch->blksz = ch->bufsz / 2;
|
||||
ch->num = ch->parent->num++;
|
||||
if (sndbuf_alloc(ch->buffer, es->parent_dmat, ch->bufsz) == -1) return NULL;
|
||||
@ -856,6 +858,8 @@ es_pci_attach(device_t dev)
|
||||
goto bad;
|
||||
}
|
||||
|
||||
es->bufsz = pcm_getbuffersize(dev, 4096, ES_DEFAULT_BUFSZ, 65536);
|
||||
|
||||
if (pci_get_devid(dev) == ES1371_PCI_ID ||
|
||||
pci_get_devid(dev) == ES1371_PCI_ID2 ||
|
||||
pci_get_devid(dev) == CT5880_PCI_ID) {
|
||||
@ -891,7 +895,7 @@ es_pci_attach(device_t dev)
|
||||
/*lowaddr*/BUS_SPACE_MAXADDR_32BIT,
|
||||
/*highaddr*/BUS_SPACE_MAXADDR,
|
||||
/*filter*/NULL, /*filterarg*/NULL,
|
||||
/*maxsize*/ES_BUFFSIZE, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
||||
/*maxsize*/es->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
||||
/*flags*/0, &es->parent_dmat) != 0) {
|
||||
device_printf(dev, "unable to create dma tag\n");
|
||||
goto bad;
|
||||
|
@ -96,7 +96,7 @@ SND_DECLARE_FILE("$FreeBSD$");
|
||||
#define FM_INTSTATUS_VOL 0x4000
|
||||
#define FM_INTSTATUS_MPU 0x8000
|
||||
|
||||
#define FM801_BUFFSIZE 1024*4 /* Other values do not work!!! */
|
||||
#define FM801_DEFAULT_BUFSZ 4096 /* Other values do not work!!! */
|
||||
|
||||
/* debug purposes */
|
||||
#define DPRINT if(0) printf
|
||||
@ -158,6 +158,8 @@ struct fm801_info {
|
||||
rec_shift,
|
||||
rec_size;
|
||||
|
||||
unsigned int bufsz;
|
||||
|
||||
struct fm801_chinfo pch, rch;
|
||||
};
|
||||
|
||||
@ -328,7 +330,7 @@ fm801ch_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *
|
||||
ch->channel = c;
|
||||
ch->buffer = b;
|
||||
ch->dir = dir;
|
||||
if (sndbuf_alloc(ch->buffer, fm801->parent_dmat, FM801_BUFFSIZE) == -1) return NULL;
|
||||
if (sndbuf_alloc(ch->buffer, fm801->parent_dmat, fm801->bufsz) == -1) return NULL;
|
||||
return (void *)ch;
|
||||
}
|
||||
|
||||
@ -604,6 +606,8 @@ fm801_pci_attach(device_t dev)
|
||||
goto oops;
|
||||
}
|
||||
|
||||
fm801->bufsz = pcm_getbuffersize(dev, 4096, FM801_DEFAULT_BUFSZ, 65536);
|
||||
|
||||
fm801_init(fm801);
|
||||
|
||||
codec = AC97_CREATE(dev, fm801, fm801_ac97);
|
||||
@ -623,7 +627,7 @@ fm801_pci_attach(device_t dev)
|
||||
/*lowaddr*/BUS_SPACE_MAXADDR_32BIT,
|
||||
/*highaddr*/BUS_SPACE_MAXADDR,
|
||||
/*filter*/NULL, /*filterarg*/NULL,
|
||||
/*maxsize*/FM801_BUFFSIZE, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
||||
/*maxsize*/fm801->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
||||
/*flags*/0, &fm801->parent_dmat) != 0) {
|
||||
device_printf(dev, "unable to create dma tag\n");
|
||||
goto oops;
|
||||
|
@ -74,7 +74,7 @@ SND_DECLARE_FILE("$FreeBSD$");
|
||||
# define AGG_MAXPLAYCH 4
|
||||
#endif
|
||||
|
||||
#define AGG_BUFSIZ 0x4000 /* 0x1000, but gets underflows */
|
||||
#define AGG_DEFAULT_BUFSZ 0x4000 /* 0x1000, but gets underflows */
|
||||
|
||||
|
||||
/* -----------------------------
|
||||
@ -112,6 +112,7 @@ struct agg_info {
|
||||
struct ac97_info *codec;
|
||||
void *lock;
|
||||
|
||||
unsigned int bufsz;
|
||||
u_int playchns, active;
|
||||
struct agg_chinfo pch[AGG_MAXPLAYCH];
|
||||
struct agg_chinfo rch;
|
||||
@ -520,7 +521,7 @@ static void
|
||||
aggch_start_dac(struct agg_chinfo *ch)
|
||||
{
|
||||
u_int wpwa = APU_USE_SYSMEM | (ch->offset >> 9);
|
||||
u_int size = AGG_BUFSIZ >> 1;
|
||||
u_int size = ch->parent->bufsz >> 1;
|
||||
u_int speed = ch->speed;
|
||||
u_int offset = ch->offset >> 1;
|
||||
u_int cp = 0;
|
||||
@ -593,7 +594,7 @@ static inline void
|
||||
suppress_jitter(struct agg_chinfo *ch)
|
||||
{
|
||||
if (ch->wcreg_tpl & WAVCACHE_CHCTL_STEREO) {
|
||||
int cp, diff, halfsize = AGG_BUFSIZ >> 2;
|
||||
int cp, diff, halfsize = ch->parent->bufsz >> 2;
|
||||
|
||||
if (ch->aputype == APUTYPE_16BITSTEREO)
|
||||
halfsize >>= 1;
|
||||
@ -654,10 +655,10 @@ aggch_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c,
|
||||
ch->num = ess->playchns;
|
||||
ch->dir = dir;
|
||||
|
||||
p = dma_malloc(ess, AGG_BUFSIZ, &physaddr);
|
||||
p = dma_malloc(ess, ess->bufsz, &physaddr);
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
sndbuf_setup(b, p, AGG_BUFSIZ);
|
||||
sndbuf_setup(b, p, ess->bufsz);
|
||||
|
||||
ch->offset = physaddr - ess->baseaddr;
|
||||
if (physaddr < ess->baseaddr || ch->offset > WPWA_MAXADDR) {
|
||||
@ -963,18 +964,20 @@ agg_attach(device_t dev)
|
||||
}
|
||||
ess->dev = dev;
|
||||
|
||||
ess->bufsz = pcm_getbuffersize(dev, 4096, AGG_DEFAULT_BUFSZ, 65536);
|
||||
|
||||
if (bus_dma_tag_create(/*parent*/NULL,
|
||||
/*alignment*/1 << WAVCACHE_BASEADDR_SHIFT,
|
||||
/*boundary*/WPWA_MAXADDR + 1,
|
||||
/*lowaddr*/MAESTRO_MAXADDR, /*highaddr*/BUS_SPACE_MAXADDR,
|
||||
/*filter*/NULL, /*filterarg*/NULL,
|
||||
/*maxsize*/AGG_BUFSIZ * 2, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
||||
/*maxsize*/ess->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
||||
/*flags*/0, &ess->parent_dmat) != 0) {
|
||||
device_printf(dev, "unable to create dma tag\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
ess->stat = dma_malloc(ess, AGG_BUFSIZ, &ess->baseaddr);
|
||||
ess->stat = dma_malloc(ess, ess->bufsz, &ess->baseaddr);
|
||||
if (ess->stat == NULL) {
|
||||
device_printf(dev, "cannot allocate status buffer\n");
|
||||
goto bad;
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
SND_DECLARE_FILE("$FreeBSD$");
|
||||
|
||||
#define ESS_BUFFSIZE (16384)
|
||||
#define SOLO_DEFAULT_BUFSZ 16384
|
||||
#define ABS(x) (((x) < 0)? -(x) : (x))
|
||||
|
||||
/* if defined, playback always uses the 2nd channel and full duplex works */
|
||||
@ -90,6 +90,8 @@ struct ess_info {
|
||||
bus_dma_tag_t parent_dmat;
|
||||
|
||||
int simplex_dir, type, duplex:1, newspeed:1, dmasz[2];
|
||||
unsigned int bufsz;
|
||||
|
||||
struct ess_chinfo pch, rch;
|
||||
};
|
||||
|
||||
@ -518,7 +520,7 @@ esschan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *
|
||||
ch->channel = c;
|
||||
ch->buffer = b;
|
||||
ch->dir = dir;
|
||||
if (sndbuf_alloc(ch->buffer, sc->parent_dmat, ESS_BUFFSIZE) == -1)
|
||||
if (sndbuf_alloc(ch->buffer, sc->parent_dmat, sc->bufsz) == -1)
|
||||
return NULL;
|
||||
ch->hwch = 1;
|
||||
if ((dir == PCMDIR_PLAY) && (sc->duplex))
|
||||
@ -803,7 +805,6 @@ ess_dmatrigger(struct ess_info *sc, int ch, int go)
|
||||
static void
|
||||
ess_release_resources(struct ess_info *sc, device_t dev)
|
||||
{
|
||||
/* should we bus_teardown_intr here? */
|
||||
if (sc->irq) {
|
||||
if (sc->ih)
|
||||
bus_teardown_intr(dev, sc->irq, sc->ih);
|
||||
@ -916,6 +917,8 @@ ess_attach(device_t dev)
|
||||
if (ess_alloc_resources(sc, dev))
|
||||
goto no;
|
||||
|
||||
sc->bufsz = pcm_getbuffersize(dev, 4096, SOLO_DEFAULT_BUFSZ, 65536);
|
||||
|
||||
ddma = rman_get_start(sc->vc) | 1;
|
||||
pci_write_config(dev, PCI_LEGACYCONTROL, 0x805f, 2);
|
||||
pci_write_config(dev, PCI_DDMACONTROL, ddma, 2);
|
||||
@ -949,7 +952,7 @@ ess_attach(device_t dev)
|
||||
/*lowaddr*/BUS_SPACE_MAXADDR_24BIT,
|
||||
/*highaddr*/BUS_SPACE_MAXADDR,
|
||||
/*filter*/NULL, /*filterarg*/NULL,
|
||||
/*maxsize*/ESS_BUFFSIZE, /*nsegments*/1,
|
||||
/*maxsize*/sc->bufsz, /*nsegments*/1,
|
||||
/*maxsegz*/0x3ffff,
|
||||
/*flags*/0, &sc->parent_dmat) != 0) {
|
||||
device_printf(dev, "unable to create dma tag\n");
|
||||
|
@ -40,7 +40,7 @@ SND_DECLARE_FILE("$FreeBSD$");
|
||||
#define ALI_PCI_ID 0x545110b9
|
||||
#define SPA_PCI_ID 0x70181039
|
||||
|
||||
#define TR_BUFFSIZE 0x1000
|
||||
#define TR_DEFAULT_BUFSZ 0x1000
|
||||
#define TR_TIMEOUT_CDC 0xffff
|
||||
#define TR_MAXPLAYCH 4
|
||||
|
||||
@ -75,12 +75,14 @@ struct tr_info {
|
||||
bus_dma_tag_t parent_dmat;
|
||||
|
||||
struct resource *reg, *irq;
|
||||
int regtype, regid, irqid;
|
||||
void *ih;
|
||||
int regtype, regid, irqid;
|
||||
void *ih;
|
||||
|
||||
void *lock;
|
||||
|
||||
u_int32_t playchns;
|
||||
unsigned int bufsz;
|
||||
|
||||
struct tr_chinfo chinfo[TR_MAXPLAYCH];
|
||||
struct tr_rchinfo recchinfo;
|
||||
};
|
||||
@ -435,7 +437,7 @@ trpchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *
|
||||
ch->buffer = b;
|
||||
ch->parent = tr;
|
||||
ch->channel = c;
|
||||
if (sndbuf_alloc(ch->buffer, tr->parent_dmat, TR_BUFFSIZE) == -1)
|
||||
if (sndbuf_alloc(ch->buffer, tr->parent_dmat, tr->bufsz) == -1)
|
||||
return NULL;
|
||||
|
||||
return ch;
|
||||
@ -540,7 +542,7 @@ trrchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *
|
||||
ch->buffer = b;
|
||||
ch->parent = tr;
|
||||
ch->channel = c;
|
||||
if (sndbuf_alloc(ch->buffer, tr->parent_dmat, TR_BUFFSIZE) == -1)
|
||||
if (sndbuf_alloc(ch->buffer, tr->parent_dmat, tr->bufsz) == -1)
|
||||
return NULL;
|
||||
|
||||
return ch;
|
||||
@ -774,6 +776,8 @@ tr_pci_attach(device_t dev)
|
||||
goto bad;
|
||||
}
|
||||
|
||||
tr->bufsz = pcm_getbuffersize(dev, 4096, TR_DEFAULT_BUFSZ, 65536);
|
||||
|
||||
if (tr_init(tr) == -1) {
|
||||
device_printf(dev, "unable to initialize the card\n");
|
||||
goto bad;
|
||||
@ -795,7 +799,7 @@ tr_pci_attach(device_t dev)
|
||||
/*lowaddr*/BUS_SPACE_MAXADDR_32BIT,
|
||||
/*highaddr*/BUS_SPACE_MAXADDR,
|
||||
/*filter*/NULL, /*filterarg*/NULL,
|
||||
/*maxsize*/TR_BUFFSIZE, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
||||
/*maxsize*/tr->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
||||
/*flags*/0, &tr->parent_dmat) != 0) {
|
||||
device_printf(dev, "unable to create dma tag\n");
|
||||
goto bad;
|
||||
|
@ -41,7 +41,7 @@ SND_DECLARE_FILE("$FreeBSD$");
|
||||
#define SEGS_PER_CHAN (NSEGS/2)
|
||||
|
||||
#define TIMEOUT 50
|
||||
#define VIA_BUFFSIZE 0x1000
|
||||
#define VIA_DEFAULT_BUFSZ 0x1000
|
||||
|
||||
#undef DEB
|
||||
#define DEB(x)
|
||||
@ -79,6 +79,8 @@ struct via_info {
|
||||
void *ih;
|
||||
struct ac97_info *codec;
|
||||
|
||||
unsigned int bufsz;
|
||||
|
||||
struct via_chinfo pch, rch;
|
||||
struct via_dma_op *sgd_table;
|
||||
u_int16_t codec_caps;
|
||||
@ -257,7 +259,7 @@ viachan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *
|
||||
ch->mode = VIA_RECORD_MODE;
|
||||
}
|
||||
|
||||
if (sndbuf_alloc(ch->buffer, via->parent_dmat, VIA_BUFFSIZE) == -1)
|
||||
if (sndbuf_alloc(ch->buffer, via->parent_dmat, via->bufsz) == -1)
|
||||
return NULL;
|
||||
return ch;
|
||||
}
|
||||
@ -473,6 +475,8 @@ via_attach(device_t dev)
|
||||
via->st = rman_get_bustag(via->reg);
|
||||
via->sh = rman_get_bushandle(via->reg);
|
||||
|
||||
via->bufsz = pcm_getbuffersize(dev, 4096, VIA_DEFAULT_BUFSZ, 65536);
|
||||
|
||||
via->irqid = 0;
|
||||
via->irq = bus_alloc_resource(dev, SYS_RES_IRQ, &via->irqid, 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE);
|
||||
if (!via->irq || snd_setup_intr(dev, via->irq, 0, via_intr, via, &via->ih)) {
|
||||
@ -498,7 +502,7 @@ via_attach(device_t dev)
|
||||
/*lowaddr*/BUS_SPACE_MAXADDR_32BIT,
|
||||
/*highaddr*/BUS_SPACE_MAXADDR,
|
||||
/*filter*/NULL, /*filterarg*/NULL,
|
||||
/*maxsize*/VIA_BUFFSIZE, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
||||
/*maxsize*/via->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
||||
/*flags*/0, &via->parent_dmat) != 0) {
|
||||
device_printf(dev, "unable to create dma tag\n");
|
||||
goto bad;
|
||||
|
Loading…
Reference in New Issue
Block a user