50 Commits

Author SHA1 Message Date
Sebastian Huber
03ae1fa930 bsps/irq: Fix type limits warnings
Set BSP_INTERRUPT_VECTOR_COUNT to 1 to avoid type limits and array
bounds warnings.

Make sure all functions using the default interrupt controller
implementation return a status of RTEMS_UNSATISFIED.

Update #5298.
Close #5377.
2025-10-29 07:16:41 +00:00
Joel Sherrill
bc959e983f bsps/shared/*: Address unused parameter warnings
Add "(void) param;" annotation to address unused parameter warnings.
Found with GCC's warning -Wunused-parameter.
2025-10-10 20:52:14 +00:00
Lucian Silistru
45b1495a8a record: Avoid dependency on object link order
For the application configuration option
CONFIGURE_RECORD_INTERRUPTS_ENABLED, define
bsp_interrupt_get_dispatch_table_slot() in the application configuration
to avoid issues with the object link order within the RTEMS libraries.

Enable this option in an associated test.

Close #5244.
2025-08-12 13:18:30 -05:00
Sebastian Huber
a947bba9df dev/irq: Add BSP_IRQ_HAVE_GET_SET_AFFINITY
Allow BSPs to provide the interrupt get/set affinity implementation even for
non-SMP configurations.
2024-10-02 05:24:30 +02:00
Sebastian Huber
ab8817ca03 rtems: Add get/set interrupt priorities
Add directives to get and set the priority of an interrupt vector.

Implement the directives for the following BSP families:

* arm/lpc24xx
* arm/lpc32xx
* powerpc/mpc55xxevb
* powerpc/qoriq

Implement the directives for the following interrupt controllers:

* GICv2 and GICv3 (arm and aarch64)
* NVIC (arm)
* PLIC (riscv)

Update #5002.
2024-05-10 13:26:22 +00:00
Sebastian Huber
5b0e355ed7 bsps: Move declarations to <bsp/irq-generic.h>
Move declarations of bsp_interrupt_get_affinity() and
bsp_interrupt_set_affinity() to <bsp/irq-generic.h>.  Canonicalize the
<bsp/irq.h> includes.

Implement bsp_interrupt_get_affinity() and bsp_interrupt_set_affinity() only if
needed (usually RTEMS_SMP).

Provide stub implementations for i386 to fix build errors.
2024-03-27 20:20:38 +01:00
Kinsey Moore
5b22003411 bsps: Remove unused includes 2023-10-13 19:02:15 -05:00
Sebastian Huber
a41611ab4a bsps/irq: Remove unused parameter
Update #4862.
2023-07-28 17:18:07 +02:00
Sebastian Huber
bcef89f236 Update company name
The embedded brains GmbH & Co. KG is the legal successor of embedded
brains GmbH.
2023-05-20 11:05:26 +02:00
Sebastian Huber
d36070fec8 intr: Add Interrupt Manager implementation group
The shared BSP interrupt controller support code actually implements
parts of the Interrupt Manager.

Update #3706.
2023-01-24 09:56:53 +01:00
Sebastian Huber
c46fbb9552 config: Add CONFIGURE_RECORD_INTERRUPTS_ENABLED
This enables the tracing of interrupt entry/exit events through an
application configuration option.  The interrupt processing can be
viewed with Trace Compass using rtems-record-lttng from the RTEMS Tools.

Update #4769.
2022-12-02 10:25:44 +01:00
Sebastian Huber
0d5e41afde bsps/irq: Add bsp_interrupt_get_dispatch_table_slot()
Update #4769.
2022-12-02 10:25:44 +01:00
Sebastian Huber
71d1acd41d bsps/irq: Rename handler in dispatch table
The name handler table was a bit misleading after the last rework.
Rename it to distach table.  Update the documentation accordingly.

Update #4769.
2022-12-02 10:25:39 +01:00
Sebastian Huber
f311caf984 bsps/irq: Improve affinity set handling
Restrict the affinity set to the set of online processors.  Make sure
the affinity set for an interrupt vector contains at least one online
processor.

Update #3269.
2022-03-16 07:29:27 +01:00
Sebastian Huber
ca4fa22e51 bsps/irq: Fix formatting
Update #3269.
2022-03-16 07:29:27 +01:00
Sebastian Huber
c7b4eca7fa bsps/irq: bsp_interrupt_facility_initialize()
Do not return a status code in bsp_interrupt_facility_initialize() since this
leads to unreachable code in bsp_interrupt_initialize().  Use RTEMS_DEBUG
assertions in bsp_interrupt_facility_initialize() if necessary.
2021-07-27 10:03:19 +02:00
Sebastian Huber
e518323872 bsps/irq: Add rtems_interrupt_entry_install()
Add rtems_interrupt_entry_remove().  Split up irq-generic.c into several files.
In particular, place all functions which use dynamic memory into their own
file.

Add optional macros to let the BSP customize the vector installation after
installing the first entry and the vector removal before removing the last
entry:

* bsp_interrupt_vector_install()

* bsp_interrupt_vector_remove()

Use these new customization options in the m68k/genmcf548x BSP so re-use the
generic interrupt controller support.

Update #3269.
2021-07-26 19:57:31 +02:00
Sebastian Huber
70357f1731 bsps/irq: Move bsp_interrupt_handler_is_empty()
This function is only used by one BSP.

Update #3269.
2021-07-26 19:57:31 +02:00
Sebastian Huber
63d9e840b7 bsps/irq: Add bsp_interrupt_check_and_lock()
Return RTEMS_INCORRECT_STATE instead of RTEMS_INTERNAL_ERROR in case the
interrupt support is not initialized.  This is similar to
rtems_timer_server_fire_after() for example.

Update #3269.
2021-07-26 19:57:31 +02:00
Sebastian Huber
73fcbf4cff bsps/irq: Use rtems_interrupt_entry
Update #3269.
2021-07-26 19:57:31 +02:00
Sebastian Huber
85a378510d bsps/irq: bsp_interrupt_set_affinity()
Return a status code for bsp_interrupt_set_affinity().

Update #3269.
2021-07-26 19:57:31 +02:00
Sebastian Huber
23ec04c48c bsps/irq: bsp_interrupt_get_affinity()
Return a status code for bsp_interrupt_get_affinity().

Update #3269.
2021-07-26 19:57:31 +02:00
Sebastian Huber
32f5a195d7 bsps/irq: bsp_interrupt_vector_disable()
Return a status code for bsp_interrupt_vector_disable().

Update #3269.
2021-07-26 19:57:31 +02:00
Sebastian Huber
bc86a5fa84 bsps/irq: bsp_interrupt_vector_enable()
Return a status code for bsp_interrupt_vector_enable().

Update #3269.
2021-07-26 19:57:30 +02:00
Sebastian Huber
deb5afb2f2 bsps/irq: Add rtems_interrupt_is_pending()
Add a default implementation which just returns RTEMS_UNSATISFIED.

Update #3269.
2021-07-26 17:08:42 +02:00
Sebastian Huber
eebecd09fa bsps/irq: Add rtems_interrupt_get_attributes()
Add a default implementation which clears the attributes to zero and
just returns RTEMS_SUCCESSFUL for valid parameters.

Update #3269.
2021-07-26 17:08:42 +02:00
Sebastian Huber
9832652c53 bsps/irq: Add rtems_interrupt_raise()
Add rtems_interrupt_raise_on() and rtems_interrupt_clear().

Add a default implementation which just returns RTEMS_UNSATISFIED for
valid parameters.

Update #3269.
2021-07-26 07:54:25 +02:00
Sebastian Huber
781213f9ec bsps/irq: Add rtems_interrupt_vector_is_enabled()
Add a default implementation which just returns RTEMS_UNSATISFIED for
valid parameters.

Update #3269.
2021-07-26 07:54:25 +02:00
Sebastian Huber
4969af4102 rtems: Add RTEMS_FATAL_SOURCE_SPURIOUS_INTERRUPT
Add RTEMS_FATAL_SOURCE_SPURIOUS_INTERRUPT as the fatal source for
spurious interrupts.  Use the interrupt vector number of the spurious
interrupt for the fatal code.

Update #3269.
2021-07-26 07:54:25 +02:00
Sebastian Huber
96265c87a3 rtems: Add rtems_interrupt_vector_enable()
Add rtems_interrupt_vector_disable().

Update #3269.
2021-07-26 07:54:25 +02:00
Sebastian Huber
04c2c0804b bsps/irq: Move handler iterate to separate file
Update #3269.
2021-07-26 07:54:25 +02:00
Sebastian Huber
1b3b5b8428 bsps/irq: Canonicalize get/set affinity errors
Bring the error conditions and status in line with
rtems_task_get_affinity() and rtems_task_set_affinity().

Update #3269.
2021-07-26 07:54:25 +02:00
Sebastian Huber
efb3fc284a bsps/irq: Move get/set affinity to separate file
Update #3269.
2021-07-26 07:54:25 +02:00
Sebastian Huber
3fee662093 bsps/irq: Use BSP_INTERRUPT_VECTOR_COUNT
Use BSP_INTERRUPT_VECTOR_COUNT instead of BSP_INTERRUPT_VECTOR_MAX.

Update #3269.
2021-06-24 11:36:25 +02:00
Sebastian Huber
049e2b64e1 bsps/irq: Remove BSP_INTERRUPT_VECTOR_NUMBER
Replace it with BSP_INTERRUPT_VECTOR_COUNT.

Update #3269.
2021-06-24 11:35:49 +02:00
Sebastian Huber
af73b7b64b bsps/irq: Remove BSP_INTERRUPT_VECTOR_MIN
Remove BSP_INTERRUPT_VECTOR_MIN and unconditionally let interrupt vector
numbers start with zero.

The BSP_INTERRUPT_VECTOR_MIN == 0 invariant was tested by the previous commit
and building all BSPs.

Update #3269.
2021-06-24 11:35:49 +02:00
Sebastian Huber
61d0be7214 bsps/irq: Remove BSP_INTERRUPT_NO_HEAP_USAGE
Remove the support for BSP_INTERRUPT_NO_HEAP_USAGE.  This was only used
by one BSP and provides no real benefit.

Update #3269.
2021-06-24 08:27:21 +02:00
Sebastian Huber
3ee19b7ac3 bsps/irq: Change license to BSD-2-Clause
Change license to BSD-2-Clause according to file history and
re-licensing agreement.

Update #3053.
2021-06-17 17:24:32 +02:00
Sebastian Huber
99c73303de rtems: Improve rtems_interrupt_server_create()
Also start interrupt server tasks on processors which do not have a
scheduler.  Applications may dynamically manage processors using
rtems_scheduler_remove_processor() and rtems_scheduler_add_processor().
2020-11-24 07:40:24 +01:00
Sebastian Huber
bb4e534014 bsps: Fix rtems_interrupt_server_delete()
The ISR lock must be destroyed to prevent memory corruption if RTEMS_PROFILING
and RTEMS_SMP is enabled.

Close #4158.
2020-10-19 17:44:49 +02:00
Sebastian Huber
c60942ea5b rtems: Add rtems_interrupt_server_create()
Add rtems_interrupt_server_destroy().

Before this patch, the only way to create interrupt servers was
rtems_interrupt_server_initialize(). This function creates the default
interrupt server and in SMP configurations additional interrupt servers
for the additional processors. The interrupt server is heavily used by
libbsd. This includes the epoch based reclamation which performs time
consuming resource and memory deallocation work. This does not work well
with time critical services, for example an UART over SPI or I2C. One
approach to address this problem is to allow the application to create
custom interrupt servers with the right priority and task properties.
The interrupt server API accounted for this, however, it was not
implemented before this patch.

Close #4034.
2020-08-03 08:52:41 +02:00
Gedare Bloom
739e3d0f72 bsps/irq: fix resource leak in irq-server.c
Resource leak identified by Coverity (CID 1456675). The value
of instances is leaked in case some but not all irq servers are
created. It should be stored in bsp_interrupt_server_instances.
2020-01-03 11:33:02 -07:00
Sebastian Huber
33ed4123c0 rtems: Add rtems_interrupt_server_entry_move()
The use case for this function is the libbsd.  In FreeBSD, the interrupt
setup and binding to a processor is done in two steps.  Message
based interrupts like PCIe MSI and MSI-X interrupts can be implemented
through interrupt server entries.  They are setup at the default
interrupt server and may optionally move to an interrupt server bound to
a specific processor.
2019-09-20 09:22:46 +02:00
Sebastian Huber
45d06591f1 bsps: Always build generic interrupt support
This makes it possible to write tests for the generic interrupt
controller support.

Update #3269.
2019-05-16 07:29:24 +02:00
Sebastian Huber
f9219db2a9 rtems: Add rtems_scheduler_get_processor_maximum()
Add rtems_scheduler_get_processor_maximum() as a replacement for
rtems_get_processor_count(). The rtems_get_processor_count() is a bit
orphaned. Adopt it by the Scheduler Manager. The count is also
misleading, since the processor set may have gaps and the actual count
of online processors may be less than the value returned by
rtems_get_processor_count().

Update #3732.
2019-04-09 08:06:46 +02:00
Sebastian Huber
4e686261d8 bsps/irq: Fix interrupt server init (SMP) 2019-02-07 11:13:59 +01:00
Sebastian Huber
9a029cec02 bsps/irq: Use rtems_malloc() 2018-11-12 13:26:22 +01:00
Sebastian Huber
32ccc016d8 bsps: Fix the generic IRQ support
The genmcf548x partly uses is own implementation of the interrupt
extension API for libbsd support.

This patch is a part of the BSP source reorganization.

Update #3285.
2018-08-03 14:14:19 +02:00
Sebastian Huber
dea4bbe374 bsps: Avoid malloc() in generic IRQ support
Use rtems_heap_allocate_aligned_with_boundary() instead of malloc() to
avoid a dependency on errno.
2018-06-05 07:08:40 +02:00
Sebastian Huber
9b7c456732 bsps: Move generic IRQ support to bsps
This patch is a part of the BSP source reorganization.

Update #3285.
2018-04-09 07:09:47 +02:00