Changeset 203 for soft/giet_vm/sys/irq_handler.c
- Timestamp:
- Aug 13, 2012, 10:52:25 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/sys/irq_handler.c
r189 r203 42 42 43 43 // get the highest priority active IRQ index 44 45 #if GIET_USE_XICU 46 47 #else 48 49 if ( _icu_read( pid / NB_PROCS_MAX, 50 pid % NB_PROCS_MAX, 51 ICU_IT_VECTOR, 52 &irq_id ) ) 44 if ( _icu_get_index( pid / NB_PROCS_MAX, 45 pid % NB_PROCS_MAX, 46 &irq_id ) ) 53 47 { 54 _puts("\n[GIET ERROR] wrong _icu_read in _irq_demux() function\n"); 55 _exit(); 48 _get_lock(&_tty_put_lock); 49 _puts("\n[GIET ERROR] Strange... Wrong _icu_read in _irq_demux()\n"); 50 _release_lock(&_tty_put_lock); 56 51 } 57 58 #endif59 52 60 53 if ( irq_id < 32 ) // do nothing if no interrupt active … … 74 67 // _isr_default() 75 68 // The default ISR is called when no specific ISR has been installed in the 76 // interrupt vector. It simply displays a message on kernel TTY[0].69 // interrupt vector. It simply displays an error message on kernel TTY[0]. 77 70 /////////////////////////////////////////////////////////////////////////////////// 78 71 void _isr_default() 79 72 { 80 _puts("\n\n!!! Strange... Default ISR activated !!!\n"); 73 _get_lock(&_tty_put_lock); 74 _puts("\n[GIET ERROR] Strange... Default ISR activated for processor "); 75 _putd( _procid() ); 76 _puts("\n"); 77 _release_lock(&_tty_put_lock); 81 78 } 82 79 … … 122 119 unsigned int* ioc_address = (unsigned int*)&seg_ioc_base; 123 120 124 _ioc_status = ioc_address[BLOCK_DEVICE_STATUS]; / * save status & reset IRQ */125 _ioc_done = 1; / * signals completion */121 _ioc_status = ioc_address[BLOCK_DEVICE_STATUS]; // save status & reset IRQ 122 _ioc_done = 1; // signals completion 126 123 } 127 124 128 125 /////////////////////////////////////////////////////////////////////////////////// 129 126 // _isr_timer() 130 // This ISR handles the IRQs generated by the "user" timers (the IRQs 131 // generatedby the "system" timers should be handled by the _isr_switch().127 // This ISR handles the IRQs generated by the "user" timers (the IRQs generated 128 // by the "system" timers should be handled by the _isr_switch(). 132 129 // These timers are distributed in all clusters, and can be implemented 133 130 // in a vci_multi_timer component, or in a vci_xicu component. 134 // The channel_id argument is the global channel index:135 // channel_id = cluster_id*(NB_TIMERS_MAX+NB_PROCS_MAX) + loc_id131 // The timer_id argument is a global index: 132 // timer_id = cluster_id*(NB_TIMERS_MAX+NB_PROCS_MAX) + local_id 136 133 // The user timer local index is (loc_id - NB_PROCS_MAX). 137 134 // 138 135 // The ISR acknowledges the IRQ and registers the event in the proper entry 139 // of the _timer_event[] array .140 // A log message is displayed on the kernel terminal.141 /////////////////////////////////////////////////////////////////////////////////// 142 void _isr_timer(unsigned int channel_id) 143 { 144 145 unsigned int cluster_id = channel_id / (NB_TIMERS_MAX + NB_PROCS_MAX);146 unsigned int loc_id = channel_id % (NB_TIMERS_MAX + NB_PROCS_MAX); 147 148 if (loc _id < NB_PROCS_MAX )136 // of the _timer_event[] array, and a log message is displayed on kernel terminal. 137 /////////////////////////////////////////////////////////////////////////////////// 138 void _isr_timer(unsigned int timer_id) 139 { 140 141 unsigned int cluster_id = timer_id / (NB_TIMERS_MAX + NB_PROCS_MAX); 142 unsigned int local_id = timer_id % (NB_TIMERS_MAX + NB_PROCS_MAX); 143 144 // checking timer type 145 if (local_id < NB_PROCS_MAX ) 149 146 { 150 _puts("[GIET ERROR] Receiving a user timer IRQ for a system timer\n"); 151 _puts(" cluster = "); 152 _putw(cluster_id); 153 _puts(" / local_id = "); 154 _putw(loc_id); 147 _get_lock(&_tty_put_lock); 148 _puts("[GIET ERROR] Strange... User timer ISR for a system timer\n"); 149 _release_lock(&_tty_put_lock); 155 150 } 156 151 157 #if GIET_USE_XICU 158 159 // TODO 160 161 #else 162 163 // compute Timer address 164 unsigned int* timer_address = (unsigned int*)&seg_timer_base + 165 (loc_id * TIMER_SPAN) + 166 (cluster_id * CLUSTER_SPAN); 167 168 // reset IRQ 169 timer_address[TIMER_RESETIRQ] = 0; 170 171 #endif 152 // aknowledge IRQ 153 _timer_reset_irq( cluster_id, local_id ); 172 154 173 155 #if NB_TIMERS_MAX … … 177 159 178 160 // display a message on TTY 0 179 _puts("[GIET] User Timer IRQ / cluster = "); 180 _putw(cluster_id); 181 _puts(" / timer = "); 182 _putw(loc_id - NB_PROCS_MAX); 161 _get_lock(&_tty_put_lock); 162 _puts("[GIET] User Timer IRQ at cycle "); 163 _putd( _proctime() ); 164 _puts(" / index = "); 165 _putd(timer_id); 183 166 _puts("\n"); 167 _release_lock(&_tty_put_lock); 184 168 } 185 169 … … 219 203 // get cluster index and proc local index 220 204 unsigned int pid = _procid(); 221 unsigned int loc _id= pid % NB_PROCS_MAX;205 unsigned int local_id = pid % NB_PROCS_MAX; 222 206 unsigned int cluster_id = pid / NB_PROCS_MAX; 223 207 224 #if GIET_USE_XICU 225 226 unsigned int* timer_address = // TODO 227 228 #else 229 230 // compute Timer address 231 unsigned int* timer_address = (unsigned int*)&seg_timer_base + 232 (loc_id * TIMER_SPAN) + 233 (cluster_id * CLUSTER_SPAN); 234 235 // reset IRQ 236 timer_address[TIMER_RESETIRQ] = 0; 237 238 #endif 208 // acknowledge IRQ 209 _timer_reset_irq( cluster_id, local_id ); 239 210 240 211 // performs the context switch 241 212 _ctx_switch(); 242 243 } 244 213 } 214
Note: See TracChangeset
for help on using the changeset viewer.