This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 351db57e35 arch/arm/rp23xx: Set priority for svcall exception
351db57e35 is described below

commit 351db57e35972f08017ea077bc3284e26ebea802
Author: Ian Douglas Scott <[email protected]>
AuthorDate: Sun Jan 12 20:18:55 2025 -0800

    arch/arm/rp23xx: Set priority for svcall exception
    
    Fixes https://github.com/apache/nuttx/issues/15503.
    
    Signed-off-by: Ian Douglas Scott <[email protected]>
---
 arch/arm/src/rp23xx/rp23xx_irq.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/arch/arm/src/rp23xx/rp23xx_irq.c b/arch/arm/src/rp23xx/rp23xx_irq.c
index 450e2315b9..2bf5e4975e 100644
--- a/arch/arm/src/rp23xx/rp23xx_irq.c
+++ b/arch/arm/src/rp23xx/rp23xx_irq.c
@@ -181,6 +181,27 @@ static int rp23xx_reserved(int irq, void *context, void 
*arg)
 }
 #endif
 
+/****************************************************************************
+ * Name: rp23xx_prioritize_syscall
+ *
+ * Description:
+ *   Set the priority of an exception.  This function may be needed
+ *   internally even if support for prioritized interrupts is not enabled.
+ *
+ ****************************************************************************/
+
+static inline void rp23xx_prioritize_syscall(int priority)
+{
+  uint32_t regval;
+
+  /* SVCALL is system handler 11 */
+
+  regval  = getreg32(NVIC_SYSH8_11_PRIORITY);
+  regval &= ~NVIC_SYSH_PRIORITY_PR11_MASK;
+  regval |= (priority << NVIC_SYSH_PRIORITY_PR11_SHIFT);
+  putreg32(regval, NVIC_SYSH8_11_PRIORITY);
+}
+
 /****************************************************************************
  * Name: rp23xx_clrpend
  *
@@ -276,6 +297,8 @@ void up_irqinitialize(void)
   irq_attach(RP23XX_IRQ_SVCALL, arm_svcall, NULL);
   irq_attach(RP23XX_IRQ_HARDFAULT, arm_hardfault, NULL);
 
+  rp23xx_prioritize_syscall(NVIC_SYSH_SVCALL_PRIORITY);
+
   /* Attach all other processor exceptions (except reset and sys tick) */
 
 #ifdef CONFIG_DEBUG_FEATURES

Reply via email to