1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
//! The RTOS seam: the Kairos kernel's port, pinned once for the family.
//!
//! Every Janus firmware that runs on `rusty_rtos` reaches it through this
//! crate and never names `rusty_rtos_port-*` itself. Same rule, and same
//! reason, as [`rusty_esp_alloc`](https://docs.rs/rusty_esp_alloc): the pin,
//! the compatibility window and the startup shape are decided here once
//! rather than in every firmware.
//!
//! **This crate declares no scheduler and starts nothing.** It hands out the
//! port and states what that port requires; the deliverable's own `main`
//! does the starting, exactly as it declares its own global allocator.
//!
//! # The window, and why it is narrow
//!
//! The Xtensa port's context switch runs inside a software interrupt so that
//! `xtensa-lx-rt`'s exception entry spills the register windows — which is
//! how FreeRTOS and `esp-rtos` do it, and what a hand-written spill from task
//! context could not do. That makes `xtensa-lx-rt` a hard joint between the
//! port and esp-hal, and it is a **`links` crate**: exactly one version may
//! exist in a dependency graph, so the port and esp-hal must agree or the
//! build fails outright rather than misbehaving.
//!
//! Checked on 2026-09-20, and the news is good:
//!
//! ```text
//! rusty_rtos_port-xtensa 0.1.0 pins xtensa-lx-rt 0.23 (to match esp-hal 1.2.1)
//! janus xiao-s3-probe resolves xtensa-lx-rt 0.23.0
//! janus xiao-s3-keys resolves xtensa-lx-rt 0.23.0
//! ```
//!
//! The joint already lines up. See [`compat`] for the rest of the window.
//!
//! # What this cannot do yet
//!
//! Host the Wi-Fi/BLE blob. `esp-radio` reaches a scheduler through the
//! `esp-radio-rtos-driver` interface, and as of 2026-09-20 the Kairos ports
//! **document** that interface but do not implement it — it is the Kairos
//! half of K5. Until then a Janus firmware with a radio keeps `esp-rtos`,
//! and this seam carries the pin so that the day the ports implement it, the
//! change on our side is one feature flag rather than six manifests.
//!
//! The integration contract, written for the Kairos side, is
//! `docs/plans/janus-rtos.md` in the Kairos umbrella.
/// The compatibility window this seam guarantees, as facts a build can check
/// against rather than prose someone has to remember.
///
/// Every value here was read off a resolved lockfile or a published
/// manifest, not from a plan.
/// The Kairos port for the target being built, or `None` where there is
/// none — a host build, or an architecture Kairos has not ported.
///
/// This is what a firmware prints at startup to prove which kernel it is on,
/// the same way the probe firmwares print their allocator arm. A capability
/// you cannot detect is one you must not claim.
pub const
/// The Kairos port itself, re-exported so a firmware names this crate and
/// not the port.
pub use rusty_rtos_port_xtensa as port;
/// The Kairos port itself, re-exported so a firmware names this crate and
/// not the port.
pub use rusty_rtos_port_riscv as port;
/// The Kairos shared vocabulary — ticks, priorities, handles, the `Config`
/// trait — re-exported for the same reason.
pub use rusty_rtos_core as core_types;
/// The Kairos scheduler, under the `kernel` feature.
///
/// [`port`] gives a firmware the primitives to LEAVE a task and come back —
/// `Context`, `new_task_context`, `switch_context`, `yield_now`. It does not
/// decide which task runs next. This does: `Kernel::create_task`,
/// `start_scheduler`, `switch_context`, the ready lists and the tick.
pub use rusty_rtos_kernel_core as kernel;