Ignore:
Timestamp:
Oct 1, 2015, 4:20:46 PM (9 years ago)
Author:
alain
Message:

Major release: Change the task model to implement the POSIX threads API.

  • The shell "exec" and "kill" commands can be used to activate/de-activate the applications.
  • The "pause", "resume", and "context" commands can be used to stop, restart, a single thtead or to display the thread context.

This version has been tested on the following multi-threaded applications,
that have been modified to use the POSIX threads:

  • classif
  • convol
  • transpose
  • gameoflife
  • raycast
File:
1 edited

Legend:

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

    r657 r709  
    3232///////////////////////////////////////////////////////////////////////////////////
    3333
    34 // global index ot the task, for each entry in the command list
    35 __attribute__((section(".kdata")))
    36 unsigned int     _ahci_gtid[32];
     34// global index ot the thread, for each entry in the command list
     35__attribute__((section(".kdata")))
     36unsigned int     _ahci_trdid[32];
    3737
    3838// status of the command, for each entry in the command list
     
    406406
    407407    /////////////////////////////////////////////////////////////////
    408     // in descheduling mode, we deschedule the task
    409     // and use an interrupt to reschedule the task.
     408    // in descheduling mode, we deschedule the thread
     409    // and use an interrupt to reschedule the thread.
    410410    // We need a critical section, because we must set the NORUN bit
    411411        // before to launch the transfer, and we don't want to be
     
    422422#endif
    423423        unsigned int save_sr;
    424         unsigned int ltid = _get_current_task_id();
     424        unsigned int ltid = _get_thread_ltid();
    425425
    426426        // activates interrupt
    427427        _sdc_set_register( AHCI_PXIE , 0x00000001 );
    428428
    429         // set _ahci_gtid[ptw]
    430         _ahci_gtid[ptw] = (procid<<16) + ltid;
     429        // set _ahci_trdid[ptw]
     430        _ahci_trdid[ptw] = (x<<24) + (y<<16) + (p<<8) + ltid;
    431431
    432432        // enters critical section
     
    435435        // Set NORUN_MASK_IOC bit
    436436        static_scheduler_t* psched  = (static_scheduler_t*)_schedulers[x][y][p];
    437         unsigned int*       ptr     = &psched->context[ltid][CTX_NORUN_ID];
     437        unsigned int*       ptr     = &psched->context[ltid].slot[CTX_NORUN_ID];
    438438        _atomic_or( ptr , NORUN_MASK_IOC );
    439439       
     
    441441        _sdc_set_register( AHCI_PXCI, (1<<ptw) );
    442442
    443         // deschedule task
     443        // deschedule thread
    444444        _ctx_switch();                     
    445445
    446446#if GIET_DEBUG_IOC
    447447if (_get_proctime() > GIET_DEBUG_IOC)
    448 _printf("\n[DEBUG SDC] _sdc_access() : task %d on P[%d,%d,%d] resume at cycle %d\n",
     448_printf("\n[DEBUG SDC] _sdc_access() : thread %d on P[%d,%d,%d] resume at cycle %d\n",
    449449        ltid , x , y , p , _get_proctime() );
    450450#endif
     
    497497            _sdc_set_register( AHCI_PXIS , 0 );
    498498 
    499             // identify waiting task
    500             unsigned int procid  = _ahci_gtid[cmd_id]>>16;
    501             unsigned int ltid    = _ahci_gtid[cmd_id] & 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);
    506  
     499            // identify waiting thread
     500            unsigned int x       = (_ahci_trdid[cmd_id]>>24) & 0xFF;
     501            unsigned int y       = (_ahci_trdid[cmd_id]>>16) & 0xFF;
     502            unsigned int p       = (_ahci_trdid[cmd_id]>> 8) & 0xFF;
     503            unsigned int ltid    = (_ahci_trdid[cmd_id]    ) & 0xFF;
     504
    507505            // Reset NORUN_MASK_IOC bit
    508506            static_scheduler_t* psched  = (static_scheduler_t*)_schedulers[x][y][p];
    509             _atomic_and( &psched->context[ltid][CTX_NORUN_ID] , ~NORUN_MASK_IOC );
    510 
    511             // send a WAKUP WTI to processor running the waiting task
    512             _xcu_send_wti( cluster ,
     507            _atomic_and( &psched->context[ltid].slot[CTX_NORUN_ID] , ~NORUN_MASK_IOC );
     508
     509            // send a WAKUP WTI to processor running the waiting thread
     510            _xcu_send_wti( (x<<Y_WIDTH) + y,
    513511                           p ,
    514512                           0 );          // don't force context switch
     
    517515if (_get_proctime() > GIET_DEBUG_IOC)
    518516_printf("\n[DEBUG SDC] _sdc_isr() : command %d completed at cycle %d\n"
    519         "  resume task %d running on P[%d,%d,%d] / status = %x\n",
     517        "  resume thread %d running on P[%d,%d,%d] / status = %x\n",
    520518        cmd_id , _get_proctime() ,
    521519        ltid , x , y , p , _ahci_status[cmd_id] );
Note: See TracChangeset for help on using the changeset viewer.