handle emulated dma reads
don't try to get sample size from snd_dbuf
This commit is contained in:
parent
962a3cbc83
commit
35f9e4a1db
@ -403,7 +403,9 @@ ad1816chan_trigger(void *data, int go)
|
||||
struct ad1816_info *ad1816 = ch->parent;
|
||||
int wr, reg;
|
||||
|
||||
if (go == PCMTRIG_EMLDMAWR) return 0;
|
||||
if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
|
||||
return 0;
|
||||
|
||||
buf_isadma(ch->buffer, go);
|
||||
wr = (ch->dir == PCMDIR_PLAY);
|
||||
reg = wr? AD1816_PLAY : AD1816_CAPT;
|
||||
|
@ -678,7 +678,7 @@ esschan_trigger(void *data, int go)
|
||||
{
|
||||
struct ess_chinfo *ch = data;
|
||||
|
||||
if (go == PCMTRIG_EMLDMAWR)
|
||||
if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
|
||||
return 0;
|
||||
|
||||
switch (go) {
|
||||
|
@ -49,6 +49,7 @@ struct mss_chinfo {
|
||||
pcm_channel *channel;
|
||||
snd_dbuf *buffer;
|
||||
int dir;
|
||||
u_int32_t fmt;
|
||||
};
|
||||
|
||||
struct mss_info {
|
||||
@ -1293,6 +1294,7 @@ mss_format(struct mss_chinfo *ch, u_int32_t format)
|
||||
{AFMT_U8, AFMT_MU_LAW, AFMT_S16_LE, AFMT_A_LAW,
|
||||
-1, AFMT_IMA_ADPCM, AFMT_U16_BE, -1};
|
||||
|
||||
ch->fmt = format;
|
||||
for (i = 0; i < 8; i++) if (arg == fmts[i]) break;
|
||||
arg = i << 1;
|
||||
if (format & AFMT_STEREO) arg |= 1;
|
||||
@ -1309,13 +1311,17 @@ mss_trigger(struct mss_chinfo *ch, int go)
|
||||
{
|
||||
struct mss_info *mss = ch->parent;
|
||||
u_char m;
|
||||
int retry, wr, cnt;
|
||||
int retry, wr, cnt, ss;
|
||||
|
||||
wr = (ch->dir == PCMDIR_PLAY)? 1 : 0;
|
||||
ss = 1;
|
||||
ss <<= (ch->fmt & AFMT_STEREO)? 1 : 0;
|
||||
ss <<= (ch->fmt & AFMT_16BIT)? 1 : 0;
|
||||
|
||||
wr = (ch->dir == PCMDIR_PLAY)? 1 : 0;
|
||||
m = ad_read(mss, 9);
|
||||
switch (go) {
|
||||
case PCMTRIG_START:
|
||||
cnt = (ch->buffer->dl / ch->buffer->sample_size) - 1;
|
||||
cnt = (ch->buffer->dl / ss) - 1;
|
||||
|
||||
DEB(if (m & 4) printf("OUCH! reg 9 0x%02x\n", m););
|
||||
m |= wr? I9_PEN : I9_CEN; /* enable DMA */
|
||||
@ -1768,7 +1774,9 @@ msschan_trigger(void *data, int go)
|
||||
{
|
||||
struct mss_chinfo *ch = data;
|
||||
|
||||
if (go == PCMTRIG_EMLDMAWR) return 0;
|
||||
if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
|
||||
return 0;
|
||||
|
||||
buf_isadma(ch->buffer, go);
|
||||
mss_trigger(ch, go);
|
||||
return 0;
|
||||
|
@ -689,7 +689,7 @@ sbchan_trigger(void *data, int go)
|
||||
{
|
||||
struct sb_chinfo *ch = data;
|
||||
|
||||
if (go == PCMTRIG_EMLDMAWR)
|
||||
if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
|
||||
return 0;
|
||||
|
||||
buf_isadma(ch->buffer, go);
|
||||
|
@ -689,7 +689,7 @@ sbchan_trigger(void *data, int go)
|
||||
{
|
||||
struct sb_chinfo *ch = data;
|
||||
|
||||
if (go == PCMTRIG_EMLDMAWR)
|
||||
if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
|
||||
return 0;
|
||||
|
||||
buf_isadma(ch->buffer, go);
|
||||
|
@ -689,7 +689,7 @@ sbchan_trigger(void *data, int go)
|
||||
{
|
||||
struct sb_chinfo *ch = data;
|
||||
|
||||
if (go == PCMTRIG_EMLDMAWR)
|
||||
if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
|
||||
return 0;
|
||||
|
||||
buf_isadma(ch->buffer, go);
|
||||
|
@ -350,7 +350,10 @@ auchan_trigger(void *data, int go)
|
||||
{
|
||||
struct au_chinfo *ch = data;
|
||||
struct au_info *au = ch->parent;
|
||||
if (go == PCMTRIG_EMLDMAWR) return 0;
|
||||
|
||||
if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
|
||||
return 0;
|
||||
|
||||
if (ch->dir == PCMDIR_PLAY) {
|
||||
au_setadb(au, 0x11, (go)? 1 : 0);
|
||||
if (!go) {
|
||||
|
@ -388,7 +388,9 @@ csachan_trigger(void *data, int go)
|
||||
struct csa_chinfo *ch = data;
|
||||
struct csa_info *csa = ch->parent;
|
||||
|
||||
if (go == PCMTRIG_EMLDMAWR) return 0;
|
||||
if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
|
||||
return 0;
|
||||
|
||||
if (ch->dir == PCMDIR_PLAY) {
|
||||
if (go == PCMTRIG_START)
|
||||
csa_startplaydma(csa);
|
||||
|
@ -672,7 +672,9 @@ emuchan_trigger(void *data, int go)
|
||||
struct sc_chinfo *ch = data;
|
||||
struct sc_info *sc = ch->parent;
|
||||
|
||||
if (go == PCMTRIG_EMLDMAWR) return 0;
|
||||
if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
|
||||
return 0;
|
||||
|
||||
if (go == PCMTRIG_START) {
|
||||
emu_vsetup(ch);
|
||||
emu_vwrite(sc, ch->master);
|
||||
|
@ -365,9 +365,16 @@ eschan_trigger(void *data, int go)
|
||||
{
|
||||
struct es_chinfo *ch = data;
|
||||
struct es_info *es = ch->parent;
|
||||
unsigned cnt = ch->buffer->dl / ch->buffer->sample_size - 1;
|
||||
unsigned ss, cnt;
|
||||
|
||||
if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
|
||||
return 0;
|
||||
|
||||
ss = 1;
|
||||
ss <<= (ch->fmt & AFMT_STEREO)? 1 : 0;
|
||||
ss <<= (ch->fmt & AFMT_16BIT)? 1 : 0;
|
||||
cnt = ch->buffer->dl / ss - 1;
|
||||
|
||||
if (go == PCMTRIG_EMLDMAWR) return 0;
|
||||
if (ch->dir == PCMDIR_PLAY) {
|
||||
if (go == PCMTRIG_START) {
|
||||
int b = (ch->fmt & AFMT_S16_LE)? 2 : 1;
|
||||
|
@ -396,7 +396,8 @@ nmchan_trigger(void *data, int go)
|
||||
struct sc_info *sc = ch->parent;
|
||||
int ssz;
|
||||
|
||||
if (go == PCMTRIG_EMLDMAWR) return 0;
|
||||
if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
|
||||
return 0;
|
||||
|
||||
ssz = (ch->fmt & AFMT_16BIT)? 2 : 1;
|
||||
if (ch->fmt & AFMT_STEREO)
|
||||
|
@ -52,7 +52,7 @@ struct tr_chinfo {
|
||||
u_int32_t eso, delta;
|
||||
u_int32_t rvol, cvol;
|
||||
u_int32_t gvsel, pan, vol, ctrl;
|
||||
int index;
|
||||
int index, ss;
|
||||
snd_dbuf *buffer;
|
||||
pcm_channel *channel;
|
||||
struct tr_info *parent;
|
||||
@ -438,9 +438,12 @@ trchan_setformat(void *data, u_int32_t format)
|
||||
struct tr_info *tr = ch->parent;
|
||||
u_int32_t bits = tr_fmttobits(format);
|
||||
|
||||
ch->ss = 1;
|
||||
ch->ss <<= (format & AFMT_STEREO)? 1 : 0;
|
||||
ch->ss <<= (format & AFMT_16BIT)? 1 : 0;
|
||||
if (ch->index >= 0) {
|
||||
tr_rdch(tr, ch->index, ch);
|
||||
ch->eso = (ch->buffer->bufsize / ch->buffer->sample_size) - 1;
|
||||
ch->eso = (ch->buffer->bufsize / ch->ss) - 1;
|
||||
ch->ctrl = bits | 0x01;
|
||||
tr_wrch(tr, ch->index, ch);
|
||||
} else {
|
||||
@ -488,7 +491,9 @@ trchan_trigger(void *data, int go)
|
||||
struct tr_chinfo *ch = data;
|
||||
struct tr_info *tr = ch->parent;
|
||||
|
||||
if (go == PCMTRIG_EMLDMAWR) return 0;
|
||||
if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
|
||||
return 0;
|
||||
|
||||
if (ch->index >= 0) {
|
||||
if (go == PCMTRIG_START) {
|
||||
tr_rdch(tr, ch->index, ch);
|
||||
@ -508,9 +513,10 @@ trchan_getptr(void *data)
|
||||
{
|
||||
struct tr_chinfo *ch = data;
|
||||
struct tr_info *tr = ch->parent;
|
||||
|
||||
if (ch->index >= 0) {
|
||||
tr_rdch(tr, ch->index, ch);
|
||||
return ch->cso * ch->buffer->sample_size;
|
||||
return ch->cso * ch->ss;
|
||||
} else return tr_rd(tr, TR_REG_DMAR0, 4) - vtophys(ch->buffer->buf);
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,7 @@ extern pcm_feeder feeder_root;
|
||||
|
||||
#define PCMTRIG_START 1
|
||||
#define PCMTRIG_EMLDMAWR 2
|
||||
#define PCMTRIG_EMLDMARD 3
|
||||
#define PCMTRIG_STOP 0
|
||||
#define PCMTRIG_ABORT -1
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user