interface as select function argument Topic is solved

If you have a simple question and just want an answer.
User avatar
myndideal
Active Member
Posts: 59
Joined: Thu May 05, 2011 10:00 pm
Location: Budapest

interface as select function argument

Post by myndideal »

Hi, select function is an xc specific syntax to define select cases which can be reuse in different context. It is documented in XMOS programming guide, and some more places. Each example contains only channels, but not interfaces.  https://www.xmos.com/published/how-use-select-function

I would like to use interface rather than channels. Is it possible?

Code: Select all

select local_imp(server interface memory_extender mem){ case mem.st8(uintptr_t address, unsigned data): unsafe { *((uint8_t *unsafe)address) = data; } break; //case somethingmore: break;}void handler_remote_ram(server interface memory_extender mem){ while (1) { select { case local_imp(mem): break; //case somethingelse: break; }}void handler_sdram(server interface memory_extender mem){ while (1) { select { case local_imp(mem): break; //case somethingelse: break; }} 
Error, what I got:

Code: Select all

virtaddr.xc:38:10: error: transaction does not use any chanends    case local_imp(mem):


View Solution
Vineela
Member++
Posts: 21
Joined: Mon Dec 16, 2013 1:27 pm

Post by Vineela »

Hello, I guess this is what you are for!

https://www.xmos.com/download/private/A ... terfaces-t...

 

Thanks,

Vineela

richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post by richard »

The syntax for calling a select function from a select is:

case local_imp(mem);

not

case local_imp(mem): break;
 
The second syntax is used for calling transaction functions from a select, and transaction functions must have a channel end argument (which I think is why the error message mentions chanends).