Changeset 0b83afe9 in rtems


Ignore:
Timestamp:
Jul 14, 2006, 8:11:29 PM (14 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
1ac7a00
Parents:
8eb78a20
Message:

2006-07-13 Jerry Needell <jerry.needell@…>

  • clock/ckinit.c, include/leon.h, timer/timer.c, amba/amba.c fixed up merge from 4.6.6. Correct references to LEON3_IrqCtrl_Regs_Map.mask[x] and LEON3_Timer_Regs_Map.timer[x].
Location:
c/src/lib/libbsp/sparc/leon3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/leon3/ChangeLog

    r8eb78a20 r0b83afe9  
     12006-07-13      Jerry Needell <jerry.needell@unh.edu>
     2
     3        * clock/ckinit.c, include/leon.h, timer/timer.c, amba/amba.c
     4        fixed up merge from 4.6.6. Correct references to
     5        LEON3_IrqCtrl_Regs_Map.mask[x] and LEON3_Timer_Regs_Map.timer[x].
     6
    172006-07-12      Jerry Needell <jerry.needell@unh.edu>
    28
  • c/src/lib/libbsp/sparc/leon3/amba/amba.c

    r8eb78a20 r0b83afe9  
    1414 */
    1515
    16 #include <leon.h>
     16#include <bsp.h>
    1717
    1818#define amba_insert_device(tab, address) \
     
    3232volatile LEON3_IrqCtrl_Regs_Map *LEON3_IrqCtrl_Regs;
    3333
     34int LEON3_Cpu_Index = 0;
     35static int apb_init = 0;
     36
    3437/*
    3538 *  bsp_leon3_predriver_hook
     
    4245 */
    4346
     47unsigned int getasr17();
     48
     49asm(" .text  \n"
     50    "getasr17:   \n"
     51    "retl \n"
     52    "mov %asr17, %o0\n"
     53);
     54   
     55     
     56extern rtems_configuration_table Configuration;
    4457
    4558void bsp_leon3_predriver_hook(void)
     
    4861  unsigned int mbar, iobar, conf;
    4962  int i, j;
     63  unsigned int tmp;
    5064
    5165  amba_conf.ahbmst.devnr = 0; amba_conf.ahbslv.devnr = 0; amba_conf.apbslv.devnr = 0;
     
    6983    conf = amba_get_confword(amba_conf.ahbslv, i, 0);
    7084    mbar = amba_ahb_get_membar(amba_conf.ahbslv, i, 0);
    71     if ((amba_vendor(conf) == VENDOR_GAISLER) && (amba_device(conf) == GAISLER_APBMST))
     85    if ((amba_vendor(conf) == VENDOR_GAISLER) && (amba_device(conf) == GAISLER_APBMST) &&
     86        (apb_init == 0))
    7287    {
    7388      amba_conf.apbmst = amba_membar_start(mbar);
     
    7893        cfg_area += LEON3_APB_CONF_WORDS;
    7994      }
     95      apb_init = 1;
    8096    }
    8197  }   
     
    90106      iobar = amba_apb_get_membar(amba_conf.apbslv, i);
    91107      LEON3_IrqCtrl_Regs = (volatile LEON3_IrqCtrl_Regs_Map *) amba_iobar_start(amba_conf.apbmst, iobar);
     108      /* asm("mov %%asr17, %0": : "r" (tmp)); */
     109      if (Configuration.User_multiprocessing_table != NULL)
     110      {
     111        tmp = getasr17();
     112        LEON3_Cpu_Index = (tmp >> 28) & 3;
     113      }
    92114      break;
    93115    }
  • c/src/lib/libbsp/sparc/leon3/clock/ckinit.c

    r8eb78a20 r0b83afe9  
    3131 */
    3232
     33extern rtems_configuration_table Configuration;
     34
     35#define LEON3_CLOCK_INDEX (Configuration.User_multiprocessing_table ? LEON3_Cpu_Index : 0)
     36
    3337#define CLOCK_VECTOR LEON_TRAP_TYPE( LEON_INTERRUPT_TIMER1 )
    3438
     
    3741 */
    3842
    39 volatile uint32_t Clock_driver_ticks;
     43volatile rtems_unsigned32 Clock_driver_ticks;
    4044volatile LEON3_Timer_Regs_Map *LEON3_Timer_Regs = 0;
    4145static int clkirq;
     
    4852 */
    4953
    50 extern uint32_t CPU_SPARC_CLICKS_PER_TICK;
     54extern rtems_unsigned32 CPU_SPARC_CLICKS_PER_TICK;
    5155
    5256rtems_isr_entry  Old_ticker;
     
    6064rtems_device_major_number rtems_clock_major = ~0;
    6165rtems_device_minor_number rtems_clock_minor;
    62 
    6366
    6467/*
     
    125128)
    126129{
     130  int i;
     131  unsigned int iobar, conf;
     132
    127133  Clock_driver_ticks = 0;
    128134
     135  /* Find GP Timer */
     136 
     137  i = 0;
     138  while (i < amba_conf.apbslv.devnr)
     139  {
     140    conf = amba_get_confword(amba_conf.apbslv, i, 0);
     141    if ((amba_vendor(conf) == VENDOR_GAISLER) && (amba_device(conf) == GAISLER_GPTIMER))
     142    {
     143      iobar = amba_apb_get_membar(amba_conf.apbslv, i);     
     144      LEON3_Timer_Regs = (volatile LEON3_Timer_Regs_Map *) amba_iobar_start(amba_conf.apbmst, iobar);
     145      break;
     146    }
     147    i++;
     148  }
    129149
    130150  clkirq = (LEON3_Timer_Regs->status & 0xfc) >> 3;
    131151
     152  /* MP */
     153  if (Configuration.User_multiprocessing_table != NULL)
     154  {
     155    clkirq += LEON3_Cpu_Index;
     156  }
     157
    132158  if ( BSP_Configuration.ticks_per_timeslice ) {
    133     Old_ticker = (rtems_isr_entry)
    134       set_vector( clock_isr, LEON_TRAP_TYPE(clkirq), 1 );
    135 
    136     LEON3_Timer_Regs->reload_t0 = CPU_SPARC_CLICKS_PER_TICK - 1;
    137 
    138     LEON3_Timer_Regs->conf_t0 = LEON3_GPTIMER_EN | LEON3_GPTIMER_RL |
    139         LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN;
     159    Old_ticker = (rtems_isr_entry) set_vector( clock_isr, LEON_TRAP_TYPE(clkirq), 1 );
     160
     161    LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].reload = CPU_SPARC_CLICKS_PER_TICK - 1;
     162
     163    LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].conf = LEON3_GPTIMER_EN | LEON3_GPTIMER_RL | LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN;
    140164 
    141165    atexit( Clock_exit );
     
    163187    LEON_Mask_interrupt(LEON_TRAP_TYPE(clkirq));
    164188
    165     LEON3_Timer_Regs->conf_t0 = 0;
     189    LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].conf = 0;
    166190
    167191    /* do not restore old vector */
     
    227251)
    228252{
    229     uint32_t isrlevel;
     253    rtems_unsigned32 isrlevel;
    230254    rtems_libio_ioctl_args_t *args = pargp;
    231255
  • c/src/lib/libbsp/sparc/leon3/include/leon.h

    r8eb78a20 r0b83afe9  
    2727#endif
    2828
    29 #define LEON_INTERRUPT_EXTERNAL_1 5 
     29#define LEON_INTERRUPT_EXTERNAL_1 5
    3030
    3131#ifndef ASM
     
    294294 
    295295#define LEON_Is_interrupt_masked( _source ) \
    296   (LEON3_IrqCtrl_Regs.mask_p0 & (1 << (_source)))
     296  do {\
     297     (LEON3_IrqCtrl_Regs.mask[LEON3_Cpu_Index] & (1 << (_source))); \
     298   } while (0)
     299
    297300 
    298301#define LEON_Mask_interrupt( _source ) \
    299302  do { \
    300303    uint32_t _level; \
    301     \
    302304    _level = sparc_disable_interrupts(); \
    303      LEON3_IrqCtrl_Regs->mask_p0  &= ~(1 << (_source)); \
     305     LEON3_IrqCtrl_Regs->mask[LEON3_Cpu_Index]  &= ~(1 << (_source)); \
    304306    sparc_enable_interrupts( _level ); \
    305307  } while (0)
     
    308310  do { \
    309311    uint32_t _level; \
    310     \
    311312    _level = sparc_disable_interrupts(); \
    312       LEON3_IrqCtrl_Regs->mask_p0 |= (1 << (_source)); \
     313    LEON3_IrqCtrl_Regs->mask[LEON3_Cpu_Index] |= (1 << (_source)); \
    313314    sparc_enable_interrupts( _level ); \
    314315  } while (0)
     
    318319    uint32_t _level; \
    319320    uint32_t _mask = 1 << (_source); \
    320     \
    321321    _level = sparc_disable_interrupts(); \
    322       (_previous) = LEON3_IrqCtrl_Regs->mask_p0; \
    323       LEON3_IrqCtrl_Regs->mask_p0 = _previous & ~_mask; \
     322     (_previous) = LEON3_IrqCtrl_Regs->mask[LEON3_Cpu_Index]; \
     323     LEON3_IrqCtrl_Regs->mask[LEON3_Cpu_Index] = _previous & ~_mask; \
    324324    sparc_enable_interrupts( _level ); \
    325325    (_previous) &= _mask; \
     
    330330    uint32_t _level; \
    331331    uint32_t _mask = 1 << (_source); \
    332     \
    333332    _level = sparc_disable_interrupts(); \
    334       LEON3_IrqCtrl_Regs->mask_p0 = \
    335         (LEON3_IrqCtrl_Regs->mask_p0 & ~_mask) | (_previous); \
     333      LEON3_IrqCtrl_Regs->mask[LEON3_Cpu_Index] = \
     334        (LEON3_IrqCtrl_Regs->mask[LEON3_Cpu_Index] & ~_mask) | (_previous); \
    336335    sparc_enable_interrupts( _level ); \
    337336  } while (0)
     337
    338338
    339339/*
     
    368368#define LEON_REG_TIMER_COUNTER_CURRENT_MODE_MASK  0x00000003
    369369
    370 /* XXX really needed but I can't get it to install -- JRS */
    371 /* #include <spacewire.h> */
    372  
    373370#endif /* !ASM */
    374371
     
    378375
    379376#endif /* !_INCLUDE_LEON_h */
    380 
     377/* end of include file */
     378
  • c/src/lib/libbsp/sparc/leon3/timer/timer.c

    r8eb78a20 r0b83afe9  
    2323#include <bsp.h>
    2424
     25extern rtems_configuration_table Configuration;
     26
     27#define LEON3_TIMER_INDEX \
     28  (Configuration.User_multiprocessing_table ?  \
     29         (Configuration.User_multiprocessing_table)->maximum_nodes + \
     30         (Configuration.User_multiprocessing_table)->node - 1 : 1)
     31
    2532rtems_boolean Timer_driver_Find_average_overhead;
    2633
     
    2835
    2936extern volatile LEON3_Timer_Regs_Map *LEON3_Timer_Regs;
    30  
    3137
    3238void Timer_initialize()
    3339{
    34 
    3540  /*
    3641   *  Timer runs long and accurate enough not to require an interrupt.
     
    3944    if ( Timer_driver_Is_initialized == FALSE ) {
    4045      /* approximately 1 us per countdown */
    41       LEON3_Timer_Regs->reload_t1 = 0xffffff;
    42       LEON3_Timer_Regs->value_t1 = 0xffffff;
     46      LEON3_Timer_Regs->timer[LEON3_TIMER_INDEX].reload = 0xffffff;
     47      LEON3_Timer_Regs->timer[LEON3_TIMER_INDEX].value = 0xffffff;
    4348    } else {
    4449      Timer_driver_Is_initialized = TRUE;
    4550    }
    46     LEON3_Timer_Regs->conf_t1 = LEON3_GPTIMER_EN | LEON3_GPTIMER_LD;
     51    LEON3_Timer_Regs->timer[LEON3_TIMER_INDEX].conf = LEON3_GPTIMER_EN | LEON3_GPTIMER_LD;
    4752  }
    4853}
     
    5459int Read_timer()
    5560{
    56   uint32_t  total;
     61  rtems_unsigned32  total;
    5762
    5863  if (LEON3_Timer_Regs) {
    59     total = LEON3_Timer_Regs->value_t1;
     64    total = LEON3_Timer_Regs->timer[LEON3_TIMER_INDEX].value;
    6065   
    6166    total = 0xffffff - total;
     
    6671    if ( total < LEAST_VALID )
    6772      return 0;            /* below timer resolution */
    68    
     73
    6974    return total - AVG_OVERHEAD;
    7075  }
Note: See TracChangeset for help on using the changeset viewer.