diff options
author | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-05-04 12:15:51 +0000 |
---|---|---|
committer | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-05-04 12:15:51 +0000 |
commit | af83e09e9e7589c28bcf66518fd20908378880c6 (patch) | |
tree | 5446ad27085d41b40c34747ea57c01a048af7e21 /hw/musicpal.c | |
parent | 762abf67745a885be225fe15b4fb39ce89a7046a (diff) |
Use external clock in wm8750 slave mode.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4325 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/musicpal.c')
-rw-r--r-- | hw/musicpal.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/hw/musicpal.c b/hw/musicpal.c index 56bb457958..5cef81cda0 100644 --- a/hw/musicpal.c +++ b/hw/musicpal.c @@ -298,6 +298,20 @@ static void audio_callback(void *opaque, int free_out, int free_in) qemu_irq_raise(s->irq); } +static void musicpal_audio_clock_update(musicpal_audio_state *s) +{ + int rate; + + if (s->playback_mode & MP_AUDIO_CLOCK_24MHZ) + rate = 24576000 / 64; /* 24.576MHz */ + else + rate = 11289600 / 64; /* 11.2896MHz */ + + rate /= ((s->clock_div >> 8) & 0xff) + 1; + + wm8750_set_bclk_in(s->wm, rate / 2); +} + static uint32_t musicpal_audio_read(void *opaque, target_phys_addr_t offset) { musicpal_audio_state *s = opaque; @@ -339,12 +353,14 @@ static void musicpal_audio_write(void *opaque, target_phys_addr_t offset, s->play_pos = 0; } s->playback_mode = value; + musicpal_audio_clock_update(s); break; case MP_AUDIO_CLOCK_DIV: s->clock_div = value; s->last_free = 0; s->play_pos = 0; + musicpal_audio_clock_update(s); break; case MP_AUDIO_IRQ_STATUS: |