]> git.proxmox.com Git - qemu.git/blame - hw/intel-hda.h
target-mips: Remove unused inline function
[qemu.git] / hw / intel-hda.h
CommitLineData
d61a4ce8
GH
1#ifndef HW_INTEL_HDA_H
2#define HW_INTEL_HDA_H
3
4#include "qdev.h"
5
6/* --------------------------------------------------------------------- */
7/* hda bus */
8
dbaa7904
AL
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
d61a4ce8
GH
17typedef struct HDACodecBus HDACodecBus;
18typedef struct HDACodecDevice HDACodecDevice;
d61a4ce8
GH
19
20typedef void (*hda_codec_response_func)(HDACodecDevice *dev,
21 bool solicited, uint32_t response);
22typedef bool (*hda_codec_xfer_func)(HDACodecDevice *dev,
23 uint32_t stnr, bool output,
24 uint8_t *buf, uint32_t len);
25
26struct HDACodecBus {
27 BusState qbus;
28 uint32_t next_cad;
29 hda_codec_response_func response;
30 hda_codec_xfer_func xfer;
31};
32
dbaa7904
AL
33typedef struct HDACodecDeviceClass
34{
35 DeviceClass parent_class;
d61a4ce8 36
d61a4ce8 37 int (*init)(HDACodecDevice *dev);
dc4b9240 38 int (*exit)(HDACodecDevice *dev);
d61a4ce8 39 void (*command)(HDACodecDevice *dev, uint32_t nid, uint32_t data);
ba43d289 40 void (*stream)(HDACodecDevice *dev, uint32_t stnr, bool running, bool output);
dbaa7904
AL
41} HDACodecDeviceClass;
42
43struct HDACodecDevice {
44 DeviceState qdev;
45 uint32_t cad; /* codec address */
d61a4ce8
GH
46};
47
48void hda_codec_bus_init(DeviceState *dev, HDACodecBus *bus,
49 hda_codec_response_func response,
50 hda_codec_xfer_func xfer);
d61a4ce8
GH
51HDACodecDevice *hda_codec_find(HDACodecBus *bus, uint32_t cad);
52
53void hda_codec_response(HDACodecDevice *dev, bool solicited, uint32_t response);
54bool 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