diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:04:49 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:04:49 -0800 |
commit | df7881f07f53b041dc0568be8528e9dbb74994cc (patch) | |
tree | 1b3e036f7df4241bf0c2d527b73198c50e1d7891 /hw | |
parent | 55f4e4a5ec657a017e3bf75299ad71fd1c968dd3 (diff) | |
download | external_qemu-df7881f07f53b041dc0568be8528e9dbb74994cc.zip external_qemu-df7881f07f53b041dc0568be8528e9dbb74994cc.tar.gz external_qemu-df7881f07f53b041dc0568be8528e9dbb74994cc.tar.bz2 |
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'hw')
-rw-r--r-- | hw/android_arm.c | 5 | ||||
-rw-r--r-- | hw/goldfish_audio.c | 58 | ||||
-rw-r--r-- | hw/goldfish_fb.c | 2 |
3 files changed, 40 insertions, 25 deletions
diff --git a/hw/android_arm.c b/hw/android_arm.c index 7b1d446..3455054 100644 --- a/hw/android_arm.c +++ b/hw/android_arm.c @@ -12,6 +12,7 @@ #include "vl.h" #include "arm_pic.h" #include "goldfish_device.h" +#include "android/globals.h" int android_audio_enabled; char* audio_input_source = NULL; @@ -112,7 +113,8 @@ static void android_arm_init(int ram_size, int vga_ram_size, goldfish_memlog_init(0xff006000); - goldfish_battery_init(); + if (android_hw->hw_battery) + goldfish_battery_init(); goldfish_add_device_no_io(&event0_device); events_dev_init(event0_device.base, goldfish_pic[event0_device.irq]); @@ -146,4 +148,5 @@ QEMUMachine android_arm_machine = { "android_arm", "ARM Android Emulator", android_arm_init, + NULL }; diff --git a/hw/goldfish_audio.c b/hw/goldfish_audio.c index 69b2ef4..3472d73 100644 --- a/hw/goldfish_audio.c +++ b/hw/goldfish_audio.c @@ -13,6 +13,7 @@ #include "goldfish_device.h" #include "audio/audio.h" #include "android_debug.h" +#include "android/globals.h" #define DEBUG 1 @@ -157,8 +158,11 @@ static int audio_state_load( QEMUFile* f, void* opaque, int version_id ) static void enable_audio(struct goldfish_audio_state *s, int enable) { // enable or disable the output voice - AUD_set_active_out(s->voice, (enable & (AUDIO_INT_WRITE_BUFFER_1_EMPTY | AUDIO_INT_WRITE_BUFFER_2_EMPTY)) != 0); - AUD_set_active_in (s->voicein, (enable & AUDIO_INT_READ_BUFFER_FULL) != 0); + if (s->voice != NULL) + AUD_set_active_out(s->voice, (enable & (AUDIO_INT_WRITE_BUFFER_1_EMPTY | AUDIO_INT_WRITE_BUFFER_2_EMPTY)) != 0); + + if (s->voicein) + AUD_set_active_in (s->voicein, (enable & AUDIO_INT_READ_BUFFER_FULL) != 0); // reset buffer information s->data_1_length = 0; s->data_2_length = 0; @@ -456,6 +460,10 @@ void goldfish_audio_init(uint32_t base, int id, const char* input_source) struct goldfish_audio_state *s; audsettings_t as; + /* nothing to do if no audio input and output */ + if (!android_hw->hw_audioOutput && !android_hw->hw_audioInput) + return; + s = (struct goldfish_audio_state *)qemu_mallocz(sizeof(*s)); s->dev.name = "goldfish_audio"; s->dev.id = id; @@ -481,17 +489,19 @@ void goldfish_audio_init(uint32_t base, int id, const char* input_source) as.fmt = AUD_FMT_S16; as.endianness = AUDIO_HOST_ENDIANNESS; - s->voice = AUD_open_out ( - &s->card, - s->voice, - "goldfish_audio", - s, - goldfish_audio_callback, - &as - ); - if (!s->voice) { - dprint("warning: opening audio output failed\n"); - return; + if (android_hw->hw_audioOutput) { + s->voice = AUD_open_out ( + &s->card, + s->voice, + "goldfish_audio", + s, + goldfish_audio_callback, + &as + ); + if (!s->voice) { + dprint("warning: opening audio output failed\n"); + return; + } } #if USE_QEMU_AUDIO_IN @@ -500,16 +510,18 @@ void goldfish_audio_init(uint32_t base, int id, const char* input_source) as.fmt = AUD_FMT_S16; as.endianness = AUDIO_HOST_ENDIANNESS; - s->voicein = AUD_open_in ( - &s->card, - NULL, - "goldfish_audio_in", - s, - goldfish_audio_in_callback, - &as - ); - if (!s->voicein) { - dprint("warning: opening audio input failed\n"); + if (android_hw->hw_audioInput) { + s->voicein = AUD_open_in ( + &s->card, + NULL, + "goldfish_audio_in", + s, + goldfish_audio_in_callback, + &as + ); + if (!s->voicein) { + dprint("warning: opening audio input failed\n"); + } } #endif diff --git a/hw/goldfish_fb.c b/hw/goldfish_fb.c index 0924735..db3e25b 100644 --- a/hw/goldfish_fb.c +++ b/hw/goldfish_fb.c @@ -392,7 +392,7 @@ void goldfish_fb_init(DisplayState *ds, int id) s->dev.irq_count = 1; s->qfbuff = qframebuffer_fifo_get(); - qframebuffer_add_producer( s->qfbuff, s, + qframebuffer_set_producer( s->qfbuff, s, goldfish_fb_update_display, goldfish_fb_invalidate_display, goldfish_fb_detach_display ); |