User function definitions#
The following functions can be optionally defined by an application to override default (empty)
implementations in lib_xua
.
External audio hardware configuration#
The functions listed below should be implemented to configure external audio hardware.
-
void AudioHwInit(void)#
User audio hardware initialisation code.
This function is called when the device starts up and should contain user code to perform any required audio hardware initialisation
-
void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode, unsigned sampRes_DAC, unsigned sampRes_ADC)#
User audio hardware configuration code.
This function is called when on sample rate change and should contain user code to configure audio hardware (clocking, CODECs etc) for a specific mClk/Sample frequency
- Parameters:
samFreq – The new sample frequency (in Hz)
mClk – The new master clock frequency (in Hz)
dsdMode – DSD mode, DSD_MODE_NATIVE, DSD_MODE_DOP or DSD_MODE_OFF
sampRes_DAC – Playback sample resolution (in bits)
sampRes_ADC – Record sample resolution (in bits)
-
void AudioHwConfig_Mute(void)#
User code mute audio hardware.
This function is called before AudioHwConfig() and should contain user code to mute audio hardware before a sample rate change in order to reduced audible pops/clicks
Note, if using the application PLL of a xcore.ai device this function will be called before the master-clock is changed
-
void AudioHwConfig_UnMute(void)#
User code to un-mute audio hardware.
This function is called after AudioHwConfig() and should contain user code to un-mute audio hardware after a sample rate change
Audio streaming notification#
The functions listed below can be useful for mute lines, indication LEDs etc.
-
void UserAudioStreamStart(void)#
User stream start code.
User code to perform any actions required at every stream start - either input or output
-
void UserAudioStreamStop(void)#
User stream stop code.
User code to perform any actions required on every stream stop - either input or output
-
void UserAudioInputStreamStart(void)#
User input stream stop code.
User code to perform any actions required on input stream start i.e. device to host
-
void UserAudioInputStreamStop(void)#
User input stream stop code.
User code to perform any actions required on input stream stop i.e. device to host
-
void UserAudioOutputStreamStart(void)#
User output stream start code.
User code to perform any actions required on output stream start i.e. host to device
-
void UserAudioOutputStreamStop(void)#
User output stream stop code.
User code to perfrom any actions required on output stream stop i.e. host to device
HID controls#
The following function is called when the device wishes to read physical user input (buttons etc). The function should write relevant HID bits into this array. The bit ordering and functionality is defined by the HID report descriptor used.
-
size_t UserHIDGetData(const unsigned id, unsigned char hidData[HID_MAX_DATA_BYTES])#
Get the data for the next HID Report.
- Parameters:
id – [in] The HID Report ID (see 5.6, 6.2.2.7, 8.1 and 8.2 of the USB Device Class Definition for HID 1.11) Set to zero if the application provides only one HID Report which does not include a Report ID
hidData – [out] The HID data If using Report IDs, this function places the Report ID in the first element; otherwise the first element holds the first byte of HID event data.
- Return values:
Zero – means no new HID event data has been recorded for the given id
- Returns:
The length of the HID Report in the hidData argument