ICARUS OS (Intelligent Cooperative Architecture for Real-time Unified Systems) 0.1.0
Preemptive Real-Time Operating System for ARM Cortex-M7
Loading...
Searching...
No Matches
scheduler.c File Reference

ICARUS Scheduler Implementation. More...

#include "icarus/scheduler.h"
#include "icarus/kernel.h"
#include "bsp/config.h"
#include <stddef.h>
#include "stm32h7xx.h"

Go to the source code of this file.

Functions

uint32_t __os_get_tick_count (void)
 Privileged implementation of os_get_tick_count.
 
uint8_t __os_get_running_task_count (void)
 Privileged implementation of os_get_running_task_count.
 
const char * __os_get_current_task_name (void)
 Privileged implementation of os_get_current_task_name.
 
uint32_t __os_get_task_ticks_remaining (void)
 Privileged implementation of os_get_task_ticks_remaining.
 
void __os_yield (void)
 Privileged implementation of os_yield.
 
uint32_t __task_active_sleep (uint32_t ticks)
 Privileged implementation of task_active_sleep.
 
uint32_t __task_blocking_sleep (uint32_t ticks)
 Privileged implementation of task_blocking_sleep.
 
uint32_t __task_busy_wait (uint32_t ticks)
 Privileged implementation of task_busy_wait.
 

Variables

static char task_name_buffer [32]
 

Detailed Description

ICARUS Scheduler Implementation.

Version
0.1.0

Task scheduling, yielding, and sleep functions.

Author
Souham Biswas
Date
2025

Definition in file scheduler.c.

Function Documentation

◆ __os_get_current_task_name()

const char * __os_get_current_task_name ( void  )

Privileged implementation of os_get_current_task_name.

Note
Internal function - use os_get_current_task_name() wrapper
Copies name from DTCM to RAM_D1 buffer for unprivileged access

Definition at line 65 of file scheduler.c.

References current_task_index, ICARUS_MAX_TASK_NAME_LEN, icarus_task_t::name, num_created_tasks, task_list, and task_name_buffer.

Referenced by os_get_current_task_name(), and SVC_Handler_C().

◆ __os_get_running_task_count()

uint8_t __os_get_running_task_count ( void  )

Privileged implementation of os_get_running_task_count.

Note
Internal function - use os_get_running_task_count() wrapper

Definition at line 56 of file scheduler.c.

References running_task_count.

Referenced by os_get_running_task_count(), and SVC_Handler_C().

◆ __os_get_task_ticks_remaining()

uint32_t __os_get_task_ticks_remaining ( void  )

Privileged implementation of os_get_task_ticks_remaining.

Note
Internal function - use os_get_task_ticks_remaining() wrapper

Definition at line 87 of file scheduler.c.

References current_task_ticks_remaining.

Referenced by os_get_task_ticks_remaining(), and SVC_Handler_C().

◆ __os_get_tick_count()

uint32_t __os_get_tick_count ( void  )

Privileged implementation of os_get_tick_count.

Note
Internal function - use os_get_tick_count() wrapper

Definition at line 48 of file scheduler.c.

References os_tick_count.

Referenced by os_get_tick_count(), and SVC_Handler_C().

◆ __os_yield()

void __os_yield ( void  )

Privileged implementation of os_yield.

Note
Internal function - use os_yield() wrapper

Definition at line 99 of file scheduler.c.

References current_task_ticks_remaining, and ticks_per_task.

Referenced by __os_exit_task(), __os_kill_process(), __task_active_sleep(), os_yield(), and SVC_Handler_C().

◆ __task_active_sleep()

uint32_t __task_active_sleep ( uint32_t  ticks)

Privileged implementation of task_active_sleep.

Note
Internal function - use task_active_sleep() wrapper

Definition at line 108 of file scheduler.c.

References __os_yield(), current_task_index, icarus_task_t::global_tick_paused, os_tick_count, task_list, icarus_task_t::task_state, TASK_STATE_BLOCKED, and icarus_task_t::ticks_to_pause.

Referenced by SVC_Handler_C(), and task_active_sleep().

◆ __task_blocking_sleep()

uint32_t __task_blocking_sleep ( uint32_t  ticks)

Privileged implementation of task_blocking_sleep.

Note
Internal function - use task_blocking_sleep() wrapper
Spin-wait calls public SVC wrappers — only safe from thread mode

Definition at line 121 of file scheduler.c.

References enter_critical(), exit_critical(), and task_busy_wait().

Referenced by task_blocking_sleep().

◆ __task_busy_wait()

uint32_t __task_busy_wait ( uint32_t  ticks)

Privileged implementation of task_busy_wait.

Note
Internal function - use task_busy_wait() wrapper
Uses os_get_tick_count() SVC gate — safe with DTCM priv-only

Definition at line 133 of file scheduler.c.

References os_get_tick_count(), and os_tick_count.

Referenced by task_busy_wait().

Variable Documentation

◆ task_name_buffer

char task_name_buffer[32]
static

Definition at line 39 of file scheduler.c.

Referenced by __os_get_current_task_name().