source: rtems/bsps/sparc/erc32/include/tm27.h @ 10ee41a8

Last change on this file since 10ee41a8 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: 3.3 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 * @ingroup sparc_erc32
6 * @brief Implementations for interrupt mechanisms for Time Test 27
7 */
8
9/*
10 *  COPYRIGHT (c) 2006.
11 *  Aeroflex Gaisler AB.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 *    notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 *    notice, this list of conditions and the following disclaimer in the
20 *    documentation and/or other materials provided with the distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef _RTEMS_TMTEST27
36#error "This is an RTEMS internal file you must not include directly."
37#endif
38
39#ifndef __tm27_h
40#define __tm27_h
41
42/*
43 *  Define the interrupt mechanism for Time Test 27
44 *
45 *  NOTE: Since the interrupt code for the SPARC supports both synchronous
46 *        and asynchronous trap handlers, support for testing with both
47 *        is included.
48 */
49
50#define ERC32_BSP_USE_SYNCHRONOUS_TRAP  0
51
52/*
53 *  The synchronous trap is an arbitrarily chosen software trap.
54 */
55
56#if (ERC32_BSP_USE_SYNCHRONOUS_TRAP == 1)
57
58#define TEST_VECTOR SPARC_SYNCHRONOUS_TRAP( 0x90 )
59
60#define MUST_WAIT_FOR_INTERRUPT 1
61
62#define TM27_USE_VECTOR_HANDLER
63
64#define Install_tm27_vector( handler ) \
65  set_vector( (handler), TEST_VECTOR, 1 );
66
67#define Cause_tm27_intr() \
68  __asm__ volatile( "ta 0x10; nop " );
69
70#define Clear_tm27_intr() /* empty */
71
72#define Lower_tm27_intr() /* empty */
73
74/*
75 *  The asynchronous trap is an arbitrarily chosen ERC32 interrupt source.
76 */
77
78#else   /* use a regular asynchronous trap */
79
80#define TEST_INTERRUPT_SOURCE ERC32_INTERRUPT_EXTERNAL_1
81#define TEST_INTERRUPT_SOURCE2 (ERC32_INTERRUPT_EXTERNAL_1+1)
82
83#define MUST_WAIT_FOR_INTERRUPT 1
84
85static inline void Install_tm27_vector( rtems_interrupt_handler handler )
86{
87  (void) rtems_interrupt_handler_install(
88    TEST_INTERRUPT_SOURCE,
89    "tm27 low",
90    RTEMS_INTERRUPT_SHARED,
91    handler,
92    NULL
93  );
94  (void) rtems_interrupt_handler_install(
95    TEST_INTERRUPT_SOURCE2,
96    "tm27 high",
97    RTEMS_INTERRUPT_SHARED,
98    handler,
99    NULL
100  );
101}
102
103#define Cause_tm27_intr() \
104  do { \
105    ERC32_Force_interrupt( TEST_INTERRUPT_SOURCE+(Interrupt_nest>>1) ); \
106    nop(); \
107    nop(); \
108    nop(); \
109  } while (0)
110
111#define Clear_tm27_intr() \
112  ERC32_Clear_interrupt( TEST_INTERRUPT_SOURCE )
113
114#define Lower_tm27_intr() /* empty */
115
116#endif
117
118#endif
Note: See TracBrowser for help on using the repository browser.