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_psim
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#include <bsp/irq.h>
23
24/*
25 * Stuff for Time Test 27
26 */
27
28#define MUST_WAIT_FOR_INTERRUPT 1
29
30static void stub_rtems_irq_enable( const struct __rtems_irq_connect_data__ *i )
31{
32 (void) i;
33}
34
35static void stub_rtems_irq_disable( const struct __rtems_irq_connect_data__ *i )
36{
37 (void) i;
38}
39
40static int stub_rtems_irq_is_enabled(
41 const struct __rtems_irq_connect_data__ *i
42)
43{
44 (void) i;
45 return 0;
46}
47
48static rtems_irq_connect_data clockIrqData = {
49 .name = BSP_DECREMENTER,
50 .hdl = 0,
51 .handle = 0,
52 .on = stub_rtems_irq_enable,
53 .off = stub_rtems_irq_disable,
54 .isOn = stub_rtems_irq_is_enabled,
55 .next_handler = NULL
56};
57
58static inline void Install_tm27_vector( rtems_interrupt_handler handler )
59{
60 clockIrqData.hdl = handler;
61 if ( !BSP_install_rtems_irq_handler( &clockIrqData ) ) {
62 printk( "Error installing clock interrupt handler!\n" );
64 }
65}
66
67#define Cause_tm27_intr() \
68 do { \
69 uint32_t _clicks = 1; \
70 __asm__ volatile( "mtdec %0" \
71 : "=r"(( _clicks )) \
72 : "r"(( _clicks )) ); \
73 } while ( 0 )
74
75#define Clear_tm27_intr() \
76 do { \
77 uint32_t _clicks = 0xffffffff; \
78 __asm__ volatile( "mtdec %0" \
79 : "=r"(( _clicks )) \
80 : "r"(( _clicks )) ); \
81 } while ( 0 )
82
83#define Lower_tm27_intr() \
84 do { \
85 uint32_t _msr = 0; \
86 _ISR_Set_level( 0 ); \
87 __asm__ volatile( "mfmsr %0 ;" \
88 : "=r"( _msr ) \
89 : "r"( _msr ) ); \
90 _msr |= 0x8002; \
91 __asm__ volatile( "mtmsr %0 ;" \
92 : "=r"( _msr ) \
93 : "r"( _msr ) ); \
94 } while ( 0 )
95
96#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