RTEMS 6.1-rc7
Loading...
Searching...
No Matches
tm27.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (C) 2010, 2015 embedded brains GmbH & Co. KG
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#ifndef _RTEMS_TMTEST27
37 #error "This is an RTEMS internal file you must not include directly."
38#endif /* _RTEMS_TMTEST27 */
39
40#ifndef TMTESTS_TM27_H
41#define TMTESTS_TM27_H
42
44
45#include <bsp/irq.h>
46#include <bsp/qoriq.h>
47
48#define MUST_WAIT_FOR_INTERRUPT 1
49
50#define IPI_INDEX_LOW 1
51
52#define IPI_INDEX_HIGH 2
53
54static inline void Install_tm27_vector( rtems_interrupt_handler handler )
55{
56 static rtems_interrupt_entry entry_low;
57 static rtems_interrupt_entry entry_high;
58 rtems_vector_number low = QORIQ_IRQ_IPI_0 + IPI_INDEX_LOW;
59 rtems_vector_number high = QORIQ_IRQ_IPI_0 + IPI_INDEX_HIGH;
60
61 (void) rtems_interrupt_set_priority(low, 14);
62 (void) rtems_interrupt_set_priority(high, 13);
63
64 rtems_interrupt_entry_initialize(
65 &entry_low,
66 handler,
67 NULL,
68 "tm17 low"
69 );
71 low,
73 &entry_low
74 );
75
76 rtems_interrupt_entry_initialize(
77 &entry_high,
78 handler,
79 NULL,
80 "tm17 high"
81 );
83 high,
85 &entry_high
86 );
87}
88
89static inline void qoriq_tm27_cause(uint32_t ipi_index)
90{
91 uint32_t self = ppc_processor_id();
92
93 qoriq.pic.per_cpu[self].ipidr[ipi_index].reg = UINT32_C(1) << self;
94}
95
96static inline void Cause_tm27_intr(void)
97{
98 qoriq_tm27_cause(IPI_INDEX_LOW);
99}
100
101static inline void Clear_tm27_intr(void)
102{
103 /* Nothing to do */
104}
105
106static inline inline void Lower_tm27_intr(void)
107{
108 qoriq_tm27_cause(IPI_INDEX_HIGH);
109}
110
111#endif /* TMTESTS_TM27_H */
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_UNIQUE
This interrupt handler install option ensures that the interrupt handler is unique.
Definition: intr.h:972
void(* rtems_interrupt_handler)(void *)
Interrupt handler routines shall have this type.
Definition: intr.h:1030
rtems_status_code rtems_interrupt_set_priority(rtems_vector_number vector, uint32_t priority)
Sets the priority of the interrupt vector.
Definition: irq-priority.c:39
General purpose assembler macros, linker command file support and some inline functions for direct re...
QorIQ Configuration, Control and Status Registers.
This structure represents an interrupt entry.
Definition: intr.h:1070