arm-m: support zero interrupt back to game

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2024-09-27 18:48:47 +08:00 committed by Xiang Xiao
parent 946b01d4a8
commit 9a317472fd
8 changed files with 54 additions and 24 deletions

View File

@ -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
@ -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;
}

View File

@ -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
@ -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;
}

View File

@ -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
@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}