[PATCH] bsp/sparc: Move BSP_ISR_handler to a separate file

Joel Sherrill joel.sherrill at oarcorp.com
Wed Feb 4 15:34:17 UTC 2015



On February 4, 2015 8:12:07 AM MST, Gedare Bloom <gedare at rtems.org> wrote:
>I'd like to entertain a new name for this "BSP_ISR_handler" function
>now that it becomes an exported symbol. We should put it into a proper
>namespace.

Reasonable.

I would also suggest that there be a standard name for the last symbol before the call from assembly to a C handler. The names in the back trace are rather random.

>Also, I'm not sure on the legality of putting a copyright for Cobham
>Gaisler that predates Cobham's acquisition of Aeroflex. But I am not a
>lawyer.

I think this is ok since I assume all IP was acquired and it is really reflecting the current name and contact information. It doesn't seem to be a copyright grab. But IANAL either. 




>-Gedare
>
>On Wed, Feb 4, 2015 at 4:52 AM, Daniel Cederman <cederman at gaisler.com>
>wrote:
>> This allows it to be wrapped by another function at link-time
>> and can be used to trace interrupts. If not placed in a separate
>> file, the function pointer address used in BSP_shared_interrupt_init
>> will be resolved at compile-time, and the function will not be
>wrappable.
>> ---
>>  c/src/lib/libbsp/sparc/Makefile.am                 |  1 +
>>  c/src/lib/libbsp/sparc/erc32/Makefile.am           |  1 +
>>  c/src/lib/libbsp/sparc/erc32/include/bsp.h         |  3 ++
>>  c/src/lib/libbsp/sparc/leon2/Makefile.am           |  1 +
>>  c/src/lib/libbsp/sparc/leon2/include/bsp.h         |  3 ++
>>  c/src/lib/libbsp/sparc/leon3/Makefile.am           |  1 +
>>  c/src/lib/libbsp/sparc/leon3/include/bsp.h         |  3 ++
>>  .../lib/libbsp/sparc/shared/irq/bsp_isr_handler.c  | 35
>++++++++++++++++++++++
>>  c/src/lib/libbsp/sparc/shared/irq/irq-shared.c     | 32
>+++++++-------------
>>  9 files changed, 58 insertions(+), 22 deletions(-)
>>  create mode 100644
>c/src/lib/libbsp/sparc/shared/irq/bsp_isr_handler.c
>>
>> diff --git a/c/src/lib/libbsp/sparc/Makefile.am
>b/c/src/lib/libbsp/sparc/Makefile.am
>> index 3d433fb..615aea7 100644
>> --- a/c/src/lib/libbsp/sparc/Makefile.am
>> +++ b/c/src/lib/libbsp/sparc/Makefile.am
>> @@ -11,6 +11,7 @@ EXTRA_DIST += shared/start/start.S
>>
>>  # Interrupt
>>  EXTRA_DIST += shared/irq/irq-shared.c
>> +EXTRA_DIST += shared/irq/bsp_isr_handler.c
>>
>>  # AMBA Plug&Play bus
>>  EXTRA_DIST += shared/include/ambapp.h
>> diff --git a/c/src/lib/libbsp/sparc/erc32/Makefile.am
>b/c/src/lib/libbsp/sparc/erc32/Makefile.am
>> index c99d2fb..8dcdd32 100644
>> --- a/c/src/lib/libbsp/sparc/erc32/Makefile.am
>> +++ b/c/src/lib/libbsp/sparc/erc32/Makefile.am
>> @@ -71,6 +71,7 @@ include_bsp_HEADERS += \
>>      include/bsp/irq.h
>>  libbsp_a_SOURCES += \
>>      ../../sparc/shared/irq/irq-shared.c \
>> +    ../../sparc/shared/irq/bsp_isr_handler.c \
>>      ../../shared/src/irq-default-handler.c \
>>      ../../shared/src/irq-generic.c \
>>      ../../shared/src/irq-info.c \
>> diff --git a/c/src/lib/libbsp/sparc/erc32/include/bsp.h
>b/c/src/lib/libbsp/sparc/erc32/include/bsp.h
>> index 3393910..2e531ec 100644
>> --- a/c/src/lib/libbsp/sparc/erc32/include/bsp.h
>> +++ b/c/src/lib/libbsp/sparc/erc32/include/bsp.h
>> @@ -106,6 +106,9 @@ typedef void (*bsp_shared_isr)(void *arg);
>>  /* Initializes the Shared System Interrupt service */
>>  extern void BSP_shared_interrupt_init(void);
>>
>> +/* Called directly from IRQ trap handler TRAP[0x10..0x1F] =
>IRQ[0..15] */
>> +void BSP_ISR_handler(rtems_vector_number vector);
>> +
>>  /* Registers a shared IRQ handler, and enable it at IRQ controller.
>Multiple
>>   * interrupt handlers may use the same IRQ number, all ISRs will be
>called
>>   * when an interrupt on that line is fired.
>> diff --git a/c/src/lib/libbsp/sparc/leon2/Makefile.am
>b/c/src/lib/libbsp/sparc/leon2/Makefile.am
>> index d1e3817..efcb286 100644
>> --- a/c/src/lib/libbsp/sparc/leon2/Makefile.am
>> +++ b/c/src/lib/libbsp/sparc/leon2/Makefile.am
>> @@ -80,6 +80,7 @@ include_bsp_HEADERS += \
>>      include/bsp/irq.h
>>  libbsp_a_SOURCES += \
>>      ../../sparc/shared/irq/irq-shared.c \
>> +    ../../sparc/shared/irq/bsp_isr_handler.c \
>>      ../../shared/src/irq-default-handler.c \
>>      ../../shared/src/irq-generic.c \
>>      ../../shared/src/irq-info.c \
>> diff --git a/c/src/lib/libbsp/sparc/leon2/include/bsp.h
>b/c/src/lib/libbsp/sparc/leon2/include/bsp.h
>> index 41a1e43..807f8d9 100644
>> --- a/c/src/lib/libbsp/sparc/leon2/include/bsp.h
>> +++ b/c/src/lib/libbsp/sparc/leon2/include/bsp.h
>> @@ -130,6 +130,9 @@ typedef void (*bsp_shared_isr)(void *arg);
>>  /* Initializes the Shared System Interrupt service */
>>  extern void BSP_shared_interrupt_init(void);
>>
>> +/* Called directly from IRQ trap handler TRAP[0x10..0x1F] =
>IRQ[0..15] */
>> +void BSP_ISR_handler(rtems_vector_number vector);
>> +
>>  /* Registers a shared IRQ handler, and enable it at IRQ controller.
>Multiple
>>   * interrupt handlers may use the same IRQ number, all ISRs will be
>called
>>   * when an interrupt on that line is fired.
>> diff --git a/c/src/lib/libbsp/sparc/leon3/Makefile.am
>b/c/src/lib/libbsp/sparc/leon3/Makefile.am
>> index c894095..cec0b34 100644
>> --- a/c/src/lib/libbsp/sparc/leon3/Makefile.am
>> +++ b/c/src/lib/libbsp/sparc/leon3/Makefile.am
>> @@ -82,6 +82,7 @@ include_bsp_HEADERS += \
>>  libbsp_a_SOURCES += \
>>      startup/eirq.c \
>>      ../../sparc/shared/irq/irq-shared.c \
>> +    ../../sparc/shared/irq/bsp_isr_handler.c \
>>      ../../shared/src/irq-default-handler.c \
>>      ../../shared/src/irq-generic.c \
>>      ../../shared/src/irq-info.c \
>> diff --git a/c/src/lib/libbsp/sparc/leon3/include/bsp.h
>b/c/src/lib/libbsp/sparc/leon3/include/bsp.h
>> index 2514190..f4e1121 100644
>> --- a/c/src/lib/libbsp/sparc/leon3/include/bsp.h
>> +++ b/c/src/lib/libbsp/sparc/leon3/include/bsp.h
>> @@ -153,6 +153,9 @@ typedef void (*bsp_shared_isr)(void *arg);
>>  /* Initializes the Shared System Interrupt service */
>>  extern void BSP_shared_interrupt_init(void);
>>
>> +/* Called directly from IRQ trap handler TRAP[0x10..0x1F] =
>IRQ[0..15] */
>> +void BSP_ISR_handler(rtems_vector_number vector);
>> +
>>  /* Registers a shared IRQ handler, and enable it at IRQ controller.
>Multiple
>>   * interrupt handlers may use the same IRQ number, all ISRs will be
>called
>>   * when an interrupt on that line is fired.
>> diff --git a/c/src/lib/libbsp/sparc/shared/irq/bsp_isr_handler.c
>b/c/src/lib/libbsp/sparc/shared/irq/bsp_isr_handler.c
>> new file mode 100644
>> index 0000000..cc55a15
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/sparc/shared/irq/bsp_isr_handler.c
>> @@ -0,0 +1,35 @@
>> +/*
>> +*  COPYRIGHT (c) 2015
>> +*  Cobham Gaisler
>> +*
>> +*  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 <rtems.h>
>> +#include <bsp.h>
>> +#include <bsp/irq-generic.h>
>> +
>> +static inline void bsp_dispatch_irq(int irq)
>> +{
>> +  bsp_interrupt_handler_entry *e =
>> +    &bsp_interrupt_handler_table[bsp_interrupt_handler_index(irq)];
>> +
>> +  while (e != NULL) {
>> +    (*e->handler)(e->arg);
>> +    e = e->next;
>> +  }
>> +}
>> +
>> +/* Called directly from IRQ trap handler TRAP[0x10..0x1F] =
>IRQ[0..15] */
>> +void BSP_ISR_handler(rtems_vector_number vector)
>> +{
>> +  int irq = vector - 0x10;
>> +
>> +  /* Let BSP fixup and/or handle incomming IRQ */
>> +  irq = bsp_irq_fixup(irq);
>> +
>> +  bsp_dispatch_irq(irq);
>> +}
>> diff --git a/c/src/lib/libbsp/sparc/shared/irq/irq-shared.c
>b/c/src/lib/libbsp/sparc/shared/irq/irq-shared.c
>> index 79dbe55..d75dee0 100644
>> --- a/c/src/lib/libbsp/sparc/shared/irq/irq-shared.c
>> +++ b/c/src/lib/libbsp/sparc/shared/irq/irq-shared.c
>> @@ -1,3 +1,13 @@
>> +/*
>> +*  COPYRIGHT (c) 2012-2015
>> +*  Cobham Gaisler
>> +*
>> +*  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 <rtems.h>
>>  #include <bsp.h>
>>  #include <bsp/irq-generic.h>
>> @@ -27,28 +37,6 @@ static inline int bsp_irq_cpu(int irq)
>>  }
>>  #endif
>>
>> -static inline void bsp_dispatch_irq(int irq)
>> -{
>> -  bsp_interrupt_handler_entry *e =
>> -    &bsp_interrupt_handler_table[bsp_interrupt_handler_index(irq)];
>> -
>> -  while (e != NULL) {
>> -    (*e->handler)(e->arg);
>> -    e = e->next;
>> -  }
>> -}
>> -
>> -/* Called directly from IRQ trap handler TRAP[0x10..0x1F] =
>IRQ[0..15] */
>> -static void BSP_ISR_handler(rtems_vector_number vector)
>> -{
>> -  int irq = vector - 0x10;
>> -
>> -  /* Let BSP fixup and/or handle incomming IRQ */
>> -  irq = bsp_irq_fixup(irq);
>> -
>> -  bsp_dispatch_irq(irq);
>> -}
>> -
>>  /* Initialize interrupts */
>>  void BSP_shared_interrupt_init(void)
>>  {
>> --
>> 2.2.1
>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
>_______________________________________________
>devel mailing list
>devel at rtems.org
>http://lists.rtems.org/mailman/listinfo/devel

--joel



More information about the devel mailing list