diff options
Diffstat (limited to 'bsps/mips/jmr3904')
-rw-r--r-- | bsps/mips/jmr3904/clock/clockdrv.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/bsps/mips/jmr3904/clock/clockdrv.c b/bsps/mips/jmr3904/clock/clockdrv.c new file mode 100644 index 0000000000..e0539f1f3f --- /dev/null +++ b/bsps/mips/jmr3904/clock/clockdrv.c @@ -0,0 +1,50 @@ +/** + * @file + * + * Instantiate the clock driver shell. + * + * The TX3904 simulator in gdb counts instructions. + */ + +/* + * COPYRIGHT (c) 1989-2012. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#include <rtems.h> +#include <bsp/irq.h> +#include <bsp.h> + +#define CLOCK_DRIVER_USE_FAST_IDLE 1 + +#define CLOCK_VECTOR TX3904_IRQ_TMR0 + +/* + * 5000 clicks per tick ISR is HIGHLY arbitrary + */ + +#define CLICKS 5000 + +#define Clock_driver_support_install_isr( _new ) \ + rtems_interrupt_handler_install( CLOCK_VECTOR, "clock", 0, _new, NULL ) + +#define Clock_driver_support_initialize_hardware() \ + do { \ + uint32_t _clicks = CLICKS; \ + TX3904_TIMER_WRITE( TX3904_TIMER0_BASE, TX3904_TIMER_CCDR, 0x3 ); \ + TX3904_TIMER_WRITE( TX3904_TIMER0_BASE, TX3904_TIMER_CPRA, _clicks ); \ + TX3904_TIMER_WRITE( TX3904_TIMER0_BASE, TX3904_TIMER_TISR, 0x00 ); \ + TX3904_TIMER_WRITE( TX3904_TIMER0_BASE, TX3904_TIMER_ITMR, 0x8001 ); \ + TX3904_TIMER_WRITE( TX3904_TIMER0_BASE, TX3904_TIMER_TCR, 0xC0 ); \ + *((volatile uint32_t*) 0xFFFFC01C) = 0x00000700; \ + } while(0) + +#define Clock_driver_support_shutdown_hardware() + +#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER + +#include "../../../shared/dev/clock/clockimpl.h" |