C Microkernel Realtime eXecutive
Realtime Operating System for Cortex-M based microcontrollers
 
Loading...
Searching...
No Matches
sched.h
1#pragma once
2
3#include "runtime.h"
4#include <stdbool.h>
5#include <arch/corelocal.h>
6
13extern struct OS_core_state_t core[OS_NUM_CORES];
14
26
31uint8_t os_get_current_process(void);
32
37uint8_t os_get_current_thread(void);
38
43void os_set_current_thread(Thread_t new_thread);
44
49uint8_t os_get_current_stack(void);
50
56uint32_t os_get_micro_time(void);
57
62int os_sched_yield(void);
63
71void _os_start(uint8_t start_core);
72
76int os_thread_create(entrypoint_t * entrypoint, void * data, uint8_t priority);
77
81int os_thread_join(uint8_t thread_id);
82
86int os_thread_exit(int status);
87
91int os_thread_stop(uint8_t thread_id);
92
96int os_thread_continue(uint8_t thread_id);
97
105int os_thread_kill(uint8_t thread_id, int status);
106
110int os_setpriority(uint8_t priority);
111
116uint32_t * os_stack_get(int stack_id);
117
122struct OS_thread_t * os_thread_get(Thread_t thread_id);
123
137int os_thread_construct(Thread_t tid, entrypoint_t * entrypoint, void * data, uint8_t core);
138
144
156int os_thread_migrate(uint8_t thread_id, int target_core);
157
160uint32_t os_shutdown();
161
163
164int os_thread_set_ready(struct OS_thread_t * thread);
165
long os_sched_timing_callback(long delay_us)
Kernel callback for timing provider.
Definition sched.c:159
uint8_t Thread_t
Data type used for thread IDs.
Definition defines.h:72
#define OS_NUM_CORES
Definition kernel.h:45
uint8_t os_get_current_thread(void)
Kernel implementation of get_tid() syscall.
Definition sched.c:183
int os_thread_stop(uint8_t thread)
Kernel implementation of thread_stop() syscall.
Definition sched.c:311
int os_thread_set_ready(struct OS_thread_t *thread)
Definition sched.c:354
struct OS_core_state_t core[OS_NUM_CORES]
CPU scheduling thread IDs.
Definition sched.c:38
uint32_t os_shutdown(void)
Kernel implementation of the shutdown() syscall.
Definition sched.c:616
struct OS_thread_t * os_thread_get(Thread_t thread_id)
Get thread descriptor.
Definition sched.c:631
uint8_t os_get_current_process(void)
Kernel implementation of get_pid.
Definition sched.c:198
void os_thread_dispose(void)
Alias to thread_exit.
int os_thread_kill(uint8_t thread_id, int status)
Kernel way to kill an arbitrary thread.
Definition sched.c:282
struct OS_thread_t * os_thread_by_id(Thread_t id)
Definition sched.c:344
int os_thread_join(uint8_t thread_id)
Kernel implementation of thread_join() syscall.
Definition sched.c:413
int os_thread_continue(uint8_t thread)
Kernel implementation of thread_continue() syscall.
Definition sched.c:360
uint32_t os_get_micro_time(void)
Get amount of microseconds elapsed since scheduler start.
Definition sched.c:203
int os_setpriority(uint8_t priority)
Kernel implementation of setpriority() syscall.
Definition sched.c:386
void os_set_current_thread(Thread_t new_thread)
Kernel internal function to override current thread.
Definition sched.c:188
int os_sched_yield(void)
Kernel implementation of sched_yield() syscall.
Definition sched.c:111
int os_thread_migrate(uint8_t thread_id, int target_core)
Migrate thread between CPU cores.
Definition sched.c:636
int os_thread_construct(Thread_t tid, entrypoint_t *entrypoint, void *data, uint8_t core_id)
Make thread runnable.
Definition sched.c:457
uint8_t os_get_current_stack(void)
Get ID of stack used by current thread.
Definition sched.c:193
int os_thread_create(entrypoint_t *entrypoint, void *data, uint8_t priority)
Syscall handling thread_create() Creates new thread inside current process using specified entrypoint...
Definition sched.c:528
uint32_t * os_stack_get(int stack_id)
Get address of stack.
Definition sched.c:258
int os_thread_exit(int status)
Kernel implementation of thread_exit() syscall.
Definition sched.c:276
static void delay_us(uint32_t period_us)
Perform short busy wait.
Definition timer.c:225
void _os_start(uint8_t start_core)
Start up scheduler.
Definition sched.c:537
Structure holding current scheduling state of CPU.
Definition runtime.h:183
Thread control block.
Definition runtime.h:72