summaryrefslogtreecommitdiff
path: root/include/rtdef.h
diff options
context:
space:
mode:
authorShell <[email protected]>2024-10-30 16:57:42 +0800
committerRbb666 <[email protected]>2024-11-03 10:08:45 +0800
commit40cd8cce995e24ea265664c5db127c662a747032 (patch)
tree278e962b3f5ad6a55f0b8157fec5c1d89db99d9e /include/rtdef.h
parent3a696ebc671cb04b41f2ba19138fc3bd42c71f37 (diff)
feat: Added rt_interrupt_context* family for nested interrupt handling
These changes introduce the rt_interrupt_context family, providing a mechanism for managing nested interrupts. The context management ensures proper storage and retrieval of interrupt states, improving reliability in nested interrupt scenarios by enabling context tracking across different interrupt levels. This enhancement is essential for platforms where nested interrupt handling is crucial, such as in real- time or multi-threaded applications. Changes: - Defined rt_interrupt_context structure with context and node fields in `rtdef.h` to support nested interrupts. - Added rt_slist_pop function in `rtservice.h` for simplified node removal in singly linked lists. - Declared rt_interrupt_context_push, rt_interrupt_context_pop, and rt_interrupt_context_get functions in `rtthread.h` to manage the interrupt/exception stack. - Modified AArch64 CPU support in `cpuport.h` to include rt_hw_show_register for debugging registers. - Refactored `_rt_hw_trap_irq` in `trap.c` for context-aware IRQ handling, with stack push/pop logic to handle nested contexts. - Implemented interrupt context push, pop, and retrieval logic in `irq.c` to manage context at the CPU level. Signed-off-by: Shell <[email protected]>
Diffstat (limited to 'include/rtdef.h')
-rw-r--r--include/rtdef.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/rtdef.h b/include/rtdef.h
index 0d5c421759..7171a0b8c8 100644
--- a/include/rtdef.h
+++ b/include/rtdef.h
@@ -723,6 +723,9 @@ struct rt_cpu
#ifdef RT_USING_CPU_USAGE_TRACER
struct rt_cpu_usage_stats cpu_stat;
#endif /* RT_USING_CPU_USAGE_TRACER */
+#ifdef ARCH_USING_IRQ_CTX_LIST
+ rt_slist_t irq_ctx_head;
+#endif /* ARCH_USING_IRQ_CTX_LIST */
};
#else /* !RT_USING_SMP */
@@ -734,6 +737,9 @@ struct rt_cpu
#ifdef RT_USING_CPU_USAGE_TRACER
struct rt_cpu_usage_stats cpu_stat;
#endif /* RT_USING_CPU_USAGE_TRACER */
+#ifdef ARCH_USING_IRQ_CTX_LIST
+ rt_slist_t irq_ctx_head;
+#endif /* ARCH_USING_IRQ_CTX_LIST */
};
#endif /* RT_USING_SMP */
@@ -744,6 +750,16 @@ typedef struct rt_cpu *rt_cpu_t;
struct rt_thread;
+/**
+ * interrupt/exception frame handling
+ *
+ */
+
+typedef struct rt_interrupt_context {
+ void *context; /**< arch specific context */
+ rt_slist_t node; /**< node for nested interrupt */
+} *rt_interrupt_context_t;
+
#ifdef RT_USING_SMART
typedef rt_err_t (*rt_wakeup_func_t)(void *object, struct rt_thread *thread);