Changeset 630 for soft/giet_vm/giet_drivers/sdc_driver.c
- Timestamp:
- Jul 18, 2015, 3:04:15 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/sdc_driver.c
r603 r630 20 20 21 21 #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 28 extern static_scheduler_t* _schedulers[X_SIZE][Y_SIZE][NB_PROCS_MAX]; 22 29 23 30 /////////////////////////////////////////////////////////////////////////////////// … … 401 408 // in descheduling mode, we deschedule the task 402 409 // and use an interrupt to reschedule the task. 403 // We need a critical section, because we must reset theRUN bit410 // We need a critical section, because we must set the NORUN bit 404 411 // before to launch the transfer, and we don't want to be 405 412 // descheduled between these two operations. … … 426 433 _it_disable( &save_sr ); 427 434 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 431 440 // start transfer 432 441 _sdc_set_register( AHCI_PXCI, (1<<ptw) ); … … 489 498 490 499 // identify waiting task 491 unsigned int remote_procid = _ahci_gtid[ptr]>>16;492 unsigned int ltid 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); 497 506 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 ); 505 511 506 512 // 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 , 509 515 0 ); // don't force context switch 510 516 … … 514 520 " resume task %d running on P[%d,%d,%d] / status = %x\n", 515 521 ptr , _get_proctime() , 516 ltid , remote_x , remote_y , remote_p , _ahci_status[ptr] );522 ltid , x , y , p , _ahci_status[ptr] ); 517 523 #endif 518 524 } … … 521 527 break; 522 528 } 523 } 529 } // end for completed commands 524 530 } // end _sdc_isr() 525 531
Note: See TracChangeset
for help on using the changeset viewer.