[FreeBSD] es1370 patch wanted (patch sound freebsd)
Ключевые слова: patch, sound, freebsd, (найти похожие документы)
_ RU.UNIX.BSD (2:5077/15.22) _____________________________________ RU.UNIX.BSD _
From : Sergey Osokin 2:5020/758.5 11 Aug 99 12:05:00
Subj : [FreeBSD] es1370 patch wanted
________________________________________________________________________________
Hello Andrey!
Вторник Август 10 1999, Andrey Lavrentyev writes to All:
AL> Hi Serge,
AL> я пропустил ответ про патч или ответа небыло?
AL> PS. "Сказал "A", говори и "B""!
говоpю "Б" :-)))
=== Cut ===
Index: es1370.c
RCS file: /usr/CVS-Repository/src/sys/pci/es1370.c,v
retrieving revision 1.4
diff -u -r1.4 es1370.c
--- es1370.c 1999/05/09 17:06:45 1.4
+++ es1370.c 1999/05/29 18:59:01
@@ -77,6 +77,9 @@
#define DMA_ALIGN_MASK (~(DMA_ALIGN_THRESHOLD - 1))
#define DMA_READ_THRESHOLD 0x200
+#define ES_TYPE 0
+#define ES_TYPE_DAC1 1
+
#define MEM_MAP_REG 0x14
#define UNIT(minor) ((minor) >> 4)
@@ -103,11 +106,11 @@
bus_space_handle_t sh;
bus_dma_tag_t parent_dmat;
- bus_dmamap_t dmam_in, dmam_out;
/* Contents of board's registers */
u_long ctrl;
u_long sctrl;
+ u_long init_total[2], init_at[2];
};
@@ -131,6 +134,7 @@
static void es_rd_map(void *, bus_dma_segment_t *, int, int);
static int es_wrabort(snddev_info *);
static void es_wr_map(void *, bus_dma_segment_t *, int, int);
+static void es1_wr_map(void *, bus_dma_segment_t *, int, int);
static const char *es_pci_probe __P((pcici_t, pcidi_t));
static void es_pci_attach __P((pcici_t, int));
static int es_rd_dmaupdate(snddev_info *);
@@ -159,7 +163,7 @@
static snddev_info es_op_desc = {
"ENSONIQ AudioPCI",
- 0, /* type, apparently unused */
+ ES_TYPE,
NULL, /* ISA probe */
NULL, /* ISA attach */
@@ -178,7 +182,28 @@
AFMT_FULLDUPLEX | AFMT_STEREO | AFMT_U8 | AFMT_S16_LE, /* brag :-) */
};
+static snddev_info es1_op_desc = {
+ "ENSONIQ AudioPCI DAC1",
+ ES_TYPE_DAC1,
+ NULL, /* ISA probe */
+ NULL, /* ISA attach */
+
+ es_dsp_open,
+ es_dsp_close,
+ es_dsp_read,
+ es_dsp_write,
+ es_dsp_ioctl,
+ es_select,
+
+ NULL, /* Interrupt Service Routine */
+ es_callback,
+
+ ES_BUFFSIZE,
+
+ AFMT_STEREO | AFMT_U8 | AFMT_S16_LE,
+};
+
/* -------------------------------------------------------------------- */
/*
@@ -186,23 +211,22 @@
*/
static const struct {
- unsigned volidx:4;
unsigned left:4;
unsigned right:4;
unsigned stereo:1;
unsigned recmask:13;
unsigned avail:1;
-} mixtable[SOUND_MIXER_NRDEVICES] = {
- [SOUND_MIXER_VOLUME] = { 0, 0x0, 0x1, 1, 0x0000, 1 },
- [SOUND_MIXER_PCM] = { 1, 0x2, 0x3, 1, 0x0400, 1 },
- [SOUND_MIXER_SYNTH] = { 2, 0x4, 0x5, 1, 0x0060, 1 },
- [SOUND_MIXER_CD] = { 3, 0x6, 0x7, 1, 0x0006, 1 },
- [SOUND_MIXER_LINE] = { 4, 0x8, 0x9, 1, 0x0018, 1 },
- [SOUND_MIXER_LINE1] = { 5, 0xa, 0xb, 1, 0x1800, 1 },
- [SOUND_MIXER_LINE2] = { 6, 0xc, 0x0, 0, 0x0100, 1 },
- [SOUND_MIXER_LINE3] = { 7, 0xd, 0x0, 0, 0x0200, 1 },
- [SOUND_MIXER_MIC] = { 8, 0xe, 0x0, 0, 0x0001, 1 },
- [SOUND_MIXER_OGAIN] = { 9, 0xf, 0x0, 0, 0x0000, 1 } };
+} mixtable[SOUND_MIXER_NRDEVICES] = {
+ [SOUND_MIXER_VOLUME] = { 0x0, 0x1, 1, 0x0000, 1 },
+ [SOUND_MIXER_PCM] = { 0x2, 0x3, 1, 0x0400, 1 },
+ [SOUND_MIXER_SYNTH] = { 0x4, 0x5, 1, 0x0060, 1 },
+ [SOUND_MIXER_CD] = { 0x6, 0x7, 1, 0x0006, 1 },
+ [SOUND_MIXER_LINE] = { 0x8, 0x9, 1, 0x0018, 1 },
+ [SOUND_MIXER_LINE1] = { 0xa, 0xb, 1, 0x1800, 1 },
+ [SOUND_MIXER_LINE2] = { 0xc, 0x0, 0, 0x0100, 1 },
+ [SOUND_MIXER_LINE3] = { 0xd, 0x0, 0, 0x0200, 1 },
+ [SOUND_MIXER_MIC] = { 0xe, 0x0, 0, 0x0001, 1 },
+ [SOUND_MIXER_OGAIN] = { 0xf, 0x0, 0, 0x0000, 1 } };
static int
mixer_ioctl(snddev_info *d, u_long cmd, caddr_t data, int fflag, struct proc
*p)
@@ -216,6 +240,10 @@
case IOC_IN | IOC_OUT: /* _IOWR */
switch (i) {
case SOUND_MIXER_RECSRC:
+ if (d->type == ES_TYPE_DAC1) {
+ ret = ENODEV;
+ break;
+ }
for (i = j = 0; i != SOUND_MIXER_NRDEVICES; i++)
if ((*val & (1 << i)) != 0) {
if (!mixtable[i].recmask)
@@ -231,7 +259,7 @@
write_codec(d, CODEC_OMIX1, 0x7f);
write_codec(d, CODEC_OMIX2, 0x3f);
break;
-
+
default:
if (i >= SOUND_MIXER_NRDEVICES || !mixtable[i].avail)
ret = EINVAL;
@@ -317,7 +345,7 @@
if ((oflags & FREAD) == 0)
d->rec_fmt = 0;
- else if ((oflags & FWRITE) == 0)
+ if ((oflags & FWRITE) == 0)
d->play_fmt = 0;
d->play_speed = d->rec_speed = DSP_DEFAULT_SPEED;
@@ -339,7 +367,8 @@
d->flags &= ~SND_F_BUSY;
- es_rdabort(d);
+ if (d->type != ES_TYPE_DAC1)
+ es_rdabort(d);
return (0);
}
@@ -352,6 +381,8 @@
snddev_info *d = &pcm_info[unit];
snd_dbuf *b = &d->dbuf_in;
+ if (d->type == ES_TYPE_DAC1)
+ return (ENODEV);
if (d->flags & SND_F_READING) {
/* This shouldn't happen and is actually silly */
tsleep(&s, PZERO, "sndar", hz);
@@ -359,10 +390,11 @@
}
d->flags |= SND_F_READING;
- /*
- * XXX Check for SND_F_INIT. If set, wait for DMA to run empty and
- * re-initialize the board
- */
+ if (d->flags & SND_F_INIT) {
+ es_rdabort(d);
+ d->callback(d, SND_CB_INIT);
+ d->flags &= ~SND_F_INIT;
+ }
if (buf->uio_resid - d->rec_blocksize > 0)
limit = buf->uio_resid - d->rec_blocksize;
@@ -432,6 +464,7 @@
int l, l1, ret = 0, unit = UNIT(minor(dev));
long s;
snddev_info *d = &pcm_info[unit];
+ struct es_info *es = (struct es_info *)d->device_data;
snd_dbuf *b = &d->dbuf_out;
if (d->flags & SND_F_WRITING) {
@@ -441,10 +474,10 @@
}
d->flags |= SND_F_WRITING;
- /*
- * XXX Check for SND_F_INIT. If set, wait for DMA to run empty and
- * re-initialize the board
- */
+ if (d->flags & SND_F_INIT) {
+ es->init_at[d->type] = es->init_total[d->type] + d->dbuf_out.rl;
+ d->flags &= ~SND_F_INIT;
+ }
while ((l = buf->uio_resid) != 0) {
s = spltty();
@@ -558,7 +591,7 @@
splx(s);
}
a->bytes = b->fl;
- a->fragments = b->fl / d->rec_blocksize;
+ a->fragments = b->fl / d->play_blocksize;
a->fragstotal = b->bufsize / d->play_blocksize;
a->fragsize = d->play_blocksize;
}
@@ -646,6 +679,8 @@
bus_space_write_4(es->st, es->sh, ES1370_REG_SERIAL_CONTROL, sctrl);
bus_space_write_4(es->st, es->sh, ES1370_REG_SERIAL_CONTROL,
es->sctrl);
+ if (intsrc & STAT_DAC1)
+ dma_wrintr(d + 1);
if (intsrc & STAT_DAC2)
dma_wrintr(d);
if (intsrc & STAT_ADC)
@@ -660,16 +695,18 @@
*/
static int
-alloc_dmabuf(snddev_info *d, int rd)
+alloc_dmabuf(snddev_info *d, int wr)
{
struct es_info *es = (struct es_info *)d->device_data;
- snd_dbuf *b = rd ? &d->dbuf_in : &d->dbuf_out;
- bus_dmamap_t *dmam = rd ? &es->dmam_in : &es->dmam_out;
+ snd_dbuf *b = wr ? &d->dbuf_out : &d->dbuf_in;
+ bus_dmamap_t dmam;
+ void (*map_fnc[])(void *, bus_dma_segment_t *, int, int) =
+ { es_rd_map, es_wr_map, es1_wr_map };
if (bus_dmamem_alloc(es->parent_dmat, (void **)&b->buf, BUS_DMA_NOWAIT,
- dmam) != 0 ||
- bus_dmamap_load(es->parent_dmat, *dmam, b->buf, d->bufsize,
- rd ? es_rd_map : es_wr_map, es, 0) != 0)
+ &dmam) != 0 ||
+ bus_dmamap_load(es->parent_dmat, dmam, b->buf, d->bufsize,
+ map_fnc[wr], es, 0) != 0)
return -1;
b->rp = b->fp = b->dl = b->rl = 0;
@@ -681,19 +718,32 @@
es_wr_dmaupdate(snddev_info *d)
{
struct es_info *es = (struct es_info *)d->device_data;
- unsigned hwptr, delta;
+ unsigned hwptr, delta, reg;
- bus_space_write_4(es->st, es->sh, ES1370_REG_MEMPAGE,
- ES1370_REG_DAC2_FRAMECNT >> 8);
- hwptr = (bus_space_read_4(es->st, es->sh,
- ES1370_REG_DAC2_FRAMECNT & 0xff) >> 14) & 0x3fffc;
+ if (d->type == ES_TYPE_DAC1)
+ reg = ES1370_REG_DAC1_FRAMECNT;
+ else
+ reg = ES1370_REG_DAC2_FRAMECNT;
+ bus_space_write_4(es->st, es->sh, ES1370_REG_MEMPAGE, reg >> 8);
+ hwptr = (bus_space_read_4(es->st, es->sh, reg & 0xff) >> 14) & 0x3fffc;
delta = (d->dbuf_out.bufsize + hwptr - d->dbuf_out.rp) %
d->dbuf_out.bufsize;
+ if (delta > d->dbuf_out.rl) {
+ delta = d->dbuf_out.rl;
+ d->dbuf_out.fp = hwptr;
+ }
d->dbuf_out.rp = hwptr;
d->dbuf_out.rl -= delta;
d->dbuf_out.fl += delta;
d->dbuf_out.total += delta;
+ es->init_total[d->type] += delta;
+ if (es->init_at[d->type] != 0 &&
+ es->init_total[d->type] >= es->init_at[d->type]) {
+ d->callback(d, SND_CB_INIT);
+ es->init_at[d->type] = 0;
+ }
+
return delta;
}
@@ -709,10 +759,15 @@
ES1370_REG_ADC_FRAMECNT & 0xff) >> 14) & 0x3fffc;
delta = (d->dbuf_in.bufsize + hwptr - d->dbuf_in.fp) %
d->dbuf_in.bufsize;
+ if (delta > d->dbuf_in.fl) {
+ delta = d->dbuf_in.fl;
+ d->dbuf_in.rp = hwptr;
+ }
d->dbuf_in.fp = hwptr;
d->dbuf_in.rl += delta;
d->dbuf_in.fl -= delta;
d->dbuf_in.total += delta;
+
return delta;
}
@@ -731,11 +786,20 @@
switch(reason & SND_CB_REASON_MASK) {
case SND_CB_INIT:
- es->ctrl = (es->ctrl & ~CTRL_PCLKDIV) |
- (DAC2_SRTODIV(d->play_speed) << CTRL_SH_PCLKDIV);
+ if (d->type == ES_TYPE_DAC1) {
+ es->sctrl &= ~SCTRL_P1FMT;
+ es->ctrl = (es->ctrl & ~CTRL_WTSRSEL) |
+ (DAC1_SRTODIV(d->play_speed) << CTRL_SH_WTSRSEL);
+ if (d->flags & SND_F_STEREO)
+ es->sctrl |= SCTRL_P1SMB;
+ } else {
+ es->sctrl &= ~(SCTRL_R1FMT | SCTRL_P2FMT);
+ es->ctrl = (es->ctrl & ~CTRL_PCLKDIV) |
+ (DAC2_SRTODIV(d->play_speed) << CTRL_SH_PCLKDIV);
+ if (d->flags & SND_F_STEREO)
+ es->sctrl |= SCTRL_P2SMB | SCTRL_R1SMB;
+ }
snd_set_blocksize(d);
-
- es->sctrl &= ~(SCTRL_R1FMT | SCTRL_P2FMT);
d->flags &= ~SND_F_XLAT8;
switch(d->play_fmt) {
case 0:
@@ -743,7 +807,10 @@
break;
case AFMT_S16_LE:
- es->sctrl |= SCTRL_P2SEB;
+ if (d->type == ES_TYPE_DAC1)
+ es->sctrl |= SCTRL_P1SEB;
+ else
+ es->sctrl |= SCTRL_P2SEB;
break;
case AFMT_MU_LAW:
@@ -760,7 +827,8 @@
break;
case AFMT_S16_LE:
- es->sctrl |= SCTRL_R1SEB;
+ if (d->type != ES_TYPE_DAC1)
+ es->sctrl |= SCTRL_R1SEB;
break;
case AFMT_MU_LAW:
@@ -771,9 +839,6 @@
return (-1);
}
- if (d->flags & SND_F_STEREO)
- es->sctrl |= SCTRL_P2SMB | SCTRL_R1SMB;
-
bus_space_write_4(es->st, es->sh, ES1370_REG_CONTROL,
es->ctrl);
bus_space_write_4(es->st, es->sh, ES1370_REG_SERIAL_CONTROL,
@@ -781,22 +846,37 @@
break;
case SND_CB_START:
- if (rd) {
- es->ctrl |= CTRL_ADC_EN;
- es->sctrl = (es->sctrl & ~SCTRL_R1LOOPSEL) |
- SCTRL_R1INTEN;
- bus_space_write_4(es->st, es->sh, ES1370_REG_ADC_SCOUNT,
- d->dbuf_in.dl / d->dbuf_in.sample_size - 1);
- } else {
- es->ctrl |= CTRL_DAC2_EN;
- es->sctrl = (es->sctrl & ~(SCTRL_P2ENDINC |
- SCTRL_P2STINC | SCTRL_P2LOOPSEL | SCTRL_P2PAUSE |
- SCTRL_P2DACSEN)) | SCTRL_P2INTEN |
- (((d->play_fmt == AFMT_S16_LE) ? 2 : 1)
- << SCTRL_SH_P2ENDINC);
+ if (d->type == ES_TYPE_DAC1) {
+ es->ctrl |= CTRL_DAC1_EN;
+ es->sctrl = (es->sctrl & ~(SCTRL_P1LOOPSEL |
+ SCTRL_P1PAUSE | SCTRL_P1SCTRLD)) | SCTRL_P1INTEN;
+ if (d->dbuf_out.dl == d->dbuf_out.rl)
+ es->sctrl |= SCTRL_P1LOOPSEL;
bus_space_write_4(es->st, es->sh,
- ES1370_REG_DAC2_SCOUNT,
+ ES1370_REG_DAC1_SCOUNT,
d->dbuf_out.dl / d->dbuf_out.sample_size - 1);
+ } else {
+ if (rd) {
+ es->ctrl |= CTRL_ADC_EN;
+ es->sctrl = (es->sctrl & ~SCTRL_R1LOOPSEL) |
+ SCTRL_R1INTEN;
+ bus_space_write_4(es->st, es->sh,
+ ES1370_REG_ADC_SCOUNT,
+ d->dbuf_in.dl / d->dbuf_in.sample_size - 1);
+ } else {
+ es->ctrl |= CTRL_DAC2_EN;
+ es->sctrl = (es->sctrl & ~(SCTRL_P2ENDINC |
+ SCTRL_P2STINC | SCTRL_P2LOOPSEL |
+ SCTRL_P2PAUSE | SCTRL_P2DACSEN)) |
+ SCTRL_P2INTEN |
+ (((d->play_fmt == AFMT_S16_LE) ? 2 : 1)
+ << SCTRL_SH_P2ENDINC);
+ if (d->dbuf_out.dl == d->dbuf_out.rl)
+ es->sctrl |= SCTRL_P2LOOPSEL;
+ bus_space_write_4(es->st, es->sh,
+ ES1370_REG_DAC2_SCOUNT,
+ d->dbuf_out.dl / d->dbuf_out.sample_size - 1);
+ }
}
bus_space_write_4(es->st, es->sh, ES1370_REG_SERIAL_CONTROL,
es->sctrl);
@@ -805,10 +885,14 @@
case SND_CB_ABORT:
case SND_CB_STOP:
- if (rd)
- es->ctrl &= ~CTRL_ADC_EN;
- else
- es->ctrl &= ~CTRL_DAC2_EN;
+ if (d->type == ES_TYPE_DAC1)
+ es->ctrl &= ~CTRL_DAC1_EN;
+ else {
+ if (rd)
+ es->ctrl &= ~CTRL_ADC_EN;
+ else
+ es->ctrl &= ~CTRL_DAC2_EN;
+ }
bus_space_write_4(es->st, es->sh, ES1370_REG_CONTROL, es->ctrl);
break;
@@ -852,6 +936,19 @@
}
static void
+es1_wr_map(void *arg, bus_dma_segment_t *segs, int nseg, int error)
+{
+ struct es_info *es = (struct es_info *)arg;
+
+ bus_space_write_1(es->st, es->sh, ES1370_REG_MEMPAGE,
+ ES1370_REG_DAC1_FRAMEADR >> 8);
+ bus_space_write_4(es->st, es->sh, ES1370_REG_DAC1_FRAMEADR & 0xff,
+ segs->ds_addr);
+ bus_space_write_4(es->st, es->sh, ES1370_REG_DAC1_FRAMECNT & 0xff,
+ (segs->ds_len >> 2) - 1);
+}
+
+static void
es_rd_map(void *arg, bus_dma_segment_t *segs, int nseg, int error)
{
struct es_info *es = (struct es_info *)arg;
@@ -867,39 +964,36 @@
static void
dma_wrintr(snddev_info *d)
{
+ int l, loop;
snd_dbuf *b = &d->dbuf_out;
-
- /*
- * According to Linux driver:
- * dmaupdate()
- * Bei underrun error++
- * wake_up(dac2.wait)
- */
+ struct es_info *es = (struct es_info *)d->device_data;
if (b->dl != 0) {
es_wr_dmaupdate(d);
wakeup(b);
}
- if (b->rl >= DMA_ALIGN_THRESHOLD &&
- !(d->flags & SND_F_ABORTING)) {
- int l = min(b->rl, d->play_blocksize);
- l &= DMA_ALIGN_MASK;
+ if (d->flags & SND_F_ABORTING)
+ l = 0;
+ else
+ l = min(b->rl, d->play_blocksize) & DMA_ALIGN_MASK;
- if (l != b->dl) {
- if (b->dl != 0) {
- d->callback(d, SND_CB_WR | SND_CB_STOP);
- es_wr_dmaupdate(d);
- l = min(b->rl, d->play_blocksize);
- l &= DMA_ALIGN_MASK;
- }
- b->dl = l;
+ if (d->type == ES_TYPE_DAC1)
+ loop = es->sctrl & SCTRL_P1LOOPSEL;
+ else
+ loop = es->sctrl & SCTRL_P2LOOPSEL;
+
+ if (l != b->dl || loop) {
+ if (b->dl != 0) {
+ d->callback(d, SND_CB_WR | SND_CB_STOP);
+ es_wr_dmaupdate(d);
+ l = min(b->rl, d->play_blocksize) & DMA_ALIGN_MASK;
+ }
+ b->dl = l;
+ if (b->dl != 0) {
+ DELAY(50);
d->callback(d, SND_CB_WR | SND_CB_START);
}
- } else if (b->dl != 0) {
- b->dl = 0;
- d->callback(d, SND_CB_WR | SND_CB_STOP);
- es_wr_dmaupdate(d);
}
}
@@ -995,6 +1089,7 @@
u_int i;
es->ctrl = CTRL_CDC_EN | CTRL_SERR_DIS |
+ (DAC1_SRTODIV(DSP_DEFAULT_SPEED) << CTRL_SH_WTSRSEL) |
(DAC2_SRTODIV(DSP_DEFAULT_SPEED) << CTRL_SH_PCLKDIV);
bus_space_write_4(es->st, es->sh, ES1370_REG_CONTROL, es->ctrl);
es->sctrl = 0;
@@ -1044,14 +1139,21 @@
if (unit > NPCM_MAX)
return;
- d = &pcm_info[unit];
- *d = es_op_desc;
+ for (i = 1; i != NPCM_MAX; i++)
+ if (pcm_info[i - 1].io_base == 0 &&
+ pcm_info[i].io_base == 0)
+ break;
+ if (i == NPCM_MAX)
+ return;
+ d = &pcm_info[i - 1];
+ d[0] = es_op_desc;
+ d[1] = es1_op_desc;
if ((es = malloc(sizeof(*es), M_DEVBUF, M_NOWAIT)) == NULL) {
printf("pcm%d: cannot allocate softc\n", unit);
return;
}
bzero(es, sizeof(*es));
- d->device_data = es;
+ d[0].device_data = d[1].device_data = es;
vaddr = paddr = NULL;
mapped = 0;
@@ -1078,26 +1180,26 @@
printf("pcm%d: using %s space register mapping at %#x\n", unit,
es->st == IO_SPACE_MAPPING ? "I/O" : "Memory", es->sh);
- d->io_base = es->sh;
- d->mix_devs = 0;
+ d[0].io_base = d[1].io_base = es->sh;
+ d[0].mix_devs = d[1].mix_devs = 0;
for (i = 0; i != SOUND_MIXER_NRDEVICES; i++)
if (mixtable[i].avail)
- d->mix_devs |= (1 << i);
- d->mix_rec_devs = 0;
+ d[0].mix_devs = d[1].mix_devs |= (1 << i);
+ d[0].mix_rec_devs = d[1].mix_rec_devs = 0;
for (i = 0; i != SOUND_MIXER_NRDEVICES; i++)
if (mixtable[i].recmask)
- d->mix_rec_devs |= (1 << i);
+ d[0].mix_rec_devs |= (1 << i);
if (es_init(d) == -1) {
printf("pcm%d: unable to initialize the card\n", unit);
free(es, M_DEVBUF);
- d->io_base = 0;
+ d[0].io_base = d[1].io_base = 0;
return;
}
if (pci_map_int(config_id, es_intr, d, &tty_imask) == 0) {
printf("pcm%d: unable to map interrupt\n", unit);
free(es, M_DEVBUF);
- d->io_base = 0;
+ d[0].io_base = d[1].io_base = 0;
return;
}
if (bus_dma_tag_create(/*parent*/NULL, /*alignment*/2, /*boundary*/0,
@@ -1108,19 +1210,21 @@
/*flags*/0, &es->parent_dmat) != 0) {
printf("pcm%d: unable to create dma tag\n", unit);
free(es, M_DEVBUF);
- d->io_base = 0;
+ d[0].io_base = d[1].io_base = 0;
return;
}
if (alloc_dmabuf(d, 0) == -1 ||
- alloc_dmabuf(d, 1) == -1) {
+ alloc_dmabuf(d, 1) == -1 ||
+ alloc_dmabuf(d + 1, 2) == -1) {
printf("pcm%d: unable to allocate dma buffers\n", unit);
free(es, M_DEVBUF);
- d->io_base = 0;
+ d[0].io_base = d[1].io_base = 0;
return;
}
pcminit(d, unit);
+ pcminit(d + 1, unit + 1);
return;
}
Index: es1370_reg.h
RCS file: /usr/CVS-Repository/src/sys/pci/es1370_reg.h,v
retrieving revision 1.1
diff -u -r1.1 es1370_reg.h
--- es1370_reg.h 1998/12/31 08:14:27 1.1
+++ es1370_reg.h 1999/03/19 11:29:09
@@ -48,6 +48,9 @@
#define DAC2_SRTODIV(x) (((1411200 + (x) / 2) / (x) - 2) & 0x1fff)
#define DAC2_DIVTOSR(x) (1411200 / ((x) + 2))
+#define DAC1_SRTODIV(x) ((x) > 33075 ? 3 : (x) / 11025)
+#define DAC1_DIVTOSR(x) ((11025 << (x)) / 2)
+
#define CTRL_ADC_STOP 0x80000000 /* 1 = ADC stopped */
#define CTRL_XCTL1 0x40000000 /* SERR pin if enabled */
#define CTRL_OPEN 0x20000000 /* no function, can be read and
@@ -118,6 +121,15 @@
#define STAT_DAC2 0x00000002 /* DAC2 int pending */
#define STAT_ADC 0x00000001 /* ADC int pending */
+#define UCTRL_RXINTEN 0x80
+#define UCTRL_TXINTEN 0x20
+#define UCTRL_SWR 0x03
+
+#define USTAT_RXINT 0x80
+#define USTAT_TXINT 0x04
+#define USTAT_TXRDY 0x02
+#define USTAT_RXRDY 0x01
+
#define CODEC_OMIX1 0x10
#define CODEC_OMIX2 0x11
#define CODEC_LIMIX1 0x12
@@ -129,6 +141,7 @@
#define CODEC_ADSEL 0x18
#define CODEC_MGAIN 0x19
-#define ES_BUFFSIZE 0x20000 /* We're PCI! Use a large buffer */
+#define ES_BUFFSIZE 0x20000 /* We're PCI! Use a large buffer */
+#define ES_MIDIBUFFSIZE 0x2000
#endif
=== Cut ===
До свидания,
oZZ
---
* Origin: (2:5020/758.5)