import
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#include <os_port.h>
|
||||
#include "os_critical.h"
|
||||
#include "os_sched.h"
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* */
|
||||
|
||||
volatile void* g_os_port_switch_from_sp;
|
||||
volatile void* g_os_port_switch_to_sp;
|
||||
volatile os_bool_t g_os_port_context_switch_flag;
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* */
|
||||
|
||||
|
||||
void os_port_on_switch_success(void){
|
||||
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();
|
||||
}
|
||||
|
||||
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){
|
||||
os_critical_leave_in_isr();
|
||||
return;
|
||||
}
|
||||
g_os_port_context_switch_flag = OS_TRUE;
|
||||
g_os_port_switch_from_sp = from_sp;
|
||||
g_os_port_switch_to_sp = to_sp;
|
||||
os_critical_leave_in_isr();
|
||||
|
||||
os_port_send_context_switch_request();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user