source: rtems/bsps/powerpc/motorola_powerpc/include/tm27.h

Last change on this file was 10ee41a8, checked in by Sebastian Huber <sebastian.huber@…>, on 01/23/23 at 13:56:31

tm27: Avoid function pointer casts

Add TM27_USE_VECTOR_HANDLER to select the interrupt handler type used by
the <tm27.h> implementation.

Close #4820.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 * @file
3 * @ingroup powerpc_motorola_powerpc
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/*
21 *  Stuff for Time Test 27
22 */
23
24#include <bsp/irq.h>
25
26#define MUST_WAIT_FOR_INTERRUPT 1
27
28static void null_irq_enable(const rtems_irq_connect_data* a) { (void) a; }
29static void null_irq_disable(const rtems_irq_connect_data* a) { (void) a; }
30static int null_irq_is_enabled(const rtems_irq_connect_data* a) { (void) a; return 0; }
31
32static rtems_irq_connect_data clockIrqData =
33{
34 .name = BSP_DECREMENTER,
35 .hdl = 0,
36 .handle = 0,
37 .on = null_irq_enable,
38 .off = null_irq_disable,
39 .isOn = null_irq_is_enabled
40};
41
42static inline void Install_tm27_vector( rtems_interrupt_handler handler )
43{
44  clockIrqData.hdl = handler;
45  if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
46        printk("Error installing clock interrupt handler!\n");
47        rtems_fatal_error_occurred(1);
48  }
49}
50
51#define Cause_tm27_intr()  \
52  do { \
53    uint32_t   _clicks = 8; \
54    __asm__ volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
55  } while (0)
56
57#define Clear_tm27_intr() \
58  do { \
59    uint32_t   _clicks = 0xffffffff; \
60    __asm__ volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
61  } while (0)
62
63#define Lower_tm27_intr() \
64  do { \
65    uint32_t   _msr = 0; \
66    _ISR_Set_level( 0 ); \
67    __asm__ volatile( "mfmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \
68    _msr |=  0x8002; \
69    __asm__ volatile( "mtmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \
70  } while (0)
71
72#endif
Note: See TracBrowser for help on using the repository browser.