make drivers start at beginning of buffer when triggered - improves mmap.
not all tested. not sure about aureal.c or csapcm.c
This commit is contained in:
parent
2ae7162ec5
commit
674c45bd04
@ -413,6 +413,7 @@ ad1816chan_trigger(void *data, int go)
|
||||
if (!(io_rd(ad1816, reg) & AD1816_ENABLE)) {
|
||||
int cnt = ((ch->buffer->dl) >> 2) - 1;
|
||||
ad1816_write(ad1816, wr? 8 : 10, cnt); /* count */
|
||||
ad1816_write(ad1816, wr? 9 : 11, 0); /* reset cur cnt */
|
||||
ad1816_write(ad1816, 1, ad1816_read(ad1816, 1) |
|
||||
(wr? 0x8000 : 0x4000)); /* enable int */
|
||||
/* enable playback */
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include <dev/sound/isa/sb.h>
|
||||
#include <dev/sound/chip.h>
|
||||
|
||||
#define ESS_BUFFSIZE (16384)
|
||||
#define ESS_BUFFSIZE (4096)
|
||||
#define ABS(x) (((x) < 0)? -(x) : (x))
|
||||
|
||||
/* audio2 never generates irqs and sounds very noisy */
|
||||
|
@ -378,6 +378,12 @@ eschan_trigger(void *data, int go)
|
||||
es->sctrl |= SCTRL_P2INTEN | (b << SCTRL_SH_P2ENDINC);
|
||||
bus_space_write_4(es->st, es->sh,
|
||||
ES1370_REG_DAC2_SCOUNT, cnt);
|
||||
/* start at beginning of buffer */
|
||||
bus_space_write_4(es->st, es->sh, ES1370_REG_MEMPAGE,
|
||||
ES1370_REG_DAC2_FRAMECNT >> 8);
|
||||
bus_space_write_4(es->st, es->sh,
|
||||
ES1370_REG_DAC2_FRAMECNT & 0xff,
|
||||
(ch->buffer->bufsize >> 2) - 1);
|
||||
} else es->ctrl &= ~CTRL_DAC2_EN;
|
||||
} else {
|
||||
if (go == PCMTRIG_START) {
|
||||
@ -386,6 +392,12 @@ eschan_trigger(void *data, int go)
|
||||
es->sctrl |= SCTRL_R1INTEN;
|
||||
bus_space_write_4(es->st, es->sh,
|
||||
ES1370_REG_ADC_SCOUNT, cnt);
|
||||
/* start at beginning of buffer */
|
||||
bus_space_write_4(es->st, es->sh, ES1370_REG_MEMPAGE,
|
||||
ES1370_REG_ADC_FRAMECNT >> 8);
|
||||
bus_space_write_4(es->st, es->sh,
|
||||
ES1370_REG_ADC_FRAMECNT & 0xff,
|
||||
(ch->buffer->bufsize >> 2) - 1);
|
||||
} else es->ctrl &= ~CTRL_ADC_EN;
|
||||
}
|
||||
bus_space_write_4(es->st, es->sh, ES1370_REG_SERIAL_CONTROL, es->sctrl);
|
||||
@ -398,17 +410,17 @@ eschan_getptr(void *data)
|
||||
{
|
||||
struct es_chinfo *ch = data;
|
||||
struct es_info *es = ch->parent;
|
||||
if (ch->dir == PCMDIR_PLAY) {
|
||||
bus_space_write_4(es->st, es->sh, ES1370_REG_MEMPAGE,
|
||||
ES1370_REG_DAC2_FRAMECNT >> 8);
|
||||
return (bus_space_read_4(es->st, es->sh,
|
||||
ES1370_REG_DAC2_FRAMECNT & 0xff) >> 14) & 0x3fffc;
|
||||
} else {
|
||||
bus_space_write_4(es->st, es->sh, ES1370_REG_MEMPAGE,
|
||||
ES1370_REG_ADC_FRAMECNT >> 8);
|
||||
return (bus_space_read_4(es->st, es->sh,
|
||||
ES1370_REG_ADC_FRAMECNT & 0xff) >> 14) & 0x3fffc;
|
||||
}
|
||||
u_int32_t reg, cnt;
|
||||
|
||||
if (ch->dir == PCMDIR_PLAY)
|
||||
reg = ES1370_REG_DAC2_FRAMECNT;
|
||||
else
|
||||
reg = ES1370_REG_ADC_FRAMECNT;
|
||||
|
||||
bus_space_write_4(es->st, es->sh, ES1370_REG_MEMPAGE, reg >> 8);
|
||||
cnt = bus_space_read_4(es->st, es->sh, reg & 0x000000ff) >> 16;
|
||||
/* cnt is longwords */
|
||||
return cnt << 2;
|
||||
}
|
||||
|
||||
static pcmchan_caps *
|
||||
|
@ -487,10 +487,15 @@ trchan_trigger(void *data, int go)
|
||||
{
|
||||
struct tr_chinfo *ch = data;
|
||||
struct tr_info *tr = ch->parent;
|
||||
|
||||
if (go == PCMTRIG_EMLDMAWR) return 0;
|
||||
if (ch->index >= 0) {
|
||||
if (go == PCMTRIG_START) tr_startch(tr, ch->index);
|
||||
else tr_stopch(tr, ch->index);
|
||||
if (go == PCMTRIG_START) {
|
||||
tr_rdch(tr, ch->index, ch);
|
||||
ch->cso = 0;
|
||||
tr_wrch(tr, ch->index, ch);
|
||||
tr_startch(tr, ch->index);
|
||||
} else tr_stopch(tr, ch->index);
|
||||
} else {
|
||||
u_int32_t i = tr_rd(tr, TR_REG_SBCTRL, 1) & ~7;
|
||||
tr_wr(tr, TR_REG_SBCTRL, i | (go == PCMTRIG_START)? 1 : 0, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user