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

    r603 r630  
    2020
    2121#define  SDC_POLLING_TIMEOUT  1000000   // number of retries for polling PXCI
     22
     23//////////////////////////////////////////////////////////////////////////////////
     24//      Extern variables
     25//////////////////////////////////////////////////////////////////////////////////
     26
     27// allocated in the boot.c or kernel_init.c files
     28extern static_scheduler_t* _schedulers[X_SIZE][Y_SIZE][NB_PROCS_MAX];
    2229
    2330///////////////////////////////////////////////////////////////////////////////////
     
    401408    // in descheduling mode, we deschedule the task
    402409    // and use an interrupt to reschedule the task.
    403     // We need a critical section, because we must reset the RUN bit
     410    // We need a critical section, because we must set the NORUN bit
    404411        // before to launch the transfer, and we don't want to be
    405412    // descheduled between these two operations.
     
    426433        _it_disable( &save_sr );
    427434
    428         // reset runnable
    429         _set_task_slot( x, y, p, ltid, CTX_RUN_ID, 0 ); 
    430 
     435        // Set NORUN_MASK_IOC bit
     436        static_scheduler_t* psched  = (static_scheduler_t*)_schedulers[x][y][p];
     437        unsigned int*       ptr     = &psched->context[ltid][CTX_NORUN_ID];
     438        _atomic_or( ptr , NORUN_MASK_IOC );
     439       
    431440        // start transfer
    432441        _sdc_set_register( AHCI_PXCI, (1<<ptw) );
     
    489498 
    490499            // identify waiting task
    491             unsigned int remote_procid  = _ahci_gtid[ptr]>>16;
    492             unsigned int ltid           = _ahci_gtid[ptr] & 0xFFFF;
    493             unsigned int remote_cluster = remote_procid >> P_WIDTH;
    494             unsigned int remote_x       = remote_cluster >> Y_WIDTH;
    495             unsigned int remote_y       = remote_cluster & ((1<<Y_WIDTH)-1);
    496             unsigned int remote_p       = remote_procid & ((1<<P_WIDTH)-1);
     500            unsigned int procid  = _ahci_gtid[ptr]>>16;
     501            unsigned int ltid    = _ahci_gtid[ptr] & 0xFFFF;
     502            unsigned int cluster = procid >> P_WIDTH;
     503            unsigned int x       = cluster >> Y_WIDTH;
     504            unsigned int y       = cluster & ((1<<Y_WIDTH)-1);
     505            unsigned int p       = procid & ((1<<P_WIDTH)-1);
    497506 
    498             // re-activates waiting task
    499             _set_task_slot( remote_x,
    500                             remote_y,
    501                             remote_p,
    502                             ltid,
    503                             CTX_RUN_ID,
    504                             1 );
     507            // Reset NORUN_MASK_IOC bit
     508            static_scheduler_t* psched  = (static_scheduler_t*)_schedulers[x][y][p];
     509            unsigned int*       ptr     = &psched->context[ltid][CTX_NORUN_ID];
     510            _atomic_and( ptr , ~NORUN_MASK_IOC );
    505511
    506512            // send a WAKUP WTI to processor running the waiting task
    507             _xcu_send_wti( remote_cluster ,
    508                            remote_p ,
     513            _xcu_send_wti( cluster ,
     514                           p ,
    509515                           0 );          // don't force context switch
    510516
     
    514520        "  resume task %d running on P[%d,%d,%d] / status = %x\n",
    515521        ptr , _get_proctime() ,
    516         ltid , remote_x , remote_y , remote_p , _ahci_status[ptr] );
     522        ltid , x , y , p , _ahci_status[ptr] );
    517523#endif
    518524        }
     
    521527            break;
    522528        }
    523     }
     529    }  // end for completed commands
    524530}  // end _sdc_isr()
    525531
Note: See TracChangeset for help on using the changeset viewer.