Guarded Error

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
140dB
Member
Posts: 10
Joined: Fri Nov 07, 2014 1:30 pm

Guarded Error

Post by 140dB »

Hello All,

What I need is two seperate client tasks to talk to one server task (spi bus task).

I keep getting this error:

"55: error: select does not select on function `command_status' of interface `spi_interface' which is not marked as [[guarded]]"

Can someone explain this error? I read the programming guide on "guarded" and found it not useful.

For the sake of simplicity I have not even attempted to add [[combinable]] or [[distributable]] seeing how just getting xmos things to work seems to take all week for simple items. 

I have set up a server task with two client tasks in my project similar to this example code:

(I am following this code structure based on xmos documentation)

Defined in a .h file

interface my_interface { void fA(int x, int y); void fB(float x);};[/code]Running in my main:

int main(void){ interface my_interface i1; interface my_interface i2; par { task1(i1); task3(i2); task4(i1, i2) } return 0;[/code]Running on a core (server portion)

void task4(interface my_interface server i1, interface my_interface server i2) { while (1) { // wait for either fA or fB over either connection. select { case i1.fA(int x, int y): printf("Received fA on interface end i1: %d, %d\n", x, y); break; case i1.fB(float x): printf("Received fB on interface end i1: %f\n", x); break; case i2.fA(int x, int y): printf("Received fA on interface end i2: %d, %d\n", x, y); break; case i2.fB(float x): printf("Received fB on interface end i2: %f\n", x); break; } }}[/code]Running on a core (client portion)

void task1(client interface my_interface i){ // 'i' is the client end of the connection, // let's communicate with the other end. i.fA(5, 10);}[/code]Read