1 | /* |
---|
2 | * Instantiate the clock driver shell. |
---|
3 | * |
---|
4 | * $Id$ |
---|
5 | */ |
---|
6 | |
---|
7 | #include <bsp.h> |
---|
8 | |
---|
9 | #define CLOCK_VECTOR 84 |
---|
10 | |
---|
11 | #define Clock_driver_support_install_isr( _new, _old ) \ |
---|
12 | do { _old = (rtems_isr_entry) set_vector( _new, CLOCK_VECTOR, 1 ); } while(0) |
---|
13 | |
---|
14 | |
---|
15 | typedef struct { |
---|
16 | volatile unsigned8 cr; /* 0 - 0 : Timer Control Register */ |
---|
17 | volatile unsigned8 pad0; /* 1 - 1 : pad */ |
---|
18 | volatile unsigned8 ivr; /* 2 - 2 : Timer Interrupt Vector Register */ |
---|
19 | volatile unsigned8 pad1; /* 3 - 3 : pad */ |
---|
20 | volatile unsigned32 cpr; /* 4 - 7 : Timer Counter Preload Register */ |
---|
21 | volatile unsigned8 pad2[12]; /* 8 - 19 : pad */ |
---|
22 | volatile unsigned32 sr; /* 20 - 23 : Timer Status Register */ |
---|
23 | } timer_hw_t; |
---|
24 | |
---|
25 | #define TIMER_BASE (timer_hw_t *)0x72001 |
---|
26 | |
---|
27 | /* 8 microseconds per click, 125,000 per second */ |
---|
28 | |
---|
29 | /* XXX should check that microseconds_per_tick is >= 8 */ |
---|
30 | void Clock_driver_support_initialize_hardware() |
---|
31 | { |
---|
32 | timer_hw_t *t = TIMER_BASE; |
---|
33 | |
---|
34 | t->ivr = CLOCK_VECTOR; |
---|
35 | t->cpr = rtems_configuration_get_microseconds_per_tick() / 8; |
---|
36 | t->cr = 0xA0; /* initialize with timer disabled */ |
---|
37 | t->cr = 0xA1; /* enable timer */ |
---|
38 | } |
---|
39 | |
---|
40 | void Clock_driver_support_at_tick() |
---|
41 | { |
---|
42 | timer_hw_t *t = TIMER_BASE; |
---|
43 | |
---|
44 | t->sr = 0xA0; /* Negate timer interrupt request */ |
---|
45 | } |
---|
46 | |
---|
47 | |
---|
48 | void Clock_driver_support_shutdown_hardware() |
---|
49 | { |
---|
50 | timer_hw_t *t = TIMER_BASE; |
---|
51 | |
---|
52 | t->cr = 0xA0; /* initialize with timer disabled */ |
---|
53 | } |
---|
54 | |
---|
55 | #include "../../../shared/clockdrv_shell.c" |
---|