source: rtems/c/src/lib/libbsp/sparc/leon3/clock/ckinit.c @ 921bb59

4.104.114.84.95
Last change on this file since 921bb59 was 921bb59, checked in by Joel Sherrill <joel.sherrill@…>, on 09/06/07 at 00:07:44

2007-09-05 Daniel Hellstrom <daniel@…>

  • clock/ckinit.c, console/console.c, leon_greth/leon_greth.c, leon_smc91111/leon_smc91111.c: LEON3 BSP drivers updated to use new AMBA PnP scanning functions. Affected drivers: amba/amba.c,clock/ckinit.c,console/console.c, leon_greth/leon_greth.c, leon_smc9111.c.
  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2 *  Clock Tick Device Driver
3 *
4 *  This routine initializes LEON timer 1 which used for the clock tick.
5 *
6 *  The tick frequency is directly programmed to the configured number of
7 *  microseconds per tick.
8 *
9 *  COPYRIGHT (c) 1989-2006.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  Modified for LEON3 BSP.
13 *  COPYRIGHT (c) 2004.
14 *  Gaisler Research.
15 *
16 *  The license and distribution terms for this file may be
17 *  found in the file LICENSE in this distribution or at
18 *  http://www.rtems.com/license/LICENSE.
19 *
20 *  $Id$
21 */
22
23#include <bsp.h>
24#include <bspopts.h>
25
26#if SIMSPARC_FAST_IDLE==1
27#define CLOCK_DRIVER_USE_FAST_IDLE
28#endif
29
30/*
31 *  The Real Time Clock Counter Timer uses this trap type.
32 */
33
34extern rtems_configuration_table Configuration;
35
36#define LEON3_CLOCK_INDEX \
37  (Configuration.User_multiprocessing_table ? LEON3_Cpu_Index : 0)
38
39volatile LEON3_Timer_Regs_Map *LEON3_Timer_Regs = 0;
40static int clkirq;
41
42#define CLOCK_VECTOR LEON_TRAP_TYPE( clkirq )
43
44#define Clock_driver_support_at_tick()
45
46#define Clock_driver_support_find_timer() \
47  do { \
48    int cnt; \
49    amba_apb_device dev; \
50    \
51    /* Find LEON3 Interrupt controler */ \
52    cnt = amba_find_apbslv(&amba_conf,VENDOR_GAISLER,GAISLER_IRQMP,&dev); \
53    if ( cnt > 0 ){ \
54      /* Found APB IRQ_MP Interrupt Controller */ \
55      LEON3_IrqCtrl_Regs = (volatile LEON3_IrqCtrl_Regs_Map *) dev.start; \
56      clkirq = (LEON3_Timer_Regs->status & 0xfc) >> 3; \
57      \
58      if (Configuration.User_multiprocessing_table != NULL) { \
59        clkirq += LEON3_Cpu_Index; \
60      } \
61    } \
62  } while (0)
63
64#define Clock_driver_support_install_isr( _new, _old ) \
65  do { \
66    _old = set_vector( _new, CLOCK_VECTOR, 1 ); \
67  } while(0)
68
69#define Clock_driver_support_initialize_hardware() \
70  do { \
71    LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].reload = \
72      BSP_Configuration.microseconds_per_tick - 1; \
73    \
74    LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].conf = \
75      LEON3_GPTIMER_EN | LEON3_GPTIMER_RL | \
76        LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN; \
77  } while (0)
78
79#define Clock_driver_support_shutdown_hardware() \
80  do { \
81    LEON_Mask_interrupt(LEON_TRAP_TYPE(clkirq)); \
82    LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].conf = 0; \
83  } while (0)
84
85#include "../../../shared/clockdrv_shell.c"
Note: See TracBrowser for help on using the repository browser.