Changeset 204 for soft/giet_vm/sys/irq_handler.c
- Timestamp:
- Aug 14, 2012, 8:14:55 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/sys/irq_handler.c
r203 r204 92 92 // compute cluster_id and loc_id 93 93 unsigned int cluster_id = channel_id / NB_DMAS_MAX; 94 unsigned int loc_id = channel_id % NB_DMAS_MAX; 95 96 // compute DMA channel address 97 unsigned int* dma_address = (unsigned int*)&seg_dma_base + 98 (loc_id * DMA_SPAN) + 99 (cluster_id * CLUSTER_SPAN); 94 unsigned int local_id = channel_id % NB_DMAS_MAX; 100 95 101 96 // save DMA channel status 102 _dma_status[channel_id] = dma_address[DMA_LEN]; 103 104 // reset DMA channel 105 dma_address[DMA_RESET] = 0; 97 if ( _dma_get_status(cluster_id, local_id, &_dma_status[channel_id]) ) 98 { 99 _get_lock(&_tty_put_lock); 100 _puts("[GIET ERROR] illegal DMA channel detected by _isr_dma\n"); 101 _release_lock(&_tty_put_lock); 102 return; 103 } 104 105 // reset DMA channel irq 106 if ( _dma_reset_irq(cluster_id, local_id) ) 107 { 108 _get_lock(&_tty_put_lock); 109 _puts("[GIET ERROR] illegal DMA channel detected by _isr_dma\n"); 110 _release_lock(&_tty_put_lock); 111 return; 112 } 106 113 107 114 // release DMA channel … … 117 124 void _isr_ioc() 118 125 { 119 unsigned int* ioc_address = (unsigned int*)&seg_ioc_base; 120 121 _ioc_status = ioc_address[BLOCK_DEVICE_STATUS]; // save status & reset IRQ 122 _ioc_done = 1; // signals completion 126 // save status & reset IRQ 127 if ( _ioc_get_status( &_ioc_status ) ) 128 { 129 _get_lock(&_tty_put_lock); 130 _puts("[GIET ERROR] bad access to IOC status detected by _isr_ioc\n"); 131 _release_lock(&_tty_put_lock); 132 return; 133 } 134 135 // signals completion 136 _ioc_done = 1; 123 137 } 124 138 … … 148 162 _puts("[GIET ERROR] Strange... User timer ISR for a system timer\n"); 149 163 _release_lock(&_tty_put_lock); 164 return; 150 165 } 151 166 152 167 // aknowledge IRQ 153 _timer_reset_irq( cluster_id, local_id ); 168 if ( _timer_reset_irq( cluster_id, local_id ) ) 169 { 170 _get_lock(&_tty_put_lock); 171 _puts("[GIET ERROR] illegal timer index detected by _isr_timer\n"); 172 _release_lock(&_tty_put_lock); 173 return; 174 } 154 175 155 176 #if NB_TIMERS_MAX … … 172 193 // This ISR handles the IRQs generated by the multi_tty controler, 173 194 // signaling that a character is available. 174 // There is one single multi_tty component controling all TTYs, and the tty_id175 // a rgument is the global TTY index.195 // There is one single multi_tty component controling all TTYs, 196 // and the tty_id // argument is the global TTY index. 176 197 // There is one communication buffer _tty_buf[tty_id] per terminal. 177 198 // The sychronisation variable _tty_full[tty_id], is set by the ISR, … … 181 202 void _isr_tty(unsigned int tty_id) 182 203 { 183 // compute terminal base address184 unsigned int *tty_address = (unsigned int*)&seg_tty_base + (tty_id * TTY_SPAN);185 186 204 // save character and reset IRQ 187 _tty_get_buf[tty_id] = (unsigned char)tty_address[TTY_READ]; 205 if ( _tty_get_char( tty_id, &_tty_get_buf[tty_id] ) ) 206 { 207 _get_lock(&_tty_put_lock); 208 _puts("[GIET ERROR] illegal tty index detected by _isr_tty\n"); 209 _release_lock(&_tty_put_lock); 210 return; 211 } 188 212 189 213 // signals character available … … 207 231 208 232 // acknowledge IRQ 209 _timer_reset_irq( cluster_id, local_id ); 233 if ( _timer_reset_irq( cluster_id, local_id ) ) 234 { 235 _get_lock(&_tty_put_lock); 236 _puts("[GIET ERROR] illegal proc index detected by _isr_switch\n"); 237 _release_lock(&_tty_put_lock); 238 return; 239 } 210 240 211 241 // performs the context switch
Note: See TracChangeset
for help on using the changeset viewer.