1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2013. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.org/license/LICENSE. |
---|
8 | */ |
---|
9 | |
---|
10 | #include <bsp.h> |
---|
11 | #include <bsp/irq.h> |
---|
12 | #include <bspopts.h> |
---|
13 | |
---|
14 | /* XXX convert to macros? Move to score/cpu? */ |
---|
15 | void mips_set_timer(uint32_t timer_clock_interval); |
---|
16 | uint32_t mips_get_timer(void); |
---|
17 | |
---|
18 | /* XXX move to BSP.h or irq.h?? */ |
---|
19 | #define EXT_INT5 0x8000 /* external interrupt 5 */ |
---|
20 | #define CLOCK_VECTOR_MASK EXT_INT5 |
---|
21 | #define CLOCK_VECTOR (MIPS_INTERRUPT_BASE+0x7) |
---|
22 | |
---|
23 | extern uint32_t bsp_clicks_per_microsecond; |
---|
24 | |
---|
25 | static uint32_t mips_timer_rate = 0; |
---|
26 | |
---|
27 | /* refresh the internal CPU timer */ |
---|
28 | #define Clock_driver_support_at_tick() \ |
---|
29 | mips_set_timer( mips_timer_rate ); |
---|
30 | |
---|
31 | #define Clock_driver_support_install_isr( _new, _old ) \ |
---|
32 | do { \ |
---|
33 | rtems_interrupt_handler_install(CLOCK_VECTOR, \ |
---|
34 | "PIT clock",0, _new, NULL); \ |
---|
35 | } while(0) |
---|
36 | |
---|
37 | #define Clock_driver_support_initialize_hardware() \ |
---|
38 | do { \ |
---|
39 | mips_timer_rate = rtems_configuration_get_microseconds_per_tick() * \ |
---|
40 | bsp_clicks_per_microsecond; \ |
---|
41 | mips_set_timer( mips_timer_rate ); \ |
---|
42 | mips_enable_in_interrupt_mask(CLOCK_VECTOR_MASK); \ |
---|
43 | } while(0) |
---|
44 | |
---|
45 | #define Clock_driver_support_shutdown_hardware() \ |
---|
46 | do { \ |
---|
47 | mips_disable_in_interrupt_mask(CLOCK_VECTOR_MASK); \ |
---|
48 | } while (0) |
---|
49 | |
---|
50 | #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER |
---|
51 | |
---|
52 | #include "../../../shared/clockdrv_shell.h" |
---|