Skip to content

Commit

Permalink
ESS bits for IRQ raise
Browse files Browse the repository at this point in the history
  • Loading branch information
Cacodemon345 committed Mar 2, 2024
1 parent a338d46 commit e4f8485
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/sound/snd_sb_dsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ sb_update_status(sb_dsp_t *dsp, int bit, int set)
break;
}

/* TODO: Investigate real hardware for this (the ES1887 datasheet documents this bit somewhat oddly.) */
if (dsp->ess_playback_mode && bit <= 1 && set && !masked) {
if (!(ESSreg(0xB1) & 0x40)) // if ESS playback, and IRQ disabled, do not fire
return;
}

if (set && !masked)
dsp->irq_update(dsp->irq_priv, 1);
else if (!set)
Expand Down Expand Up @@ -377,6 +383,9 @@ sb_start_dma(sb_dsp_t *dsp, int dma8, int autoinit, uint8_t format, int len)
if (!timer_is_enabled(&dsp->output_timer))
timer_set_delay_u64(&dsp->output_timer, dsp->sblatcho);
}

/* This will be set later for ESS playback/record modes. */
dsp->ess_playback_mode = 0;
}

void
Expand Down Expand Up @@ -409,6 +418,32 @@ sb_start_dma_i(sb_dsp_t *dsp, int dma8, int autoinit, uint8_t format, int len)
memset(dsp->record_buffer, 0, sizeof(dsp->record_buffer));
}

void
sb_start_dma_ess(sb_dsp_t* dsp, int dma8, int autoinit, uint8_t format, int len)
{
if (IS_ESS(dsp)) {
dma_set_drq(dsp->sb_8_dmanum, 0);
dma_set_drq(dsp->sb_16_8_dmanum, 0);
}
sb_start_dma(dsp, dma8, autoinit, format, len);
dsp->ess_playback_mode = 1;
dma_set_drq(dsp->sb_8_dmanum, 1);
dma_set_drq(dsp->sb_16_8_dmanum, 1);
}

void
sb_start_dma_ess_i(sb_dsp_t* dsp, int dma8, int autoinit, uint8_t format, int len)
{
if (IS_ESS(dsp)) {
dma_set_drq(dsp->sb_8_dmanum, 0);
dma_set_drq(dsp->sb_16_8_dmanum, 0);
}
sb_start_dma_i(dsp, dma8, autoinit, format, len);
dsp->ess_playback_mode = 1;
dma_set_drq(dsp->sb_8_dmanum, 1);
dma_set_drq(dsp->sb_16_8_dmanum, 1);
}

int
sb_8_read_dma(void *priv)
{
Expand Down

0 comments on commit e4f8485

Please sign in to comment.