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

Description

Kernel is built around minimalistic core, which consists of prioritized thread scheduler.

Scheduler can be started up after basic HW setup is done by calling os_start(). This will collect all auto-started threads, prepare them and start thread scheduler. All other mechanisms are built around thread scheduler.

Data Structures

struct  OS_thread_t
 Thread control block. More...
 
struct  OS_stack_t
 Kernel structure for maintaining thread stacks. More...
 
struct  OS_MPU_region
 MPU region description. More...
 
struct  OS_process_definition_t
 Static definition of process in firmware image. More...
 
struct  OS_process_t
 Process control block. More...
 
struct  OS_thread_create_t
 Structure describing auto-spawned thread. More...
 
struct  OS_core_state_t
 Structure holding current scheduling state of CPU. More...
 

Macros

#define OS_TASK_NO_STACK   (~0)
 
#define OS_STACK_DWORD   (OS_STACK_SIZE/4)
 

Typedefs

typedef int() entrypoint_t(void *)
 Prototype for thread entrypoint function.
 
typedef Process_t OS_RPC_stack[8]
 RPC call owner process stack.
 

Enumerations

enum  ThreadState {
  THREAD_STATE_EMPTY = 0 , THREAD_STATE_READY , THREAD_STATE_RUNNING , THREAD_STATE_CREATED ,
  THREAD_STATE_STOPPED , THREAD_STATE_FINISHED , THREAD_STATE_BLOCKED_JOINING
}
 List of states in which thread can be. More...
 

Variables

struct OS_thread_t os_threads [OS_THREADS]
 Scheduler notion on existing threads.
 
struct OS_process_t os_processes [OS_PROCESSES]
 Scheduler notion on existing processes.
 
struct OS_stack_t os_stacks
 Scheduler notion on existing stacks.
 

Macro Definition Documentation

◆ OS_STACK_DWORD

#define OS_STACK_DWORD   (OS_STACK_SIZE/4)

◆ OS_TASK_NO_STACK

#define OS_TASK_NO_STACK   (~0)

Typedef Documentation

◆ entrypoint_t

typedef int() entrypoint_t(void *)

Prototype for thread entrypoint function.

Thread entrypoint function takes one user-defined argument. By default it is assumed that this is a pointer to user data, but there is no checking performed on the value passed to the callee. It can be anything, once properly typecasted. Thread entrypoint can return signed 32bit value as it's return value. This is available for whoever will call thread_join() as thread exit status.

◆ OS_RPC_stack

typedef Process_t OS_RPC_stack[8]

RPC call owner process stack.

This stack records owners of nested RPC calls. It can accomodate up to 8 owners which means 8 nested RPC calls.

Enumeration Type Documentation

◆ ThreadState

List of states in which thread can be.

Enumerator
THREAD_STATE_EMPTY 

This thread slot is empty (default after reset)

THREAD_STATE_READY 

Thread is ready to be scheduled.

THREAD_STATE_RUNNING 

Thread is currently running.

THREAD_STATE_CREATED 

Thread was created, but does not have stack assigned.

THREAD_STATE_STOPPED 

Thread was running, but was forced to stop.

It still has valid state so can't be disposed of without damage. Can be placed into ready/running state by calling thread_continue().

THREAD_STATE_FINISHED 

Thread finished it's execution either explicitly by calling thread_exit() or by returning from thread entrypoint.

Nobody called thread_join() yet. This state is the same as "zombie" in Linux.

THREAD_STATE_BLOCKED_JOINING 

Thread is blocked waitihg for other thread to finish.

Variable Documentation

◆ os_processes

struct OS_process_t os_processes[OS_PROCESSES]
extern

Scheduler notion on existing processes.

Scheduler notion on existing processes.

◆ os_stacks

struct OS_stack_t os_stacks
extern

Scheduler notion on existing stacks.

Scheduler notion on existing stacks.

◆ os_threads

struct OS_thread_t os_threads[OS_THREADS]
extern

Scheduler notion on existing threads.

Scheduler notion on existing threads.