Changeset 207 for soft/giet_vm/sys/irq_handler.c
- Timestamp:
- Aug 16, 2012, 6:36:16 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/sys/irq_handler.c
r204 r207 82 82 // This ISR handles all IRQs generated by the multi-channels DMA controlers. 83 83 // The multi_dma components can be distributed in the clusters. 84 // The channel_id argument is the global DMA channel index.85 // channel_id = cluster_id*NB_DMAS_MAX + loc_id86 // - The ISR saves the transfert status in _dma_status[ channel_id].84 // The channel_id argument is the local DMA channel index. 85 // dma_global_id = cluster_id*NB_DMAS_MAX + channel_id 86 // - The ISR saves the transfert status in _dma_status[dma_global_id]. 87 87 // - It acknowledges the interrupt to reinitialize the DMA controler. 88 // - it resets the synchronisation variable _dma_busy[ channel_id].88 // - it resets the synchronisation variable _dma_busy[dma_global_id]. 89 89 /////////////////////////////////////////////////////////////////////////////////// 90 90 void _isr_dma( unsigned int channel_id ) 91 91 { 92 // compute cluster_id and loc_id 93 unsigned int cluster_id = channel_id / NB_DMAS_MAX; 94 unsigned int local_id = channel_id % NB_DMAS_MAX; 92 // compute cluster_id 93 unsigned int cluster_id = _procid()/NB_PROCS_MAX; 94 95 // compute dma_global_id 96 unsigned int dma_global_id = cluster_id*NB_DMAS_MAX + channel_id; 95 97 96 98 // save DMA channel status 97 if ( _dma_get_status(cluster_id, local_id, &_dma_status[channel_id]) ) 99 if ( _dma_get_status(cluster_id, 100 channel_id, 101 (unsigned int*)&_dma_status[dma_global_id] ) ) 98 102 { 99 103 _get_lock(&_tty_put_lock); … … 104 108 105 109 // reset DMA channel irq 106 if ( _dma_reset_irq(cluster_id, local_id) ) 110 if ( _dma_reset_irq( cluster_id, 111 channel_id) ) 107 112 { 108 113 _get_lock(&_tty_put_lock); … … 113 118 114 119 // release DMA channel 115 _dma_done[ channel_id] = 1;120 _dma_done[dma_global_id] = 1; 116 121 } 117 122 … … 125 130 { 126 131 // save status & reset IRQ 127 if ( _ioc_get_status( &_ioc_status ) )132 if ( _ioc_get_status( (unsigned int*)&_ioc_status ) ) 128 133 { 129 134 _get_lock(&_tty_put_lock); … … 143 148 // These timers are distributed in all clusters, and can be implemented 144 149 // in a vci_multi_timer component, or in a vci_xicu component. 145 // The timer_id argument is a global index: 146 // timer_id = cluster_id*(NB_TIMERS_MAX+NB_PROCS_MAX) + local_id 147 // The user timer local index is (loc_id - NB_PROCS_MAX). 148 // 150 // The timer_id argument is the user timer local index. 151 // timer_globa_id = cluster_id*(NB_TIMERS_MAX) + timer_id 149 152 // The ISR acknowledges the IRQ and registers the event in the proper entry 150 153 // of the _timer_event[] array, and a log message is displayed on kernel terminal. … … 152 155 void _isr_timer(unsigned int timer_id) 153 156 { 154 155 unsigned int cluster_id = timer_id / (NB_TIMERS_MAX + NB_PROCS_MAX); 156 unsigned int local_id = timer_id % (NB_TIMERS_MAX + NB_PROCS_MAX); 157 158 // checking timer type 159 if (local_id < NB_PROCS_MAX ) 160 { 161 _get_lock(&_tty_put_lock); 162 _puts("[GIET ERROR] Strange... User timer ISR for a system timer\n"); 163 _release_lock(&_tty_put_lock); 164 return; 165 } 157 // compute cluster_id 158 unsigned int cluster_id = _procid()/NB_PROCS_MAX; 166 159 167 160 // aknowledge IRQ 168 if ( _timer_reset_irq( cluster_id, local_id ) ) 161 if ( _timer_reset_irq( cluster_id, 162 NB_PROCS_MAX + timer_id ) ) 169 163 { 170 164 _get_lock(&_tty_put_lock); … … 176 170 #if NB_TIMERS_MAX 177 171 // register the event 178 _timer_event[(cluster_id*NB_TIMERS_MAX) + (loc_id - NB_PROCS_MAX)] = 1; 172 unsigned int timer_global_id = cluster_id*NB_TIMERS_MAX + timer_id; 173 _user_timer_event[timer_global_id] = 1; 179 174 #endif 180 175 181 176 // display a message on TTY 0 182 177 _get_lock(&_tty_put_lock); 183 _puts(" [GIET] User Timer IRQ at cycle ");178 _puts("\n[GIET] User Timer IRQ at cycle "); 184 179 _putd( _proctime() ); 185 _puts(" / index = "); 186 _putd(timer_id); 180 _puts("\n - cluster_id = "); 181 _putd( cluster_id ); 182 _puts("\n - timer_id = "); 183 _putd( timer_id ); 187 184 _puts("\n"); 188 185 _release_lock(&_tty_put_lock); … … 194 191 // signaling that a character is available. 195 192 // There is one single multi_tty component controling all TTYs, 196 // and the tty_id //argument is the global TTY index.193 // and the tty_id argument is the global TTY index. 197 194 // There is one communication buffer _tty_buf[tty_id] per terminal. 198 195 // The sychronisation variable _tty_full[tty_id], is set by the ISR, … … 203 200 { 204 201 // save character and reset IRQ 205 if ( _tty_get_char( tty_id, &_tty_get_buf[tty_id] ) ) 202 if ( _tty_get_char( tty_id, 203 (unsigned char*)&_tty_get_buf[tty_id] ) ) 206 204 { 207 205 _get_lock(&_tty_put_lock);
Note: See TracChangeset
for help on using the changeset viewer.