[0c0181d] | 1 | /* |
---|
[a15650d] | 2 | * COPYRIGHT (c) 1989-2013. |
---|
[0c0181d] | 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 |
---|
[c499856] | 7 | * http://www.rtems.org/license/LICENSE. |
---|
[0c0181d] | 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 | |
---|
[a15650d] | 25 | static uint32_t mips_timer_rate = 0; |
---|
[0c0181d] | 26 | |
---|
| 27 | /* refresh the internal CPU timer */ |
---|
| 28 | #define Clock_driver_support_at_tick() \ |
---|
| 29 | mips_set_timer( mips_timer_rate ); |
---|
| 30 | |
---|
[f3b29236] | 31 | #define Clock_driver_support_install_isr( _new ) \ |
---|
| 32 | rtems_interrupt_handler_install(CLOCK_VECTOR, "PIT clock",0, _new, NULL) |
---|
[0c0181d] | 33 | |
---|
| 34 | #define Clock_driver_support_initialize_hardware() \ |
---|
| 35 | do { \ |
---|
| 36 | mips_timer_rate = rtems_configuration_get_microseconds_per_tick() * \ |
---|
| 37 | bsp_clicks_per_microsecond; \ |
---|
| 38 | mips_set_timer( mips_timer_rate ); \ |
---|
| 39 | mips_enable_in_interrupt_mask(CLOCK_VECTOR_MASK); \ |
---|
| 40 | } while(0) |
---|
| 41 | |
---|
| 42 | #define Clock_driver_support_shutdown_hardware() \ |
---|
| 43 | do { \ |
---|
| 44 | mips_disable_in_interrupt_mask(CLOCK_VECTOR_MASK); \ |
---|
| 45 | } while (0) |
---|
| 46 | |
---|
[75acd9e] | 47 | #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER |
---|
| 48 | |
---|
[0c0181d] | 49 | #include "../../../shared/clockdrv_shell.h" |
---|