RTEMS 7.0-rc1
Loading...
Searching...
No Matches
tm27.h
1/* SPDX-License-Identifier: GPL-2.0+-with-RTEMS-exception */
2
3/*
4 * @file
5 * @ingroup powerpc_motorola_powerpc
6 * @brief Implementations for interrupt mechanisms for Time Test 27
7 */
8
9/*
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#ifndef _RTEMS_TMTEST27
16#error "This is an RTEMS internal file you must not include directly."
17#endif
18
19#ifndef __tm27_h
20#define __tm27_h
21
22/*
23 * Stuff for Time Test 27
24 */
25
26#include <bsp/irq.h>
27
28#define MUST_WAIT_FOR_INTERRUPT 1
29
30static void null_irq_enable(const rtems_irq_connect_data* a) { (void) a; }
31static void null_irq_disable(const rtems_irq_connect_data* a) { (void) a; }
32static int null_irq_is_enabled(const rtems_irq_connect_data* a) { (void) a; return 0; }
33
34static rtems_irq_connect_data clockIrqData =
35{
36 .name = BSP_DECREMENTER,
37 .hdl = 0,
38 .handle = 0,
39 .on = null_irq_enable,
40 .off = null_irq_disable,
41 .isOn = null_irq_is_enabled
42};
43
44static inline void Install_tm27_vector( rtems_interrupt_handler handler )
45{
46 clockIrqData.hdl = handler;
47 if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
48 printk("Error installing clock interrupt handler!\n");
50 }
51}
52
53#define Cause_tm27_intr() \
54 do { \
55 uint32_t _clicks = 8; \
56 __asm__ volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
57 } while (0)
58
59#define Clear_tm27_intr() \
60 do { \
61 uint32_t _clicks = 0xffffffff; \
62 __asm__ volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
63 } while (0)
64
65#define Lower_tm27_intr() \
66 do { \
67 uint32_t _msr = 0; \
68 _ISR_Set_level( 0 ); \
69 __asm__ volatile( "mfmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \
70 _msr |= 0x8002; \
71 __asm__ volatile( "mtmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \
72 } while (0)
73
74#endif
RTEMS_NO_RETURN void rtems_fatal_error_occurred(uint32_t fatal_code)
Invokes the fatal error handler.
Definition: fatal.c:47
void(* rtems_interrupt_handler)(void *)
Interrupt handler routines shall have this type.
Definition: intr.h:1030
Definition: irq.h:65