From 2d7c576f4ab90819ca1bd05e92375a00804fdfd7 Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Sun, 3 Feb 2019 04:25:29 +0200 Subject: [PATCH] fixed 16bit playback. DMA page reg expects the page unshifted --- src/dma.c | 5 ++++- src/main.c | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/dma.c b/src/dma.c index 56ec5d9..3ff5fd0 100644 --- a/src/dma.c +++ b/src/dma.c @@ -42,6 +42,7 @@ void dma_in(int chan, uint32_t phyaddr, int size, unsigned int flags) static void dma_io(int chan, uint32_t phyaddr, int size, unsigned int flags, unsigned int dir) { unsigned int mode; + unsigned char page; mask(chan); outp(clrff_port[chan], 0); @@ -52,6 +53,8 @@ static void dma_io(int chan, uint32_t phyaddr, int size, unsigned int flags, uns if(flags & DMA_AUTO) mode |= MODE_AUTO; outp(mode_port[chan], mode); + page = (phyaddr >> 16) & 0xff; + if(IS_16BIT(chan)) { phyaddr >>= 1; size >>= 1; @@ -59,7 +62,7 @@ static void dma_io(int chan, uint32_t phyaddr, int size, unsigned int flags, uns outp(addr_port[chan], phyaddr & 0xff); outp(addr_port[chan], (phyaddr >> 8) & 0xff); - outp(page_port[chan], (phyaddr >> 16) & 0xff); + outp(page_port[chan], page); size--; outp(count_port[chan], size & 0xff); diff --git a/src/main.c b/src/main.c index 8fa1126..f8ca49d 100644 --- a/src/main.c +++ b/src/main.c @@ -12,7 +12,7 @@ static int play_file(const char *fname); static int cbfunc(void *buf, int size, void *cls); static void print_usage(const char *argv0); -static int vol = 220; +static int vol = 255; static int quit; int main(int argc, char **argv) @@ -22,7 +22,7 @@ int main(int argc, char **argv) if(audio_init() == -1) { return 1; } - audio_setvolume(AUDIO_MASTER, vol); + audio_setvolume(AUDIO_MASTER, 255); audio_setvolume(AUDIO_PCM, 255); for(i=1; i