RTEMS 6.1-rc7
Loading...
Searching...
No Matches
irqimpl.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
12/*
13 * Copyright (C) 2021 embedded brains GmbH & Co. KG
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef LIBBSP_SPARC_LEON3_BSP_IRQIMPL_H
38#define LIBBSP_SPARC_LEON3_BSP_IRQIMPL_H
39
40#include <rtems.h>
41#include <grlib/irqamp-regs.h>
42#include <grlib/io.h>
43
44#include <bspopts.h>
45
46struct ambapp_dev;
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
63extern uint32_t LEON3_Cpu_Index;
64
69
75#define LEON3_IRQCTRL_ACQUIRE( _lock_context ) \
76 rtems_interrupt_lock_acquire( &LEON3_IrqCtrl_Lock, _lock_context )
77
83#define LEON3_IRQCTRL_RELEASE( _lock_context ) \
84 rtems_interrupt_lock_release( &LEON3_IrqCtrl_Lock, _lock_context )
85
89#if defined(LEON3_IRQAMP_BASE)
90#define LEON3_IrqCtrl_Regs ((irqamp *) LEON3_IRQAMP_BASE)
91#else
93
97extern struct ambapp_dev *LEON3_IrqCtrl_Adev;
98#endif
99
106#if defined(LEON3_IRQAMP_EXTENDED_INTERRUPT)
107#define LEON3_IrqCtrl_EIrq LEON3_IRQAMP_EXTENDED_INTERRUPT
108#else
109extern uint32_t LEON3_IrqCtrl_EIrq;
110#endif
111
117void leon3_ext_irq_init( irqamp *regs );
118
125static inline uint32_t bsp_irq_fixup( uint32_t irq )
126{
127 uint32_t eirq;
128 uint32_t cpu_self;
129
130 if ( irq != LEON3_IrqCtrl_EIrq ) {
131 return irq;
132 }
133
134 cpu_self = _LEON3_Get_current_processor();
135 eirq = grlib_load_32( &LEON3_IrqCtrl_Regs->pextack[ cpu_self ] );
136 eirq = IRQAMP_PEXTACK_EID_4_0_GET( eirq );
137
138 if ( eirq < 16 ) {
139 return irq;
140 }
141
142 return eirq;
143}
144
147#ifdef __cplusplus
148}
149#endif
150
151#endif /* LIBBSP_SPARC_LEON3_BSP_IRQIMPL_H */
char rtems_interrupt_lock
This structure represents an ISR lock.
Definition: intr.h:532
irqamp * LEON3_IrqCtrl_Regs
This pointer provides the IRQ(A)MP register block address.
Definition: amba.c:121
void leon3_ext_irq_init(irqamp *regs)
Initializes the interrupt controller for the boot processor.
Definition: eirq.c:54
struct ambapp_dev * LEON3_IrqCtrl_Adev
This pointer provides the IRQ(A)MP device information block.
Definition: amba.c:122
uint32_t LEON3_IrqCtrl_EIrq
This object provides the interrupt number used to multiplex extended interrupts or is zero if no exte...
Definition: eirq.c:47
uint32_t LEON3_Cpu_Index
This object provides the index of the boot processor.
Definition: bspstart.c:64
rtems_interrupt_lock LEON3_IrqCtrl_Lock
This lock serializes the interrupt controller access.
Definition: eirq.c:50
This header file defines the IRQAMP register block interface.
This header file defines the RTEMS Classic API.
Definition: ambapp.h:94
This structure defines the IRQ(A)MP register block memory map.
Definition: irqamp-regs.h:780
uint32_t pextack[16]
See Processor n extended interrupt acknowledge register (PEXTACK).
Definition: irqamp-regs.h:846