Re: [PATCH] part of implimenting a monotonic clock in rtems part of this is not the final patch.

2021-06-19 Thread zack_on_the_speed_chanel
I have added the tests and added the ones that create the timer. My idea for 
testing is that if I change the wall clock and I'll check the monotonic clock's 
time. But I think I have to make a signal and arm the timer.


Thanks
Zack

Sent with ProtonMail Secure Email.

‐‐‐ Original Message ‐‐‐

On Friday, June 18th, 2021 at 8:01 AM, Christian Mauderer  
wrote:

> Hello Zack,
>
> On 18/06/2021 04:34, zack_on_the_speed_chanel wrote:
>
> > so I tested it with the but I have not made a new test file I'll do that 
> > soon. How do I add a new test? All the tests that test the timer 
> > functionality do work. I"m confident that all the changes I had to made to 
> > implement a monotonic clock should be there.
>
> Regarding a new test: Just grep for example for psxtimer01 in the
>
> sources and add the new test simmilar to the existing one.
>
> The most relevant files are spec/build/testsuites/psxtests/*.yml for the
>
> waf based build system and testsuites/psxtests/Makefile.am and
>
> .../configure.ac for the old build system.
>
> But please check whether you need a new test program. If you basically
>
> only copy the test routine of psxtimer01 or psxtimer02 and replace all
>
> CLOCK_REALTIME by CLOCK_MONOTONIC then you shouldn't add a new test.
>
> Instead create a function in the test that is called once with
>
> CLOCK_REALTIME and once with CLOCK_MONOTONIC.
>
> Please make sure that the test not only tests the API but also whether
>
> the timer work as expected. A timer with CLOCK_REALTIME can be affected
>
> by changes in the wall clock. CLOCK_MONOTONIC should not be affected. So
>
> please make sure that your test checks whether that is really the case.
>
> Best regards
>
> Christian
>
> > Thanks
> >
> > Zack
> >
> > Sent with ProtonMail Secure Email.
> >
> > ‐‐‐ Original Message ‐‐‐
> >
> > On Tuesday, June 15th, 2021 at 7:29 AM, Christian Mauderer 
> > o...@c-mauderer.de wrote:
> >
> > > If you add a new functionallity you should add a test that tests the
> > >
> > > expected behaviour. You just shouldn't replace one but add a new test or
> > >
> > > a new test case to an existing test.
> > >
> > > Best regards
> > >
> > > Christian
> > >
> > > On 14/06/2021 22:18, zack_on_the_speed_chanel wrote:
> > >
> > > > also i'll revert the posix test that I changed back to normal because 
> > > > it was only for testing.
> > > >
> > > > Sent with ProtonMail Secure Email.
> > > >
> > > > ‐‐‐ Original Message ‐‐‐
> > > >
> > > > On Monday, June 14th, 2021 at 8:14 PM, zack_on_the_speed_chanel 
> > > > zack_on_the_speed_cha...@protonmail.ch wrote:
> > > >
> > > > > I've made most of the corrections to the code. I fixed up the 
> > > > > formatting but I still don't know if I have to add anything for the 
> > > > > settime and delete_timer(). i assume as the monotonic clock only 
> > > > > affects the value I think it's all I have to do. I also can try to 
> > > > > modify a posix test to check my theory.
> > > > >
> > > > > Thanks
> > > > >
> > > > > Zack
> > > > >
> > > > > Sent with ProtonMail Secure Email.
> > > > >
> > > > > ‐‐‐ Original Message ‐‐‐
> > > > >
> > > > > On Saturday, June 12th, 2021 at 9:31 AM, Christian Mauderer 
> > > > > o...@c-mauderer.de wrote:
> > > > >
> > > > > > Hello Zack,
> > > > > >
> > > > > > I don't really know a lot about the timer toppic. So this is more 
> > > > > > of a
> > > > > >
> > > > > > style and general suggestion review.
> > > > > >
> > > > > > On 09/06/2021 20:27, zack wrote:
> > > > > >
> > > > > > > From: zack zack_on_the_speed_cha...@protonmail.ch
> > > > > > >
> > > > > > > cpukit/include/rtems/posix/timer.h | 6 ++-
> > > > > > >
> > > > > > > cpukit/posix/src/psxtimercreate.c | 5 +-
> > > > > > >
> > > > > > > cpukit/posix/src/timergettime.c | 61 ---
> > > > > > >
> > > > > > > testsuites/psxtests/psxtimer02/psxtimer.c | 26 +++---
> > > > > > >
> > > > > > > 4 files changed, 81 insertions(+), 17 deletions(-)
> > > > > > >
> > > > > > > diff --git a/cpukit/include/rtems/posix/timer.h 
> > > > > > > b/cpukit/include/rtems/posix/timer.h
> > > > > > >
> > > > > > > index bcbf07a65a..f8cf6115b2 100644
> > > > > > >
> > > > > > > --- a/cpukit/include/rtems/posix/timer.h
> > > > > > >
> > > > > > > +++ b/cpukit/include/rtems/posix/timer.h
> > > > > > >
> > > > > > > @@ -21,7 +21,7 @@
> > > > > > >
> > > > > > > #include 
> > > > > > >
> > > > > > > #include 
> > > > > > > -
> > > > > >
> > > > > > I think the blank line separated rtems includes from others. So 
> > > > > > please
> > > > > >
> > > > > > don't remove it.
> > > > > >
> > > > > > > +#include 
> > > > > > >
> > > > > > > #include 
> > > > > > >
> > > > > > > #ifdef __cplusplus
> > > > > > >
> > > > > > > @@ -47,7 +47,9 @@ typedef struct {
> > > > > > >
> > > > > > > struct itimerspec timer_data; /* Timing data of the timer /
> > > > > > >
> > > > > > > uint32_t ticks; / Number of ticks of the initialization /
> > > > > > 

Re: GSoC POSIX Compliance: Can't Build RTEMS Tool Suite Anymore

2021-06-19 Thread Matthew Joyce
Thanks for your note, Sir! I'll never get that day back, but I'm glad to be
back on track now and have made
a bit of progress.

I made the change locally in libc/sys/signal.h to use the *__restrict. I
then configured and (successfully!)
built newlib for sparc-rtems6. I see the various build binaries in the
b-sparc-rtems6-newlib directory. I nm
them for the newly declared functions, for example: sparc-rtems6-nm
/libc.a | grep sig2str but
they don't show up at all. Would symbols show up in the binaries after
being declared (but not defined)?
Where do I go from here to ensure this prototype patch is good to go to
submit to Newlib?

Also, you wrote:
"...as long as you are working on patches to newlib, it is simpler and much
quicker to just build newlib
and install it over the RSB built version. You do not need to rebuild gcc,
binutils, or gdb."

Could you please elaborate on what you mean by "just build newlib and
install it over the RSB built version"?

Thank you very much for your time!

Sincerely,

Matt


On Jun 18, 2021, at 5:17 PM, Joel Sherrill  wrote:




On Fri, Jun 18, 2021 at 8:33 AM Matthew Joyce  wrote:

> Dear Mentors,
>
> I'm sorry to report that I've taken one step forward and three steps
> back. Since last night, I'm having trouble building the RTEMS tool
> suite at all. I keep getting the same error (attached).
>
> Steps I've taken to attempt to resolve:
> 1) Tried to check out previous commits and rebuild from there.
> 2) sudo yum update && upgrade
>

Did the native gcc or binutils update? The failure looks like an assembler
issue with gcc output but weird since it is a partial line error. Did you
run out of disk space?


> 3) Followed the quick-start guide from scratch (clone rsb and source
> into a new development directory, still fails in 2.4, Install the tool
> suite).
>
> How I got here: I applied my initial header patch to rsb using the
> blog guide and rebuilt the tool set. It built successfully, but then
> failed when I ran waf. (Compiler had issues with my use of the keyword
> "restrict".) I then created a new patch without "restrict", just to
> see if it would compile.


__restrict is what I hope you used and not just restrict. newlib uses
the __restrict macro it defines to ensure it only uses the restrict keyword
when it is supported by the language standard version being compiled with.


> I deleted the old patch from the
> tools/rtems-gcc-10-newlib-head.cfg and put the new one in.
>
> I'm guessing that was not correct based on my experience of the last 15
> hours!
>

You have to eventually deal with the RSB but as long as you are working
on patches to newlib, it is simpler and much quicker to just build newlib
and install it over the RSB built version. You do not need to rebuild gcc,
binutils, or gdb.

With the locally updated newlib, make changes to your local RTEMS
to add methods and/or tests.

When the newlib side is ready, submit the patch for review. When that
is merged, the newlib version in the RSB will need to be bumped.
After the newlib RSB hash is bumped, then things are in place to submit
your RTEMS modifications.

Streamlining the build/test cycle like this may save an hour an iteration.

You usually can't submit a newlib change and a corresponding RTEMS
change in parallel anyway. They have to be sequenced because of the
dependency.


>
> I'm really looking forward to your feedback and advice when you can.
> Thank you again!
>
> Sincerely,
>
> Matt
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH rtems 2/2] bsps/imxrt: Simplify linkcmds and make it flexible

2021-06-19 Thread dufault
I'm getting back to this as I have the HyperRAM working so I'm trying to set up 
appropriate linker settings.

> On Jun 10, 2021, at 01:43 , Sebastian Huber 
>  wrote:
> 
> The initial stack needs to be in an accessible memory area. Currently it is 
> placed in this linker output section:
> 
>   .rtemsstack (NOLOAD) : ALIGN_WITH_INPUT {
>   bsp_section_rtemsstack_begin = .;
>   *(SORT_BY_ALIGNMENT (SORT_BY_NAME (.rtemsstack*)))
>   bsp_section_rtemsstack_end = .;
>   } > REGION_WORK AT > REGION_WORK
>   bsp_section_rtemsstack_size = bsp_section_rtemsstack_end - 
> bsp_section_rtemsstack_begin;
> 
> Maybe we should place the .rtemsstack.interrupt input section into the 
> REGION_VECTOR memory region.

On the "imxrt" REGION_VECTOR is in FLASH, at least ".vector' in the app I'm 
testing is at 0x6004653c which is in HyperFLASH.

In HyperRAM I see these regions allocated:

REGION_DATA: .rwbarrier
REGION_DATA_LOAD: .data, .rtemsrwset
REGION_BSS: .bss
REGION_WORK: .rtemsstack, .work
REGION_STACK: .stack

So I put REGION_WORK in the OCRAM to get .rtemsstack out of HyperRAM to get 
started.  My application is now running out of HyperFLASH and HyperRAM though 
I'm sure I'll find issues.

- What's in "REGION_WORK"?  Does that have anything to do with the RTEMS work 
space?
- What's the proper solution?  I don't particularly want to redo my HyperRAM 
initialization to avoid using stack since I'm calling some NXP functions.  I'd 
like a small amount of stack available in the context of bsp_start_hook_0() to 
set up the external RAM.
- What's going on in the shared ARM _start with bsp_start_hook_0_done and the 
branch to bsp_start_hook_0()?





Peter
-
Peter Dufault
HD Associates, Inc.  Software and System Engineering

This email is delivered through the public internet using protocols subject to 
interception and tampering.



signature.asc
Description: Message signed with OpenPGP
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH v2 08/12] bsps/irq: Remove BSP_INTERRUPT_VECTOR_NUMBER

2021-06-19 Thread Sebastian Huber
Replace it with BSP_INTERRUPT_VECTOR_COUNT.

Update #3269.
---
 bsps/include/bsp/irq-generic.h | 4 +---
 bsps/shared/irq/irq-generic.c  | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/bsps/include/bsp/irq-generic.h b/bsps/include/bsp/irq-generic.h
index 31010d1c08..749dc78988 100644
--- a/bsps/include/bsp/irq-generic.h
+++ b/bsps/include/bsp/irq-generic.h
@@ -74,10 +74,8 @@ extern "C" {
   #error "if you define BSP_INTERRUPT_USE_INDEX_TABLE, you have to define 
BSP_INTERRUPT_HANDLER_TABLE_SIZE etc. as well"
 #endif
 
-#define BSP_INTERRUPT_VECTOR_NUMBER (BSP_INTERRUPT_VECTOR_MAX + 1)
-
 #ifndef BSP_INTERRUPT_HANDLER_TABLE_SIZE
-  #define BSP_INTERRUPT_HANDLER_TABLE_SIZE BSP_INTERRUPT_VECTOR_NUMBER
+  #define BSP_INTERRUPT_HANDLER_TABLE_SIZE BSP_INTERRUPT_VECTOR_COUNT
 #endif
 
 /* Internal macros for SMP support, do not use externally */
diff --git a/bsps/shared/irq/irq-generic.c b/bsps/shared/irq/irq-generic.c
index abe732a9d3..65971fb1b3 100644
--- a/bsps/shared/irq/irq-generic.c
+++ b/bsps/shared/irq/irq-generic.c
@@ -44,7 +44,7 @@
 
 #ifdef BSP_INTERRUPT_USE_INDEX_TABLE
   bsp_interrupt_handler_index_type bsp_interrupt_handler_index_table
-[BSP_INTERRUPT_VECTOR_NUMBER];
+[BSP_INTERRUPT_VECTOR_COUNT];
 #endif
 
 bsp_interrupt_handler_entry bsp_interrupt_handler_table
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2 04/12] bsps/irq: Assert BSP_INTERRUPT_VECTOR_MIN == 0

2021-06-19 Thread Sebastian Huber
After building all BSPs with this patch, this BSP-specific define can be
removed to simplify the implementation.

Update #3269.
---
 bsps/include/bsp/irq-generic.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/bsps/include/bsp/irq-generic.h b/bsps/include/bsp/irq-generic.h
index e888a66cea..8dc6c6d576 100644
--- a/bsps/include/bsp/irq-generic.h
+++ b/bsps/include/bsp/irq-generic.h
@@ -62,6 +62,10 @@ extern "C" {
   #error "invalid BSP_INTERRUPT_VECTOR_MIN or BSP_INTERRUPT_VECTOR_MAX"
 #endif
 
+#if BSP_INTERRUPT_VECTOR_MIN != 0
+  #error "BSP_INTERRUPT_VECTOR_MIN shall be zero"
+#endif
+
 #if defined(BSP_INTERRUPT_USE_INDEX_TABLE) && 
!defined(BSP_INTERRUPT_HANDLER_TABLE_SIZE)
   #error "if you define BSP_INTERRUPT_USE_INDEX_TABLE, you have to define 
BSP_INTERRUPT_HANDLER_TABLE_SIZE etc. as well"
 #endif
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2 03/12] bsp/generic_or1k: Remove incomplete IRQ support

2021-06-19 Thread Sebastian Huber
Update #3269.
---
 bsps/or1k/generic_or1k/include/bsp/irq.h  |  3 +-
 bsps/or1k/generic_or1k/irq/irq.c  | 43 ---
 .../lib/libbsp/or1k/generic_or1k/Makefile.am  |  6 +--
 .../bsps/or1k/generic_or1k/bspgenericor1k.yml |  4 +-
 4 files changed, 3 insertions(+), 53 deletions(-)
 delete mode 100644 bsps/or1k/generic_or1k/irq/irq.c

diff --git a/bsps/or1k/generic_or1k/include/bsp/irq.h 
b/bsps/or1k/generic_or1k/include/bsp/irq.h
index 791aefcae0..c9f2c62a91 100644
--- a/bsps/or1k/generic_or1k/include/bsp/irq.h
+++ b/bsps/or1k/generic_or1k/include/bsp/irq.h
@@ -23,8 +23,7 @@
 #include 
 #include 
 
-#define BSP_INTERRUPT_VECTOR_MIN  0x100
-#define BSP_INTERRUPT_VECTOR_MAX  0x1F00
+#include 
 
 /* Interrupt Identification Register */
 #define OR1K_BSP_UART_REG_INT_ID_MSI(0x00)
diff --git a/bsps/or1k/generic_or1k/irq/irq.c b/bsps/or1k/generic_or1k/irq/irq.c
deleted file mode 100644
index f9a7b6426d..00
--- a/bsps/or1k/generic_or1k/irq/irq.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * @file
- *
- * @ingroup or1k_interrupt
- *
- * @brief Interrupt support.
- */
-
-/*
- * Copyright (c) 2014 Hesham ALMatary
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#include 
-#include 
-#include 
-
-/* Almost all of the jobs that the following functions should
- * do are implemented in cpukit
- */
-
-void bsp_interrupt_handler_default(rtems_vector_number vector)
-{
-printk("spurious interrupt: %" PRIdrtems_vector_number "\n", vector);
-}
-
-rtems_status_code bsp_interrupt_facility_initialize()
-{
-  return 0;
-}
-
-void bsp_interrupt_vector_enable(rtems_vector_number vector)
-{
-  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
-}
-
-void bsp_interrupt_vector_disable(rtems_vector_number vector)
-{
-  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
-}
diff --git a/c/src/lib/libbsp/or1k/generic_or1k/Makefile.am 
b/c/src/lib/libbsp/or1k/generic_or1k/Makefile.am
index fc3686e54e..e6e185cbeb 100644
--- a/c/src/lib/libbsp/or1k/generic_or1k/Makefile.am
+++ b/c/src/lib/libbsp/or1k/generic_or1k/Makefile.am
@@ -59,10 +59,6 @@ librtemsbsp_a_SOURCES += 
../../../../../../bsps/or1k/generic_or1k/btimer/btimer.
 # clock
 librtemsbsp_a_SOURCES 
+=../../../../../../bsps/or1k/generic_or1k/clock/clockdrv.c
 
-# IRQ
-librtemsbsp_a_SOURCES += 
../../../../../../bsps/shared/irq/irq-default-handler.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/or1k/generic_or1k/irq/irq.c
-
 # Cache
 librtemsbsp_a_SOURCES += ../../../../../../bsps/or1k/shared/cache/cache.c
 
@@ -71,6 +67,6 @@ librtemsbsp_a_SOURCES += 
../../../../../../bsps/or1k/shared/cache/cache.c
 ###
 
 
-include $(srcdir)/../../../../../../bsps/shared/irq-sources.am
+include $(srcdir)/../../../../../../bsps/shared/irq-default-sources.am
 include $(srcdir)/../../../../../../bsps/shared/shared-sources.am
 include $(srcdir)/../../../../../../bsps/or1k/generic_or1k/headers.am
diff --git a/spec/build/bsps/or1k/generic_or1k/bspgenericor1k.yml 
b/spec/build/bsps/or1k/generic_or1k/bspgenericor1k.yml
index 9ab0f3580e..0b2314c8ed 100644
--- a/spec/build/bsps/or1k/generic_or1k/bspgenericor1k.yml
+++ b/spec/build/bsps/or1k/generic_or1k/bspgenericor1k.yml
@@ -27,7 +27,7 @@ links:
 - role: build-dependency
   uid: ../../obj
 - role: build-dependency
-  uid: ../../objirq
+  uid: ../../objirqdflt
 - role: build-dependency
   uid: ../../opto0
 - role: build-dependency
@@ -51,14 +51,12 @@ source:
 - bsps/or1k/generic_or1k/clock/clockdrv.c
 - bsps/or1k/generic_or1k/console/console-config.c
 - bsps/or1k/generic_or1k/console/uart.c
-- bsps/or1k/generic_or1k/irq/irq.c
 - bsps/or1k/generic_or1k/start/bspstart.c
 - bsps/or1k/shared/cache/cache.c
 - bsps/shared/dev/getentropy/getentropy-cpucounter.c
 - bsps/shared/dev/serial/legacy-console-control.c
 - bsps/shared/dev/serial/legacy-console-select.c
 - bsps/shared/dev/serial/legacy-console.c
-- bsps/shared/irq/irq-default-handler.c
 - bsps/shared/start/bspfatal-default.c
 - bsps/shared/start/bspgetworkarea-default.c
 - bsps/shared/start/bspreset-empty.c
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2 06/12] smpcapture02: Fix use of BSP_INTERRUPT_VECTOR_MAX

2021-06-19 Thread Sebastian Huber
This define represents the last valid interrupt vector number.

Update #3269.
---
 testsuites/smptests/smpcapture02/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testsuites/smptests/smpcapture02/init.c 
b/testsuites/smptests/smpcapture02/init.c
index 9cf1f0b006..329fd344e6 100644
--- a/testsuites/smptests/smpcapture02/init.c
+++ b/testsuites/smptests/smpcapture02/init.c
@@ -316,7 +316,7 @@ static void Init(rtems_task_argument arg)
   test(cpu_count);
 
   /* Try to find the clock interrupt handler */
-  for ( vec = 0; vec < BSP_INTERRUPT_VECTOR_MAX; vec++ ) {
+  for ( vec = 0; vec <= BSP_INTERRUPT_VECTOR_MAX; vec++ ) {
 rtems_interrupt_handler_iterate(vec, locate_clock_interrupt_handler, );
 if ( cih.found )
   break;
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2 10/12] bsps/irq: Remove BSP_INTERRUPT_VECTOR_MAX

2021-06-19 Thread Sebastian Huber
This define is no longer used.

Update #3269.
---
 bsps/aarch64/a53/include/bsp/irq.h  | 1 -
 bsps/aarch64/a72/include/bsp/irq.h  | 1 -
 bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h| 1 -
 bsps/arm/altera-cyclone-v/include/bsp/irq.h | 1 -
 bsps/arm/atsam/include/bsp/irq.h| 1 -
 bsps/arm/beagle/include/bsp/irq.h   | 1 -
 bsps/arm/csb336/include/bsp/irq.h   | 1 -
 bsps/arm/csb337/include/bsp/irq.h   | 1 -
 bsps/arm/edb7312/include/bsp/irq.h  | 1 -
 bsps/arm/fvp/include/bsp/irq.h  | 1 -
 bsps/arm/gumstix/include/bsp/irq.h  | 1 -
 bsps/arm/imx/include/bsp/irq.h  | 1 -
 bsps/arm/imxrt/include/bsp/irq.h| 1 -
 bsps/arm/lm3s69xx/include/bsp/irq.h | 1 -
 bsps/arm/lpc176x/include/bsp/irq.h  | 1 -
 bsps/arm/lpc24xx/include/bsp/irq.h  | 2 --
 bsps/arm/lpc32xx/include/bsp/irq.h  | 1 -
 bsps/arm/raspberrypi/include/bsp/irq.h  | 2 --
 bsps/arm/realview-pbx-a9/include/bsp/irq.h  | 1 -
 bsps/arm/rtl22xx/include/bsp/irq.h  | 1 -
 bsps/arm/smdk2410/include/bsp/irq.h | 1 -
 bsps/arm/stm32f4/include/bsp/irq.h  | 1 -
 bsps/arm/stm32h7/include/bsp/irq.h  | 1 -
 bsps/arm/tms570/include/bsp/irq.h   | 1 -
 bsps/arm/xen/include/bsp/irq.h  | 1 -
 bsps/arm/xilinx-zynq/include/bsp/irq.h  | 1 -
 bsps/arm/xilinx-zynqmp/include/bsp/irq.h| 1 -
 bsps/i386/include/bsp/irq.h | 1 -
 bsps/include/bsp/irq-default.h  | 1 -
 bsps/include/bsp/irq-generic.h  | 8 
 bsps/lm32/include/bsp/irq.h | 1 -
 bsps/m68k/genmcf548x/include/bsp/irq.h  | 1 -
 bsps/mips/csb350/include/bsp/irq.h  | 1 -
 bsps/mips/hurricane/include/bsp/irq.h   | 1 -
 bsps/mips/jmr3904/include/bsp/irq.h | 1 -
 bsps/mips/malta/include/bsp/irq.h   | 1 -
 bsps/mips/rbtx4925/include/bsp/irq.h| 1 -
 bsps/mips/rbtx4938/include/bsp/irq.h| 1 -
 bsps/powerpc/gen5200/include/bsp/irq.h  | 1 -
 bsps/powerpc/gen83xx/include/bsp/irq.h  | 1 -
 bsps/powerpc/motorola_powerpc/include/bsp/irq.h | 1 -
 bsps/powerpc/mpc55xxevb/include/bsp/irq.h   | 1 -
 bsps/powerpc/mpc8260ads/include/bsp/irq.h   | 1 -
 bsps/powerpc/psim/include/bsp/irq.h | 1 -
 bsps/powerpc/qemuppc/include/bsp/irq.h  | 1 -
 bsps/powerpc/qoriq/include/bsp/irq.h| 2 --
 bsps/powerpc/t32mppc/include/bsp/irq.h  | 1 -
 bsps/powerpc/tqm8xx/include/bsp/irq.h   | 1 -
 bsps/powerpc/virtex/include/bsp/irq.h   | 1 -
 bsps/riscv/griscv/include/bsp/irq.h | 1 -
 bsps/riscv/riscv/include/bsp/irq.h  | 1 -
 bsps/sparc/erc32/include/bsp/irq.h  | 1 -
 bsps/sparc/leon2/include/bsp/irq.h  | 1 -
 bsps/sparc/leon3/include/bsp/irq.h  | 1 -
 bsps/x86_64/include/bsp/irq.h   | 1 -
 55 files changed, 65 deletions(-)

diff --git a/bsps/aarch64/a53/include/bsp/irq.h 
b/bsps/aarch64/a53/include/bsp/irq.h
index 2816c9abd8..b797408ca5 100644
--- a/bsps/aarch64/a53/include/bsp/irq.h
+++ b/bsps/aarch64/a53/include/bsp/irq.h
@@ -48,7 +48,6 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#define BSP_INTERRUPT_VECTOR_MAX 1023
 #define BSP_INTERRUPT_VECTOR_COUNT 1024
 
 /* Interrupts vectors */
diff --git a/bsps/aarch64/a72/include/bsp/irq.h 
b/bsps/aarch64/a72/include/bsp/irq.h
index e96cde7216..c2e86ec0a9 100644
--- a/bsps/aarch64/a72/include/bsp/irq.h
+++ b/bsps/aarch64/a72/include/bsp/irq.h
@@ -48,7 +48,6 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#define BSP_INTERRUPT_VECTOR_MAX 1023
 #define BSP_INTERRUPT_VECTOR_COUNT 1024
 
 /* Interrupts vectors */
diff --git a/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h 
b/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h
index 7974b0b4eb..b67d7d0f8e 100644
--- a/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h
+++ b/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h
@@ -48,7 +48,6 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#define BSP_INTERRUPT_VECTOR_MAX 1023
 #define BSP_INTERRUPT_VECTOR_COUNT 1024
 
 /* Interrupts vectors */
diff --git a/bsps/arm/altera-cyclone-v/include/bsp/irq.h 
b/bsps/arm/altera-cyclone-v/include/bsp/irq.h
index e9837ae9e3..496645c23f 100644
--- a/bsps/arm/altera-cyclone-v/include/bsp/irq.h
+++ b/bsps/arm/altera-cyclone-v/include/bsp/irq.h
@@ -47,7 +47,6 @@ extern "C" {
  */
 
 /* Use interrupt IDs as defined in alt_interrupt_common.h */
-#define BSP_INTERRUPT_VECTOR_MAX ALT_INT_INTERRUPT_RAM_ECC_UNCORRECTED_IRQ
 #define BSP_INTERRUPT_VECTOR_COUNT \
   (ALT_INT_INTERRUPT_RAM_ECC_UNCORRECTED_IRQ + 1)
 
diff --git a/bsps/arm/atsam/include/bsp/irq.h b/bsps/arm/atsam/include/bsp/irq.h
index e7a4add25a..fa3d56ab1e 100644
--- a/bsps/arm/atsam/include/bsp/irq.h
+++ b/bsps/arm/atsam/include/bsp/irq.h
@@ -23,7 +23,6 @@
  

[PATCH v2 05/12] bsps/irq: Remove BSP_INTERRUPT_VECTOR_MIN

2021-06-19 Thread Sebastian Huber
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.
---
 bsps/aarch64/a53/include/bsp/irq.h|  1 -
 bsps/aarch64/a72/include/bsp/irq.h|  1 -
 bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h  |  1 -
 bsps/arm/altera-cyclone-v/include/bsp/irq.h   |  1 -
 bsps/arm/atsam/include/bsp/irq.h  |  2 --
 bsps/arm/beagle/include/bsp/irq.h |  1 -
 bsps/arm/beagle/irq/irq.c |  2 +-
 bsps/arm/csb336/include/bsp/irq.h |  2 --
 bsps/arm/csb337/include/bsp/irq.h |  2 --
 bsps/arm/edb7312/include/bsp/irq.h|  2 --
 bsps/arm/fvp/include/bsp/irq.h|  2 --
 bsps/arm/gumstix/include/bsp/irq.h|  2 --
 bsps/arm/imx/include/bsp/irq.h|  1 -
 bsps/arm/imxrt/include/bsp/irq.h  |  1 -
 bsps/arm/lm3s69xx/include/bsp/irq.h   |  1 -
 bsps/arm/lpc176x/include/bsp/irq.h|  2 --
 bsps/arm/lpc24xx/include/bsp/irq.h|  2 --
 bsps/arm/lpc24xx/irq/irq.c|  2 +-
 bsps/arm/lpc32xx/include/bsp/irq.h|  1 -
 bsps/arm/raspberrypi/include/bsp/irq.h|  1 -
 bsps/arm/realview-pbx-a9/include/bsp/irq.h|  1 -
 bsps/arm/rtl22xx/include/bsp/irq.h|  2 --
 bsps/arm/shared/irq/irq-armv7m.c  |  2 +-
 bsps/arm/smdk2410/include/bsp/irq.h   |  2 --
 bsps/arm/stm32f4/include/bsp/irq.h|  1 -
 bsps/arm/stm32h7/include/bsp/irq.h|  2 --
 bsps/arm/tms570/include/bsp/irq.h |  1 -
 bsps/arm/xen/include/bsp/irq.h|  1 -
 bsps/arm/xilinx-zynq/include/bsp/irq.h|  1 -
 bsps/arm/xilinx-zynqmp/include/bsp/irq.h  |  1 -
 bsps/i386/include/bsp/irq.h   |  1 -
 bsps/include/bsp/irq-default.h|  5 -
 bsps/include/bsp/irq-generic.h| 22 +++
 bsps/lm32/include/bsp/irq.h   |  5 -
 bsps/m68k/genmcf548x/include/bsp/irq.h|  2 --
 bsps/mips/csb350/include/bsp/irq.h|  1 -
 bsps/mips/hurricane/include/bsp/irq.h |  1 -
 bsps/mips/jmr3904/include/bsp/irq.h   |  2 --
 bsps/mips/malta/include/bsp/irq.h |  2 --
 bsps/mips/rbtx4925/include/bsp/irq.h  |  1 -
 bsps/mips/rbtx4938/include/bsp/irq.h  |  1 -
 bsps/powerpc/gen5200/include/bsp/irq.h|  2 --
 bsps/powerpc/gen83xx/include/bsp/irq.h|  2 --
 .../motorola_powerpc/include/bsp/irq.h|  1 -
 bsps/powerpc/mpc55xxevb/include/bsp/irq.h |  2 --
 bsps/powerpc/mpc8260ads/include/bsp/irq.h |  2 --
 bsps/powerpc/psim/include/bsp/irq.h   |  1 -
 bsps/powerpc/qemuppc/include/bsp/irq.h|  2 --
 bsps/powerpc/qoriq/include/bsp/irq.h  |  2 --
 bsps/powerpc/qoriq/irq/irq.c  |  6 ++---
 bsps/powerpc/t32mppc/include/bsp/irq.h|  1 -
 bsps/powerpc/tqm8xx/include/bsp/irq.h |  2 --
 bsps/powerpc/virtex/include/bsp/irq.h |  1 -
 bsps/riscv/griscv/include/bsp/irq.h   |  2 --
 bsps/riscv/riscv/include/bsp/irq.h|  2 --
 bsps/shared/irq/irq-info.c|  2 +-
 bsps/sparc/erc32/include/bsp/irq.h|  1 -
 bsps/sparc/leon2/include/bsp/irq.h|  1 -
 bsps/sparc/leon3/include/bsp/irq.h|  1 -
 bsps/x86_64/include/bsp/irq.h |  1 -
 testsuites/smptests/smpcapture02/init.c   |  2 +-
 61 files changed, 16 insertions(+), 107 deletions(-)

diff --git a/bsps/aarch64/a53/include/bsp/irq.h 
b/bsps/aarch64/a53/include/bsp/irq.h
index f7a4f1ad1f..e1aebf5a22 100644
--- a/bsps/aarch64/a53/include/bsp/irq.h
+++ b/bsps/aarch64/a53/include/bsp/irq.h
@@ -48,7 +48,6 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#define BSP_INTERRUPT_VECTOR_MIN 0
 #define BSP_INTERRUPT_VECTOR_MAX 1023
 
 /* Interrupts vectors */
diff --git a/bsps/aarch64/a72/include/bsp/irq.h 
b/bsps/aarch64/a72/include/bsp/irq.h
index c3de523d48..71076ed82a 100644
--- a/bsps/aarch64/a72/include/bsp/irq.h
+++ b/bsps/aarch64/a72/include/bsp/irq.h
@@ -48,7 +48,6 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#define BSP_INTERRUPT_VECTOR_MIN 0
 #define BSP_INTERRUPT_VECTOR_MAX 1023
 
 /* Interrupts vectors */
diff --git a/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h 
b/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h
index 13ce55d5b9..f12a4536b5 100644
--- a/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h
+++ b/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h
@@ -48,7 +48,6 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#define BSP_INTERRUPT_VECTOR_MIN 0
 #define BSP_INTERRUPT_VECTOR_MAX 1023
 
 /* Interrupts vectors */
diff --git a/bsps/arm/altera-cyclone-v/include/bsp/irq.h 
b/bsps/arm/altera-cyclone-v/include/bsp/irq.h
index bd2bba4caa..d5470f9b4e 100644
--- a/bsps/arm/altera-cyclone-v/include/bsp/irq.h
+++ 

[PATCH v2 07/12] bsps/irq: Add BSP_INTERRUPT_VECTOR_COUNT

2021-06-19 Thread Sebastian Huber
Assert BSP_INTERRUPT_VECTOR_MAX + 1 == BSP_INTERRUPT_VECTOR_COUNT.

After building all BSPs with this patch, BSP_INTERRUPT_VECTOR_MAX can be
removed and replaced by BSP_INTERRUPT_VECTOR_COUNT.  The
BSP_INTERRUPT_VECTOR_COUNT allows a default implementation which supports no
interrupt vector at all.  Using COUNT instead of MAX may avoid some
interpretation issues, for example is the maximum value a valid vector number
or not.

Update #3269.
---
 bsps/aarch64/a53/include/bsp/irq.h  | 1 +
 bsps/aarch64/a72/include/bsp/irq.h  | 1 +
 bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h| 1 +
 bsps/arm/altera-cyclone-v/include/bsp/irq.h | 2 ++
 bsps/arm/atsam/include/bsp/irq.h| 1 +
 bsps/arm/beagle/include/bsp/irq.h   | 1 +
 bsps/arm/csb336/include/bsp/irq.h   | 1 +
 bsps/arm/csb337/include/bsp/irq.h   | 1 +
 bsps/arm/edb7312/include/bsp/irq.h  | 1 +
 bsps/arm/fvp/include/bsp/irq.h  | 2 ++
 bsps/arm/gumstix/include/bsp/irq.h  | 1 +
 bsps/arm/imx/include/bsp/irq.h  | 1 +
 bsps/arm/imxrt/include/bsp/irq.h| 1 +
 bsps/arm/lm3s69xx/include/bsp/irq.h | 1 +
 bsps/arm/lpc176x/include/bsp/irq.h  | 1 +
 bsps/arm/lpc24xx/include/bsp/irq.h  | 2 ++
 bsps/arm/lpc32xx/include/bsp/irq.h  | 1 +
 bsps/arm/raspberrypi/include/bsp/irq.h  | 2 ++
 bsps/arm/realview-pbx-a9/include/bsp/irq.h  | 1 +
 bsps/arm/rtl22xx/include/bsp/irq.h  | 1 +
 bsps/arm/smdk2410/include/bsp/irq.h | 1 +
 bsps/arm/stm32f4/include/bsp/irq.h  | 1 +
 bsps/arm/stm32h7/include/bsp/irq.h  | 1 +
 bsps/arm/tms570/include/bsp/irq.h   | 1 +
 bsps/arm/xen/include/bsp/irq.h  | 1 +
 bsps/arm/xilinx-zynq/include/bsp/irq.h  | 1 +
 bsps/arm/xilinx-zynqmp/include/bsp/irq.h| 1 +
 bsps/i386/include/bsp/irq.h | 1 +
 bsps/include/bsp/irq-default.h  | 1 +
 bsps/include/bsp/irq-generic.h  | 8 
 bsps/lm32/include/bsp/irq.h | 1 +
 bsps/m68k/genmcf548x/include/bsp/irq.h  | 1 +
 bsps/mips/csb350/include/bsp/irq.h  | 1 +
 bsps/mips/hurricane/include/bsp/irq.h   | 1 +
 bsps/mips/jmr3904/include/bsp/irq.h | 1 +
 bsps/mips/malta/include/bsp/irq.h   | 1 +
 bsps/mips/rbtx4925/include/bsp/irq.h| 1 +
 bsps/mips/rbtx4938/include/bsp/irq.h| 1 +
 bsps/powerpc/gen5200/include/bsp/irq.h  | 1 +
 bsps/powerpc/gen83xx/include/bsp/irq.h  | 1 +
 bsps/powerpc/motorola_powerpc/include/bsp/irq.h | 1 +
 bsps/powerpc/mpc55xxevb/include/bsp/irq.h   | 1 +
 bsps/powerpc/mpc8260ads/include/bsp/irq.h   | 1 +
 bsps/powerpc/psim/include/bsp/irq.h | 1 +
 bsps/powerpc/qemuppc/include/bsp/irq.h  | 1 +
 bsps/powerpc/qoriq/include/bsp/irq.h| 2 ++
 bsps/powerpc/t32mppc/include/bsp/irq.h  | 1 +
 bsps/powerpc/tqm8xx/include/bsp/irq.h   | 1 +
 bsps/powerpc/virtex/include/bsp/irq.h   | 1 +
 bsps/riscv/griscv/include/bsp/irq.h | 1 +
 bsps/riscv/riscv/include/bsp/irq.h  | 1 +
 bsps/sparc/erc32/include/bsp/irq.h  | 1 +
 bsps/sparc/leon2/include/bsp/irq.h  | 1 +
 bsps/sparc/leon3/include/bsp/irq.h  | 1 +
 bsps/x86_64/include/bsp/irq.h   | 1 +
 55 files changed, 67 insertions(+)

diff --git a/bsps/aarch64/a53/include/bsp/irq.h 
b/bsps/aarch64/a53/include/bsp/irq.h
index e1aebf5a22..2816c9abd8 100644
--- a/bsps/aarch64/a53/include/bsp/irq.h
+++ b/bsps/aarch64/a53/include/bsp/irq.h
@@ -49,6 +49,7 @@ extern "C" {
 #endif /* __cplusplus */
 
 #define BSP_INTERRUPT_VECTOR_MAX 1023
+#define BSP_INTERRUPT_VECTOR_COUNT 1024
 
 /* Interrupts vectors */
 #define BSP_TIMER_VIRT_PPI 27
diff --git a/bsps/aarch64/a72/include/bsp/irq.h 
b/bsps/aarch64/a72/include/bsp/irq.h
index 71076ed82a..e96cde7216 100644
--- a/bsps/aarch64/a72/include/bsp/irq.h
+++ b/bsps/aarch64/a72/include/bsp/irq.h
@@ -49,6 +49,7 @@ extern "C" {
 #endif /* __cplusplus */
 
 #define BSP_INTERRUPT_VECTOR_MAX 1023
+#define BSP_INTERRUPT_VECTOR_COUNT 1024
 
 /* Interrupts vectors */
 #define BSP_TIMER_VIRT_PPI 27
diff --git a/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h 
b/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h
index f12a4536b5..7974b0b4eb 100644
--- a/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h
+++ b/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h
@@ -49,6 +49,7 @@ extern "C" {
 #endif /* __cplusplus */
 
 #define BSP_INTERRUPT_VECTOR_MAX 1023
+#define BSP_INTERRUPT_VECTOR_COUNT 1024
 
 /* Interrupts vectors */
 #define BSP_TIMER_VIRT_PPI 27
diff --git a/bsps/arm/altera-cyclone-v/include/bsp/irq.h 
b/bsps/arm/altera-cyclone-v/include/bsp/irq.h
index d5470f9b4e..e9837ae9e3 100644
--- a/bsps/arm/altera-cyclone-v/include/bsp/irq.h
+++ 

[PATCH v2 12/12] bsp/atsam: Fix BSP_INTERRUPT_VECTOR_COUNT

2021-06-19 Thread Sebastian Huber
Fix an off by one error.

Update #3269.
---
 bsps/arm/atsam/include/bsp/irq.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bsps/arm/atsam/include/bsp/irq.h b/bsps/arm/atsam/include/bsp/irq.h
index fa3d56ab1e..e788570469 100644
--- a/bsps/arm/atsam/include/bsp/irq.h
+++ b/bsps/arm/atsam/include/bsp/irq.h
@@ -23,6 +23,6 @@
   #include 
 #endif
 
-#define BSP_INTERRUPT_VECTOR_COUNT 65
+#define BSP_INTERRUPT_VECTOR_COUNT 64
 
 #endif /* LIBBSP_ARM_ATSAM_ESV_70_IRQ_H */
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2 09/12] bsps/irq: Use BSP_INTERRUPT_VECTOR_COUNT

2021-06-19 Thread Sebastian Huber
Use BSP_INTERRUPT_VECTOR_COUNT instead of BSP_INTERRUPT_VECTOR_MAX.

Update #3269.
---
 bsps/arm/atsam/start/bspstart.c | 2 +-
 bsps/arm/beagle/irq/irq.c   | 2 +-
 bsps/arm/lpc176x/irq/irq.c  | 2 +-
 bsps/arm/lpc24xx/irq/irq.c  | 4 ++--
 bsps/arm/lpc32xx/include/bsp/irq.h  | 2 +-
 bsps/arm/shared/irq/irq-armv7m.c| 2 +-
 bsps/arm/shared/start/start.S   | 2 +-
 bsps/arm/tms570/irq/irq.c   | 2 +-
 bsps/include/bsp/irq-generic.h  | 8 
 bsps/m68k/genmcf548x/irq/irq.c  | 4 ++--
 bsps/mips/shared/irq/irq.c  | 2 +-
 bsps/powerpc/qoriq/irq/irq.c| 6 +++---
 bsps/shared/irq/irq-info.c  | 2 +-
 bsps/shared/irq/irq-server.c| 2 +-
 testsuites/smptests/smpcapture02/init.c | 2 +-
 15 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/bsps/arm/atsam/start/bspstart.c b/bsps/arm/atsam/start/bspstart.c
index b463bab696..3f49779797 100644
--- a/bsps/arm/atsam/start/bspstart.c
+++ b/bsps/arm/atsam/start/bspstart.c
@@ -21,7 +21,7 @@
 #include 
 
 RTEMS_STATIC_ASSERT(
-  PERIPH_COUNT_IRQn <= BSP_INTERRUPT_VECTOR_MAX,
+  PERIPH_COUNT_IRQn <= BSP_INTERRUPT_VECTOR_COUNT,
   PERIPH_COUNT_IRQn
 );
 
diff --git a/bsps/arm/beagle/irq/irq.c b/bsps/arm/beagle/irq/irq.c
index 721703b87b..8e9294cae9 100644
--- a/bsps/arm/beagle/irq/irq.c
+++ b/bsps/arm/beagle/irq/irq.c
@@ -133,7 +133,7 @@ rtems_status_code bsp_interrupt_facility_initialize(void)
   }
 
   /* Mask all interrupts */
-  for(i = 0; i <= BSP_INTERRUPT_VECTOR_MAX; i++)
+  for(i = 0; i < BSP_INTERRUPT_VECTOR_COUNT; i++)
 bsp_interrupt_vector_disable(i);
 
   /* Install generic interrupt handler */
diff --git a/bsps/arm/lpc176x/irq/irq.c b/bsps/arm/lpc176x/irq/irq.c
index e05fd59e6c..a060401d0b 100644
--- a/bsps/arm/lpc176x/irq/irq.c
+++ b/bsps/arm/lpc176x/irq/irq.c
@@ -38,7 +38,7 @@
  */
 static inline bool lpc176x_irq_is_valid( const rtems_vector_number vector )
 {
-  return vector <= BSP_INTERRUPT_VECTOR_MAX;
+  return vector < BSP_INTERRUPT_VECTOR_COUNT;
 }
 
 void lpc176x_irq_set_priority(
diff --git a/bsps/arm/lpc24xx/irq/irq.c b/bsps/arm/lpc24xx/irq/irq.c
index 2fed80efda..ed07805a9a 100644
--- a/bsps/arm/lpc24xx/irq/irq.c
+++ b/bsps/arm/lpc24xx/irq/irq.c
@@ -31,7 +31,7 @@
 
 static inline bool lpc24xx_irq_is_valid(rtems_vector_number vector)
 {
-  return vector <= BSP_INTERRUPT_VECTOR_MAX;
+  return vector < BSP_INTERRUPT_VECTOR_COUNT;
 }
 
 void lpc24xx_irq_set_priority(rtems_vector_number vector, unsigned priority)
@@ -91,7 +91,7 @@ rtems_status_code bsp_interrupt_facility_initialize(void)
   /* Use IRQ category */
   VICIntSelect = 0;
 
-  for (i = 0; i <= BSP_INTERRUPT_VECTOR_MAX; ++i) {
+  for (i = 0; i < BSP_INTERRUPT_VECTOR_COUNT; ++i) {
 /* Use the vector address register to store the vector number */
 addr [i] = i;
 
diff --git a/bsps/arm/lpc32xx/include/bsp/irq.h 
b/bsps/arm/lpc32xx/include/bsp/irq.h
index d6f7e3144e..02fce3258a 100644
--- a/bsps/arm/lpc32xx/include/bsp/irq.h
+++ b/bsps/arm/lpc32xx/include/bsp/irq.h
@@ -142,7 +142,7 @@ extern "C" {
 #define BSP_INTERRUPT_VECTOR_MAX LPC32XX_IRQ_SYSCLK
 #define BSP_INTERRUPT_VECTOR_COUNT (LPC32XX_IRQ_SYSCLK + 1)
 
-#define LPC32XX_IRQ_COUNT (BSP_INTERRUPT_VECTOR_MAX + 1)
+#define LPC32XX_IRQ_COUNT BSP_INTERRUPT_VECTOR_COUNT
 
 void lpc32xx_irq_set_priority(rtems_vector_number vector, unsigned priority);
 
diff --git a/bsps/arm/shared/irq/irq-armv7m.c b/bsps/arm/shared/irq/irq-armv7m.c
index 7c7c1ab114..2bf8c9df74 100644
--- a/bsps/arm/shared/irq/irq-armv7m.c
+++ b/bsps/arm/shared/irq/irq-armv7m.c
@@ -67,7 +67,7 @@ rtems_status_code bsp_interrupt_facility_initialize(void)
 
   _ARMV7M_SCB->icsr = ARMV7M_SCB_ICSR_PENDSVCLR | ARMV7M_SCB_ICSR_PENDSTCLR;
 
-  for (i = 0; i <= BSP_INTERRUPT_VECTOR_MAX; ++i) {
+  for (i = 0; i < BSP_INTERRUPT_VECTOR_COUNT; ++i) {
 _ARMV7M_NVIC_Clear_enable(i);
 _ARMV7M_NVIC_Clear_pending(i);
 _ARMV7M_NVIC_Set_priority(i, BSP_ARMV7M_IRQ_PRIORITY_DEFAULT);
diff --git a/bsps/arm/shared/start/start.S b/bsps/arm/shared/start/start.S
index bd623178ed..698495d32e 100644
--- a/bsps/arm/shared/start/start.S
+++ b/bsps/arm/shared/start/start.S
@@ -529,7 +529,7 @@ bsp_start_vector_table_begin:
.word   _ARMV7M_Exception_default /* Reserved */
.word   _ARMV7M_Pendable_service_call /* PendSV */
.word   _ARMV7M_Clock_handler /* SysTick */
-   .rept   BSP_INTERRUPT_VECTOR_MAX + 1
+   .rept   BSP_INTERRUPT_VECTOR_COUNT
.word   _ARMV7M_NVIC_Interrupt_dispatch /* IRQ */
.endr
 
diff --git a/bsps/arm/tms570/irq/irq.c b/bsps/arm/tms570/irq/irq.c
index 7129915c93..4abab8feb3 100644
--- a/bsps/arm/tms570/irq/irq.c
+++ b/bsps/arm/tms570/irq/irq.c
@@ -28,7 +28,7 @@
 #include 
 #include 
 
-unsigned int priorityTable[BSP_INTERRUPT_VECTOR_MAX+1];
+unsigned int priorityTable[BSP_INTERRUPT_VECTOR_COUNT];
 
 /**
  * @brief Set priority of the interrupt vector.
diff --git 

[PATCH v2 02/12] bsp/genmcf548x: Change BSP_INTERRUPT_VECTOR_MIN

2021-06-19 Thread Sebastian Huber
This BSP uses a customized implementation of the interrupt extension API.  It
was the only BSP which defined BSP_INTERRUPT_VECTOR_MIN to a value other than
zero.  Define it to zero and use a custom is_valid_vector() function instead.

Update #3269.
---
 bsps/m68k/genmcf548x/include/bsp/irq.h |  2 +-
 bsps/m68k/genmcf548x/irq/irq.c | 16 +++-
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/bsps/m68k/genmcf548x/include/bsp/irq.h 
b/bsps/m68k/genmcf548x/include/bsp/irq.h
index 0a5a4cd6d5..c9809e3cbf 100644
--- a/bsps/m68k/genmcf548x/include/bsp/irq.h
+++ b/bsps/m68k/genmcf548x/include/bsp/irq.h
@@ -89,7 +89,7 @@
 #define MCF548X_IRQ_GPT1 61
 #define MCF548X_IRQ_GPT0 62
 
-#define BSP_INTERRUPT_VECTOR_MIN 1
+#define BSP_INTERRUPT_VECTOR_MIN 0
 
 #define BSP_INTERRUPT_VECTOR_MAX 63
 
diff --git a/bsps/m68k/genmcf548x/irq/irq.c b/bsps/m68k/genmcf548x/irq/irq.c
index f02231b67c..d010865152 100644
--- a/bsps/m68k/genmcf548x/irq/irq.c
+++ b/bsps/m68k/genmcf548x/irq/irq.c
@@ -16,6 +16,12 @@
 
 #include 
 
+static inline bool is_valid_vector(rtems_vector_number vector)
+{
+  return 1 <= vector
+&& vector <= (rtems_vector_number) BSP_INTERRUPT_VECTOR_MAX;
+}
+
 void asm_default_interrupt(void);
 
 typedef void (*void_func)(void);
@@ -65,7 +71,7 @@ void bsp_interrupt_vector_enable(rtems_vector_number vector)
   uint32_t bit = vector_to_bit(vector);
   rtems_interrupt_level level;
 
-  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+  bsp_interrupt_assert(is_valid_vector(vector));
 
   rtems_interrupt_disable(level);
   *imr &= ~bit;
@@ -78,7 +84,7 @@ void bsp_interrupt_vector_disable(rtems_vector_number vector)
   uint32_t bit = vector_to_bit(vector);
   rtems_interrupt_level level;
 
-  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+  bsp_interrupt_assert(is_valid_vector(vector));
 
   rtems_interrupt_disable(level);
   *imr |= bit;
@@ -134,7 +140,7 @@ rtems_status_code rtems_interrupt_handler_install(
 {
   rtems_status_code sc = RTEMS_SUCCESSFUL;
 
-  if (bsp_interrupt_is_valid_vector(vector)) {
+  if (is_valid_vector(vector)) {
 rtems_interrupt_level level;
 
 rtems_interrupt_disable(level);
@@ -180,7 +186,7 @@ rtems_status_code rtems_interrupt_handler_remove(
 {
   rtems_status_code sc = RTEMS_SUCCESSFUL;
 
-  if (bsp_interrupt_is_valid_vector(vector)) {
+  if (is_valid_vector(vector)) {
 rtems_interrupt_level level;
 interrupt_control *ic = _controls[vector];
 
@@ -215,7 +221,7 @@ rtems_status_code rtems_interrupt_handler_iterate(
 {
   rtems_status_code sc = RTEMS_SUCCESSFUL;
 
-  if (bsp_interrupt_is_valid_vector(vector)) {
+  if (is_valid_vector(vector)) {
 if (is_occupied_by_us(vector)) {
   const interrupt_control *ic = _controls[vector];
 
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2 01/12] bsps/irq: Remove BSP_INTERRUPT_NO_HEAP_USAGE

2021-06-19 Thread Sebastian Huber
Remove the support for BSP_INTERRUPT_NO_HEAP_USAGE.  This was only used
by one BSP and provides no real benefit.

Update #3269.
---
 bsps/include/bsp/irq-generic.h|  8 --
 bsps/powerpc/mpc55xxevb/include/bsp/irq.h |  1 -
 bsps/shared/irq/irq-generic.c | 34 ++-
 3 files changed, 3 insertions(+), 40 deletions(-)

diff --git a/bsps/include/bsp/irq-generic.h b/bsps/include/bsp/irq-generic.h
index 4135aa518c..e888a66cea 100644
--- a/bsps/include/bsp/irq-generic.h
+++ b/bsps/include/bsp/irq-generic.h
@@ -66,10 +66,6 @@ extern "C" {
   #error "if you define BSP_INTERRUPT_USE_INDEX_TABLE, you have to define 
BSP_INTERRUPT_HANDLER_TABLE_SIZE etc. as well"
 #endif
 
-#if defined(BSP_INTERRUPT_NO_HEAP_USAGE) && 
!defined(BSP_INTERRUPT_USE_INDEX_TABLE)
-  #error "if you define BSP_INTERRUPT_NO_HEAP_USAGE, you have to define 
BSP_INTERRUPT_USE_INDEX_TABLE etc. as well"
-#endif
-
 #define BSP_INTERRUPT_VECTOR_NUMBER \
   (BSP_INTERRUPT_VECTOR_MAX - BSP_INTERRUPT_VECTOR_MIN + 1)
 
@@ -150,10 +146,6 @@ static inline rtems_vector_number 
bsp_interrupt_handler_index(
  * table will be accessed via a small index table.  You can define the size of
  * the handler table with @ref BSP_INTERRUPT_HANDLER_TABLE_SIZE.
  *
- * Normally new list entries are allocated from the heap.  You may define
- * @ref BSP_INTERRUPT_NO_HEAP_USAGE, if you do not want to use the heap.  For
- * this option you have to define @ref BSP_INTERRUPT_USE_INDEX_TABLE as well.
- *
  * You have to provide some special routines in your BSP (follow the links for
  * the details):
  * - bsp_interrupt_facility_initialize()
diff --git a/bsps/powerpc/mpc55xxevb/include/bsp/irq.h 
b/bsps/powerpc/mpc55xxevb/include/bsp/irq.h
index c923859dec..491c120ee8 100644
--- a/bsps/powerpc/mpc55xxevb/include/bsp/irq.h
+++ b/bsps/powerpc/mpc55xxevb/include/bsp/irq.h
@@ -483,7 +483,6 @@ rtems_status_code 
mpc55xx_intc_clear_software_irq(rtems_vector_number vector);
 
 #ifdef BSP_INTERRUPT_HANDLER_TABLE_SIZE
   #define BSP_INTERRUPT_USE_INDEX_TABLE
-  #define BSP_INTERRUPT_NO_HEAP_USAGE
 #endif
 
 /** @} */
diff --git a/bsps/shared/irq/irq-generic.c b/bsps/shared/irq/irq-generic.c
index 1e83a6f249..abe732a9d3 100644
--- a/bsps/shared/irq/irq-generic.c
+++ b/bsps/shared/irq/irq-generic.c
@@ -142,34 +142,6 @@ static inline bool bsp_interrupt_allocate_handler_index(
   #endif
 }
 
-static bsp_interrupt_handler_entry *bsp_interrupt_allocate_handler_entry(void)
-{
-  bsp_interrupt_handler_entry *e;
-
-  #ifdef BSP_INTERRUPT_NO_HEAP_USAGE
-rtems_vector_number index = 0;
-
-if (bsp_interrupt_allocate_handler_index(0, )) {
-  e = _interrupt_handler_table [index];
-} else {
-  e = NULL;
-}
-  #else
-e = rtems_malloc(sizeof(*e));
-  #endif
-
-  return e;
-}
-
-static void bsp_interrupt_free_handler_entry(bsp_interrupt_handler_entry *e)
-{
-  #ifdef BSP_INTERRUPT_NO_HEAP_USAGE
-bsp_interrupt_clear_handler_entry(e, 0);
-  #else
-free(e);
-  #endif
-}
-
 void bsp_interrupt_initialize(void)
 {
   rtems_status_code sc = RTEMS_SUCCESSFUL;
@@ -318,7 +290,7 @@ static rtems_status_code bsp_interrupt_handler_install(
   }
 
   /* Allocate a new entry */
-  current = bsp_interrupt_allocate_handler_entry();
+  current = rtems_malloc(sizeof(*current));
   if (current == NULL) {
 /* Not enough memory */
 bsp_interrupt_unlock();
@@ -433,7 +405,7 @@ static rtems_status_code bsp_interrupt_handler_remove(
   match->next = current->next;
   bsp_interrupt_enable(level);
 
-  bsp_interrupt_free_handler_entry(current);
+  free(current);
 } else if (match == head) {
   /*
* The match is the list head and has no successor.
@@ -465,7 +437,7 @@ static rtems_status_code bsp_interrupt_handler_remove(
   bsp_interrupt_fence(ATOMIC_ORDER_RELEASE);
   bsp_interrupt_enable(level);
 
-  bsp_interrupt_free_handler_entry(match);
+  free(match);
 }
   } else {
 /* No matching entry found */
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2 11/12] bsps/irq: Default BSP_INTERRUPT_VECTOR_COUNT == 0

2021-06-19 Thread Sebastian Huber
Change the default value of BSP_INTERRUPT_VECTOR_COUNT so that no interrupt
vectors are supported and all related directives return RTEMS_INVALID_ID.

Update #3269.
---
 bsps/include/bsp/irq-default.h | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/bsps/include/bsp/irq-default.h b/bsps/include/bsp/irq-default.h
index 4521624b31..8aacb4fec3 100644
--- a/bsps/include/bsp/irq-default.h
+++ b/bsps/include/bsp/irq-default.h
@@ -45,9 +45,12 @@ extern "C" {
  */
 
 /**
- * @brief Default maximum interrupt vector.
+ * @brief This constant defines the default interrupt vector count.
+ *
+ * By default, no interrupt vectors are supported and all related directives
+ * return RTEMS_INVALID_ID.
  */
-#define BSP_INTERRUPT_VECTOR_COUNT 1
+#define BSP_INTERRUPT_VECTOR_COUNT 0
 
 /** @} */
 
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2 00/12] Simplify generic interrupt controller support

2021-06-19 Thread Sebastian Huber
Chris thankfully reminded me that my first patch set was far too sloppy:

https://lists.rtems.org/pipermail/devel/2021-June/067858.html

I did split it up into parts which are easier to review and test.  This patch
set simplifies the generic interrupt controller support a bit to prepare for
more complex follow up changes.  It basically replaces the BSP-provided defines
BSP_INTERRUPT_VECTOR_MIN and BSP_INTERRUPT_VECTOR_MAX with
BSP_INTERRUPT_VECTOR_COUNT.  The correctness of the changes was checked by
adding a C pre processor assertion and building all BSPs.

Sebastian Huber (12):
  bsps/irq: Remove BSP_INTERRUPT_NO_HEAP_USAGE
  bsp/genmcf548x: Change BSP_INTERRUPT_VECTOR_MIN
  bsp/generic_or1k: Remove incomplete IRQ support
  bsps/irq: Assert BSP_INTERRUPT_VECTOR_MIN == 0
  bsps/irq: Remove BSP_INTERRUPT_VECTOR_MIN
  smpcapture02: Fix use of BSP_INTERRUPT_VECTOR_MAX
  bsps/irq: Add BSP_INTERRUPT_VECTOR_COUNT
  bsps/irq: Remove BSP_INTERRUPT_VECTOR_NUMBER
  bsps/irq: Use BSP_INTERRUPT_VECTOR_COUNT
  bsps/irq: Remove BSP_INTERRUPT_VECTOR_MAX
  bsps/irq: Default BSP_INTERRUPT_VECTOR_COUNT == 0
  bsp/atsam: Fix BSP_INTERRUPT_VECTOR_COUNT

 bsps/aarch64/a53/include/bsp/irq.h|  3 +-
 bsps/aarch64/a72/include/bsp/irq.h|  3 +-
 bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h  |  3 +-
 bsps/arm/altera-cyclone-v/include/bsp/irq.h   |  4 +-
 bsps/arm/atsam/include/bsp/irq.h  |  4 +-
 bsps/arm/atsam/start/bspstart.c   |  2 +-
 bsps/arm/beagle/include/bsp/irq.h |  3 +-
 bsps/arm/beagle/irq/irq.c |  2 +-
 bsps/arm/csb336/include/bsp/irq.h |  4 +-
 bsps/arm/csb337/include/bsp/irq.h |  4 +-
 bsps/arm/edb7312/include/bsp/irq.h|  4 +-
 bsps/arm/fvp/include/bsp/irq.h|  5 +--
 bsps/arm/gumstix/include/bsp/irq.h|  4 +-
 bsps/arm/imx/include/bsp/irq.h|  3 +-
 bsps/arm/imxrt/include/bsp/irq.h  |  3 +-
 bsps/arm/lm3s69xx/include/bsp/irq.h   |  3 +-
 bsps/arm/lpc176x/include/bsp/irq.h|  4 +-
 bsps/arm/lpc176x/irq/irq.c|  2 +-
 bsps/arm/lpc24xx/include/bsp/irq.h|  6 +--
 bsps/arm/lpc24xx/irq/irq.c|  4 +-
 bsps/arm/lpc32xx/include/bsp/irq.h|  5 +--
 bsps/arm/raspberrypi/include/bsp/irq.h|  5 +--
 bsps/arm/realview-pbx-a9/include/bsp/irq.h|  3 +-
 bsps/arm/rtl22xx/include/bsp/irq.h|  4 +-
 bsps/arm/shared/irq/irq-armv7m.c  |  2 +-
 bsps/arm/shared/start/start.S |  2 +-
 bsps/arm/smdk2410/include/bsp/irq.h   |  4 +-
 bsps/arm/stm32f4/include/bsp/irq.h|  3 +-
 bsps/arm/stm32h7/include/bsp/irq.h|  4 +-
 bsps/arm/tms570/include/bsp/irq.h |  3 +-
 bsps/arm/tms570/irq/irq.c |  2 +-
 bsps/arm/xen/include/bsp/irq.h|  3 +-
 bsps/arm/xilinx-zynq/include/bsp/irq.h|  3 +-
 bsps/arm/xilinx-zynqmp/include/bsp/irq.h  |  3 +-
 bsps/i386/include/bsp/irq.h   |  3 +-
 bsps/include/bsp/irq-default.h| 12 +++---
 bsps/include/bsp/irq-generic.h| 30 -
 bsps/lm32/include/bsp/irq.h   |  7 +--
 bsps/m68k/genmcf548x/include/bsp/irq.h|  4 +-
 bsps/m68k/genmcf548x/irq/irq.c| 18 +---
 bsps/mips/csb350/include/bsp/irq.h|  3 +-
 bsps/mips/hurricane/include/bsp/irq.h |  3 +-
 bsps/mips/jmr3904/include/bsp/irq.h   |  4 +-
 bsps/mips/malta/include/bsp/irq.h |  4 +-
 bsps/mips/rbtx4925/include/bsp/irq.h  |  3 +-
 bsps/mips/rbtx4938/include/bsp/irq.h  |  3 +-
 bsps/mips/shared/irq/irq.c|  2 +-
 bsps/or1k/generic_or1k/include/bsp/irq.h  |  3 +-
 bsps/or1k/generic_or1k/irq/irq.c  | 43 ---
 bsps/powerpc/gen5200/include/bsp/irq.h|  4 +-
 bsps/powerpc/gen83xx/include/bsp/irq.h|  4 +-
 .../motorola_powerpc/include/bsp/irq.h|  3 +-
 bsps/powerpc/mpc55xxevb/include/bsp/irq.h |  5 +--
 bsps/powerpc/mpc8260ads/include/bsp/irq.h |  4 +-
 bsps/powerpc/psim/include/bsp/irq.h   |  3 +-
 bsps/powerpc/qemuppc/include/bsp/irq.h|  4 +-
 bsps/powerpc/qoriq/include/bsp/irq.h  |  6 +--
 bsps/powerpc/qoriq/irq/irq.c  |  6 +--
 bsps/powerpc/t32mppc/include/bsp/irq.h|  3 +-
 bsps/powerpc/tqm8xx/include/bsp/irq.h |  4 +-
 bsps/powerpc/virtex/include/bsp/irq.h |  3 +-
 bsps/riscv/griscv/include/bsp/irq.h   |  4 +-
 bsps/riscv/riscv/include/bsp/irq.h|  4 +-
 bsps/shared/irq/irq-generic.c | 36 ++--
 bsps/shared/irq/irq-info.c|  2 +-
 bsps/shared/irq/irq-server.c  |  2 +-
 bsps/sparc/erc32/include/bsp/irq.h|  3 +-
 bsps/sparc/leon2/include/bsp/irq.h|  3 +-
 bsps/sparc/leon3/include/bsp/irq.h