Changeset 440 for soft/giet_vm/giet_kernel/ctx_handler.c
- Timestamp:
- Nov 3, 2014, 11:03:55 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_kernel/ctx_handler.c
r428 r440 6 6 ////////////////////////////////////////////////////////////////////////////////// 7 7 8 #include <ctx_handler.h> 8 9 #include <giet_config.h> 9 #include <tim_driver.h> 10 #include <utils.h> 11 #include <kernel_utils.h> 10 12 #include <xcu_driver.h> 11 #include <tty_driver.h>12 #include <utils.h>13 #include <ctx_handler.h>14 #include <mapping_info.h>15 #include <sys_handler.h>16 13 14 ////////// defined in giet_kernel/switch.s file ///////// 17 15 extern void _task_switch(unsigned int *, unsigned int *); 18 16 19 ///////////////////////////////////////////////////////////////////////////////// 20 // This function performs a context switch between the running task 21 // and another task, using a round-robin sheduling policy between all 22 // tasks allocated to a given processor (static allocation). 23 // It selects the next runable task to resume execution. 24 // If the only runable task is the current task, return without context switch. 25 // If there is no runable task, the scheduler switch to the default "idle" task. 26 ///////////////////////////////////////////////////////////////////////////////// 27 // Implementation note 28 // The return address contained in $31 is saved in the current task context 29 // (in the ctx[31] slot), and the function actually returns to the address 30 // contained in the ctx[31] slot of the next task context. 31 ///////////////////////////////////////////////////////////////////////////////// 17 ////////////////// 32 18 void _ctx_switch() 33 19 { … … 98 84 } //end _ctx_switch() 99 85 100 ///////////////////////////////////////////////////////////////////////////////////// 101 // This function is executed as the"idle" task when no other task can be executed 102 ///////////////////////////////////////////////////////////////////////////////////// 86 ///////////////// 103 87 void _idle_task() 104 88 { … … 107 91 unsigned int x = cluster_xy >> Y_WIDTH; 108 92 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 109 unsigned int lpid= gpid & ((1<<P_WIDTH)-1);93 unsigned int p = gpid & ((1<<P_WIDTH)-1); 110 94 111 95 while(1) … … 126 110 127 111 // warning message 128 _printf("\n[GIET WARNING] Processor[%d,%d,%d] still idle at cycle %d\n", 129 x, y, lpid, _get_proctime() ); 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"); 130 121 } 131 122 } // end ctx_idle() 132 123 133 124 134 ///////////////////////////////////////////////////////////////////////////////// 135 // The address of this function is used to initialise the return address 136 // in the "idle" task context. 137 ///////////////////////////////////////////////////////////////////////////////// 125 //////////////// 138 126 void _ctx_eret() 139 127 {
Note: See TracChangeset
for help on using the changeset viewer.