Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMSIS/RTOS/RTX/SRC/rt_Task.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,15 @@ static void rt_init_context (P_TCB p_TCB, U8 priority, FUNCP task_body) {


/*--------------------------- rt_switch_req ---------------------------------*/
__weak void rt_switch_prehook(unsigned p_cur, unsigned p_new) {
/* empty default function */
}

void rt_switch_req (P_TCB p_new) {
/* Switch to next task (identified by "p_new"). */
unsigned oldTsk = os_tsk.run == &os_idle_TCB ? 0 : (unsigned) os_tsk.run;
unsigned newTsk = p_new == &os_idle_TCB ? 0 : (unsigned) p_new;
rt_switch_prehook(oldTsk, newTsk);
os_tsk.new = p_new;
p_new->state = RUNNING;
DBG_TASK_SWITCH(p_new->task_id);
Expand Down