1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * Instantiate the clock driver shell. |
---|
5 | * |
---|
6 | * The TX3904 simulator in gdb counts instructions. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2012. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.org/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #include <rtems.h> |
---|
19 | #include <bsp/irq.h> |
---|
20 | #include <bsp.h> |
---|
21 | |
---|
22 | #define CLOCK_DRIVER_USE_FAST_IDLE 1 |
---|
23 | |
---|
24 | #define CLOCK_VECTOR TX3904_IRQ_TMR0 |
---|
25 | |
---|
26 | /* |
---|
27 | * 5000 clicks per tick ISR is HIGHLY arbitrary |
---|
28 | */ |
---|
29 | |
---|
30 | #define CLICKS 5000 |
---|
31 | |
---|
32 | #define Clock_driver_support_install_isr( _new, _old ) \ |
---|
33 | do { \ |
---|
34 | rtems_interrupt_handler_install( \ |
---|
35 | CLOCK_VECTOR, \ |
---|
36 | "clock", \ |
---|
37 | 0, \ |
---|
38 | _new, \ |
---|
39 | NULL \ |
---|
40 | ); \ |
---|
41 | } while(0) |
---|
42 | |
---|
43 | #define Clock_driver_support_initialize_hardware() \ |
---|
44 | do { \ |
---|
45 | uint32_t _clicks = CLICKS; \ |
---|
46 | TX3904_TIMER_WRITE( TX3904_TIMER0_BASE, TX3904_TIMER_CCDR, 0x3 ); \ |
---|
47 | TX3904_TIMER_WRITE( TX3904_TIMER0_BASE, TX3904_TIMER_CPRA, _clicks ); \ |
---|
48 | TX3904_TIMER_WRITE( TX3904_TIMER0_BASE, TX3904_TIMER_TISR, 0x00 ); \ |
---|
49 | TX3904_TIMER_WRITE( TX3904_TIMER0_BASE, TX3904_TIMER_ITMR, 0x8001 ); \ |
---|
50 | TX3904_TIMER_WRITE( TX3904_TIMER0_BASE, TX3904_TIMER_TCR, 0xC0 ); \ |
---|
51 | *((volatile uint32_t*) 0xFFFFC01C) = 0x00000700; \ |
---|
52 | } while(0) |
---|
53 | |
---|
54 | #define Clock_driver_support_shutdown_hardware() |
---|
55 | |
---|
56 | #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER |
---|
57 | |
---|
58 | #include "../../../shared/clockdrv_shell.h" |
---|