移植到 CH32V10x 既 QingKeV3 系列 MCU 上

This commit is contained in:
2026-05-22 18:13:11 +08:00
parent bdfd09eca8
commit 80e32d4fb8
14 changed files with 1194 additions and 7 deletions
+12
View File
@@ -5,6 +5,10 @@
#include "os_types.h"
#endif /* INCLUDED_OS_TYPES_H */
#ifndef INCLUDED_OS_ALIGN_H
#include <os_align.h>
#endif /*INCLUDED_OS_ALIGN_H*/
#ifndef INCLUDED_OS_COMPILER_H
#include "os_compiler.h"
#endif /* INCLUDED_OS_COMPILER_H */
@@ -13,6 +17,10 @@
#include "os_macros.h"
#endif /* INCLUDED_OS_MACROS_H */
#ifndef INCLUDED_OS_ENDIAN_H
#include <os_endian.h>
#endif /*INCLUDED_OS_ENDIAN_H*/
#ifndef INCLUDED_OS_SCHED_H
#include <os_sched.h>
#endif /*INCLUDED_OS_SCHED_H*/
@@ -57,6 +65,10 @@
#include <os_fairlock.h>
#endif /*INCLUDED_OS_FAIRLOCK_H*/
#ifndef INCLUDED_OS_IDLE_H
#include <os_idle.h>
#endif /*INCLUDED_OS_IDLE_H*/
/* ==================================================================================================== */
+12
View File
@@ -44,4 +44,16 @@
#define OS_CFG_DEVICE_MAX 10
#endif /* OS_CFG_DEVICE_MAX */
#ifndef OS_CFG_IDLE_TASK_TICKS
#define OS_CFG_IDLE_TASK_TICKS 5
#endif /*OS_CFG_IDLE_TASK_TICKS*/
#ifndef OS_CFG_IDLE_TASK_STACK_SIZE
#define OS_CFG_IDLE_TASK_STACK_SIZE 1024
#endif /*OS_CFG_IDLE_TASK_STACK_SIZE*/
#ifndef OS_CFG_IDLE_TASK_PRIORITY
#define OS_CFG_IDLE_TASK_PRIORITY OS_PRIORITY_IDLE
#endif /*OS_CFG_IDLE_TASK_PRIORITY*/
#endif /*INCLUDED_OS_CONFIG_H*/
+3 -2
View File
@@ -12,13 +12,14 @@ volatile os_bool_t g_os_port_context_switch_flag;
void os_port_on_switch_success(void){
os_critical_enter_in_isr();
// os_critical_enter_in_isr();
g_os_sched_current_task_p = g_os_port_switch_to_sp;
g_os_sched_current_task_p->state = kOsTaskState_Running;
g_os_port_context_switch_flag = OS_FALSE;
os_critical_leave_in_isr();
// os_critical_leave_in_isr();
}
OS_WEAK
void os_port_context_switch(void* from_sp, void* to_sp){
os_critical_enter_in_isr();
if(g_os_port_context_switch_flag==OS_TRUE){
+2 -2
View File
@@ -33,8 +33,8 @@ os_stack_t os_port_cpu_stack_init(os_task_entry_t entry, void* param
/*
* 请求上下文切换
* @param from_sp - 切换的源头任务栈
* @param to_sp - 切换的目标任务栈
* @param from_sp - 切换的源头任务栈指针
* @param to_sp - 切换的目标任务栈指针
*/
void os_port_context_switch(void* from_sp, void* to_sp);