Ignore:
Timestamp:
Aug 13, 2012, 10:52:25 PM (12 years ago)
Author:
alain
Message:

Introducing support for XICU

File:
1 edited

Legend:

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

    r189 r203  
    4242
    4343    // 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 ) )
    5347    {
    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);
    5651    }
    57 
    58 #endif
    5952
    6053    if ( irq_id < 32 )  // do nothing if no interrupt active
     
    7467//      _isr_default()
    7568// 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].
    7770///////////////////////////////////////////////////////////////////////////////////
    7871void _isr_default()
    7972{
    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);
    8178}
    8279
     
    122119    unsigned int* ioc_address = (unsigned int*)&seg_ioc_base;
    123120
    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
    126123}
    127124
    128125///////////////////////////////////////////////////////////////////////////////////
    129126//         _isr_timer()
    130 // This ISR handles the IRQs generated by the "user" timers (the IRQs
    131 // generated by 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().
    132129// These timers are distributed in all clusters, and can be implemented
    133130// 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_id
     131// The timer_id argument is a global index:
     132//     timer_id = cluster_id*(NB_TIMERS_MAX+NB_PROCS_MAX) + local_id
    136133// The user timer local index is (loc_id - NB_PROCS_MAX).
    137134//
    138135// 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///////////////////////////////////////////////////////////////////////////////////
     138void _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 )
    149146    {
    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);
    155150    }
    156151
    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 );
    172154
    173155#if NB_TIMERS_MAX
     
    177159
    178160    // 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);
    183166    _puts("\n");
     167    _release_lock(&_tty_put_lock);
    184168}
    185169
     
    219203    // get cluster index and proc local index
    220204    unsigned int pid        = _procid();
    221     unsigned int loc_id     = pid % NB_PROCS_MAX;
     205    unsigned int local_id   = pid % NB_PROCS_MAX;
    222206    unsigned int cluster_id = pid / NB_PROCS_MAX;
    223207
    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 );
    239210
    240211    // performs the context switch
    241212    _ctx_switch();
    242 
    243 }
    244 
     213}
     214
Note: See TracChangeset for help on using the changeset viewer.