This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 3be2e75a248ae92863f0607b30e12efd71fdbba5 Author: hujun5 <[email protected]> AuthorDate: Tue Nov 11 18:43:55 2025 +0800 arm_a_r: merge arm_doirq.c to arm_a_r merge arm_doirq.c to arm_a_r Signed-off-by: hujun5 <[email protected]> --- arch/arm/src/arm/CMakeLists.txt | 1 - arch/arm/src/arm/Make.defs | 2 +- arch/arm/src/arm/arm_doirq.c | 124 ------------------------ arch/arm/src/arm_a_r/CMakeLists.txt | 2 +- arch/arm/src/arm_a_r/Make.defs | 2 +- arch/arm/src/{armv7-a => arm_a_r}/arm_doirq.c | 8 +- arch/arm/src/armv7-a/CMakeLists.txt | 1 - arch/arm/src/armv7-a/Make.defs | 2 +- arch/arm/src/armv7-r/CMakeLists.txt | 1 - arch/arm/src/armv7-r/Make.defs | 2 +- arch/arm/src/armv7-r/arm_doirq.c | 101 ------------------- arch/arm/src/armv8-r/CMakeLists.txt | 1 - arch/arm/src/armv8-r/Make.defs | 2 +- arch/arm/src/armv8-r/arm_doirq.c | 134 -------------------------- arch/arm/src/common/arm_internal.h | 5 + 15 files changed, 17 insertions(+), 371 deletions(-) diff --git a/arch/arm/src/arm/CMakeLists.txt b/arch/arm/src/arm/CMakeLists.txt index 2bc9ab74fcf..48d70f470d1 100644 --- a/arch/arm/src/arm/CMakeLists.txt +++ b/arch/arm/src/arm/CMakeLists.txt @@ -26,7 +26,6 @@ list( APPEND SRCS arm_dataabort.c - arm_doirq.c arm_initialstate.c arm_prefetchabort.c arm_syscall.c diff --git a/arch/arm/src/arm/Make.defs b/arch/arm/src/arm/Make.defs index 176c59d30d5..2d3a98c67ce 100644 --- a/arch/arm/src/arm/Make.defs +++ b/arch/arm/src/arm/Make.defs @@ -27,7 +27,7 @@ include arm_a_r/Make.defs HEAD_ASRC = arm_head.S -CMN_CSRCS += arm_dataabort.c arm_doirq.c arm_initialstate.c +CMN_CSRCS += arm_dataabort.c arm_initialstate.c CMN_CSRCS += arm_prefetchabort.c CMN_CSRCS += arm_syscall.c CMN_CSRCS += arm_undefinedinsn.c diff --git a/arch/arm/src/arm/arm_doirq.c b/arch/arm/src/arm/arm_doirq.c deleted file mode 100644 index 292e48e9561..00000000000 --- a/arch/arm/src/arm/arm_doirq.c +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** - * arch/arm/src/arm/arm_doirq.c - * - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. The - * ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <stdint.h> -#include <nuttx/irq.h> -#include <nuttx/arch.h> -#include <assert.h> - -#include <nuttx/addrenv.h> -#include <nuttx/board.h> -#include <arch/board/board.h> -#include <sched/sched.h> - -#include "arm_internal.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -uint32_t *arm_doirq(int irq, uint32_t *regs) -{ - struct tcb_s *tcb = this_task(); - - board_autoled_on(LED_INIRQ); -#ifdef CONFIG_SUPPRESS_INTERRUPTS - PANIC(); -#else - /* Nested interrupts are not supported */ - - DEBUGASSERT(!up_interrupt_context()); - - /* Set irq flag */ - - up_set_interrupt_context(true); - tcb->xcp.regs = regs; - - /* Acknowledge the interrupt */ - - arm_ack_irq(irq); - - /* Deliver the IRQ */ - - irq_dispatch(irq, regs); - tcb = this_task(); - - /* Check for a context switch. */ - - if (regs != tcb->xcp.regs) - { - struct tcb_s **running_task = &g_running_tasks[this_cpu()]; - -#ifdef CONFIG_ARCH_ADDRENV - /* Make sure that the address environment for the previously - * running task is closed down gracefully (data caches dump, - * MMU flushed) and set up the address environment for the new - * thread at the head of the ready-to-run list. - */ - - addrenv_switch(tcb); - tcb = this_task(); -#endif - - /* Update scheduler parameters */ - - nxsched_switch_context(*running_task, tcb); - - /* Record the new "running" task when context switch occurred. - * g_running_tasks[] is only used by assertion logic for reporting - * crashes. - */ - - *running_task = tcb; - - regs = tcb->xcp.regs; - } - - /* Set irq flag */ - - up_set_interrupt_context(false); -#endif - board_autoled_off(LED_INIRQ); - return regs; -} diff --git a/arch/arm/src/arm_a_r/CMakeLists.txt b/arch/arm/src/arm_a_r/CMakeLists.txt index 49edb8f44a0..4fd5862bb31 100644 --- a/arch/arm/src/arm_a_r/CMakeLists.txt +++ b/arch/arm/src/arm_a_r/CMakeLists.txt @@ -24,6 +24,6 @@ if(CONFIG_ENABLE_ALL_SIGNALS) set(CSRCS arm_schedulesigaction.c arm_sigdeliver.c) endif() -list(APPEND CSRCS arm_tcbinfo.c) +list(APPEND CSRCS arm_tcbinfo.c arm_doirq.c) target_sources(arch PRIVATE ${CSRCS}) diff --git a/arch/arm/src/arm_a_r/Make.defs b/arch/arm/src/arm_a_r/Make.defs index 4f67f472605..32c5687a3f0 100644 --- a/arch/arm/src/arm_a_r/Make.defs +++ b/arch/arm/src/arm_a_r/Make.defs @@ -22,7 +22,7 @@ # Common ARM_A_R files -CMN_CSRCS += arm_tcbinfo.c +CMN_CSRCS += arm_tcbinfo.c arm_doirq.c ifeq ($(CONFIG_ENABLE_ALL_SIGNALS),y) CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c diff --git a/arch/arm/src/armv7-a/arm_doirq.c b/arch/arm/src/arm_a_r/arm_doirq.c similarity index 96% rename from arch/arm/src/armv7-a/arm_doirq.c rename to arch/arm/src/arm_a_r/arm_doirq.c index 36de678f46a..dc282269000 100644 --- a/arch/arm/src/armv7-a/arm_doirq.c +++ b/arch/arm/src/arm_a_r/arm_doirq.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/armv7-a/arm_doirq.c + * arch/arm/src/arm_a_r/arm_doirq.c * * SPDX-License-Identifier: Apache-2.0 * @@ -65,6 +65,10 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) DEBUGASSERT(!up_interrupt_context()); + /* Acknowledge the interrupt */ + + arm_ack_irq(irq); + /* if irq == GIC_SMP_CPUSTART * We are initiating the multi-core jumping state to up_idle, * and we will use this_task(). Therefore, it cannot be overridden. @@ -121,7 +125,7 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) board_autoled_off(LED_INIRQ); - /* (*running_task)->xcp.regs is about to become invalid + /* tcb->xcp.regs is about to become invalid * and will be marked as NULL to avoid misusage. */ diff --git a/arch/arm/src/armv7-a/CMakeLists.txt b/arch/arm/src/armv7-a/CMakeLists.txt index 5ac9a61299a..35f34034f00 100644 --- a/arch/arm/src/armv7-a/CMakeLists.txt +++ b/arch/arm/src/armv7-a/CMakeLists.txt @@ -37,7 +37,6 @@ list( arm_cache.c arm_cpuinfo.c arm_dataabort.c - arm_doirq.c arm_gicv2.c arm_gicv2_dump.c arm_initialstate.c diff --git a/arch/arm/src/armv7-a/Make.defs b/arch/arm/src/armv7-a/Make.defs index cecb9461a9d..61cc1a6ceb9 100644 --- a/arch/arm/src/armv7-a/Make.defs +++ b/arch/arm/src/armv7-a/Make.defs @@ -37,7 +37,7 @@ CMN_ASRCS += arm_cpuhead.S arm_vectors.S arm_saveusercontext.S # Common C source files CMN_CSRCS += arm_cache.c arm_cpuinfo.c arm_dataabort.c -CMN_CSRCS += arm_doirq.c arm_gicv2.c arm_gicv2_dump.c +CMN_CSRCS += arm_gicv2.c arm_gicv2_dump.c CMN_CSRCS += arm_initialstate.c arm_mmu.c arm_prefetchabort.c CMN_CSRCS += arm_syscall.c arm_undefinedinsn.c CMN_CSRCS += arm_perf.c arm_userfault.c cp15_cacheops.c diff --git a/arch/arm/src/armv7-r/CMakeLists.txt b/arch/arm/src/armv7-r/CMakeLists.txt index 7d68cc0fdef..c2b0f981ad9 100644 --- a/arch/arm/src/armv7-r/CMakeLists.txt +++ b/arch/arm/src/armv7-r/CMakeLists.txt @@ -36,7 +36,6 @@ list( arm_cache.c arm_cpuinfo.c arm_dataabort.c - arm_doirq.c arm_initialstate.c arm_prefetchabort.c arm_syscall.c diff --git a/arch/arm/src/armv7-r/Make.defs b/arch/arm/src/armv7-r/Make.defs index 93c5cfef6ef..8e8120de7d4 100644 --- a/arch/arm/src/armv7-r/Make.defs +++ b/arch/arm/src/armv7-r/Make.defs @@ -33,7 +33,7 @@ HEAD_ASRC += arm_vectortab.S # Common assembly language files CMN_CSRCS += arm_cache.c arm_cpuinfo.c arm_dataabort.c -CMN_CSRCS += arm_doirq.c arm_gicv2.c arm_gicv2_dump.c +CMN_CSRCS += arm_gicv2.c arm_gicv2_dump.c CMN_CSRCS += arm_initialstate.c arm_prefetchabort.c CMN_CSRCS += arm_syscall.c arm_undefinedinsn.c CMN_CSRCS += arm_perf.c cp15_cacheops.c diff --git a/arch/arm/src/armv7-r/arm_doirq.c b/arch/arm/src/armv7-r/arm_doirq.c deleted file mode 100644 index f87c4fe7446..00000000000 --- a/arch/arm/src/armv7-r/arm_doirq.c +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** - * arch/arm/src/armv7-r/arm_doirq.c - * - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. The - * ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <stdint.h> -#include <nuttx/irq.h> -#include <nuttx/arch.h> -#include <assert.h> - -#include <nuttx/board.h> -#include <arch/board/board.h> -#include <sched/sched.h> - -#include "arm_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -uint32_t *arm_doirq(int irq, uint32_t *regs) -{ - struct tcb_s *tcb = this_task(); - - board_autoled_on(LED_INIRQ); - -#ifdef CONFIG_SUPPRESS_INTERRUPTS - PANIC(); -#else - /* Nested interrupts are not supported */ - - DEBUGASSERT(!up_interrupt_context()); - - /* if irq == GIC_SMP_CPUSTART - * We are initiating the multi-core jumping state to up_idle, - * and we will use this_task(). Therefore, it cannot be overridden. - */ - -#ifdef CONFIG_SMP - if (irq != GIC_SMP_CPUSTART) -#endif - { - tcb->xcp.regs = regs; - } - - /* Set irq flag */ - - up_set_interrupt_context(true); - - /* Deliver the IRQ */ - - irq_dispatch(irq, regs); - tcb = this_task(); - - if (regs != tcb->xcp.regs) - { - struct tcb_s **running_task = &g_running_tasks[this_cpu()]; - - /* Update scheduler parameters */ - - nxsched_switch_context(*running_task, tcb); - - /* Record the new "running" task when context switch occurred. - * g_running_tasks[] is only used by assertion logic for reporting - * crashes. - */ - - *running_task = tcb; - regs = tcb->xcp.regs; - } - - /* Set irq flag */ - - up_set_interrupt_context(false); - board_autoled_off(LED_INIRQ); -#endif - return regs; -} diff --git a/arch/arm/src/armv8-r/CMakeLists.txt b/arch/arm/src/armv8-r/CMakeLists.txt index c05ca69be81..05f9991a117 100644 --- a/arch/arm/src/armv8-r/CMakeLists.txt +++ b/arch/arm/src/armv8-r/CMakeLists.txt @@ -33,7 +33,6 @@ list( arm_cache.c arm_cpuinfo.c arm_dataabort.c - arm_doirq.c arm_gicv3.c arm_initialstate.c arm_prefetchabort.c diff --git a/arch/arm/src/armv8-r/Make.defs b/arch/arm/src/armv8-r/Make.defs index d3f1b717d29..c90cab41cf5 100644 --- a/arch/arm/src/armv8-r/Make.defs +++ b/arch/arm/src/armv8-r/Make.defs @@ -37,7 +37,7 @@ CMN_ASRCS += arm_head.S arm_vectors.S arm_saveusercontext.S # Common C source files CMN_CSRCS += arm_timer.c arm_cache.c arm_cpuinfo.c arm_dataabort.c -CMN_CSRCS += arm_doirq.c arm_gicv3.c +CMN_CSRCS += arm_gicv3.c CMN_CSRCS += arm_initialstate.c arm_prefetchabort.c CMN_CSRCS += arm_syscall.c arm_undefinedinsn.c CMN_CSRCS += arm_perf.c cp15_cacheops.c diff --git a/arch/arm/src/armv8-r/arm_doirq.c b/arch/arm/src/armv8-r/arm_doirq.c deleted file mode 100644 index f2c61e2530d..00000000000 --- a/arch/arm/src/armv8-r/arm_doirq.c +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** - * arch/arm/src/armv8-r/arm_doirq.c - * - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. The - * ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <stdint.h> -#include <nuttx/irq.h> -#include <nuttx/arch.h> -#include <assert.h> - -#include <nuttx/board.h> -#include <arch/board/board.h> -#include <sched/sched.h> - -#include "arm_internal.h" -#include "gic.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -uint32_t *arm_doirq(int irq, uint32_t *regs) -{ - struct tcb_s *tcb = this_task(); - - board_autoled_on(LED_INIRQ); - -#ifdef CONFIG_SUPPRESS_INTERRUPTS - PANIC(); -#else - /* Nested interrupts are not supported */ - - DEBUGASSERT(!up_interrupt_context()); - - /* if irq == GIC_SMP_CPUSTART - * We are initiating the multi-core jumping state to up_idle, - * and we will use this_task(). Therefore, it cannot be overridden. - */ - -#ifdef CONFIG_SMP - if (irq != GIC_SMP_CPUSTART) -#endif - { - tcb->xcp.regs = regs; - } - - /* Set irq flag */ - - up_set_interrupt_context(true); - - /* Deliver the IRQ */ - - irq_dispatch(irq, regs); - tcb = this_task(); - - if (regs != tcb->xcp.regs) - { - struct tcb_s **running_task = &g_running_tasks[this_cpu()]; - - /* Update scheduler parameters */ - - nxsched_switch_context(*running_task, tcb); - - /* Record the new "running" task when context switch occurred. - * g_running_tasks[] is only used by assertion logic for reporting - * crashes. - */ - - *running_task = tcb; - regs = tcb->xcp.regs; - } - - /* Set irq flag */ - - up_set_interrupt_context(false); - - board_autoled_off(LED_INIRQ); -#endif - return regs; -} - -/**************************************************************************** - * Name: up_irqinitialize - * - * Description: - * This function is called by up_initialize() during the bring-up of the - * system. It is the responsibility of this function to but the interrupt - * subsystem into the working and ready state. - * - ****************************************************************************/ - -void up_irqinitialize(void) -{ - /* The following operations need to be atomic, but since this function is - * called early in the initialization sequence, we expect to have exclusive - * access to the GIC. - */ - - /* Initialize the Generic Interrupt Controller (GIC) for CPU0 */ - - arm_gic0_initialize(); /* for GIC common parts */ - arm_gic_initialize(); /* for GIC CPU interface */ - -#ifndef CONFIG_SUPPRESS_INTERRUPTS - - /* And finally, enable interrupts */ - - arm_color_intstack(); - up_irq_enable(); -#endif -} diff --git a/arch/arm/src/common/arm_internal.h b/arch/arm/src/common/arm_internal.h index bfeae9deeee..cbe3c9f1157 100644 --- a/arch/arm/src/common/arm_internal.h +++ b/arch/arm/src/common/arm_internal.h @@ -296,7 +296,12 @@ void weak_function arm_initialize_stack(void); /* Interrupt acknowledge and dispatch */ +#if defined(CONFIG_ARCH_ARMV7A) || defined(CONFIG_ARCH_ARMV7R) || defined(CONFIG_ARCH_ARMV8R) +# define arm_ack_irq(i) +#else void arm_ack_irq(int irq); +#endif + uint32_t *arm_doirq(int irq, uint32_t *regs); /* Exception handling logic unique to the Cortex-M family */
