nros_platform/board/mod.rs
1// Phase 212.N.1 — trait surface only; consumers land in 212.N.2+.
2// Suppress `dead_code` workspace-wide until a family driver crate
3// pulls these in. Phase 216.A.1 — `DispatchStrategy` ships ahead of
4// its first consumer (Phase 216.A.2 trait extension), so
5// `unused_imports` joins the allowance.
6#![allow(dead_code, unused_imports)]
7
8//! Board trait family.
9//!
10//! Platform-agnostic Board taxonomy living in `nros-platform`. The
11//! board crate (`nros-board-{linux,freertos,threadx,…}`) implements
12//! the per-family/per-target surface; user Entry pkgs invoke
13//! `<Board as BoardEntry>::run(setup)` from `main.rs`.
14//!
15//! ## Surface
16//!
17//! ```text
18//! Board: BoardInit + BoardPrint + BoardExit
19//! │
20//! └── BoardEntry: Board {
21//! fn run<F, E>(setup: F) -> Result<(), E>
22//! where F: FnOnce(&mut RuntimeCtx) -> Result<(), E>;
23//! }
24//! ```
25//!
26//! `BoardEntry::run` owns the full boot lifecycle: hardware init →
27//! transport bringup → executor lifecycle → clean exit. The `setup`
28//! callback receives a [`RuntimeCtx`] for overlay (params / remaps /
29//! env) plus the codegen-emitted `run_plan(runtime)` call.
30//!
31//! ## Status
32//!
33//! This module is the trait surface only. Per-board impls live in the
34//! family driver crates and the per-board crates; the code that drives
35//! them is generated by the `nros` CLI.
36//!
37//! ## Relationship to the old `nros-board-common::Board*` traits
38//!
39//! `nros-board-common` once carried a second trait family (`Board`,
40//! `BoardInit`, `BoardPrint`, `BoardExit`, `BoardEntry`, ~~`DirectExec`~~
41//! and a generic `run`). It has been deleted; this module is
42//! the one board entry API.
43
44pub mod config;
45pub mod dispatch;
46pub mod entry;
47pub mod exit;
48pub mod init;
49pub mod network;
50pub mod print;
51pub mod rtic_entry;
52pub mod runtime;
53pub mod sched_task;
54
55pub use config::BoardConfig;
56pub use dispatch::DispatchStrategy;
57pub use entry::{BoardEntry, DeployOverlay, LinkKind};
58pub use exit::BoardExit;
59pub use init::BoardInit;
60pub use print::BoardPrint;
61pub use rtic_entry::{RticBoardEntry, rtic_dispatchers_agree};
62pub use runtime::{
63 NodeDispatchRuntime, NullNodeRuntime, RuntimeCtx, RuntimeError, SignaledCallback,
64};
65pub use sched_task::{
66 PriorityDirection, SchedTaskSpec, SchedTaskSpinGap, boot_sched_task_index,
67 freertos_priority_for, posix_nice_for, threadx_priority_for,
68};
69
70// Phase 313 W1 (issue #0243) — the phase-214.K.1 `NodeRuntime` →
71// `NodeDispatchRuntime` deprecation alias is removed (its one-release cycle long
72// elapsed; the only consumers were the internal re-exports). Impls use
73// `NodeDispatchRuntime` directly.
74
75/// Super-trait every board impl carries (mirrors
76/// `nros-board-common::board_init::Board`).
77///
78/// Blanket-implemented for any type carrying all three contracts;
79/// concrete board crates do NOT impl `Board` directly — they impl
80/// `BoardInit`/`BoardPrint`/`BoardExit` (and the optional mixins).
81pub trait Board: BoardInit + BoardPrint + BoardExit {}
82impl<T: BoardInit + BoardPrint + BoardExit> Board for T {}