Skip to main content

Crate rusty_rtos_kernel

Crate rusty_rtos_kernel 

Source
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.c and queue.c as 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_CAPACITY bytes, truncated to the configuration’s MAX_TASK_NAME_LEN exactly as C truncates it.
StartHandles
What Kernel::start_scheduler created, so a runner can attach bodies.

Enums§

Position
Where an item goes (xCopyPosition).
QueueKind
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 vTaskSwitchContext could not choose a task to run.
TaskState
eTaskState: what a task is doing, derived from the list it is in exactly as eTaskGetState derives it.
Wait
What a blocking call answers.

Constants§

NAME_CAPACITY
The largest configMAX_TASK_NAME_LEN this 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: prvIdleTask and the timer daemon. A system that declares n tasks needs room for n + OVERHEAD_TASKS.
VERSION
Crate version, for manifests and logs.

Traits§

TickHook
vApplicationTickHook, as something that can actually reach the kernel.

Functions§

items_for
List items a kernel needs for tasks tasks: a state item and an event item each, exactly the two ListItem_ts in a C TCB_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.