Changeset 216 for soft/giet_vm/sys


Ignore:
Timestamp:
Sep 18, 2012, 6:38:49 PM (12 years ago)
Author:
karaoui
Message:
  • updating irq_handler.c/drivers.c to support the nex affectations of timers
  • When using an xicu the number of timer is set to 32
Location:
soft/giet_vm/sys
Files:
3 edited

Legend:

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

    r215 r216  
    7878#endif
    7979
    80 #if ( (NB_TIMERS_MAX + NB_PROCS_MAX) > 32 )
     80#if ( (NB_TIMERS_MAX) > 32 )
    8181# error: NB_TIMERS_MAX + NB_PROCS_MAX cannot be larger than 32
    8282#endif
     
    111111//   local_id in [0, NB_PROCS_MAX-1],
    112112// - "user" timers : requested by the task in the mapping_info data structure.
    113 //   local_id in [NB_PROC_MAX, NB_PROCS_MAX + NB_TIMERS_MAX - 1]
    114113//   For each user timer, the timer_id is stored in the context of the task.
    115114// The global index is cluster_id * (NB_PROCS_MAX+NB_TIMERS_MAX) + local_id
     
    136135{
    137136    // parameters checking
    138     if ( cluster_id >= NB_CLUSTERS)                                     return 1;
    139     if ( local_id >= NB_TIMERS_MAX + NB_PROCS_MAX ) return 1;
     137    if ( cluster_id >= NB_CLUSTERS)     return 1;
     138    if ( local_id >= NB_TIMERS_MAX) return 2;
    140139
    141140#if USE_XICU
     
    164163{
    165164    // parameters checking
    166     if ( cluster_id >= NB_CLUSTERS)                                     return 1;
    167     if ( local_id >= NB_TIMERS_MAX + NB_PROCS_MAX ) return 1;
     165    if ( cluster_id >= NB_CLUSTERS)      return 1;
     166    if ( local_id >= NB_TIMERS_MAX ) return 2;
    168167
    169168#if USE_XICU
     
    193192{
    194193    // parameters checking
    195     if ( cluster_id >= NB_CLUSTERS)                                     return 1;
    196     if ( local_id >= NB_TIMERS_MAX + NB_PROCS_MAX ) return 1;
     194    if ( cluster_id >= NB_CLUSTERS)      return 1;
     195    if ( local_id >= NB_TIMERS_MAX ) return 2;
    197196
    198197#if USE_XICU
  • soft/giet_vm/sys/irq_handler.c

    r215 r216  
    4545    unsigned int        irq_id;
    4646
     47
    4748    // get the highest priority active IRQ index
    4849    if ( _icu_get_index( pid / NB_PROCS_MAX,
     
    5556    }
    5657
     58
    5759    if ( irq_id < 32 )  // do nothing if no interrupt active
    5860    {
     
    6062        unsigned int isr_id     = entry & 0x000000FF;
    6163        unsigned int channel_id = (entry>>16) & 0x0000FFFF;
    62         if      ( isr_id == ISR_SWITCH  ) _isr_switch();
     64        if      ( isr_id == ISR_SWITCH  ) _isr_switch( channel_id );
    6365        else if ( isr_id == ISR_IOC     ) _isr_ioc();
    6466        else if ( isr_id == ISR_DMA     ) _isr_dma( channel_id );
     
    169171    // aknowledge IRQ
    170172    if ( _timer_reset_irq( cluster_id,
    171                            NB_PROCS_MAX + timer_id ) )
     173                           timer_id ) )
    172174    {
    173175        _get_lock(&_tty_put_lock);
     
    230232// The ISR acknowledges the IRQ and calls the _ctx_switch() function.
    231233/////////////////////////////////////////////////////////////////////////////////////
    232 void _isr_switch()
     234void _isr_switch( unsigned int timer_id)
    233235{
    234236    // get cluster index and proc local index
    235     unsigned int pid        = _procid();
    236     unsigned int local_id   = pid % NB_PROCS_MAX;
    237     unsigned int cluster_id = pid / NB_PROCS_MAX;
     237    unsigned int cluster_id = _procid() / NB_PROCS_MAX;
    238238
    239239    // acknowledge IRQ
    240     if ( _timer_reset_irq( cluster_id, local_id ) )
     240    if ( _timer_reset_irq( cluster_id, timer_id ) )
    241241    {
    242242        _get_lock(&_tty_put_lock);
  • soft/giet_vm/sys/kernel_init.c

    r215 r216  
    124124    }
    125125 
     126    unsigned int isr_switch_channel = 0xFFFFFFFF;
     127
    126128    // step 3 : compute and set ICU masks
    127129    //          there is at most 32 interrupts per processor
     
    131133    unsigned int hwi_mask = 0;
    132134    unsigned int pti_mask = 0;
    133 
    134     unsigned int isr_switch_channel = 0xFFFFFFFF;
    135135
    136136    for ( irq_id = 0 ; irq_id < 32 ; irq_id++ )
     
    173173        if(isr_switch_channel == 0xFFFFFFFF)
    174174        {
     175            _get_lock(&_tty_put_lock);
    175176            _puts("\n[GIET ERROR] ISR_SWITCH not found on proc ");
    176177            _putd( proc_id);
    177178            _puts("\n");
     179            _release_lock(&_tty_put_lock);
    178180            _sys_exit();
    179181        }
    180         _timer_start( cluster_id,
    181                       isr_switch_channel,
    182                       GIET_TICK_VALUE );
     182
     183        if(_timer_start( cluster_id, isr_switch_channel, GIET_TICK_VALUE ))
     184        {
     185            _get_lock(&_tty_put_lock);
     186            _puts("\n[GIET ERROR] ISR_SWITCH init error for proc ");
     187            _putd( proc_id);
     188            _puts("\n");
     189            _release_lock(&_tty_put_lock);
     190            _sys_exit();
     191        }
    183192       
    184193#if GIET_DEBUG_INIT
Note: See TracChangeset for help on using the changeset viewer.