<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 25, 2020, 12:38 AM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 25/06/2020 01:36, Chris Johns wrote:<br>
<br>
> On 24/6/20 2:40 am, Sebastian Huber wrote:<br>
>> Hello,<br>
>><br>
>> I noticed that the rtems_interrupt_catch() directive is only declared <br>
>> and implemented if CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE:<br>
>><br>
>> #if (CPU_SIMPLE_VECTORED_INTERRUPTS == FALSE)<br>
>><br>
>> typedef ISR_Handler_entry rtems_isr_entry;<br>
>><br>
>> #else<br>
>> /**<br>
>> * @brief Interrupt handler type.<br>
>> *<br>
>> * @see rtems_interrupt_catch()<br>
>> */<br>
>> typedef rtems_isr ( *rtems_isr_entry )(<br>
>> rtems_vector_number<br>
>> );<br>
>><br>
>> /**<br>
>> * @brief RTEMS Interrupt Catch<br>
>> *<br>
>> * This directive installs @a new_isr_handler as the RTEMS interrupt <br>
>> service<br>
>> * routine for the interrupt vector with number @a vector. The <br>
>> previous RTEMS<br>
>> * interrupt service routine is returned in @a old_isr_handler.<br>
>> *<br>
>> * @param[in] new_isr_handler is the address of interrupt service <br>
>> routine<br>
>> * @param[in] vector is the interrupt vector number<br>
>> * @param[in] old_isr_handler address at which to store previous ISR <br>
>> address<br>
>> *<br>
>> * @retval RTEMS_SUCCESSFUL and *old_isr_handler filled with <br>
>> previous ISR<br>
>> * address<br>
>> */<br>
>> rtems_status_code rtems_interrupt_catch(<br>
>> rtems_isr_entry new_isr_handler,<br>
>> rtems_vector_number vector,<br>
>> rtems_isr_entry *old_isr_handler<br>
>> );<br>
>> #endif<br>
>><br>
>> This is not mentioned in the documentation:<br>
>><br>
>> <a href="https://docs.rtems.org/branches/master/c-user/interrupt_manager.html#interrupt-catch-establish-an-isr" rel="noreferrer noreferrer" target="_blank">https://docs.rtems.org/branches/master/c-user/interrupt_manager.html#interrupt-catch-establish-an-isr</a> <br>
>><br>
>><br>
>> Should we provide this function also if <br>
>> CPU_SIMPLE_VECTORED_INTERRUPTS == FALSE and for example just return <br>
>> RTEMS_NOT_IMPLEMENTED?<br>
><br>
> Which archs define CPU_SIMPLE_VECTORED_INTERRUPTS as false?<br>
cpukit/score/cpu/arm/include/rtems/score/cpu.h:#define <br>
CPU_SIMPLE_VECTORED_INTERRUPTS FALSE<br>
cpukit/score/cpu/v850/include/rtems/score/cpu.h:#define <br>
CPU_SIMPLE_VECTORED_INTERRUPTS FALSE<br>
cpukit/score/cpu/x86_64/include/rtems/score/cpu.h:#define <br>
CPU_SIMPLE_VECTORED_INTERRUPTS FALSE<br>
cpukit/score/cpu/i386/include/rtems/score/cpu.h:#define <br>
CPU_SIMPLE_VECTORED_INTERRUPTS FALSE<br>
cpukit/score/cpu/powerpc/include/rtems/score/cpu.h:#define <br>
CPU_SIMPLE_VECTORED_INTERRUPTS FALSE<br>
cpukit/score/cpu/mips/include/rtems/score/cpu.h:#define <br>
CPU_SIMPLE_VECTORED_INTERRUPTS FALSE<br>
<br>
cpukit/score/cpu/m68k/include/rtems/score/cpu.h:#define <br>
CPU_SIMPLE_VECTORED_INTERRUPTS TRUE<br>
cpukit/score/cpu/bfin/include/rtems/score/cpu.h:#define <br>
CPU_SIMPLE_VECTORED_INTERRUPTS TRUE<br>
cpukit/score/cpu/sparc64/include/rtems/score/cpu.h:#define <br>
CPU_SIMPLE_VECTORED_INTERRUPTS TRUE<br>
cpukit/score/cpu/sh/include/rtems/score/cpu.h:#define <br>
CPU_SIMPLE_VECTORED_INTERRUPTS TRUE<br>
cpukit/score/cpu/lm32/include/rtems/score/cpu.h:#define <br>
CPU_SIMPLE_VECTORED_INTERRUPTS TRUE<br>
cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h:#define <br>
CPU_SIMPLE_VECTORED_INTERRUPTS TRUE<br>
cpukit/score/cpu/nios2/include/rtems/score/cpu.h:#define <br>
CPU_SIMPLE_VECTORED_INTERRUPTS TRUE<br>
cpukit/score/cpu/sparc/include/rtems/score/cpu.h:#define <br>
CPU_SIMPLE_VECTORED_INTERRUPTS TRUE<br>
cpukit/score/cpu/moxie/include/rtems/score/cpu.h:#define <br>
CPU_SIMPLE_VECTORED_INTERRUPTS TRUE<br>
<br>
It seem riscv is missing, so an implicit FALSE.<br>
<br>
Instead of returning RTEMS_NOT_IMPLEMENTED we could also implement it <br>
like this for CPU_SIMPLE_VECTORED_INTERRUPTS == FALSE:<br>
<br>
#if CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE<br>
typedef ISR_Handler_entry rtems_isr_entry;<br>
#else<br>
typedef void ( *rtems_isr_entry )( void * );<br>
/* Now: typedef void rtems_isr_entry; */<br>
#endif<br>
<br>
rtems_status_code rtems_interrupt_catch(<br>
rtems_isr_entry new_isr_handler,<br>
rtems_vector_number vector,<br>
rtems_isr_entry *old_isr_handler<br>
)<br>
{<br>
rtems_status_code sc;<br>
<br>
if ( old_isr_handler == NULL ) {<br>
return RTEMS_INVALID_ADDRESS;<br>
}<br>
<br>
sc = rtems_interrupt_handler_install(<br>
vector,<br>
"Catch",<br>
RTEMS_INTERRUPT_UNIQUE,<br>
new_isr_handler,<br>
NULL<br>
);<br>
<br>
if ( sc == RTEMS_SUCCESSFUL ) {<br>
*old_isr_handler = NULL;<br>
}<br>
<br>
return RTEMS_SUCCESSFUL;<br>
}<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">I would prefer this and honestly thought we already had this. Maybe it was the other direction. PIC interrupt management on top of simple vectored.</div><div dir="auto"><br></div><div dir="auto">Without this, the only acceptable option IMO is compile time failure. This is comparable to the SMP cases where we wanted someone to fix code. Either we make it work for them or we let them know at compile time their driver needs work.</div><div dir="auto"><br></div><div dir="auto">--joel</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank" rel="noreferrer">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a></blockquote></div></div></div>