[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 27/49] ac97: add active to the state
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 27/49] ac97: add active to the state |
Date: |
Tue, 29 Sep 2009 22:48:46 +0200 |
This simplifies reset_voices, that only takes one argument now.
Signed-off-by: Juan Quintela <address@hidden>
---
hw/ac97.c | 42 ++++++++++++++++++++----------------------
1 files changed, 20 insertions(+), 22 deletions(-)
diff --git a/hw/ac97.c b/hw/ac97.c
index 610ca60..da6cb2d 100644
--- a/hw/ac97.c
+++ b/hw/ac97.c
@@ -146,6 +146,13 @@ typedef struct AC97BusMasterRegs {
BD bd;
} AC97BusMasterRegs;
+enum {
+ PI_INDEX = 0,
+ PO_INDEX,
+ MC_INDEX,
+ LAST_INDEX
+};
+
typedef struct AC97LinkState {
PCIDevice dev;
QEMUSoundCard card;
@@ -162,6 +169,7 @@ typedef struct AC97LinkState {
uint8_t silence[128];
uint32_t base[2];
int bup_flag;
+ uint8_t active[LAST_INDEX];
} AC97LinkState;
enum {
@@ -186,13 +194,6 @@ enum { \
prefix ## _CR = start + 11 \
}
-enum {
- PI_INDEX = 0,
- PO_INDEX,
- MC_INDEX,
- LAST_INDEX
-};
-
MKREGS (PI, PI_INDEX * 16);
MKREGS (PO, PO_INDEX * 16);
MKREGS (MC, MC_INDEX * 16);
@@ -414,21 +415,21 @@ static void open_voice (AC97LinkState *s, int index, int
freq)
}
}
-static void reset_voices (AC97LinkState *s, uint8_t active[LAST_INDEX])
+static void reset_voices (AC97LinkState *s)
{
uint16_t freq;
freq = mixer_load (s, AC97_PCM_LR_ADC_Rate);
open_voice (s, PI_INDEX, freq);
- AUD_set_active_in (s->voice_pi, active[PI_INDEX]);
+ AUD_set_active_in (s->voice_pi, s->active[PI_INDEX]);
freq = mixer_load (s, AC97_PCM_Front_DAC_Rate);
open_voice (s, PO_INDEX, freq);
- AUD_set_active_out (s->voice_po, active[PO_INDEX]);
+ AUD_set_active_out (s->voice_po, s->active[PO_INDEX]);
freq = mixer_load (s, AC97_MIC_ADC_Rate);
open_voice (s, MC_INDEX, freq);
- AUD_set_active_in (s->voice_mc, active[MC_INDEX]);
+ AUD_set_active_in (s->voice_mc, s->active[MC_INDEX]);
}
#ifdef USE_MIXER
@@ -526,11 +527,10 @@ static void record_select (AC97LinkState *s, uint32_t val)
static void mixer_reset (AC97LinkState *s)
{
- uint8_t active[LAST_INDEX];
dolog ("mixer_reset\n");
memset (s->mixer_data, 0, sizeof (s->mixer_data));
- memset (active, 0, sizeof (active));
+ memset (s->active, 0, sizeof (s->active));
mixer_store (s, AC97_Reset , 0x0000); /* 6940 */
mixer_store (s, AC97_Master_Volume_Mono_Mute , 0x8000);
mixer_store (s, AC97_PC_BEEP_Volume_Mute , 0x0000);
@@ -564,7 +564,7 @@ static void mixer_reset (AC97LinkState *s)
set_volume (s, AC97_PCM_Out_Volume_Mute, AUD_MIXER_PCM , 0x8808);
set_volume (s, AC97_Line_In_Volume_Mute, AUD_MIXER_LINE_IN, 0x8808);
#endif
- reset_voices (s, active);
+ reset_voices (s);
}
/**
@@ -1170,7 +1170,6 @@ static void po_callback (void *opaque, int free)
static void ac97_save (QEMUFile *f, void *opaque)
{
size_t i;
- uint8_t active[LAST_INDEX];
AC97LinkState *s = opaque;
pci_device_save (&s->dev, f);
@@ -1194,17 +1193,16 @@ static void ac97_save (QEMUFile *f, void *opaque)
}
qemu_put_buffer (f, s->mixer_data, sizeof (s->mixer_data));
- active[PI_INDEX] = AUD_is_active_in (s->voice_pi) ? 1 : 0;
- active[PO_INDEX] = AUD_is_active_out (s->voice_po) ? 1 : 0;
- active[MC_INDEX] = AUD_is_active_in (s->voice_mc) ? 1 : 0;
- qemu_put_buffer (f, active, sizeof (active));
+ s->active[PI_INDEX] = AUD_is_active_in (s->voice_pi) ? 1 : 0;
+ s->active[PO_INDEX] = AUD_is_active_out (s->voice_po) ? 1 : 0;
+ s->active[MC_INDEX] = AUD_is_active_in (s->voice_mc) ? 1 : 0;
+ qemu_put_buffer (f, s->active, sizeof (s->active));
}
static int ac97_load (QEMUFile *f, void *opaque, int version_id)
{
int ret;
size_t i;
- uint8_t active[LAST_INDEX];
AC97LinkState *s = opaque;
if (version_id != 2)
@@ -1232,7 +1230,7 @@ static int ac97_load (QEMUFile *f, void *opaque, int
version_id)
qemu_get_be32s (f, &r->bd.ctl_len);
}
qemu_get_buffer (f, s->mixer_data, sizeof (s->mixer_data));
- qemu_get_buffer (f, active, sizeof (active));
+ qemu_get_buffer (f, s->active, sizeof (s->active));
#ifdef USE_MIXER
record_select (s, mixer_load (s, AC97_Record_Select));
@@ -1242,7 +1240,7 @@ static int ac97_load (QEMUFile *f, void *opaque, int
version_id)
V_ (AC97_Line_In_Volume_Mute, AUD_MIXER_LINE_IN);
#undef V_
#endif
- reset_voices (s, active);
+ reset_voices (s);
s->bup_flag = 0;
s->last_samp = 0;
--
1.6.2.5
- [Qemu-devel] [PATCH 16/49] vmstate: port ssd0303 device, (continued)
- [Qemu-devel] [PATCH 16/49] vmstate: port ssd0303 device, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 18/49] tmp105: change len and alorm to uint8_t, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 19/49] vmstate: port tmp105 device, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 20/49] twl92230: change pwrbtn_state to uint8_t, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 21/49] vmstate: port twl92230 device, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 24/49] vmstate: port lm832x device, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 22/49] vmstate: add support for arrays of pointers, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 23/49] lm832x: make fields to have the same types that they are saved/loaded, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 25/49] vmstate: remove i2c_slave_load/save, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 26/49] vmstate: port audio/audio.c, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 27/49] ac97: add active to the state,
Juan Quintela <=
- Re: [Qemu-devel] [PATCH 27/49] ac97: add active to the state, malc, 2009/09/30
- [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, Juan Quintela, 2009/09/30
- [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, malc, 2009/09/30
- [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, Juan Quintela, 2009/09/30
- [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, malc, 2009/09/30
- [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, Juan Quintela, 2009/09/30
- [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, malc, 2009/09/30
- [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, Juan Quintela, 2009/09/30
- [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, malc, 2009/09/30
- [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, Juan Quintela, 2009/09/30