source: rtems/c/src/lib/libbsp/powerpc/score603e/include/tm27.h @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 * @file
3 * @ingroup powerpc_score603e
4 * @brief Implementations for interrupt mechanisms for Time Test 27
5 */
6
7/*
8 *  COPYRIGHT (c) 1989-2014.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.org/license/LICENSE.
14 */
15
16#ifndef _RTEMS_TMTEST27
17#error "This is an RTEMS internal file you must not include directly."
18#endif
19
20#ifndef __tm27_h
21#define __tm27_h
22
23#include <bsp/irq.h>
24
25/*
26 *  Stuff for Time Test 27
27 */
28
29#define MUST_WAIT_FOR_INTERRUPT 1
30
31void nullFunc() {}
32
33static rtems_irq_connect_data clockIrqData = {BSP_DECREMENTER,
34                                              0,
35                                              (rtems_irq_enable)nullFunc,
36                                              (rtems_irq_disable)nullFunc,
37                                              (rtems_irq_is_enabled) nullFunc};
38void Install_tm27_vector(void (*_handler)())
39{
40  clockIrqData.hdl = _handler;
41  if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
42        printk("Error installing clock interrupt handler!\n");
43        rtems_fatal_error_occurred(1);
44  }
45}
46
47#define Cause_tm27_intr()  \
48  do { \
49    uint32_t   _clicks = 8; \
50    __asm__ volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
51  } while (0)
52
53#define Clear_tm27_intr() \
54  do { \
55    uint32_t   _clicks = 0xffffffff; \
56    __asm__ volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
57  } while (0)
58
59#define Lower_tm27_intr() \
60  do { \
61    uint32_t   _msr = 0; \
62    _ISR_Set_level( 0 ); \
63    __asm__ volatile( "mfmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \
64    _msr |=  0x8002; \
65    __asm__ volatile( "mtmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \
66  } while (0)
67
68#endif
Note: See TracBrowser for help on using the repository browser.