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