OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [c/] [src/] [lib/] [libbsp/] [powerpc/] [psim/] [clock/] [clock.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
2
 *  Instantiate the clock driver shell for psim based
3
 *  on the decrementer register.
4
 *
5
 *  clock.c,v 1.6 2001/08/16 19:38:05 joel Exp
6
 */
7
 
8
#include <rtems.h>
9
 
10
/*
11
 *  If defined, speed up the clock ticks while the idle task is running so
12
 *  time spent in the idle task is minimized.  This significantly reduces
13
 *  the wall time required to execute the RTEMS test suites.
14
 */
15
 
16
#define CLOCK_DRIVER_USE_FAST_IDLE
17
 
18
#define CLOCK_VECTOR PPC_IRQ_DECREMENTER
19
 
20
/*  On psim, each click of the decrementer register corresponds
21
 *  to 1 instruction.  By setting this to 100, we are indicating
22
 *  that we are assuming it can execute 100 instructions per
23
 *  microsecond.  This corresponds to sustaining 1 instruction
24
 *  per cycle at 100 Mhz.  Whether this is a good guess or not
25
 *  is anyone's guess.
26
 */
27
 
28
extern int PSIM_INSTRUCTIONS_PER_MICROSECOND;
29
 
30
unsigned int PPC_DECREMENTER_CLICKS;
31
 
32
#define Clock_driver_support_install_isr( _new, _old ) \
33
  do { \
34
    _old = (rtems_isr_entry) set_vector( _new, CLOCK_VECTOR, 1 ); \
35
    PPC_DECREMENTER_CLICKS = (unsigned int)&PSIM_INSTRUCTIONS_PER_MICROSECOND; \
36
    PPC_DECREMENTER_CLICKS *= rtems_configuration_get_microseconds_per_tick(); \
37
    /* PPC_DECREMENTER_CLICKS = 5000; */ \
38
  } while(0)
39
 
40
#define Clock_driver_support_initialize_hardware() \
41
  do { \
42
    unsigned int _clicks = PPC_DECREMENTER_CLICKS; \
43
    PPC_Set_decrementer( _clicks ); \
44
  } while (0)
45
 
46
#define Clock_driver_support_at_tick() \
47
  Clock_driver_support_initialize_hardware()
48
 
49
#define Clock_driver_support_shutdown_hardware()
50
 
51
#include "../../../shared/clockdrv_shell.c"

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.