mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
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>
This commit is contained in:
parent
1c8eef0227
commit
db1015e92e
796 changed files with 3378 additions and 1823 deletions
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "intel-hda-defs.h"
|
||||
#include "audio/audio.h"
|
||||
#include "trace.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "intel-hda-defs.h"
|
||||
#include "sysemu/dma.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* hda bus */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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] = {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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[] = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue