1 /* 2 * VIRTIO Sound Device conforming to 3 * 4 * "Virtual I/O Device (VIRTIO) Version 1.2 5 * Committee Specification Draft 01 6 * 09 May 2022" 7 * 8 * Copyright (c) 2023 Emmanouil Pitsidianakis <manos.pitsidianakis@linaro.org> 9 * Copyright (C) 2019 OpenSynergy GmbH 10 * 11 * This work is licensed under the terms of the GNU GPL, version 2 or 12 * (at your option) any later version. See the COPYING file in the 13 * top-level directory. 14 */ 15 16 #ifndef QEMU_VIRTIO_SOUND_H 17 #define QEMU_VIRTIO_SOUND_H 18 19 #include "hw/virtio/virtio.h" 20 #include "audio/audio.h" 21 #include "standard-headers/linux/virtio_ids.h" 22 #include "standard-headers/linux/virtio_snd.h" 23 24 #define TYPE_VIRTIO_SND "virtio-sound-device" 25 #define VIRTIO_SND(obj) \ 26 OBJECT_CHECK(VirtIOSound, (obj), TYPE_VIRTIO_SND) 27 28 /* CONFIGURATION SPACE */ 29 30 typedef struct virtio_snd_config virtio_snd_config; 31 32 /* COMMON DEFINITIONS */ 33 34 /* common header for request/response*/ 35 typedef struct virtio_snd_hdr virtio_snd_hdr; 36 37 /* event notification */ 38 typedef struct virtio_snd_event virtio_snd_event; 39 40 /* common control request to query an item information */ 41 typedef struct virtio_snd_query_info virtio_snd_query_info; 42 43 /* JACK CONTROL MESSAGES */ 44 45 typedef struct virtio_snd_jack_hdr virtio_snd_jack_hdr; 46 47 /* jack information structure */ 48 typedef struct virtio_snd_jack_info virtio_snd_jack_info; 49 50 /* jack remapping control request */ 51 typedef struct virtio_snd_jack_remap virtio_snd_jack_remap; 52 53 /* 54 * PCM CONTROL MESSAGES 55 */ 56 typedef struct virtio_snd_pcm_hdr virtio_snd_pcm_hdr; 57 58 /* PCM stream info structure */ 59 typedef struct virtio_snd_pcm_info virtio_snd_pcm_info; 60 61 /* set PCM stream params */ 62 typedef struct virtio_snd_pcm_set_params virtio_snd_pcm_set_params; 63 64 /* I/O request header */ 65 typedef struct virtio_snd_pcm_xfer virtio_snd_pcm_xfer; 66 67 /* I/O request status */ 68 typedef struct virtio_snd_pcm_status virtio_snd_pcm_status; 69 70 typedef struct VirtIOSound { 71 VirtIODevice parent_obj; 72 73 VirtQueue *queues[VIRTIO_SND_VQ_MAX]; 74 uint64_t features; 75 QEMUSoundCard card; 76 VMChangeStateEntry *vmstate; 77 virtio_snd_config snd_conf; 78 } VirtIOSound; 79 #endif 80