]> git.ipfire.org Git - thirdparty/qemu.git/blame - hw/audio/intel-hda.h
Move QOM typedefs and add missing includes
[thirdparty/qemu.git] / hw / audio / intel-hda.h
CommitLineData
d61a4ce8
GH
1#ifndef HW_INTEL_HDA_H
2#define HW_INTEL_HDA_H
3
a27bd6c7 4#include "hw/qdev-core.h"
db1015e9 5#include "qom/object.h"
d61a4ce8
GH
6
7/* --------------------------------------------------------------------- */
8/* hda bus */
9
dbaa7904 10#define TYPE_HDA_CODEC_DEVICE "hda-codec"
db1015e9
EH
11typedef struct HDACodecDevice HDACodecDevice;
12typedef struct HDACodecDeviceClass HDACodecDeviceClass;
dbaa7904
AL
13#define HDA_CODEC_DEVICE(obj) \
14 OBJECT_CHECK(HDACodecDevice, (obj), TYPE_HDA_CODEC_DEVICE)
15#define HDA_CODEC_DEVICE_CLASS(klass) \
16 OBJECT_CLASS_CHECK(HDACodecDeviceClass, (klass), TYPE_HDA_CODEC_DEVICE)
17#define HDA_CODEC_DEVICE_GET_CLASS(obj) \
18 OBJECT_GET_CLASS(HDACodecDeviceClass, (obj), TYPE_HDA_CODEC_DEVICE)
19
0d936928 20#define TYPE_HDA_BUS "HDA"
db1015e9 21typedef struct HDACodecBus HDACodecBus;
0d936928
AL
22#define HDA_BUS(obj) OBJECT_CHECK(HDACodecBus, (obj), TYPE_HDA_BUS)
23
d61a4ce8
GH
24
25typedef void (*hda_codec_response_func)(HDACodecDevice *dev,
26 bool solicited, uint32_t response);
27typedef bool (*hda_codec_xfer_func)(HDACodecDevice *dev,
28 uint32_t stnr, bool output,
29 uint8_t *buf, uint32_t len);
30
31struct HDACodecBus {
32 BusState qbus;
33 uint32_t next_cad;
34 hda_codec_response_func response;
35 hda_codec_xfer_func xfer;
36};
37
db1015e9 38struct HDACodecDeviceClass {
dbaa7904 39 DeviceClass parent_class;
d61a4ce8 40
d61a4ce8 41 int (*init)(HDACodecDevice *dev);
5eaa8e1e 42 void (*exit)(HDACodecDevice *dev);
d61a4ce8 43 void (*command)(HDACodecDevice *dev, uint32_t nid, uint32_t data);
ba43d289 44 void (*stream)(HDACodecDevice *dev, uint32_t stnr, bool running, bool output);
db1015e9 45};
dbaa7904
AL
46
47struct HDACodecDevice {
48 DeviceState qdev;
49 uint32_t cad; /* codec address */
d61a4ce8
GH
50};
51
ab809e84 52void hda_codec_bus_init(DeviceState *dev, HDACodecBus *bus, size_t bus_size,
d61a4ce8
GH
53 hda_codec_response_func response,
54 hda_codec_xfer_func xfer);
d61a4ce8
GH
55HDACodecDevice *hda_codec_find(HDACodecBus *bus, uint32_t cad);
56
57void hda_codec_response(HDACodecDevice *dev, bool solicited, uint32_t response);
58bool hda_codec_xfer(HDACodecDevice *dev, uint32_t stnr, bool output,
59 uint8_t *buf, uint32_t len);
60
61/* --------------------------------------------------------------------- */
62
63#define dprint(_dev, _level, _fmt, ...) \
64 do { \
65 if (_dev->debug >= _level) { \
66 fprintf(stderr, "%s: ", _dev->name); \
67 fprintf(stderr, _fmt, ## __VA_ARGS__); \
68 } \
69 } while (0)
70
71/* --------------------------------------------------------------------- */
72
73#endif