Changeset 528 for soft/giet_vm/giet_kernel/ctx_handler.c
- Timestamp:
- Mar 27, 2015, 11:43:48 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_kernel/ctx_handler.c
r459 r528 8 8 #include <ctx_handler.h> 9 9 #include <giet_config.h> 10 #include <hard_config.h> 10 11 #include <utils.h> 11 12 #include <tty0.h> 12 13 #include <xcu_driver.h> 13 14 14 ////////// defined in giet_kernel/switch.s file ///////// 15 ///////////////////////////////////////////////////////////////////////////////// 16 // Extern variables and functions 17 ///////////////////////////////////////////////////////////////////////////////// 18 19 // defined in giet_kernel/switch.s file 15 20 extern void _task_switch(unsigned int *, unsigned int *); 21 22 // allocated in boot.c or kernel_init.c files 23 extern static_scheduler_t* _schedulers[X_SIZE][Y_SIZE][NB_PROCS_MAX]; 24 25 ////////////////////////////////// 26 void _ctx_display( unsigned int x, 27 unsigned int y, 28 unsigned int p, 29 unsigned int ltid, 30 char* string ) 31 { 32 static_scheduler_t* psched = _schedulers[x][y][p]; 33 _printf("\n########## task[%d,%d,%d,%d] context\n" 34 " - CTX_EPC = %x\n" 35 " - CTX_PTAB = %x\n" 36 " - CTX_PTPR = %x\n" 37 " - CTX_VSID = %x\n" 38 " - CTX_SR = %x\n" 39 " - CTX_RA = %x\n" 40 " - CTX_SP = %x\n" 41 " - CTX_RUN = %x\n" 42 "########## %s\n", 43 x , y , p , ltid , 44 psched->context[ltid][CTX_EPC_ID], 45 psched->context[ltid][CTX_PTAB_ID], 46 psched->context[ltid][CTX_PTPR_ID], 47 psched->context[ltid][CTX_VSID_ID], 48 psched->context[ltid][CTX_SR_ID], 49 psched->context[ltid][CTX_RA_ID], 50 psched->context[ltid][CTX_SP_ID], 51 psched->context[ltid][CTX_RUN_ID], 52 string ); 53 } // _ctx_display() 54 16 55 17 56 ////////////////// … … 48 87 49 88 // launch "idle" task if no runable task 50 if (found == 0) 51 { 52 next_task_id = IDLE_TASK_INDEX; 53 } 89 if (found == 0) next_task_id = IDLE_TASK_INDEX; 54 90 55 91 #if GIET_DEBUG_SWITCH 56 92 unsigned int x = cluster_xy >> Y_WIDTH; 57 93 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 58 59 _printf("\n[TASK SWITCH] (%d) -> (%d) on processor[%d,%d,%d] at cycle %d\n", 94 _printf("\n[DEBUG SWITCH] (%d) -> (%d) on processor[%d,%d,%d] at cycle %d\n", 60 95 curr_task_id, next_task_id, x, y , lpid, _get_proctime() ); 61 96 #endif … … 66 101 unsigned int* next_ctx_vaddr = &(psched->context[next_task_id][0]); 67 102 68 // reset timer counter. 69 // In all clusters, the first NB_PROCS_MAX 70 // timers are system timers (TICK) 71 72 #if USE_XCU 103 // reset TICK timer counter. 73 104 _xcu_timer_reset_cpt( cluster_xy, lpid ); 74 #else75 _timer_reset_cpt( cluster_xy, lpid);76 #endif77 105 78 106 // set current task index … … 80 108 81 109 // makes context switch 82 _task_switch(curr_ctx_vaddr, next_ctx_vaddr); 110 _task_switch( curr_ctx_vaddr , next_ctx_vaddr ); 111 83 112 } 84 113 } //end _ctx_switch() 114 85 115 86 116 ///////////////// … … 110 140 111 141 // warning message 112 _puts("\n[GIET WARNING] Processor["); 113 _putd( x ); 114 _puts(","); 115 _putd( y ); 116 _puts(","); 117 _putd( p ); 118 _puts("] still idle at cycle "); 119 _putd( _get_proctime() ); 120 _puts("\n"); 142 _printf("\n[GIET WARNING] Processor[%d,%d,%d] still idle at cycle %d", 143 x , y , p , _get_proctime() ); 121 144 } 122 145 } // end ctx_idle()
Note: See TracChangeset
for help on using the changeset viewer.