[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 05/25] virtio-snd: Add device implementation structures
From: |
Shreyansh Chouhan |
Subject: |
[RFC PATCH 05/25] virtio-snd: Add device implementation structures |
Date: |
Sat, 12 Feb 2022 03:42:59 +0530 |
Added jacks, pcm streams and the VirtIOSound structure for actual
device implementation.
Signed-off-by: Shreyansh Chouhan <chouhan.shreyansh2702@gmail.com>
---
include/hw/virtio/virtio-snd.h | 66 ++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/include/hw/virtio/virtio-snd.h b/include/hw/virtio/virtio-snd.h
index 3c16609a25..4d800a9626 100644
--- a/include/hw/virtio/virtio-snd.h
+++ b/include/hw/virtio/virtio-snd.h
@@ -13,6 +13,9 @@
#define VIRTIO_ID_SOUND 25
+#define TYPE_VIRTIO_SOUND "virtio-sound-device"
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOSound, VIRTIO_SOUND)
+
/* CONFIGURATION SPACE */
typedef struct virtio_snd_config {
@@ -314,4 +317,67 @@ typedef struct virtio_snd_chmap_info {
uint8_t positions[VIRTIO_SND_CHMAP_MAX_SIZE];
} virtio_snd_chmap_info;
+/* VIRTIO SOUND DEVICE */
+
+/* Jacks */
+typedef struct virtio_snd_jack {
+ uint32_t features; /* 1 << VIRTIO_SND_JACK_F_XXX */
+ uint32_t hda_fn_nid;
+ uint32_t hda_reg_defconf;
+ uint32_t hda_reg_caps;
+ uint8_t connected;
+} virtio_snd_jack;
+
+/* Streams */
+typedef struct virtio_snd_pcm_stream {
+ uint32_t hda_fn_nid;
+ uint32_t buffer_bytes;
+ uint32_t period_bytes;
+ uint32_t features; /* 1 << VIRTIO_SND_PCM_F_XXX */
+ uint32_t flags; /* 1 << VIRTIO_SND_PCM_FL_XXX */
+ uint32_t direction;
+ uint8_t channels_min;
+ uint8_t channels_max;
+ uint64_t formats; /* 1 << VIRTIO_SND_PCM_FMT_XXX */
+ uint64_t rates; /* 1 << VIRTIO_SND_PCM_RATE_XXX */
+ uint32_t r_pos, w_pos;
+ bool flushing;
+ uint8_t chmap[VIRTIO_SND_CHMAP_MAX_SIZE];
+ VirtQueueElement **elems;
+ VirtIOSound *s;
+ union {
+ SWVoiceIn *in;
+ SWVoiceOut *out;
+ } voice;
+} virtio_snd_pcm_stream;
+
+/* Stream params */
+typedef struct virtio_snd_pcm_params {
+ uint32_t features;
+ uint32_t buffer_bytes; /* size of hardware buffer in bytes */
+ uint32_t period_bytes; /* size of hardware period in bytes */
+ uint8_t channel;
+ uint8_t format;
+ uint8_t rate;
+} virtio_snd_pcm_params;
+
+/* Sound device */
+struct VirtIOSound {
+ /* Parent VirtIODevice object */
+ VirtIODevice parent_obj;
+ virtio_snd_config snd_conf;
+
+ VirtQueue *ctrl_vq;
+ VirtQueue *event_vq;
+ VirtQueue *tx_vq;
+ VirtQueue *rx_vq;
+
+ QEMUSoundCard card;
+ size_t config_size;
+
+ virtio_snd_pcm_params **pcm_params;
+ virtio_snd_pcm_stream **streams;
+ virtio_snd_jack **jacks;
+};
+
#endif
--
2.31.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [RFC PATCH 05/25] virtio-snd: Add device implementation structures,
Shreyansh Chouhan <=