alpha: convert "naked" qemu_log to tracepoint
[qemu/ar7.git] / hw / audio / intel-hda.h
blobd784bcf5fc9f3e22e49fc9b11228722665cd0c39
1 #ifndef HW_INTEL_HDA_H
2 #define HW_INTEL_HDA_H
4 #include "hw/qdev.h"
6 /* --------------------------------------------------------------------- */
7 /* hda bus */
9 #define TYPE_HDA_CODEC_DEVICE "hda-codec"
10 #define HDA_CODEC_DEVICE(obj) \
11 OBJECT_CHECK(HDACodecDevice, (obj), TYPE_HDA_CODEC_DEVICE)
12 #define HDA_CODEC_DEVICE_CLASS(klass) \
13 OBJECT_CLASS_CHECK(HDACodecDeviceClass, (klass), TYPE_HDA_CODEC_DEVICE)
14 #define HDA_CODEC_DEVICE_GET_CLASS(obj) \
15 OBJECT_GET_CLASS(HDACodecDeviceClass, (obj), TYPE_HDA_CODEC_DEVICE)
17 #define TYPE_HDA_BUS "HDA"
18 #define HDA_BUS(obj) OBJECT_CHECK(HDACodecBus, (obj), TYPE_HDA_BUS)
20 typedef struct HDACodecBus HDACodecBus;
21 typedef struct HDACodecDevice HDACodecDevice;
23 typedef void (*hda_codec_response_func)(HDACodecDevice *dev,
24 bool solicited, uint32_t response);
25 typedef bool (*hda_codec_xfer_func)(HDACodecDevice *dev,
26 uint32_t stnr, bool output,
27 uint8_t *buf, uint32_t len);
29 struct HDACodecBus {
30 BusState qbus;
31 uint32_t next_cad;
32 hda_codec_response_func response;
33 hda_codec_xfer_func xfer;
36 typedef struct HDACodecDeviceClass
38 DeviceClass parent_class;
40 int (*init)(HDACodecDevice *dev);
41 int (*exit)(HDACodecDevice *dev);
42 void (*command)(HDACodecDevice *dev, uint32_t nid, uint32_t data);
43 void (*stream)(HDACodecDevice *dev, uint32_t stnr, bool running, bool output);
44 } HDACodecDeviceClass;
46 struct HDACodecDevice {
47 DeviceState qdev;
48 uint32_t cad; /* codec address */
51 void hda_codec_bus_init(DeviceState *dev, HDACodecBus *bus, size_t bus_size,
52 hda_codec_response_func response,
53 hda_codec_xfer_func xfer);
54 HDACodecDevice *hda_codec_find(HDACodecBus *bus, uint32_t cad);
56 void hda_codec_response(HDACodecDevice *dev, bool solicited, uint32_t response);
57 bool hda_codec_xfer(HDACodecDevice *dev, uint32_t stnr, bool output,
58 uint8_t *buf, uint32_t len);
60 /* --------------------------------------------------------------------- */
62 #define dprint(_dev, _level, _fmt, ...) \
63 do { \
64 if (_dev->debug >= _level) { \
65 fprintf(stderr, "%s: ", _dev->name); \
66 fprintf(stderr, _fmt, ## __VA_ARGS__); \
67 } \
68 } while (0)
70 /* --------------------------------------------------------------------- */
72 #endif