]> git.proxmox.com Git - qemu.git/blob - hw/intel-hda.h
PPC: Fix TLB invalidation bug within the PPC interrupt handler.
[qemu.git] / hw / intel-hda.h
1 #ifndef HW_INTEL_HDA_H
2 #define HW_INTEL_HDA_H
3
4 #include "qdev.h"
5
6 /* --------------------------------------------------------------------- */
7 /* hda bus */
8
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)
16
17 typedef struct HDACodecBus HDACodecBus;
18 typedef struct HDACodecDevice HDACodecDevice;
19
20 typedef void (*hda_codec_response_func)(HDACodecDevice *dev,
21 bool solicited, uint32_t response);
22 typedef bool (*hda_codec_xfer_func)(HDACodecDevice *dev,
23 uint32_t stnr, bool output,
24 uint8_t *buf, uint32_t len);
25
26 struct HDACodecBus {
27 BusState qbus;
28 uint32_t next_cad;
29 hda_codec_response_func response;
30 hda_codec_xfer_func xfer;
31 };
32
33 typedef struct HDACodecDeviceClass
34 {
35 DeviceClass parent_class;
36
37 int (*init)(HDACodecDevice *dev);
38 int (*exit)(HDACodecDevice *dev);
39 void (*command)(HDACodecDevice *dev, uint32_t nid, uint32_t data);
40 void (*stream)(HDACodecDevice *dev, uint32_t stnr, bool running, bool output);
41 } HDACodecDeviceClass;
42
43 struct HDACodecDevice {
44 DeviceState qdev;
45 uint32_t cad; /* codec address */
46 };
47
48 void hda_codec_bus_init(DeviceState *dev, HDACodecBus *bus,
49 hda_codec_response_func response,
50 hda_codec_xfer_func xfer);
51 HDACodecDevice *hda_codec_find(HDACodecBus *bus, uint32_t cad);
52
53 void hda_codec_response(HDACodecDevice *dev, bool solicited, uint32_t response);
54 bool hda_codec_xfer(HDACodecDevice *dev, uint32_t stnr, bool output,
55 uint8_t *buf, uint32_t len);
56
57 /* --------------------------------------------------------------------- */
58
59 #define dprint(_dev, _level, _fmt, ...) \
60 do { \
61 if (_dev->debug >= _level) { \
62 fprintf(stderr, "%s: ", _dev->name); \
63 fprintf(stderr, _fmt, ## __VA_ARGS__); \
64 } \
65 } while (0)
66
67 /* --------------------------------------------------------------------- */
68
69 #endif