diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index 4aee251aec70f0a859521fa5dde164f1be85aa4c..a471ac72a7cb40ed738c8d5f08da4ac594ed5f1a 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -1327,6 +1327,12 @@ The system can be re-made subsequently by just typing <code>make</code>. For use in C code</li> <li><code>CONFIG_ENDIAN_BIG</code>: Define if big endian (default is little endian).</li> + <li><code>CONFIG_ARCH_NOINTC</code>: + Define if the architecture does not support an interrupt controller + or otherwise cannot support APIs like up_enable_irq() and up_disable_irq().</li> + <li><code>CONFIG_ARCH_IRQPRIO</code>: + Define if the architecture suports prioritizaton of interrupts and the + up_prioritize_irq() API.</li> </ul> <p> diff --git a/arch/arm/include/str71x/irq.h b/arch/arm/include/str71x/irq.h index d68b3779f3bc30112e55b2cf3bb7888b85a85830..ecb1dcc958ca438f451de73327791fb0d64f724b 100644 --- a/arch/arm/include/str71x/irq.h +++ b/arch/arm/include/str71x/irq.h @@ -110,8 +110,6 @@ extern "C" { * Public Functions ************************************************************************************/ -EXTERN int up_irqpriority(int irq, ubyte priority); /* Set interrupt priority (0-15) */ - #undef EXTERN #ifdef __cplusplus } diff --git a/arch/arm/src/str71x/str71x_irq.c b/arch/arm/src/str71x/str71x_irq.c index 2093ecc7f892105f16092fcf4b33aee30eef93db..1c243f4604b396bf6a3749b9b510f57e18ac9ad3 100644 --- a/arch/arm/src/str71x/str71x_irq.c +++ b/arch/arm/src/str71x/str71x_irq.c @@ -169,14 +169,14 @@ void up_maskack_irq(int irq) } /**************************************************************************** - * Name: up_irqpriority + * Name: up_prioritize_irq * * Description: * set interrupt priority * ****************************************************************************/ -int up_irqpriority(int irq, ubyte priority) +int up_prioritize_irq(int irq, int priority) { uint32 addr; uint32 reg32; diff --git a/arch/arm/src/str71x/str71x_timerisr.c b/arch/arm/src/str71x/str71x_timerisr.c index 571d67de276568ff534dac6a0beda2c5e1e9766e..f6b709e603fe7d34e1313b84cf79ac663d43932d 100644 --- a/arch/arm/src/str71x/str71x_timerisr.c +++ b/arch/arm/src/str71x/str71x_timerisr.c @@ -184,7 +184,7 @@ void up_timerinit(void) /* Set the IRQ interrupt priority */ - up_irqpriority(STR71X_IRQ_SYSTIMER, 1); + up_prioritize_irq(STR71X_IRQ_SYSTIMER, 1); /* Attach the timer interrupt vector */ diff --git a/arch/sh/src/common/up_doirq.c b/arch/sh/src/common/up_doirq.c index 6b0d2c0fc5c477384d7d4bc7a2de0b7f86881d82..01aa21500b18e9725e5b8056cca8f920b9e96b5f 100644 --- a/arch/sh/src/common/up_doirq.c +++ b/arch/sh/src/common/up_doirq.c @@ -81,7 +81,7 @@ void up_doirq(int irq, uint32* regs) current_regs = regs; - /* Mask and acknowledge the interrupt */ + /* Mask and acknowledge the interrupt (if supported by the chip) */ up_maskack_irq(irq); diff --git a/arch/sh/src/common/up_internal.h b/arch/sh/src/common/up_internal.h index 31f016074137782f4a61e500a3dcb0bcb0fc476b..8cb3ee2dd5cbce91f1ccf887a5069be673bceea1 100644 --- a/arch/sh/src/common/up_internal.h +++ b/arch/sh/src/common/up_internal.h @@ -171,9 +171,13 @@ extern void up_wdtinit(void); extern void up_timerinit(void); -/* Defined in up_irq.c */ +/* Defined in chip-specific logic if CONFIG_ARCH_NOINTC is not set */ +#ifndef CONFIG_ARCH_NOINTC extern void up_maskack_irq(int irq); +#else +# define up_maskack_irq(irq) +#endif /* Defined in board/up_leds.c */ diff --git a/arch/sh/src/sh1/sh1_head.S b/arch/sh/src/sh1/sh1_head.S index 6ff1294933cd1cd796e1bd270a9e4aa55775e9e9..82e8c7175db7610cdf64290afc1e241f21452091 100644 --- a/arch/sh/src/sh1/sh1_head.S +++ b/arch/sh/src/sh1/sh1_head.S @@ -232,7 +232,7 @@ __start0: add #4, r0 /* R0: Address of next byte to clear in BSS */ cmp/ge r0, r1 /* End of BSS? */ bt 3b /* Loop until the end of BSS */ - nop /* Delay slot + nop /* Delay slot */ /* Configure the uart so that we can get debug output as soon * as possible. diff --git a/arch/sh/src/sh1/sh1_irq.c b/arch/sh/src/sh1/sh1_irq.c index f56f642d5f2280cddda720f4aeaa36dccd14d083..71a43f5f2b85a1a0f2b13412087626d0f85e4283 100644 --- a/arch/sh/src/sh1/sh1_irq.c +++ b/arch/sh/src/sh1/sh1_irq.c @@ -88,54 +88,14 @@ void up_irqinitialize(void) } /**************************************************************************** - * Name: up_disable_irq - * - * Description: - * Disable the IRQ specified by 'irq' - * - ****************************************************************************/ - -void up_disable_irq(int irq) -{ -#warning "To be provided" -} - -/**************************************************************************** - * Name: up_enable_irq - * - * Description: - * Enable the IRQ specified by 'irq' - * - ****************************************************************************/ - -void up_enable_irq(int irq) -{ -#warning "To be provided" -} - -/**************************************************************************** - * Name: up_maskack_irq - * - * Description: - * Mask the IRQ and acknowledge it - * - ****************************************************************************/ - -void up_maskack_irq(int irq) -{ -#warning "To be provided" -} - -/**************************************************************************** - * Name: up_irqpriority + * Name: up_prioritize_irq * * Description: * set interrupt priority * ****************************************************************************/ -#warning "Should this be supported?" -void up_irqpriority(int irq, ubyte priority) +void up_prioritize_irq(int irq, int priority) { #warning "To be provided" } diff --git a/arch/sh/src/sh1/sh1_serial.c b/arch/sh/src/sh1/sh1_serial.c index cfdfbe3490e5f1e07742da2941027c962322dec0..7578132b2af365ae800f52a775d6ea8f85bd07d9 100644 --- a/arch/sh/src/sh1/sh1_serial.c +++ b/arch/sh/src/sh1/sh1_serial.c @@ -425,24 +425,16 @@ static int up_attach(struct uart_dev_s *dev) /* Attach the RDR full IRQ */ - ret = irq_attach(priv->irq + , up_interrupt); + ret = irq_attach(priv->irq + SH1_RXI_IRQ_OFFSET, up_interrupt); if (ret == OK) { - /* Enable the interrupt - */ + /* Attach the TDR empty IRQ */ - up_enable_irq(priv->irq); - } - - /* Enable the RDR full and TDR empty interrupts at the interupt controller - * (RX and TX interrupts are still disabled in the SCI) - */ - - if (ret == OK) - { - - up_enable_irq(priv->irq); - up_enable_irq(priv->irq); + ret = irq_attach(priv->irq + SH1_TXI_IRQ_OFFSET, up_interrupt); + if (ret < 0) + { + (void)irq_detach(priv->irq + SH1_RXI_IRQ_OFFSET); + } } return ret; diff --git a/arch/sh/src/sh1/sh1_timerisr.c b/arch/sh/src/sh1/sh1_timerisr.c index d3bf495a1a4730345e4ae587ea9c175f4ea609a0..874e256470ec47207a85c90d988ce67cc34023ae 100644 --- a/arch/sh/src/sh1/sh1_timerisr.c +++ b/arch/sh/src/sh1/sh1_timerisr.c @@ -104,7 +104,7 @@ void up_timerinit(void) /* Set the IRQ interrupt priority */ - up_irqpriority(STR71X_IRQ_SYSTIMER, 1); + up_prioritize_irq(STR71X_IRQ_SYSTIMER, 1); /* Attach the timer interrupt vector */ diff --git a/configs/README.txt b/configs/README.txt index bedbc6ae75927c8fd6a515c70c34f01db3cf9a93..123a90171491ee0fd3a9887a7adb64d7e431b404 100644 --- a/configs/README.txt +++ b/configs/README.txt @@ -126,6 +126,12 @@ defconfig -- This is a configuration file similar to the Linux CONFIG_ARCH_BOARD_name - For use in C code CONFIG_ENDIAN_BIG - define if big endian (default is little endian) + CONFIG_ARCH_NOINTC - define if the architecture does not + support an interrupt controller or otherwise cannot support + APIs like up_enable_irq() and up_disable_irq(). + CONFIG_ARCH_IRQPRIO + Define if the architecture suports prioritizaton of interrupts + and the up_prioritize_irq() API. Some architectures require a description of the RAM configuration: diff --git a/configs/olimex-strp711/ostest/defconfig b/configs/olimex-strp711/ostest/defconfig index 1ff1ad1c0ce468356dd60628a740ccfa6d5e8e15..0d629c2e197fabce7f271200d8b2d3942c868a2f 100644 --- a/configs/olimex-strp711/ostest/defconfig +++ b/configs/olimex-strp711/ostest/defconfig @@ -46,6 +46,12 @@ # the board that supports the particular chip or SoC. # CONFIG_ENDIAN_BIG - define if big endian (default is little endian) # CONFIG_ARCH_BOARD_name - for use in C code +# CONFIG_ARCH_NOINTC - define if the architecture does not +# support an interrupt controller or otherwise cannot support +# APIs like up_enable_irq() and up_disable_irq(). +# CONFIG_ARCH_IRQPRIO +# Define if the architecture suports prioritizaton of interrupts +# and the up_prioritize_irq() API. # CONFIG_BOARD_LOOPSPERMSEC - for delay loops # CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to Olimex STR-P711 # CONFIG_ARCH_BUTTONS - Support reading buttons. Unique to Olimex STR-P711 @@ -62,6 +68,8 @@ CONFIG_ARCH_CHIP=str71x CONFIG_ARCH_STR71X=y CONFIG_ARCH_BOARD=olimex-strp711 CONFIG_ARCH_BOARD_OLIMEX_STRP711=y +CONFIG_ARCH_NOINTC=n +CONFIG_ARCH_IRQPRIO=y CONFIG_BOARD_LOOPSPERMSEC=3270 CONFIG_ARCH_LEDS=y CONFIG_ARCH_BUTTONS=y diff --git a/configs/us7032evb1/ostest/defconfig b/configs/us7032evb1/ostest/defconfig index 6510a5029d48bd5ca335af986c9dd75a8d681150..fa2ac1c48475aaac213de77436dfea9328bfca9e 100644 --- a/configs/us7032evb1/ostest/defconfig +++ b/configs/us7032evb1/ostest/defconfig @@ -46,6 +46,12 @@ # the board that supports the particular chip or SoC. # CONFIG_ENDIAN_BIG - define if big endian (default is little endian) # CONFIG_ARCH_BOARD_name - for use in C code +# CONFIG_ARCH_NOINTC - define if the architecture does not +# support an interrupt controller or otherwise cannot support +# APIs like up_enable_irq() and up_disable_irq(). +# CONFIG_ARCH_IRQPRIO +# Define if the architecture suports prioritizaton of interrupts +# and the up_prioritize_irq() API. # CONFIG_ENDIAN_BIG - Define for big-endian operation # CONFIG_BOARD_LOOPSPERMSEC - for delay loops # CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to Olimex STR-P711 @@ -65,6 +71,8 @@ CONFIG_ARCH_SH7032=y CONFIG_ARCH_BOARD=us7032evb1 CONFIG_ARCH_BOARD_US7032EVB1=y CONFIG_ENDIAN_BIG=y +CONFIG_ARCH_NOINTC=y +CONFIG_ARCH_IRQPRIO=y CONFIG_BOARD_LOOPSPERMSEC=3270 CONFIG_ARCH_LEDS=y CONFIG_ARCH_BUTTONS=y diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index 40667b0778c8af9f6d2910eaaffa226ad0afd60f..e2e8958ea3d5f32021b9d95d9dfeb4c555634451 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -394,7 +394,9 @@ EXTERN boolean up_interrupt_context(void); * ****************************************************************************/ +#ifndef CONFIG_ARCH_NOINTC EXTERN void up_enable_irq(int irq); +#endif /**************************************************************************** * Name: up_disable_irq @@ -410,7 +412,25 @@ EXTERN void up_enable_irq(int irq); * ****************************************************************************/ +#ifndef CONFIG_ARCH_NOINTC EXTERN void up_disable_irq(int irq); +#endif + + +/**************************************************************************** + * Name: up_prioritize_irq + * + * Description: + * Set the priority of an IRQ. + * + * Since this API is not supported on all architectures, it should be + * avoided in common implementations where possible. + * + ****************************************************************************/ + +#ifdef CONFIG_ARCH_IRQPRIO +EXTERN int up_prioritize_irq(int irq, int priority); +#endif /**************************************************************************** * These are standard interfaces that are exported by the OS