I am a newbie in multi-core processor programming. I'm trying to understand the performance of XMOS processors. I'm toggling some LEDs and watching the timing delays. I can see time delays when I use "print" function.
main function is;
Code: Select all
int main() {
chan xscope_data_in;
startkit_adc_if i_adc; //For triggering/reading ADC
chan c_adc;
par{
on tile[0]:task1(); // LED toggle
on tile[0]:task2(); // some LED animations
on tile[0]: adc_task(i_adc, c_adc, 0, adc_sample);
startkit_adc(c_adc);
on tile[0]: app(i_adc);
}
return 0;
}
Code: Select all
void app(client startkit_adc_if i_adc)
{
timer t_loop;
int loop_time;
unsigned short adc_val[4] = {0, 0, 0, 0};
t_loop :> loop_time;
loop_time += LOOP_PERIOD; //Set comparison to future time
while (1) {
select {
case t_loop when timerafter(loop_time) :> void:
i_adc.trigger(); //Fire the ADC!
loop_time += LOOP_PERIOD; //Setup future time event
break;
case i_adc.complete(): //Notification from ADC server when aquisition complete
i_adc.read(adc_val); //Get the values (and clear the notfication)
// for(int i = 0; i < 4; i++){
// printstr("ADC chan ");
// printint(i);
// printstr(" = ");
// printint(adc_val[i]);
// }
// printchar('\n');
break;
}
}
}