diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/rtdef.h | 16 | ||||
| -rw-r--r-- | include/rtservice.h | 15 | ||||
| -rw-r--r-- | include/rtthread.h | 4 |
3 files changed, 35 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); diff --git a/include/rtservice.h b/include/rtservice.h index 993b95dbed..a5b15ed1ce 100644 --- a/include/rtservice.h +++ b/include/rtservice.h @@ -11,6 +11,7 @@ * 2012-03-22 Bernard rename kservice.h to rtservice.h * 2017-11-15 JasonJia Modify rt_slist_foreach to rt_slist_for_each_entry. * Make code cleanup. + * 2024-01-03 Shell add rt_slist_pop() */ #ifndef __RT_SERVICE_H__ @@ -224,6 +225,20 @@ rt_inline unsigned int rt_slist_len(const rt_slist_t *l) return len; } +rt_inline rt_slist_t *rt_slist_pop(rt_slist_t *l) +{ + struct rt_slist_node *node = l; + + /* remove node */ + node = node->next; + if (node != (rt_slist_t *)0) + { + ((struct rt_slist_node *)l)->next = node->next; + } + + return node; +} + rt_inline rt_slist_t *rt_slist_remove(rt_slist_t *l, rt_slist_t *n) { /* remove slist head */ diff --git a/include/rtthread.h b/include/rtthread.h index e6740d46da..272847bf06 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -713,6 +713,10 @@ rt_err_t rt_device_control(rt_device_t dev, int cmd, void *arg); void rt_interrupt_enter(void); void rt_interrupt_leave(void); +void rt_interrupt_context_push(rt_interrupt_context_t this_ctx); +void rt_interrupt_context_pop(void); +void *rt_interrupt_context_get(void); + /** * CPU object */ |
