upgrade rtt 5.2.2

This commit is contained in:
wmano
2025-09-03 20:50:03 +08:00
parent f6985d97c5
commit 5409d3a614
41 changed files with 1130 additions and 988 deletions
+4 -16
View File
@@ -31,6 +31,7 @@
* 2023-03-27 rose_man Split into scheduler upc and scheduler_mp.c
* 2023-10-17 ChuShicheng Modify the timing of clearing RT_THREAD_STAT_YIELD flag bits
* 2025-08-04 Pillar Add rt_scheduler_critical_switch_flag
* 2025-08-20 RyanCW rt_scheduler_lock_nest use atomic operations
*/
#define __RT_IPC_SOURCE__
@@ -49,7 +50,7 @@ rt_uint8_t rt_thread_ready_table[32];
#endif /* RT_THREAD_PRIORITY_MAX > 32 */
extern volatile rt_atomic_t rt_interrupt_nest;
static rt_int16_t rt_scheduler_lock_nest;
static rt_atomic_t rt_scheduler_lock_nest;
rt_uint8_t rt_current_priority;
static rt_int8_t rt_scheduler_critical_switch_flag;
@@ -649,22 +650,9 @@ RTM_EXPORT(rt_exit_critical_safe);
*/
rt_base_t rt_enter_critical(void)
{
rt_base_t level;
rt_base_t critical_level;
/* disable interrupt */
level = rt_hw_interrupt_disable();
/*
* the maximal number of nest is RT_UINT16_MAX, which is big
* enough and does not check here
*/
rt_scheduler_lock_nest ++;
critical_level = rt_scheduler_lock_nest;
/* enable interrupt */
rt_hw_interrupt_enable(level);
critical_level = rt_atomic_add(&rt_scheduler_lock_nest, 1) + 1;
return critical_level;
}
RTM_EXPORT(rt_enter_critical);
@@ -722,7 +710,7 @@ RTM_EXPORT(rt_exit_critical);
*/
rt_uint16_t rt_critical_level(void)
{
return rt_scheduler_lock_nest;
return (rt_uint16_t)rt_atomic_load(&rt_scheduler_lock_nest);
}
RTM_EXPORT(rt_critical_level);