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/bdv_driver.c

    r593 r630  
    2323
    2424///////////////////////////////////////////////////////////////////////////////
     25//      Extern variables
     26///////////////////////////////////////////////////////////////////////////////
     27
     28// allocated in the boot.c or kernel_init.c files
     29extern static_scheduler_t* _schedulers[X_SIZE][Y_SIZE][NB_PROCS_MAX];
     30 
     31///////////////////////////////////////////////////////////////////////////////
    2532//      Global variables
    2633///////////////////////////////////////////////////////////////////////////////
     
    162169        _it_disable( &save_sr );
    163170
    164         // reset runnable
    165         _set_task_slot( x, y, p, ltid, CTX_RUN_ID, 0 ); 
     171        // Set NORUN_MASK_IOC bit
     172        static_scheduler_t* psched  = (static_scheduler_t*)_schedulers[x][y][p];
     173        unsigned int*       ptr     = &psched->context[ltid][CTX_NORUN_ID];
     174        _atomic_or( ptr , NORUN_MASK_IOC );
    166175       
    167176        // launch transfer
     
    234243
    235244    // identify task waiting on BDV
    236     unsigned int remote_procid  = _bdv_gtid>>16;
    237     unsigned int ltid           = _bdv_gtid & 0xFFFF;
    238     unsigned int remote_cluster = remote_procid >> P_WIDTH;
    239     unsigned int remote_x       = remote_cluster >> Y_WIDTH;
    240     unsigned int remote_y       = remote_cluster & ((1<<Y_WIDTH)-1);
    241     unsigned int remote_p       = remote_procid & ((1<<P_WIDTH)-1);
    242 
    243     // re-activates sleeping task
    244     _set_task_slot( remote_x,
    245                     remote_y,
    246                     remote_p,
    247                     ltid,       
    248                     CTX_RUN_ID,  // CTX_RUN slot
    249                     1 );         // running value
     245    unsigned int procid  = _bdv_gtid>>16;
     246    unsigned int ltid    = _bdv_gtid & 0xFFFF;
     247    unsigned int cluster = procid >> P_WIDTH;
     248    unsigned int x       = cluster >> Y_WIDTH;
     249    unsigned int y       = cluster & ((1<<Y_WIDTH)-1);
     250    unsigned int p       = procid & ((1<<P_WIDTH)-1);
     251
     252    // Reset NORUN_MASK_IOC bit
     253    static_scheduler_t* psched  = (static_scheduler_t*)_schedulers[x][y][p];
     254    unsigned int*       ptr     = &psched->context[ltid][CTX_NORUN_ID];
     255    _atomic_and( ptr , ~NORUN_MASK_IOC );
    250256
    251257    // send a WAKUP WTI to processor running the sleeping task
    252     _xcu_send_wti( remote_cluster,   
    253                    remote_p,
     258    _xcu_send_wti( cluster,   
     259                   p,
    254260                   0 );          // don't force context switch
    255261
    256262#if GIET_DEBUG_IOC 
    257 unsigned int procid  = _get_procid();
    258 unsigned int x       = procid >> (Y_WIDTH + P_WIDTH);
    259 unsigned int y       = (procid >> P_WIDTH) & ((1<<Y_WIDTH)-1);
    260 unsigned int p       = procid & ((1<<P_WIDTH)-1);
     263unsigned int pid  = _get_procid();
     264unsigned int c_x  = pid >> (Y_WIDTH + P_WIDTH);
     265unsigned int c_y  = (pid >> P_WIDTH) & ((1<<Y_WIDTH)-1);
     266unsigned int c_p  = pid & ((1<<P_WIDTH)-1);
    261267if ( _get_proctime() > GIET_DEBUG_IOC )
    262268_printf("\n[BDV DEBUG] Processor[%d,%d,%d] enters _bdv_isr() at cycle %d\n"
    263269        "  for task %d running on P[%d,%d,%d] / bdv_status = %x\n",
    264         x , y , p , _get_proctime() ,
    265         ltid , remote_x , remote_y , remote_p , status );
     270        c_x , c_y , c_p , _get_proctime() ,
     271        ltid , x , y , p , status );
    266272#endif
    267273
Note: See TracChangeset for help on using the changeset viewer.