RTEMS 7.0-rc1
Loading...
Searching...
No Matches
tm27.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
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#include <bsp.h>
43#include <bsp/irq-generic.h>
44
45#if defined(RTEMS_SMP)
46#include <rtems/score/smpimpl.h>
47#endif
48
49/*
50 * Define the interrupt mechanism for Time Test 27
51 *
52 * NOTE: Since the interrupt code for the SPARC supports both synchronous
53 * and asynchronous trap handlers, support for testing with both
54 * is included.
55 */
56
57#define SIS_USE_SYNCHRONOUS_TRAP 0
58
59/*
60 * The synchronous trap is an arbitrarily chosen software trap.
61 */
62
63#if (SIS_USE_SYNCHRONOUS_TRAP == 1)
64
65#define TEST_VECTOR SPARC_SYNCHRONOUS_TRAP( 0x90 )
66
67#define MUST_WAIT_FOR_INTERRUPT 1
68
69#define TM27_USE_VECTOR_HANDLER
70
71#define Install_tm27_vector( handler ) \
72 rtems_interrupt_handler_install( \
73 TEST_VECTOR, \
74 "test tm27 interrupt", \
75 RTEMS_INTERRUPT_UNIQUE, \
76 handler, \
77 NULL \
78 ); \
79 SPARC_Clear_and_unmask_interrupt(TEST_VECTOR);
80
81#define Cause_tm27_intr() \
82 __asm__ volatile( "ta 0x10; nop " );
83
84#define Clear_tm27_intr() /* empty */
85
86#define Lower_tm27_intr() /* empty */
87
88/*
89 * The asynchronous trap is an arbitrarily chosen ERC32 interrupt source.
90 */
91
92#else /* use a regular asynchronous trap */
93
94extern uint32_t Interrupt_nest;
95
96#define TEST_INTERRUPT_SOURCE 5
97#define TEST_INTERRUPT_SOURCE2 6
98#define MUST_WAIT_FOR_INTERRUPT 1
99#define TM27_INTERRUPT_VECTOR_DEFAULT TEST_INTERRUPT_SOURCE
100
101static inline void Install_tm27_vector( rtems_interrupt_handler handler )
102{
103 static rtems_interrupt_entry entry_low;
104 static rtems_interrupt_entry entry_high;
105
106#if defined(RTEMS_SMP)
108 TEST_INTERRUPT_SOURCE,
109 _SMP_Get_online_processors()
110 );
112 TEST_INTERRUPT_SOURCE2,
113 _SMP_Get_online_processors()
114 );
115#endif
116
117 rtems_interrupt_entry_initialize(
118 &entry_low,
119 handler,
120 NULL,
121 "tm27 low"
122 );
124 TEST_INTERRUPT_SOURCE,
126 &entry_low
127 );
128 rtems_interrupt_entry_initialize(
129 &entry_high,
130 handler,
131 NULL,
132 "tm27 high"
133 );
135 TEST_INTERRUPT_SOURCE2,
137 &entry_high
138 );
139}
140
141static inline void Cause_tm27_intr( void )
142{
143 rtems_vector_number vector;
144
145 vector = TEST_INTERRUPT_SOURCE + ( Interrupt_nest >> 1 );
146#if defined(RTEMS_SMP)
148#else
149 (void) rtems_interrupt_raise( vector );
150#endif
151 nop();
152 nop();
153 nop();
154}
155
156static inline void Clear_tm27_intr( void )
157{
158 (void) rtems_interrupt_clear( TEST_INTERRUPT_SOURCE );
159}
160
161#define Lower_tm27_intr() /* empty */
162
163#endif
164
165#endif
This header file evaluates configuration options related to the BSP configuration.
rtems_status_code rtems_interrupt_entry_install(rtems_vector_number vector, rtems_option options, rtems_interrupt_entry *entry)
Installs the interrupt entry at the interrupt vector.
Definition: irq-generic.c:264
ISR_Vector_number rtems_vector_number
This integer type represents interrupt vector numbers.
Definition: intr.h:102
#define RTEMS_INTERRUPT_SHARED
This interrupt handler install option allows that the interrupt handler may share the interrupt vecto...
Definition: intr.h:960
rtems_status_code rtems_interrupt_raise_on(rtems_vector_number vector, uint32_t cpu_index)
Raises the interrupt vector on the processor.
Definition: irq-raise-clear.c:68
rtems_status_code rtems_interrupt_raise(rtems_vector_number vector)
Raises the interrupt vector.
Definition: irq-raise-clear.c:59
void(* rtems_interrupt_handler)(void *)
Interrupt handler routines shall have this type.
Definition: intr.h:1030
rtems_status_code rtems_interrupt_clear(rtems_vector_number vector)
Clears the interrupt vector.
Definition: irq-raise-clear.c:92
#define rtems_scheduler_get_processor()
Returns the index of the current processor.
Definition: scheduler.h:372
rtems_status_code bsp_interrupt_set_affinity(rtems_vector_number vector, const Processor_mask *affinity)
Sets the processor affinity set of the interrupt vector.
Definition: irq.c:407
This header file provides interfaces of the Interrupt Manager implementation.
This header file provides interfaces of the SMP Support which are only used by the implementation.
#define nop()
Definition: sparc.h:281
This structure represents an interrupt entry.
Definition: intr.h:1070