aboutsummaryrefslogtreecommitdiff
path: root/hw/audio
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2020-09-03 16:43:22 -0400
committerEduardo Habkost <ehabkost@redhat.com>2020-09-09 09:26:43 -0400
commitdb1015e92e04835c9eb50c29625fe566d1202dbd (patch)
tree41fbc0bf3e3f29b7ecb339224a049e3f2a7db8fa /hw/audio
parent1c8eef0227e2942264063f22f10a06b84e0d3fa9 (diff)
Move QOM typedefs and add missing includes
Some typedefs and macros are defined after the type check macros. This makes it difficult to automatically replace their definitions with OBJECT_DECLARE_TYPE. Patch generated using: $ ./scripts/codeconverter/converter.py -i \ --pattern=QOMStructTypedefSplit $(git grep -l '' -- '*.[ch]') which will split "typdef struct { ... } TypedefName" declarations. Followed by: $ ./scripts/codeconverter/converter.py -i --pattern=MoveSymbols \ $(git grep -l '' -- '*.[ch]') which will: - move the typedefs and #defines above the type check macros - add missing #include "qom/object.h" lines if necessary Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <20200831210740.126168-9-ehabkost@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <20200831210740.126168-10-ehabkost@redhat.com> Message-Id: <20200831210740.126168-11-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'hw/audio')
-rw-r--r--hw/audio/ac97.c6
-rw-r--r--hw/audio/adlib.c6
-rw-r--r--hw/audio/cs4231.c6
-rw-r--r--hw/audio/cs4231a.c6
-rw-r--r--hw/audio/es1370.c6
-rw-r--r--hw/audio/gus.c6
-rw-r--r--hw/audio/hda-codec.c1
-rw-r--r--hw/audio/intel-hda.c1
-rw-r--r--hw/audio/intel-hda.h11
-rw-r--r--hw/audio/marvell_88w8618.c6
-rw-r--r--hw/audio/milkymist-ac97.c3
-rw-r--r--hw/audio/pcspk.c6
-rw-r--r--hw/audio/pl041.c6
-rw-r--r--hw/audio/sb16.c6
-rw-r--r--hw/audio/wm8750.c6
15 files changed, 54 insertions, 28 deletions
diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c
index 38522cf0ba..9614419b7a 100644
--- a/hw/audio/ac97.c
+++ b/hw/audio/ac97.c
@@ -25,6 +25,7 @@
#include "migration/vmstate.h"
#include "qemu/module.h"
#include "sysemu/dma.h"
+#include "qom/object.h"
enum {
AC97_Reset = 0x00,
@@ -126,6 +127,7 @@ enum {
#define MUTE_SHIFT 15
#define TYPE_AC97 "AC97"
+typedef struct AC97LinkState AC97LinkState;
#define AC97(obj) \
OBJECT_CHECK(AC97LinkState, (obj), TYPE_AC97)
@@ -158,7 +160,7 @@ typedef struct AC97BusMasterRegs {
BD bd;
} AC97BusMasterRegs;
-typedef struct AC97LinkState {
+struct AC97LinkState {
PCIDevice dev;
QEMUSoundCard card;
uint32_t glob_cnt;
@@ -175,7 +177,7 @@ typedef struct AC97LinkState {
int bup_flag;
MemoryRegion io_nam;
MemoryRegion io_nabm;
-} AC97LinkState;
+};
enum {
BUP_SET = 1,
diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c
index 65dff5b6fc..a216fe1925 100644
--- a/hw/audio/adlib.c
+++ b/hw/audio/adlib.c
@@ -29,6 +29,7 @@
#include "audio/audio.h"
#include "hw/isa/isa.h"
#include "hw/qdev-properties.h"
+#include "qom/object.h"
//#define DEBUG
@@ -51,9 +52,10 @@
#define SHIFT 1
#define TYPE_ADLIB "adlib"
+typedef struct AdlibState AdlibState;
#define ADLIB(obj) OBJECT_CHECK(AdlibState, (obj), TYPE_ADLIB)
-typedef struct {
+struct AdlibState {
ISADevice parent_obj;
QEMUSoundCard card;
@@ -73,7 +75,7 @@ typedef struct {
QEMUAudioTimeStamp ats;
FM_OPL *opl;
PortioList port_list;
-} AdlibState;
+};
static void adlib_stop_opl_timer (AdlibState *s, size_t n)
{
diff --git a/hw/audio/cs4231.c b/hw/audio/cs4231.c
index 11a6328fc2..2b868051c3 100644
--- a/hw/audio/cs4231.c
+++ b/hw/audio/cs4231.c
@@ -27,6 +27,7 @@
#include "migration/vmstate.h"
#include "qemu/module.h"
#include "trace.h"
+#include "qom/object.h"
/*
* In addition to Crystal CS4231 there is a DMA controller on Sparc.
@@ -37,17 +38,18 @@
#define CS_MAXDREG (CS_DREGS - 1)
#define TYPE_CS4231 "SUNW,CS4231"
+typedef struct CSState CSState;
#define CS4231(obj) \
OBJECT_CHECK(CSState, (obj), TYPE_CS4231)
-typedef struct CSState {
+struct CSState {
SysBusDevice parent_obj;
MemoryRegion iomem;
qemu_irq irq;
uint32_t regs[CS_REGS];
uint8_t dregs[CS_DREGS];
-} CSState;
+};
#define CS_RAP(s) ((s)->regs[0] & CS_MAXDREG)
#define CS_VER 0xa0
diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c
index 59705a8d47..fc064a93d7 100644
--- a/hw/audio/cs4231a.c
+++ b/hw/audio/cs4231a.c
@@ -32,6 +32,7 @@
#include "qemu/module.h"
#include "qemu/timer.h"
#include "qapi/error.h"
+#include "qom/object.h"
/*
Missing features:
@@ -62,9 +63,10 @@ static struct {
#define CS_DREGS 32
#define TYPE_CS4231A "cs4231a"
+typedef struct CSState CSState;
#define CS4231A(obj) OBJECT_CHECK (CSState, (obj), TYPE_CS4231A)
-typedef struct CSState {
+struct CSState {
ISADevice dev;
QEMUSoundCard card;
MemoryRegion ioports;
@@ -82,7 +84,7 @@ typedef struct CSState {
int aci_counter;
SWVoiceOut *voice;
int16_t *tab;
-} CSState;
+};
#define MODE2 (1 << 6)
#define MCE (1 << 6)
diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
index 4255463a49..bd620d5ee2 100644
--- a/hw/audio/es1370.c
+++ b/hw/audio/es1370.c
@@ -33,6 +33,7 @@
#include "migration/vmstate.h"
#include "qemu/module.h"
#include "sysemu/dma.h"
+#include "qom/object.h"
/* Missing stuff:
SCTRL_P[12](END|ST)INC
@@ -263,7 +264,7 @@ struct chan {
uint32_t frame_cnt;
};
-typedef struct ES1370State {
+struct ES1370State {
PCIDevice dev;
QEMUSoundCard card;
MemoryRegion io;
@@ -276,7 +277,8 @@ typedef struct ES1370State {
uint32_t mempage;
uint32_t codec;
uint32_t sctl;
-} ES1370State;
+};
+typedef struct ES1370State ES1370State;
struct chan_bits {
uint32_t ctl_en;
diff --git a/hw/audio/gus.c b/hw/audio/gus.c
index 7e4a8cadad..3cd62d43d7 100644
--- a/hw/audio/gus.c
+++ b/hw/audio/gus.c
@@ -33,6 +33,7 @@
#include "migration/vmstate.h"
#include "gusemu.h"
#include "gustate.h"
+#include "qom/object.h"
#define dolog(...) AUD_log ("audio", __VA_ARGS__)
#ifdef DEBUG
@@ -42,9 +43,10 @@
#endif
#define TYPE_GUS "gus"
+typedef struct GUSState GUSState;
#define GUS(obj) OBJECT_CHECK (GUSState, (obj), TYPE_GUS)
-typedef struct GUSState {
+struct GUSState {
ISADevice dev;
GUSEmuState emu;
QEMUSoundCard card;
@@ -60,7 +62,7 @@ typedef struct GUSState {
IsaDma *isa_dma;
PortioList portio_list1;
PortioList portio_list2;
-} GUSState;
+};
static uint32_t gus_readb(void *opaque, uint32_t nport)
{
diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
index 2d16448181..8dee2915be 100644
--- a/hw/audio/hda-codec.c
+++ b/hw/audio/hda-codec.c
@@ -26,6 +26,7 @@
#include "intel-hda-defs.h"
#include "audio/audio.h"
#include "trace.h"
+#include "qom/object.h"
/* -------------------------------------------------------------------------- */
diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
index f6cea49686..de30443c2e 100644
--- a/hw/audio/intel-hda.c
+++ b/hw/audio/intel-hda.c
@@ -32,6 +32,7 @@
#include "intel-hda-defs.h"
#include "sysemu/dma.h"
#include "qapi/error.h"
+#include "qom/object.h"
/* --------------------------------------------------------------------- */
/* hda bus */
diff --git a/hw/audio/intel-hda.h b/hw/audio/intel-hda.h
index eee6fee5af..44a2897fff 100644
--- a/hw/audio/intel-hda.h
+++ b/hw/audio/intel-hda.h
@@ -2,11 +2,14 @@
#define HW_INTEL_HDA_H
#include "hw/qdev-core.h"
+#include "qom/object.h"
/* --------------------------------------------------------------------- */
/* hda bus */
#define TYPE_HDA_CODEC_DEVICE "hda-codec"
+typedef struct HDACodecDevice HDACodecDevice;
+typedef struct HDACodecDeviceClass HDACodecDeviceClass;
#define HDA_CODEC_DEVICE(obj) \
OBJECT_CHECK(HDACodecDevice, (obj), TYPE_HDA_CODEC_DEVICE)
#define HDA_CODEC_DEVICE_CLASS(klass) \
@@ -15,10 +18,9 @@
OBJECT_GET_CLASS(HDACodecDeviceClass, (obj), TYPE_HDA_CODEC_DEVICE)
#define TYPE_HDA_BUS "HDA"
+typedef struct HDACodecBus HDACodecBus;
#define HDA_BUS(obj) OBJECT_CHECK(HDACodecBus, (obj), TYPE_HDA_BUS)
-typedef struct HDACodecBus HDACodecBus;
-typedef struct HDACodecDevice HDACodecDevice;
typedef void (*hda_codec_response_func)(HDACodecDevice *dev,
bool solicited, uint32_t response);
@@ -33,15 +35,14 @@ struct HDACodecBus {
hda_codec_xfer_func xfer;
};
-typedef struct HDACodecDeviceClass
-{
+struct HDACodecDeviceClass {
DeviceClass parent_class;
int (*init)(HDACodecDevice *dev);
void (*exit)(HDACodecDevice *dev);
void (*command)(HDACodecDevice *dev, uint32_t nid, uint32_t data);
void (*stream)(HDACodecDevice *dev, uint32_t stnr, bool running, bool output);
-} HDACodecDeviceClass;
+};
struct HDACodecDevice {
DeviceState qdev;
diff --git a/hw/audio/marvell_88w8618.c b/hw/audio/marvell_88w8618.c
index 8dfacec693..5f2e7f3b73 100644
--- a/hw/audio/marvell_88w8618.c
+++ b/hw/audio/marvell_88w8618.c
@@ -19,6 +19,7 @@
#include "audio/audio.h"
#include "qapi/error.h"
#include "qemu/module.h"
+#include "qom/object.h"
#define MP_AUDIO_SIZE 0x00001000
@@ -42,10 +43,11 @@
#define MP_AUDIO_CLOCK_24MHZ (1 << 9)
#define MP_AUDIO_MONO (1 << 14)
+typedef struct mv88w8618_audio_state mv88w8618_audio_state;
#define MV88W8618_AUDIO(obj) \
OBJECT_CHECK(mv88w8618_audio_state, (obj), TYPE_MV88W8618_AUDIO)
-typedef struct mv88w8618_audio_state {
+struct mv88w8618_audio_state {
SysBusDevice parent_obj;
MemoryRegion iomem;
@@ -60,7 +62,7 @@ typedef struct mv88w8618_audio_state {
uint32_t last_free;
uint32_t clock_div;
void *wm;
-} mv88w8618_audio_state;
+};
static void mv88w8618_audio_callback(void *opaque, int free_out, int free_in)
{
diff --git a/hw/audio/milkymist-ac97.c b/hw/audio/milkymist-ac97.c
index 0fa38adbe2..4eacd4071a 100644
--- a/hw/audio/milkymist-ac97.c
+++ b/hw/audio/milkymist-ac97.c
@@ -29,6 +29,7 @@
#include "audio/audio.h"
#include "qemu/error-report.h"
#include "qemu/module.h"
+#include "qom/object.h"
enum {
R_AC97_CTRL = 0,
@@ -55,6 +56,7 @@ enum {
};
#define TYPE_MILKYMIST_AC97 "milkymist-ac97"
+typedef struct MilkymistAC97State MilkymistAC97State;
#define MILKYMIST_AC97(obj) \
OBJECT_CHECK(MilkymistAC97State, (obj), TYPE_MILKYMIST_AC97)
@@ -74,7 +76,6 @@ struct MilkymistAC97State {
qemu_irq dmar_irq;
qemu_irq dmaw_irq;
};
-typedef struct MilkymistAC97State MilkymistAC97State;
static void update_voices(MilkymistAC97State *s)
{
diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c
index ea539e7605..57edbe652c 100644
--- a/hw/audio/pcspk.c
+++ b/hw/audio/pcspk.c
@@ -33,15 +33,17 @@
#include "migration/vmstate.h"
#include "hw/audio/pcspk.h"
#include "qapi/error.h"
+#include "qom/object.h"
#define PCSPK_BUF_LEN 1792
#define PCSPK_SAMPLE_RATE 32000
#define PCSPK_MAX_FREQ (PCSPK_SAMPLE_RATE >> 1)
#define PCSPK_MIN_COUNT DIV_ROUND_UP(PIT_FREQ, PCSPK_MAX_FREQ)
+typedef struct PCSpkState PCSpkState;
#define PC_SPEAKER(obj) OBJECT_CHECK(PCSpkState, (obj), TYPE_PC_SPEAKER)
-typedef struct {
+struct PCSpkState {
ISADevice parent_obj;
MemoryRegion ioport;
@@ -56,7 +58,7 @@ typedef struct {
uint8_t data_on;
uint8_t dummy_refresh_clock;
bool migrate;
-} PCSpkState;
+};
static const char *s_spk = "pcspk";
static PCSpkState *pcspk_state;
diff --git a/hw/audio/pl041.c b/hw/audio/pl041.c
index c3d3eab6ed..e514a8cd70 100644
--- a/hw/audio/pl041.c
+++ b/hw/audio/pl041.c
@@ -30,6 +30,7 @@
#include "pl041.h"
#include "lm4549.h"
#include "migration/vmstate.h"
+#include "qom/object.h"
#if 0
#define PL041_DEBUG_LEVEL 1
@@ -77,9 +78,10 @@ typedef struct {
} pl041_channel;
#define TYPE_PL041 "pl041"
+typedef struct PL041State PL041State;
#define PL041(obj) OBJECT_CHECK(PL041State, (obj), TYPE_PL041)
-typedef struct PL041State {
+struct PL041State {
SysBusDevice parent_obj;
MemoryRegion iomem;
@@ -90,7 +92,7 @@ typedef struct PL041State {
pl041_regfile regs;
pl041_channel fifo1;
lm4549_state codec;
-} PL041State;
+};
static const unsigned char pl041_default_id[8] = {
diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c
index 2d9e50f99b..840f743e41 100644
--- a/hw/audio/sb16.c
+++ b/hw/audio/sb16.c
@@ -34,6 +34,7 @@
#include "qemu/log.h"
#include "qemu/module.h"
#include "qapi/error.h"
+#include "qom/object.h"
#define dolog(...) AUD_log ("sb16", __VA_ARGS__)
@@ -49,9 +50,10 @@
static const char e3[] = "COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992.";
#define TYPE_SB16 "sb16"
+typedef struct SB16State SB16State;
#define SB16(obj) OBJECT_CHECK (SB16State, (obj), TYPE_SB16)
-typedef struct SB16State {
+struct SB16State {
ISADevice parent_obj;
QEMUSoundCard card;
@@ -112,7 +114,7 @@ typedef struct SB16State {
int mixer_nreg;
uint8_t mixer_regs[256];
PortioList portio_list;
-} SB16State;
+};
static void SB_audio_callback (void *opaque, int free);
diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c
index 92b2902a10..dae23f43a4 100644
--- a/hw/audio/wm8750.c
+++ b/hw/audio/wm8750.c
@@ -13,6 +13,7 @@
#include "qemu/module.h"
#include "hw/audio/wm8750.h"
#include "audio/audio.h"
+#include "qom/object.h"
#define IN_PORT_N 3
#define OUT_PORT_N 3
@@ -26,9 +27,10 @@ typedef struct {
int dac_hz;
} WMRate;
+typedef struct WM8750State WM8750State;
#define WM8750(obj) OBJECT_CHECK(WM8750State, (obj), TYPE_WM8750)
-typedef struct WM8750State {
+struct WM8750State {
I2CSlave parent_obj;
uint8_t i2c_data[2];
@@ -54,7 +56,7 @@ typedef struct WM8750State {
const WMRate *rate;
uint8_t rate_vmstate;
int adc_hz, dac_hz, ext_adc_hz, ext_dac_hz, master;
-} WM8750State;
+};
/* pow(10.0, -i / 20.0) * 255, i = 0..42 */
static const uint8_t wm8750_vol_db_table[] = {