source: rtems/c/src/lib/libbsp/powerpc/gen5200/include/tm27.h @ c7a5656

4.115
Last change on this file since c7a5656 was c7a5656, checked in by Sebastian Huber <sebastian.huber@…>, on 02/18/13 at 15:29:32

bsp/gen5200: Add and use mpc5200_fatal()

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  tm27.h
3 *
4 *  The license and distribution terms for this file may be
5 *  found in the file LICENSE in this distribution or at
6 *  http://www.rtems.com/license/LICENSE.
7 */
8
9#ifndef _RTEMS_TMTEST27
10#error "This is an RTEMS internal file you must not include directly."
11#endif
12
13#ifndef __tm27_h
14#define __tm27_h
15
16#include <bsp/irq.h>
17
18/*
19 *  Stuff for Time Test 27
20 */
21
22#define MUST_WAIT_FOR_INTERRUPT 1
23
24void nullFunc() {}
25
26static rtems_irq_connect_data clockIrqData = {BSP_DECREMENTER,
27                                              0,
28                                              (rtems_irq_enable)nullFunc,
29                                              (rtems_irq_disable)nullFunc,
30                                              (rtems_irq_is_enabled) nullFunc};
31void Install_tm27_vector(void (*_handler)())
32{
33  clockIrqData.hdl = _handler;
34  if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
35        printk("Error installing clock interrupt handler!\n");
36        mpc5200_fatal(MPC5200_FATAL_TM27_IRQ_INSTALL);
37  }
38}
39
40#define Cause_tm27_intr()  \
41  do { \
42    uint32_t   _clicks = 8; \
43    __asm__ volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
44  } while (0)
45
46#define Clear_tm27_intr() \
47  do { \
48    uint32_t   _clicks = 0xffffffff; \
49    __asm__ volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
50  } while (0)
51
52#define Lower_tm27_intr() \
53  do { \
54    uint32_t   _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
61#endif
Note: See TracBrowser for help on using the repository browser.