|
XenevaOS
|
#include <Sound/sound.h>#include <Mm/kmalloc.h>#include <Fs/vfs.h>#include <Fs/Dev/devfs.h>#include <Cred/cred.h>#include <Cred/group.h>#include <aucon.h>#include <_null.h>#include <Drivers/uart.h>#include <Mm/vmmngr.h>#include <Mm/pmmngr.h>#include <string.h>
Classes | |
| struct | _sound_card_list |
Macros | |
| #define | AURORA_MAX_SOUND_CARDS 256 |
| #define | SOUND_REGISTER_SNDPLR 100 |
| #define | SOUND_START_OUTPUT 102 |
| #define | SOUND_STOP_OUTPUT 103 |
| #define | SOUND_START_INPUT 104 |
| #define | SOUND_STOP_INPUT 105 |
| #define | SOUND_SET_VOLUME 106 |
| #define | SOUND_GET_VOLUME 107 |
| #define | SOUND_MUTE_ENABLE 108 |
| #define | SOUND_MUTE_DISABLE 109 |
| #define | SOUND_READ_AVAIL 110 |
| #define | SOUND_UNREGISTER_SNDPLR 111 |
| #define | SOUND_REGISTER_CARD 112 |
| #define | SOUND_GET_CARD_LIST 113 |
| #define | SOUND_GET_CARD_TOTALNUM 114 |
| #define | SND_BUFF_SZ PAGE_SIZE |
Typedefs | |
| typedef struct _sound_card_list | aurora_snd_card_list |
Functions | |
| void | AuSoundAddDSP (AuDSP *dsp) |
| AuSoundAddDSP – adds a dsp to the dsp list. | |
| void | AuRemoveDSP (AuDSP *dsp) |
| AuRemoveDSP – removes a dsp from the dsp list. | |
| AuDSP * | AuSoundGetDSP (uint16_t id) |
| int | AuSoundIOControl (AuVFSNode *node, int code, void *arg) |
| AuSoundIOControl – io control for sound file. | |
| size_t | AuSoundRead (AuVFSNode *fsys, AuVFSNode *file, uint64_t *buffer, uint32_t length) |
| size_t | AuSoundWrite (AuVFSNode *fsys, AuVFSNode *file, uint64_t *buffer, uint32_t length) |
| void | AuSoundInitialise () |
| AuSoundInitialize – Initialized the Aurora sound system. | |
| void | AuSoundRemoveDSP (uint16_t id) |
| AuSoundRemoveDSP – remove the dsp from dsp list. | |
| int | AuSoundUnregisterCard (AuSound *snd) |
| AuSoundRegisterCard – register a new sound card to sound layer. | |
| int | AuSoundRegisterCard (AuSound *snd) |
| AuSoundRegisterCard – register a new sound card to sound layer. | |
Variables | |
| AuSound * | _cards [AURORA_MAX_SOUND_CARDS] |
| int | au_sound_last_id = -1 |
| au_sound_last_id – card index assigned by last AuSoundRegisterCard call | |
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 AURORA_MAX_SOUND_CARDS 256 |
| #define SND_BUFF_SZ PAGE_SIZE |
| #define SOUND_GET_CARD_LIST 113 |
| #define SOUND_GET_CARD_TOTALNUM 114 |
| #define SOUND_GET_VOLUME 107 |
| #define SOUND_MUTE_DISABLE 109 |
| #define SOUND_MUTE_ENABLE 108 |
| #define SOUND_READ_AVAIL 110 |
| #define SOUND_REGISTER_CARD 112 |
| #define SOUND_REGISTER_SNDPLR 100 |
| #define SOUND_SET_VOLUME 106 |
| #define SOUND_START_INPUT 104 |
| #define SOUND_START_OUTPUT 102 |
| #define SOUND_STOP_INPUT 105 |
| #define SOUND_STOP_OUTPUT 103 |
| #define SOUND_UNREGISTER_SNDPLR 111 |
| typedef struct _sound_card_list aurora_snd_card_list |
TODO: Support for controlling jack pins ADC/DAC add removal support
| void AuRemoveDSP | ( | AuDSP * | dsp | ) |
AuRemoveDSP – removes a dsp from the dsp list.
| dsp | – dsp to remove |
| void AuSoundAddDSP | ( | AuDSP * | dsp | ) |
AuSoundAddDSP – adds a dsp to the dsp list.
| dsp | – dsp to add |
| void AuSoundInitialise | ( | ) |
AuSoundInitialize – Initialized the Aurora sound system.
clear up the card data structure
| int AuSoundIOControl | ( | AuVFSNode * | node, |
| int | code, | ||
| void * | arg | ||
| ) |
AuSoundIOControl – io control for sound file.
NOT implemented yet
| int AuSoundRegisterCard | ( | AuSound * | snd | ) |
AuSoundRegisterCard – register a new sound card to sound layer.
| snd | – pointer to sound card |
| void AuSoundRemoveDSP | ( | uint16_t | id | ) |
AuSoundRemoveDSP – remove the dsp from dsp list.
| int AuSoundUnregisterCard | ( | AuSound * | snd | ) |
AuSoundRegisterCard – register a new sound card to sound layer.
AuSoundUnregisterCard – remove a sound card (hot-unplug); DSP clients bound to it are detached. Non-zero only if the card was not registered.
| snd | – pointer to sound card |
AuSoundUnregisterCard – remove a card from the registry (hot-unplug). DSP clients bound to the card are detached (_cardID = -1) rather than the removal being refused: a client such as init holds its binding for the whole uptime, so refusing would make a sound driver permanently un-unloadable. Detached clients fall back to the software buffer path and must re-select a card after the driver is loaded again. Every user of _cards[] already tolerates an empty slot. Returns 0, or non-zero if snd was not registered.
see if dps has card attached to it, also verify if the card is in force write mode
| AuSound* _cards[AURORA_MAX_SOUND_CARDS] |
| int au_sound_last_id = -1 |
au_sound_last_id – card index assigned by last AuSoundRegisterCard call