Streaming Channels in parallel

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
segher
XCore Expert
Posts: 844
Joined: Sun Jul 11, 2010 1:31 am

Post by segher »

Some of your labels end with a semicolon instead of with
a colon.


stdefeber
Active Member
Posts: 35
Joined: Wed Dec 18, 2013 9:20 pm

Post by stdefeber »

Thanks.
How stupid.
stdefeber
Active Member
Posts: 35
Joined: Wed Dec 18, 2013 9:20 pm

Post by stdefeber »

I have got the combining and splitting working. Thank to all who commented.

For testing purpose I used 1 core to do this function for me.

Code: Select all


void audio_io_mix(streaming chanend AdcChannel0,
                  streaming chanend AdcChannel1,
                  streaming chanend DacChannel0,
                  streaming chanend DacChannel1,
                  streaming chanend c_data)
{
  int InputSample;
  int OutputSample;

  InputSample  = 0;
  OutputSample = 0;


  while(1)
  {

    select
    {
       case c_data :> InputSample:
         AdcChannel0 <: InputSample;
         AdcChannel1 <: InputSample;
         break;

       case DacChannel0 :> OutputSample:
         c_data <: OutputSample;
         break;

       case DacChannel1 :> OutputSample:
         c_data <: OutputSample;
         break;

       default:
         break;
    }
  }
}
My main routine is :

Code: Select all

  par
  {
    on stdcore[0]: audio_io_test(c_data);     // I2S source/destination Core
    on stdcore[0]: audio_io_mix(Channel1, Channel2, Channel3, Channel4, c_data);    // Splitter/Combiner Core
    on stdcore[0]: iir_highpass_fixed32 (Channel1, Channel3 );    // Highpass Filter Core
    on stdcore[0]: iir_lowpass_fixed32  (Channel2, Channel4);    // Lowpass Filter Core
  }
This way I am able to use the standard I2S master module with just one channel and my IIR implementation with separate in/out channels.