Changeset 709 for soft/giet_vm/giet_drivers/sdc_driver.c
- Timestamp:
- Oct 1, 2015, 4:20:46 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/sdc_driver.c
r657 r709 32 32 /////////////////////////////////////////////////////////////////////////////////// 33 33 34 // global index ot the t ask, for each entry in the command list35 __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"))) 36 unsigned int _ahci_trdid[32]; 37 37 38 38 // status of the command, for each entry in the command list … … 406 406 407 407 ///////////////////////////////////////////////////////////////// 408 // in descheduling mode, we deschedule the t ask409 // and use an interrupt to reschedule the t ask.408 // in descheduling mode, we deschedule the thread 409 // and use an interrupt to reschedule the thread. 410 410 // We need a critical section, because we must set the NORUN bit 411 411 // before to launch the transfer, and we don't want to be … … 422 422 #endif 423 423 unsigned int save_sr; 424 unsigned int ltid = _get_ current_task_id();424 unsigned int ltid = _get_thread_ltid(); 425 425 426 426 // activates interrupt 427 427 _sdc_set_register( AHCI_PXIE , 0x00000001 ); 428 428 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; 431 431 432 432 // enters critical section … … 435 435 // Set NORUN_MASK_IOC bit 436 436 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]; 438 438 _atomic_or( ptr , NORUN_MASK_IOC ); 439 439 … … 441 441 _sdc_set_register( AHCI_PXCI, (1<<ptw) ); 442 442 443 // deschedule t ask443 // deschedule thread 444 444 _ctx_switch(); 445 445 446 446 #if GIET_DEBUG_IOC 447 447 if (_get_proctime() > GIET_DEBUG_IOC) 448 _printf("\n[DEBUG SDC] _sdc_access() : t ask%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", 449 449 ltid , x , y , p , _get_proctime() ); 450 450 #endif … … 497 497 _sdc_set_register( AHCI_PXIS , 0 ); 498 498 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 507 505 // Reset NORUN_MASK_IOC bit 508 506 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 t ask512 _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, 513 511 p , 514 512 0 ); // don't force context switch … … 517 515 if (_get_proctime() > GIET_DEBUG_IOC) 518 516 _printf("\n[DEBUG SDC] _sdc_isr() : command %d completed at cycle %d\n" 519 " resume t ask%d running on P[%d,%d,%d] / status = %x\n",517 " resume thread %d running on P[%d,%d,%d] / status = %x\n", 520 518 cmd_id , _get_proctime() , 521 519 ltid , x , y , p , _ahci_status[cmd_id] );
Note: See TracChangeset
for help on using the changeset viewer.