Page 1 of 1

How to use XMOS streaming chan & chan in C function.

Posted: Sat Aug 11, 2012 12:15 pm
by jagspaul
Hi,

My code is combined of XC & C. I want to use XMOS channels between Xc & C functions.

main.xc file

Code: Select all

streaming chan chan1
chan chan2
int main(void)
{
    par
    {
          fun_c(chan1,chan2);
          fun_xc(chan1,chan2);

     }
}
fun_c.c file

Code: Select all

 fun_c(chan1,chan2)
{
    ........
      .......

}
fun_xc.xc file

Code: Select all

 fun_xc(chan1,chan2)
{
    ........
      .......

}
Can anybody help me how to do this?

Thanks & regards
jags

Re: How to use XMOS streaming chan & chan in C function.

Posted: Sat Aug 11, 2012 2:49 pm
by Obtuse
jagspaul wrote:Hi,

My code is combined of XC & C. I want to use XMOS channels between Xc & C functions.

jags
jags,

Unless I'm misunderstanding,,,

Channels are a hardware path and in order to use C you would have to reproduce the channel end in C. That would mean an assembly routine driver compatible with the XC function on the other end of the channel.

Yes?

Re: How to use XMOS streaming chan & chan in C function.

Posted: Sat Aug 11, 2012 4:59 pm
by segher
See http://www.xmos.com/call-between-cc-and-xc for
how to pass chanends to C functions. How to actually use them
is a different story, of course.

Re: How to use XMOS streaming chan & chan in C function.

Posted: Sun Aug 12, 2012 9:16 am
by jagspaul
Thanks All.

I have got it. It's working.

regards
jags