forked from PAWPAW-Mirror/lib_xua
- Added AudioHwConfig_Mute() and AudioHwConfig_UnMute()
- Added default (empty) implementations of AudioHW.. functions
This commit is contained in:
@@ -63,16 +63,32 @@ void XUA_AudioHub(chanend ?c_aud,
|
|||||||
|
|
||||||
void SpdifTxWrapper(chanend c_spdif_tx);
|
void SpdifTxWrapper(chanend c_spdif_tx);
|
||||||
|
|
||||||
/* These functions must be implemented for the CODEC/ADC/DAC arrangement of a specific design */
|
/* The 4 functions below should implemented for the external audio haardware arrangement of a specific design.
|
||||||
|
* Note, default (empty) implementations of these are provided in audiohub_user.c
|
||||||
|
*/
|
||||||
|
|
||||||
/* Any required clocking and CODEC initialisation - run once at start up */
|
/** User code for any required audio hardwarte initialisation - run once at start up */
|
||||||
/* TODO Provide default implementation of this */
|
void AudioHwInit(void);
|
||||||
void AudioHwInit();
|
|
||||||
|
|
||||||
/* Configure audio hardware (clocking, CODECs etc) for a specific mClk/Sample frquency - run on every sample frequency change */
|
/** User code to mute audio hardware before a sample rate change - run every sample frequency change */
|
||||||
/* TODO Provide default implementation of this */
|
void AudioHwConfig_Mute(void);
|
||||||
void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode,
|
|
||||||
unsigned sampRes_DAC, unsigned sampRes_ADC);
|
/** User code to un-mute audio hardware after a sample rate change - run every sample frequency change */
|
||||||
|
void AudioHwConfig_UnMute(void);
|
||||||
|
|
||||||
|
/** User code Configure audio hardware (clocking, CODECs etc) for a specific mClk/Sample frquency - run on every sample frequency change
|
||||||
|
*
|
||||||
|
* \param samFreq The new sample frequency (in Hz)
|
||||||
|
*
|
||||||
|
* \param mclk The new master clock frequency (in Hz)
|
||||||
|
*
|
||||||
|
* \param dsdMode DSD mode, DSD_MODE_NATIVE, DSD_MODE_DOP or DSD_MODE_OFF
|
||||||
|
*
|
||||||
|
* \param sampReq_DAC Playback sample resolution (in bits)
|
||||||
|
*
|
||||||
|
* \param sampReq_ADC Record sample resolution (in bits)
|
||||||
|
*/
|
||||||
|
void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode, unsigned sampRes_DAC, unsigned sampRes_ADC);
|
||||||
|
|
||||||
#endif // __XC__
|
#endif // __XC__
|
||||||
|
|
||||||
|
|||||||
29
lib_xua/src/core/audiohub/audiohub_user.c
Normal file
29
lib_xua/src/core/audiohub/audiohub_user.c
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
// Copyright 2023 XMOS LIMITED.
|
||||||
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
|
|
||||||
|
/* Default implementations of AudioHwInit(), AudioHwConfig(), AudioHwConfig_Mute() and AudioHwConfig_UnMute() */
|
||||||
|
|
||||||
|
void AudioHwInit() __attribute__ ((weak));
|
||||||
|
void AudioHwInit()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode, unsigned sampRes_DAC, unsigned sampRes_ADC) __attribute__ ((weak));
|
||||||
|
void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode, unsigned sampRes_DAC, unsigned sampRes_ADC)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioHwConfig_Mute() __attribute__ ((weak));
|
||||||
|
void AudioHwConfig_Mute()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioHwConfig_UnMute() __attribute__ ((weak));
|
||||||
|
void AudioHwConfig_UnMute()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -805,12 +805,18 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* User should mute audio hardware */
|
||||||
|
AudioHwConfig_Mute();
|
||||||
|
|
||||||
#if (XUA_USE_APP_PLL)
|
#if (XUA_USE_APP_PLL)
|
||||||
AppPllEnable(tile[AUDIO_IO_TILE], mClk);
|
AppPllEnable(tile[AUDIO_IO_TILE], mClk);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Configure Clocking/CODEC/DAC/ADC for SampleFreq/MClk */
|
/* User code should configure audio harware for SampleFreq/MClk etc */
|
||||||
AudioHwConfig(curFreq, mClk, dsdMode, curSamRes_DAC, curSamRes_ADC);
|
AudioHwConfig(curFreq, mClk, dsdMode, curSamRes_DAC, curSamRes_ADC);
|
||||||
|
|
||||||
|
/* User should unmute audio hardware */
|
||||||
|
AudioHwConfig_UnMute();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!firstRun)
|
if(!firstRun)
|
||||||
|
|||||||
Reference in New Issue
Block a user