SSYNC vs WAITEU

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
fabriceo
XCore Addict
Posts: 233
Joined: Mon Jan 08, 2018 4:14 pm

SSYNC vs WAITEU

Post by fabriceo »

Hi,
is it possible to use an SSYNC instruction instead of a WAITEU instruction, to combine both functionality ?

assuming I have a select case which create the proper event configuration for a channel or a port.
if we replace the WAITEU instruction by a SSYNC (using a default case).
we can continue this slave task by issuing an MSYNC in the Master task, right.
but if an event occurs when this slave task is paused by the SSYNC, will it restart in run mode at the address of the event vector when the event will occur ? or the only way to change the paused state of a task is to use MSYNC ?

questioning this to avoid using a channel to trigger a slave task by its master task, as the MSYNC+SSYNC does the job.
Thanks in advance;
fabriceo
User avatar
fabriceo
XCore Addict
Posts: 233
Joined: Mon Jan 08, 2018 4:14 pm

Post by fabriceo »

Hi,
as far as I can say, SSYNC pause the task and the event are suspended also.
forcing SETSR 1 in a default select case didn't solve it, the SSYNC just wait for MSYNC

Code: Select all

void b(){
    timer t;
    int tt;
    t :> tt;
    tt+=100000;
    printf("b before sync\n");
    asm volatile("#myselect:");
    while (1) {
        select {
            case t when timerafter(tt) :> void :{
                tt+=100000;
                printf("b timerafter\n");
                break;
            }
            default :
                asm volatile("setsr 1");
                asm volatile("ssync");
                printf("b after sync\n");
                t :> tt;
                tt+=100000;
                break;
        }
    }
}