Expand description
rusty_rtos_kernel — FreeRTOS-Kernel remade in Rust: the fixed-priority preemptive scheduler, task notifications, queues, semaphores, mutexes with priority inheritance, queue sets, software timers, event groups, stream and message buffers — a pure state machine over the Port seam, forbid(unsafe), traced against the C kernel.
This is the facade: it re-exports the no_std core. Depend on this crate;
reach into the sub-crates only when you are building a port or a backend.
Part of Kairos (Remade With Rust). Plan: docs/plans/rusty_rtos_kernel.md.
Modules§
- events
- Event groups:
event_groups.c. - kernel
- The scheduler:
tasks.candqueue.cas a state machine over indices. - name
- A task’s name, stored the way the C kernel stores it.
- prelude
- The names a firmware wants in scope.
- queue
queue.c: the queue, and the semaphore and mutex built on it.- stream
stream_buffer.c: a byte ring one task writes and another reads.- system
- The static face: declare the system, and the geometry is the declaration.
- timer
timers.c: software timers and the daemon task that runs them.- typed
- The Rust face: the same kernel, with the invariants in the type system.
Macros§
- system
- Declare a system: its tasks, its queues, and the geometry they imply.
Structs§
- Kernel
- The scheduler.
- Name
- A task name: at most
NAME_CAPACITYbytes, truncated to the configuration’sMAX_TASK_NAME_LENexactly as C truncates it. - Start
Handles - What
Kernel::start_schedulercreated, so a runner can attach bodies.
Enums§
- Position
- Where an item goes (
xCopyPosition). - Queue
Kind - What a queue is underneath (
ucQueueType). - Stall
- A trace line owed by a task that was switched out before it could
emit one. Only the queue failure paths can owe one: they are the only
places FreeRTOS traces after leaving a critical section.
Why
vTaskSwitchContextcould not choose a task to run. - Task
State eTaskState: what a task is doing, derived from the list it is in exactly aseTaskGetStatederives it.- Wait
- What a blocking call answers.
Constants§
- NAME_
CAPACITY - The largest
configMAX_TASK_NAME_LENthis build supports. - OVERHEAD_
LISTS - The number of fixed lists that are not a ready list: the two delayed lists, pending-ready and suspended, and the two timer lists.
- OVERHEAD_
TASKS - The tasks a kernel creates for itself whatever the application asks
for:
prvIdleTaskand the timer daemon. A system that declaresntasks needs room forn + OVERHEAD_TASKS. - VERSION
- Crate version, for manifests and logs.
Traits§
- Tick
Hook vApplicationTickHook, as something that can actually reach the kernel.
Functions§
- items_
for - List items a kernel needs for
taskstasks: a state item and an event item each, exactly the twoListItem_ts in a CTCB_t. - lists_
for - Lists a kernel needs: one ready list per priority, the two delayed
lists, the pending-ready list and the suspended list, plus the two
event lists (
xTasksWaitingToSend,xTasksWaitingToReceive) of every queue and the one (xTasksWaitingForBits) of every event group.