Ignore:
Timestamp:
Jul 18, 2015, 3:04:15 PM (9 years ago)
Author:
alain
Message:

Update the peripheral drivers using descheduling,
to comply with the modified NORUN bit-vector in task context.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_drivers/mwr_driver.c

    r563 r630  
    4141#endif
    4242
    43 
    44 /////////////////////////////////////////////////////////////////////////////
    45 //      Global variables (all arrays are indexed by the cluster index)
     43/////////////////////////////////////////////////////////////////////////////
     44//      Extern variables
     45/////////////////////////////////////////////////////////////////////////////
     46
     47// allocated in the boot.c or kernel_init.c files
     48extern static_scheduler_t* _schedulers[X_SIZE][Y_SIZE][NB_PROCS_MAX];
     49
     50/////////////////////////////////////////////////////////////////////////////
     51//      Global variables
     52/////////////////////////////////////////////////////////////////////////////
     53// All arrays are indexed by the cluster index.
    4654/////////////////////////////////////////////////////////////////////////////
    4755
     
    150158{
    151159    // get coprocessor coordinates and characteristics
    152     // the processor executing the ISR an the coprocessor
    153     // are in the same cluster
     160    // processor executing ISR and coprocessor are in the same cluster
    154161    unsigned int gpid       = _get_procid();
    155162    unsigned int cluster_xy = gpid >> P_WIDTH;
     
    160167    unsigned int nb_to      = info & 0xFF;
    161168    unsigned int nb_from    = (info>>8) & 0xFF;
     169
    162170    unsigned int channel;
    163171    unsigned int status;
    164172    unsigned int error = 0;
    165173
    166     // check status, report errors and reset all channels
     174    // check status, report errors and reset for all channels
    167175    for ( channel = 0 ; channel < (nb_to + nb_from) ; channel++ )
    168176    {
     
    199207    // identify task waiting on coprocessor completion
    200208    // this task can run in a remote cluster
    201     unsigned int gtid           = _coproc_gtid[cluster_id];
    202     unsigned int remote_procid  = gtid>>16;
    203     unsigned int ltid           = gtid & 0xFFFF;
    204     unsigned int remote_cluster = remote_procid >> P_WIDTH;
    205     unsigned int remote_x       = remote_cluster >> Y_WIDTH;
    206     unsigned int remote_y       = remote_cluster & ((1<<Y_WIDTH)-1);
    207     unsigned int remote_p       = remote_procid & ((1<<P_WIDTH)-1);
    208 
    209     // re-activates sleeping task
    210     _set_task_slot( remote_x,
    211                     remote_y,
    212                     remote_p,
    213                     ltid,       
    214                     CTX_RUN_ID,  // CTX_RUN slot
    215                     1 );         // running value
     209    unsigned int r_gtid    = _coproc_gtid[cluster_id];
     210    unsigned int r_procid  = r_gtid>>16;
     211    unsigned int r_ltid    = r_gtid & 0xFFFF;
     212    unsigned int r_cluster = r_procid >> P_WIDTH;
     213    unsigned int r_x       = r_cluster >> Y_WIDTH;
     214    unsigned int r_y       = r_cluster & ((1<<Y_WIDTH)-1);
     215    unsigned int r_p       = r_procid & ((1<<P_WIDTH)-1);
     216
     217    // Reset NORUN_MASK_IOC bit
     218    static_scheduler_t* psched  = (static_scheduler_t*)_schedulers[r_x][r_y][r_p];
     219    unsigned int*       ptr     = &psched->context[r_ltid][CTX_NORUN_ID];
     220    _atomic_and( ptr , ~NORUN_MASK_IOC );
    216221
    217222    // send a WAKUP WTI to processor running the sleeping task
    218     _xcu_send_wti( remote_cluster,   
    219                    remote_p,
     223    _xcu_send_wti( r_cluster,   
     224                   r_p,
    220225                   0 );          // don't force context switch
    221226
     
    224229_printf("\n[GIET DEBUG COPROC] P[%d,%d,%d] executes _mwr_isr() at cycle %d\n"
    225230        "  for task %d running on P[%d,%d,%d] / error = %d\n",
    226         x , y , p , _get_proctime() , ltid , remote_x , remote_y , remote_p , error );
    227 #endif
    228 }
     231        x , y , p , _get_proctime() , ltid , r_x , r_y , r_p , error );
     232#endif
     233}  // end _mwr_isr()
    229234
    230235
Note: See TracChangeset for help on using the changeset viewer.