Ignore:
Timestamp:
Aug 16, 2012, 6:36:16 PM (12 years ago)
Author:
alain
Message:

Several bugs have been fixed to support TSAR multi-cluster architecture
such as the "tsarv4-generic_mmu" platform.

File:
1 edited

Legend:

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

    r204 r207  
    8282// This ISR handles all IRQs generated by the multi-channels DMA controlers.
    8383// 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_id
    86 // - 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].
    8787// - 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].
    8989///////////////////////////////////////////////////////////////////////////////////
    9090void _isr_dma( unsigned int channel_id )
    9191{
    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;
    9597
    9698    // 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] ) )
    98102    {
    99103        _get_lock(&_tty_put_lock);
     
    104108
    105109    // reset DMA channel irq
    106     if ( _dma_reset_irq(cluster_id, local_id) )
     110    if ( _dma_reset_irq( cluster_id,
     111                         channel_id) )
    107112    {
    108113        _get_lock(&_tty_put_lock);
     
    113118
    114119    // release DMA channel
    115     _dma_done[channel_id] = 1; 
     120    _dma_done[dma_global_id] = 1; 
    116121}
    117122
     
    125130{
    126131     // save status & reset IRQ
    127     if ( _ioc_get_status( &_ioc_status ) )
     132    if ( _ioc_get_status( (unsigned int*)&_ioc_status ) )
    128133    {
    129134        _get_lock(&_tty_put_lock);
     
    143148// These timers are distributed in all clusters, and can be implemented
    144149// 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
    149152// The ISR acknowledges the IRQ and registers the event in the proper entry
    150153// of the _timer_event[] array, and a log message is displayed on kernel terminal.
     
    152155void _isr_timer(unsigned int timer_id)
    153156{
    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;
    166159
    167160    // aknowledge IRQ
    168     if ( _timer_reset_irq( cluster_id, local_id ) )
     161    if ( _timer_reset_irq( cluster_id,
     162                           NB_PROCS_MAX + timer_id ) )
    169163    {
    170164        _get_lock(&_tty_put_lock);
     
    176170#if NB_TIMERS_MAX
    177171    // 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;
    179174#endif
    180175
    181176    // display a message on TTY 0
    182177    _get_lock(&_tty_put_lock);
    183     _puts("[GIET] User Timer IRQ at cycle ");
     178    _puts("\n[GIET] User Timer IRQ at cycle ");
    184179    _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 );
    187184    _puts("\n");
    188185    _release_lock(&_tty_put_lock);
     
    194191// signaling that a character is available.
    195192// 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.
    197194// There is one communication buffer _tty_buf[tty_id] per terminal.
    198195// The sychronisation variable _tty_full[tty_id], is set by the ISR,
     
    203200{
    204201    // 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] ) )
    206204    {
    207205        _get_lock(&_tty_put_lock);
Note: See TracChangeset for help on using the changeset viewer.