C Microkernel Realtime eXecutive
Realtime Operating System for Cortex-M based microcontrollers
 
Loading...
Searching...
No Matches

Description

Functions

bool schedule_context_switch (uint32_t current_task, uint32_t next_task)
 Opt for task switch.
 
void PendSV_Handler (void)
 Handle task switch.
 

Variables

static struct OS_thread_told_task
 
static struct OS_thread_tnew_task
 
static struct OS_process_told_parent_process
 
static struct OS_process_tnew_parent_process
 
static struct OS_process_told_host_process
 
static struct OS_process_tnew_host_process
 
static uint8_t new_thread_id
 
static Process_t new_process_id
 
static bool ctxt_switch_pending
 
struct OS_stack_t os_stacks
 Thread stacks.
 

Function Documentation

◆ PendSV_Handler()

void PendSV_Handler ( void  )

Handle task switch.

This function performs the heavy lifting of context switching when CPU is switched from one task to another. As of now, it stores outgoing task's application context onto stack and restores incoming task's context from its stack. It then sets PSP to point to incoming task's stack and resumes normal operation.

◆ schedule_context_switch()

bool schedule_context_switch ( uint32_t  current_task,
uint32_t  next_task 
)

Opt for task switch.

Schedule context switch on next suitable moment.

Calling this function will prepare task switch. It will set up some stuff needed and then schedule PendSV.

Parameters
current_taskID of task, which is currently running
next_taskID of task, which should be scheduled next
Note
API of this function is dumb.

Variable Documentation

◆ ctxt_switch_pending

bool ctxt_switch_pending
static

◆ new_host_process

struct OS_process_t* new_host_process
static

◆ new_parent_process

struct OS_process_t* new_parent_process
static

◆ new_process_id

Process_t new_process_id
static

◆ new_task

struct OS_thread_t* new_task
static

◆ new_thread_id

uint8_t new_thread_id
static

◆ old_host_process

struct OS_process_t* old_host_process
static

◆ old_parent_process

struct OS_process_t* old_parent_process
static

◆ old_task

struct OS_thread_t* old_task
static

◆ os_stacks

struct OS_stack_t os_stacks
extern

Thread stacks.

Scheduler notion on existing stacks.