Right now, I can make the USB device enumerate and show up in Audio Spy, but nothing more.
From (custom) main()
Code: Select all
on stdcore[CORE_A]:{
XUD_EpType epTypeTableOut[ENDPOINT_COUNT_OUT]={ XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, XUD_EPTYPE_ISO};
XUD_EpType epTypeTableIn[ENDPOINT_COUNT_IN]={ XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO};
par{
XUD_Manager(c_xud_out, ENDPOINT_COUNT_OUT, c_xud_in, ENDPOINT_COUNT_IN, c_sof, epTypeTableOut, epTypeTableIn, null, null, 1, XUD_SPEED_HS, XUD_PWR_BUS);
{ set_thread_fast_mode_on(); Endpoint0( c_xud_out[ENDPOINT_NUMBER_IN_CONTROL], c_xud_in[ENDPOINT_NUMBER_IN_CONTROL], c_aud_ctl, null, null); }
{set_thread_fast_mode_on(); decouple(c_mix_out , null , c_buff_ctrl);}
buffer(c_xud_out[ENDPOINT_NUMBER_OUT_AUDIO], c_xud_in[ENDPOINT_NUMBER_IN_AUDIO], c_xud_in[ENDPOINT_NUMBER_IN_FEEDBACK] , c_sof, c_aud_ctl, p_for_mclk_count ,c_buff_ctrl );
audio_custom(c_mix_out);
}
}
Code: Select all
unsigned static deliver( chanend c_out){
unsigned samples=0;
while (1)
{
outuint(c_out, 0);
/* Check for sample freq change or new samples from mixer*/
if(testct(c_out))
{
unsigned command = inct(c_out);
return command;
}
else
{
#ifndef MIXER // Interfaces straight to decouple()
(void) inuint(c_out);
#pragma loop unroll
for(int i = 0; i < NUM_USB_CHAN_IN; i++)
{
outuint(c_out, 0);
}
#pragma loop unroll
for(int i = 0; i < NUM_USB_CHAN_OUT; i++)
{
(void) inuint(c_out);
}
#else
#pragma loop unroll
for(int i = 0; i < NUM_USB_CHAN_OUT; i++)
{
(void) inuint(c_out);
}
#pragma loop unroll
for(int i = 0; i < NUM_USB_CHAN_IN; i++)
{
outuint(c_out, 0);
}
#endif
}
samples++;
if(samples!=0)
printchar('s');
}
return 0;
}
void audio_custom(chanend c_out){
unsigned command , curSamFreq=44100;
unsigned firstRun = 1;
unsigned numBits = 64;
unsigned mClk , divide ,dsdMode ,curSamRes_DAC;
//printstrln("Starting USB audio");
while(1){
mClk = MCLK_441;
if(!firstRun){
if ((curSamFreq != AUDIO_REBOOT_FROM_DFU) && (curSamFreq != AUDIO_STOP_FOR_DFU) && command)
outct(c_out, XS1_CT_END);
}
firstRun=0;
command = deliver(c_out);
if(command == SET_SAMPLE_FREQ)
curSamFreq = inuint(c_out);
else if(command == SET_STREAM_FORMAT_OUT){
/* Off = 0 , DOP = 1 Native = 2*/
dsdMode = inuint(c_out);
curSamRes_DAC = inuint(c_out);
}
if (curSamFreq == AUDIO_STOP_FOR_DFU){
outct(c_out, XS1_CT_END);
printstr("DFU");
}
}
}
(This is my first deeper dive into the USB Audio code, not using the module USB audio as it is)
The bug/bugs may be simple or more complicated.
Maybe someone here that already made a deeper dive into the USB audio code? ;)