From f2f8d4a02e4bca5c7681c6a93ea283995b8e52a6 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 21 May 2021 12:52:14 -0300 Subject: [PATCH] Some AD1848 cleanups I forgot --- src/include/86box/snd_ad1848.h | 30 ++++++++++-------------------- src/sound/snd_ad1848.c | 10 +++++----- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/src/include/86box/snd_ad1848.h b/src/include/86box/snd_ad1848.h index d1f4a4499..51579cd09 100644 --- a/src/include/86box/snd_ad1848.h +++ b/src/include/86box/snd_ad1848.h @@ -24,32 +24,22 @@ typedef struct { - int index; - uint8_t regs[32]; /* 16 original + 16 CS4231A extensions */ - uint8_t status; + int index; + uint8_t regs[32], status; /* 16 original registers + 16 CS4231A extensions */ - int trd; - int mce; + int trd, mce, count; - int count; - - int16_t out_l, out_r; + int16_t out_l, out_r; - double cd_vol_l, cd_vol_r; + double cd_vol_l, cd_vol_r; - int enable; + int enable, irq, dma, freq; - int irq, dma; - - int freq; - - pc_timer_t timer_count; - uint64_t timer_latch; + pc_timer_t timer_count; + uint64_t timer_latch; - int16_t buffer[SOUNDBUFLEN * 2]; - int pos; - - int type; + int16_t buffer[SOUNDBUFLEN * 2]; + int pos, type; } ad1848_t; diff --git a/src/sound/snd_ad1848.c b/src/sound/snd_ad1848.c index 51c0423bd..c991ff381 100644 --- a/src/sound/snd_ad1848.c +++ b/src/sound/snd_ad1848.c @@ -40,14 +40,14 @@ static double ad1848_vols_5bits_aux_gain[32]; void ad1848_setirq(ad1848_t *ad1848, int irq) { - ad1848->irq = irq; + ad1848->irq = irq; } void ad1848_setdma(ad1848_t *ad1848, int dma) { - ad1848->dma = dma; + ad1848->dma = dma; } @@ -90,8 +90,8 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv) ad1848->index = val & 0x1f; /* cs4231a extended mode enabled */ else ad1848->index = val & 0x0f; /* ad1848/cs4248 mode TODO: some variants/clones DO NOT mirror, just ignore the writes? */ - ad1848->trd = val & 0x20; - ad1848->mce = val & 0x40; + ad1848->trd = val & 0x20; + ad1848->mce = val & 0x40; break; case 1: @@ -109,7 +109,7 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv) case 7: freq /= 2560; break; } ad1848->freq = freq; - ad1848->timer_latch = (uint64_t)((double)TIMER_USEC * (1000000.0 / (double)ad1848->freq)); + ad1848->timer_latch = (uint64_t) ((double) TIMER_USEC * (1000000.0 / (double) ad1848->freq)); break; case 9: