Code: Select all
/* ... */
unsigned uart_chanend;
void uart_thread(void)
{
unsigned ret;
asm (
"getr %0, %1 \n"
: "=r"(ret)
: "i"(XS1_RES_TYPE_CHANEND) /* why does this not work? */
);
// todo: check if ressource was available
uart_chanend = ret;
asm (
"mov r0, %0 \n"
"bl uart_thread_internal \n"
: /* no output */
: "r"(ret)
: "r0"
);
}
static void uart_thread_internal(chanend uart_chanend)
{
/* .... */
(Remark: When I implementet the event handling in C I found that it's not as elegant as the select statement in XC, that's why I'm trying XC again.)
The XMOS toolchain has a great compiler backend, very well done. But I feel like XC degrades the possibilities of the XMOS. Is there hope that it will be extended soon to allow features like asynchronous threads, runtime channel setup and other things that are possible on the XMOS?
Regards,
Thomas