qemu/hw/intel-hda.h
<<
>>
Prefs
   1#ifndef HW_INTEL_HDA_H
   2#define HW_INTEL_HDA_H
   3
   4#include "qdev.h"
   5
   6/* --------------------------------------------------------------------- */
   7/* hda bus                                                               */
   8
   9typedef struct HDACodecBus HDACodecBus;
  10typedef struct HDACodecDevice HDACodecDevice;
  11typedef struct HDACodecDeviceInfo HDACodecDeviceInfo;
  12
  13typedef void (*hda_codec_response_func)(HDACodecDevice *dev,
  14                                        bool solicited, uint32_t response);
  15typedef bool (*hda_codec_xfer_func)(HDACodecDevice *dev,
  16                                    uint32_t stnr, bool output,
  17                                    uint8_t *buf, uint32_t len);
  18
  19struct HDACodecBus {
  20    BusState qbus;
  21    uint32_t next_cad;
  22    hda_codec_response_func response;
  23    hda_codec_xfer_func xfer;
  24};
  25
  26struct HDACodecDevice {
  27    DeviceState         qdev;
  28    HDACodecDeviceInfo  *info;
  29    uint32_t            cad;    /* codec address */
  30};
  31
  32struct HDACodecDeviceInfo {
  33    DeviceInfo qdev;
  34    int (*init)(HDACodecDevice *dev);
  35    int (*exit)(HDACodecDevice *dev);
  36    void (*command)(HDACodecDevice *dev, uint32_t nid, uint32_t data);
  37    void (*stream)(HDACodecDevice *dev, uint32_t stnr, bool running);
  38};
  39
  40void hda_codec_bus_init(DeviceState *dev, HDACodecBus *bus,
  41                        hda_codec_response_func response,
  42                        hda_codec_xfer_func xfer);
  43void hda_codec_register(HDACodecDeviceInfo *info);
  44HDACodecDevice *hda_codec_find(HDACodecBus *bus, uint32_t cad);
  45
  46void hda_codec_response(HDACodecDevice *dev, bool solicited, uint32_t response);
  47bool hda_codec_xfer(HDACodecDevice *dev, uint32_t stnr, bool output,
  48                    uint8_t *buf, uint32_t len);
  49
  50/* --------------------------------------------------------------------- */
  51
  52#define dprint(_dev, _level, _fmt, ...)                                 \
  53    do {                                                                \
  54        if (_dev->debug >= _level) {                                    \
  55            fprintf(stderr, "%s: ", _dev->name);                        \
  56            fprintf(stderr, _fmt, ## __VA_ARGS__);                      \
  57        }                                                               \
  58    } while (0)
  59
  60/* --------------------------------------------------------------------- */
  61
  62#endif
  63