1 | /* |
---|
2 | * COPYRIGHT (c) 1989-1999. |
---|
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.com/license/LICENSE. |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | #ifndef _RTEMS_TMTEST27 |
---|
13 | #error "This is an RTEMS internal file you must not include directly." |
---|
14 | #endif |
---|
15 | |
---|
16 | #ifndef __tm27_h |
---|
17 | #define __tm27_h |
---|
18 | |
---|
19 | #include <bsp/irq.h> |
---|
20 | |
---|
21 | #define MUST_WAIT_FOR_INTERRUPT 1 |
---|
22 | |
---|
23 | void nullFunc() {} |
---|
24 | |
---|
25 | static rtems_irq_connect_data clockIrqData = {BSP_DECREMENTER, |
---|
26 | 0, |
---|
27 | (rtems_irq_enable)nullFunc, |
---|
28 | (rtems_irq_disable)nullFunc, |
---|
29 | (rtems_irq_is_enabled) nullFunc}; |
---|
30 | void Install_tm27_vector(void (*_handler)()) |
---|
31 | { |
---|
32 | clockIrqData.hdl = _handler; |
---|
33 | if (!BSP_install_rtems_irq_handler (&clockIrqData)) { |
---|
34 | printk("Error installing clock interrupt handler!\n"); |
---|
35 | rtems_fatal_error_occurred(1); |
---|
36 | } |
---|
37 | } |
---|
38 | |
---|
39 | #define Cause_tm27_intr() \ |
---|
40 | do { \ |
---|
41 | unsigned32 _clicks = 8; \ |
---|
42 | asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \ |
---|
43 | } while (0) |
---|
44 | |
---|
45 | |
---|
46 | #define Clear_tm27_intr() \ |
---|
47 | do { \ |
---|
48 | unsigned32 _clicks = 0xffffffff; \ |
---|
49 | asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \ |
---|
50 | } while (0) |
---|
51 | |
---|
52 | #define Lower_tm27_intr() \ |
---|
53 | do { \ |
---|
54 | unsigned32 _msr = 0; \ |
---|
55 | _ISR_Set_level( 0 ); \ |
---|
56 | asm volatile( "mfmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \ |
---|
57 | _msr |= 0x8002; \ |
---|
58 | asm volatile( "mtmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \ |
---|
59 | } while (0) |
---|
60 | #endif |
---|