|
XenevaOS
|
#include <aurora.h>#include <Drivers/uart.h>#include <aucon.h>#include <stdint.h>#include <pcie.h>#include <Hal/AA64/aa64lowlevel.h>#include <Mm/vmmngr.h>#include <audrv.h>#include <Drivers/virtio.h>#include <Mm/pmmngr.h>#include <Hal/AA64/gic.h>#include <string.h>#include <_null.h>#include <Sound/sound.h>#include <Mm/kmalloc.h>
Classes | |
| struct | virtio_snd_config |
| struct | virtio_snd_hdr |
| struct | virtio_snd_info |
| struct | _virtio_snd_query_info_ |
| struct | virtio_snd_event |
| struct | virtio_snd_jack_info |
| struct | virtio_snd_pcm_hdr |
| struct | virtio_snd_pcm_info |
| struct | virtio_snd_pcm_set_params |
| struct | _snd_xfer_ |
| struct | virtio_snd_pcm_status |
Macros | |
| #define | VIRTIO_F_VERSION_1 (1ull << 32) |
| #define | VIRTIO_PCI_CAP_ID 0x09 |
| #define | VIRTIO_PCI_CAP_COMMON_CFG 1 |
| #define | VIRTIO_PCI_CAP_DEVICE_CFG 4 |
| #define | VIRTQ_DESC_F_NEXT 1 |
| #define | VIRTQ_DESC_F_WRITE 2 |
| #define | VIRTIO_PCM_BUFFER_MAXSZ 0x1000 |
Typedefs | |
| typedef struct _virtio_snd_query_info_ | virtio_snd_query_info |
| typedef struct _snd_xfer_ | virtio_snd_pcm_xfer |
Functions | |
| AU_EXTERN AU_EXPORT int | AuDriverUnload () |
| void | snd_notify_queue (VirtioCommonCfg *cfg, uint16_t queueIdx) |
| snd_notify_queue – notify host that new command is present | |
| virtio_snd_pcm_info * | snd_query_pcm_info (VirtioCommonCfg *cfg) |
| snd_query_pcm_info – query pcm information like number of jacks, chmaps, etc | |
| void | virtio_snd_interrupt (int spi_id) |
| virtio_snd_interrupt – virtio-snd interrupt handler | |
| int | virtio_snd_write (uint8_t *buffer, size_t len) |
| virtio_snd_write – sound write pcm data to card | |
| int | virtio_snd_read (uint8_t *buffer, size_t len) |
| virtio_snd_read – read pcm data from sound | |
| int | virtio_snd_output_stop () |
| virtio_snd_stop – stop output stream | |
| int | virtio_snd_output_start () |
| virtio_snd_output_start – start output stream | |
| int | virtio_snd_set_vol (uint8_t vol) |
| virtio_snd_set_vol – set volume of output stream | |
| AU_EXTERN AU_EXPORT int | AuDriverMain (AuDriver *drv) |
Variables | |
| volatile uint8_t * | notifyBase |
| #define VIRTIO_F_VERSION_1 (1ull << 32) |
BSD 2-Clause License
Copyright (c) 2022-2026, Manas Kamal Choudhury All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| #define VIRTIO_PCI_CAP_COMMON_CFG 1 |
| #define VIRTIO_PCI_CAP_DEVICE_CFG 4 |
| #define VIRTIO_PCI_CAP_ID 0x09 |
| #define VIRTIO_PCM_BUFFER_MAXSZ 0x1000 |
| #define VIRTQ_DESC_F_NEXT 1 |
| #define VIRTQ_DESC_F_WRITE 2 |
| typedef struct _snd_xfer_ virtio_snd_pcm_xfer |
| typedef struct _virtio_snd_query_info_ virtio_snd_query_info |
| anonymous enum |
| anonymous enum |
| anonymous enum |
| anonymous enum |
change the class/subclass value
reset the device
allocate controlq
allocate eventq
allocate txq
TODO: input rxq for input
set params for the output stream
prepare the output stream too
start the output stream
no interrupt based sound playback, hardware need to be forced to send pcm through command
| void snd_notify_queue | ( | VirtioCommonCfg * | cfg, |
| uint16_t | queueIdx | ||
| ) |
snd_notify_queue – notify host that new command is present
| queueIdx | – queue number, zero for controlq and one for cursorq |
| virtio_snd_pcm_info * snd_query_pcm_info | ( | VirtioCommonCfg * | cfg | ) |
snd_query_pcm_info – query pcm information like number of jacks, chmaps, etc
| cfg | – pointer to virtio common config |
| void virtio_snd_interrupt | ( | int | spi_id | ) |
virtio_snd_interrupt – virtio-snd interrupt handler
| int virtio_snd_output_start | ( | ) |
virtio_snd_output_start – start output stream
| int virtio_snd_output_stop | ( | ) |
virtio_snd_stop – stop output stream
virtio_snd_read – read pcm data from sound
| buffer | – buffer where to copy input pcm data |
| len | – length to copy |
input capability not implemented yet
| int virtio_snd_set_vol | ( | uint8_t | vol | ) |
virtio_snd_set_vol – set volume of output stream
| vol | – volume in steps |
virtio_snd_write – sound write pcm data to card
| buffer | – buffer containing pcm data |
| len | – len of the pcm data |
| volatile uint8_t* notifyBase |
private definitions