XenevaOS
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions | Variables
sndcore.c File Reference
#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>
Include dependency graph for sndcore.c:

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
 

Detailed Description

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:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

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.

Macro Definition Documentation

◆ AURORA_MAX_SOUND_CARDS

#define AURORA_MAX_SOUND_CARDS   256

◆ SND_BUFF_SZ

#define SND_BUFF_SZ   PAGE_SIZE

◆ SOUND_GET_CARD_LIST

#define SOUND_GET_CARD_LIST   113

◆ SOUND_GET_CARD_TOTALNUM

#define SOUND_GET_CARD_TOTALNUM   114

◆ SOUND_GET_VOLUME

#define SOUND_GET_VOLUME   107

◆ SOUND_MUTE_DISABLE

#define SOUND_MUTE_DISABLE   109

◆ SOUND_MUTE_ENABLE

#define SOUND_MUTE_ENABLE   108

◆ SOUND_READ_AVAIL

#define SOUND_READ_AVAIL   110

◆ SOUND_REGISTER_CARD

#define SOUND_REGISTER_CARD   112

◆ SOUND_REGISTER_SNDPLR

#define SOUND_REGISTER_SNDPLR   100

◆ SOUND_SET_VOLUME

#define SOUND_SET_VOLUME   106

◆ SOUND_START_INPUT

#define SOUND_START_INPUT   104

◆ SOUND_START_OUTPUT

#define SOUND_START_OUTPUT   102

◆ SOUND_STOP_INPUT

#define SOUND_STOP_INPUT   105

◆ SOUND_STOP_OUTPUT

#define SOUND_STOP_OUTPUT   103

◆ SOUND_UNREGISTER_SNDPLR

#define SOUND_UNREGISTER_SNDPLR   111

Typedef Documentation

◆ aurora_snd_card_list

TODO: Support for controlling jack pins ADC/DAC add removal support

Function Documentation

◆ AuRemoveDSP()

void AuRemoveDSP ( AuDSP *  dsp)

AuRemoveDSP – removes a dsp from the dsp list.

Parameters
dsp– dsp to remove

◆ AuSoundAddDSP()

void AuSoundAddDSP ( AuDSP *  dsp)

AuSoundAddDSP – adds a dsp to the dsp list.

Parameters
dsp– dsp to add

◆ AuSoundGetDSP()

AuDSP * AuSoundGetDSP ( uint16_t  id)

◆ AuSoundInitialise()

void AuSoundInitialise ( )

AuSoundInitialize – Initialized the Aurora sound system.

clear up the card data structure

◆ AuSoundIOControl()

int AuSoundIOControl ( AuVFSNode *  node,
int  code,
void *  arg 
)

AuSoundIOControl – io control for sound file.

◆ AuSoundRead()

size_t AuSoundRead ( AuVFSNode *  fsys,
AuVFSNode *  file,
uint64_t *  buffer,
uint32_t  length 
)

NOT implemented yet

◆ AuSoundRegisterCard()

int AuSoundRegisterCard ( AuSound *  snd)

AuSoundRegisterCard – register a new sound card to sound layer.

Parameters
snd– pointer to sound card

◆ AuSoundRemoveDSP()

void AuSoundRemoveDSP ( uint16_t  id)

AuSoundRemoveDSP – remove the dsp from dsp list.

◆ AuSoundUnregisterCard()

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.

Parameters
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.

◆ AuSoundWrite()

size_t AuSoundWrite ( AuVFSNode *  fsys,
AuVFSNode *  file,
uint64_t *  buffer,
uint32_t  length 
)

see if dps has card attached to it, also verify if the card is in force write mode

Variable Documentation

◆ _cards

◆ au_sound_last_id

int au_sound_last_id = -1

au_sound_last_id – card index assigned by last AuSoundRegisterCard call