Skip to content

Commit

Permalink
arm-m: support zero interrupt back to game
Browse files Browse the repository at this point in the history
Signed-off-by: ligd <[email protected]>
  • Loading branch information
GUIDINGLI authored and xiaoxiang781216 committed Oct 9, 2024
1 parent a9da6ab commit ff99745
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 24 deletions.
23 changes: 15 additions & 8 deletions arch/arm/src/armv6-m/arm_doirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,27 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)

arm_ack_irq(irq);

/* Set current regs for crash dump */

up_set_current_regs(regs);

if (irq == NVIC_IRQ_PENDSV)
{
#ifdef CONFIG_ARCH_HIPRI_INTERRUPT
/* Dispatch the PendSV interrupt */

irq_dispatch(irq, regs);
#endif

up_irq_save();
g_running_tasks[this_cpu()]->xcp.regs = regs;
}
else
{
/* Set current regs for crash dump */

up_set_current_regs(regs);

/* Dispatch irq */

tcb->xcp.regs = regs;
irq_dispatch(irq, regs);

/* Clear current regs */

up_set_current_regs(NULL);
}

/* If a context switch occurred while processing the interrupt then
Expand All @@ -110,6 +112,11 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)
regs = tcb->xcp.regs;
#endif

/* Clear current regs */

up_set_current_regs(NULL);

board_autoled_off(LED_INIRQ);

return regs;
}
23 changes: 15 additions & 8 deletions arch/arm/src/armv7-m/arm_doirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,27 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)

arm_ack_irq(irq);

/* Set current regs for crash dump */

up_set_current_regs(regs);

if (irq == NVIC_IRQ_PENDSV)
{
#ifdef CONFIG_ARCH_HIPRI_INTERRUPT
/* Dispatch the PendSV interrupt */

irq_dispatch(irq, regs);
#endif

up_irq_save();
g_running_tasks[this_cpu()]->xcp.regs = regs;
}
else
{
/* Set current regs for crash dump */

up_set_current_regs(regs);

/* Dispatch irq */

tcb->xcp.regs = regs;
irq_dispatch(irq, regs);

/* Clear current regs */

up_set_current_regs(NULL);
}

/* If a context switch occurred while processing the interrupt then
Expand All @@ -110,6 +112,11 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)
regs = tcb->xcp.regs;
#endif

/* Clear current regs */

up_set_current_regs(NULL);

board_autoled_off(LED_INIRQ);

return regs;
}
22 changes: 14 additions & 8 deletions arch/arm/src/armv8-m/arm_doirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,27 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)

arm_ack_irq(irq);

/* Set current regs for crash dump */

up_set_current_regs(regs);

if (irq == NVIC_IRQ_PENDSV)
{
#ifdef CONFIG_ARCH_HIPRI_INTERRUPT
/* Dispatch the PendSV interrupt */

irq_dispatch(irq, regs);
#endif

up_irq_save();
g_running_tasks[this_cpu()]->xcp.regs = regs;
}
else
{
/* Set current regs for crash dump */

up_set_current_regs(regs);

/* Dispatch irq */

tcb->xcp.regs = regs;
irq_dispatch(irq, regs);

/* Clear current regs */

up_set_current_regs(NULL);
}

/* If a context switch occurred while processing the interrupt then
Expand All @@ -110,6 +112,10 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)
regs = tcb->xcp.regs;
#endif

/* Clear current regs */

up_set_current_regs(NULL);

board_autoled_off(LED_INIRQ);

#ifdef CONFIG_ARMV8M_TRUSTZONE_HYBRID
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/src/lpc17xx_40xx/lpc17_40_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,11 @@ static int lpc17_40_nmi(int irq, void *context, void *arg)

static int lpc17_40_pendsv(int irq, void *context, void *arg)
{
#ifndef CONFIG_ARCH_HIPRI_INTERRUPT
up_irq_save();
_err("PANIC!!! PendSV received\n");
PANIC();
#endif
return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions arch/arm/src/mps/mps_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ static int mps_nmi(int irq, void *context, void *arg)

static int mps_pendsv(int irq, void *context, void *arg)
{
#ifndef CONFIG_ARCH_HIPRI_INTERRUPT
up_irq_save();
_err("PANIC!!! PendSV received\n");
PANIC();
#endif
return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions arch/arm/src/nrf52/nrf52_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,11 @@ static int nrf52_nmi(int irq, void *context, void *arg)

static int nrf52_pendsv(int irq, void *context, void *arg)
{
#ifndef CONFIG_ARCH_HIPRI_INTERRUPT
up_irq_save();
_err("PANIC!!! PendSV received\n");
PANIC();
#endif
return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions arch/arm/src/stm32/stm32_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ static int stm32_nmi(int irq, void *context, void *arg)

static int stm32_pendsv(int irq, void *context, void *arg)
{
#ifndef CONFIG_ARCH_HIPRI_INTERRUPT
up_irq_save();
_err("PANIC!!! PendSV received\n");
PANIC();
#endif
return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions arch/arm/src/stm32l4/stm32l4_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,11 @@ static int stm32l4_nmi(int irq, void *context, void *arg)

static int stm32l4_pendsv(int irq, void *context, void *arg)
{
#ifndef CONFIG_ARCH_HIPRI_INTERRUPT
up_irq_save();
_err("PANIC!!! PendSV received\n");
PANIC();
#endif
return 0;
}

Expand Down

0 comments on commit ff99745

Please sign in to comment.