Ignore:
Timestamp:
Aug 14, 2012, 8:14:55 PM (12 years ago)
Author:
alain
Message:

mproving support for multi-clusters architectures (CLUSTER_SIZE & CLUSTER_IO_ID parameters)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/sys/irq_handler.c

    r203 r204  
    9292    // compute cluster_id and loc_id
    9393    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;
    10095
    10196    // 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    }
    106113
    107114    // release DMA channel
     
    117124void _isr_ioc()
    118125{
    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;
    123137}
    124138
     
    148162        _puts("[GIET ERROR] Strange... User timer ISR for a system timer\n");
    149163        _release_lock(&_tty_put_lock);
     164        return;
    150165    }
    151166
    152167    // 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    }
    154175
    155176#if NB_TIMERS_MAX
     
    172193// This ISR handles the IRQs generated by the multi_tty controler,
    173194// signaling that a character is available.
    174 // There is one single multi_tty component controling all TTYs, and the tty_id
    175 // argument 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.
    176197// There is one communication buffer _tty_buf[tty_id] per terminal.
    177198// The sychronisation variable _tty_full[tty_id], is set by the ISR,
     
    181202void _isr_tty(unsigned int tty_id)
    182203{
    183     // compute terminal base address
    184     unsigned int *tty_address = (unsigned int*)&seg_tty_base + (tty_id * TTY_SPAN);
    185 
    186204    // 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    }
    188212
    189213    // signals character available
     
    207231
    208232    // 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    }
    210240
    211241    // performs the context switch
Note: See TracChangeset for help on using the changeset viewer.