RTEMS  5.1
tm27.h
1 /*
2  * @file
3  * @ingroup powerpc_gen5200
4  * @brief Implementations for interrupt mechanisms for Time Test 27
5  */
6 
7 /*
8  * The license and distribution terms for this file may be
9  * found in the file LICENSE in this distribution or at
10  * http://www.rtems.org/license/LICENSE.
11  */
12 
13 #ifndef _RTEMS_TMTEST27
14 #error "This is an RTEMS internal file you must not include directly."
15 #endif
16 
17 #ifndef __tm27_h
18 #define __tm27_h
19 
20 #include <bsp/fatal.h>
21 #include <bsp/irq.h>
22 
23 /*
24  * Stuff for Time Test 27
25  */
26 
27 #define MUST_WAIT_FOR_INTERRUPT 1
28 
29 static void nullFunc(void) {}
30 
31 static rtems_irq_connect_data clockIrqData = {BSP_DECREMENTER,
32  0,
33  (rtems_irq_enable) nullFunc,
34  (rtems_irq_disable) nullFunc,
35  (rtems_irq_is_enabled) nullFunc};
36 
37 RTEMS_INLINE_ROUTINE void Install_tm27_vector(void (*_handler)(void))
38 {
39  clockIrqData.hdl = _handler;
40  if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
41  printk("Error installing clock interrupt handler!\n");
42  bsp_fatal(MPC5200_FATAL_TM27_IRQ_INSTALL);
43  }
44 }
45 
46 #define Cause_tm27_intr() \
47  do { \
48  uint32_t _clicks = 8; \
49  __asm__ volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
50  } while (0)
51 
52 #define Clear_tm27_intr() \
53  do { \
54  uint32_t _clicks = 0xffffffff; \
55  __asm__ volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
56  } while (0)
57 
58 #define Lower_tm27_intr() \
59  do { \
60  uint32_t _msr = 0; \
61  _ISR_Set_level( 0 ); \
62  __asm__ volatile( "mfmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \
63  _msr |= 0x8002; \
64  __asm__ volatile( "mtmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \
65  } while (0)
66 
67 #endif
Definition: irq.h:45
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
int BSP_install_rtems_irq_handler(const rtems_irq_connect_data *cd)
Definition: irq-legacy.c:44
int printk(const char *fmt,...) RTEMS_PRINTFLIKE(1
Kernel Print.