# hisi-rf
`hisi-rf` is the application-facing radio facade for the hispark-rs ecosystem.
It re-exports the chip-neutral controller, runner, configuration, event, and L2
contracts from `hisi-rf-core`, then selects a safe chip composition root through
an explicit `chip-*` feature.
```toml
[dependencies]
hisi-rf = {
version = "0.1.0-alpha.52",
features = ["chip-ws63", "profile-wifi-wpa2-smoltcp"]
}
```
Chip repositories implement `WifiBackend`; applications drive TCP/IP through
`embassy-net` or the optional `smoltcp::phy::Device` adapter. WS63 applications
construct uniquely owned resources through `hisi_rf::ws63`; vendor archives,
ROM symbols, schedulers, TLS, NVS formats, and image packaging remain outside
the facade API. Application code should prefer the named
`profile-wifi-wpa2-smoltcp` or `profile-wifi-wpa3-smoltcp` composition. The
orthogonal `wifi`/`smoltcp`/security features remain available for maintainer
matrices. An Embassy Net profile will be added only with a working backend.
The profile owns its bounded state and crypto DMA scratch through explicit
application storage:
```rust,ignore
hisi_rf::ws63::declare_radio_storage!(
static RADIO_STORAGE,
events = 4
);
```
Before starting `hisi-rtos`, call `RADIO_STORAGE.install()` once and use its
allocation functions for the runtime. After RTOS startup,
`into_init_parts()` transfers the arena capability to the typed chip-resource
builder and lends the bounded control state to radio initialization. This
temporal split preserves the real linker/runtime boundary without exposing two
application-owned statics.
The storage-bound controller then starts the mandatory runner and returns only
the Wi-Fi control/L2 handles:
```rust,ignore
let (control, arena) = RADIO_STORAGE.install()?.into_init_parts();
let resources = build_resources(arena);
let mut wifi = hisi_rf::ws63::init(config, resources, control)?
.start_runner()?;
let scan = wifi.controller.scan(scan_config, &mut results).await?;
let station_mac = wifi.device.station_mac_address()
.ok_or("station netif has not been initialized")?;
```
The application does not import `hisi-rf-rtos-driver`, `ws63-radio-sys`, or a
chip backend type. Starting the runtime itself remains explicit application
policy rather than a hidden side effect of radio initialization.
The station MAC accessor becomes available after radio initialization and lets
the application configure a standard IP stack without importing backend netif
internals.
`RadioStorage::report()` provides allocation-free, versioned resource metadata.
The same contract can be emitted without naming the chip backend crate:
```console
cargo run --example ws63_resource_report --target <host-triple> \
--features chip-ws63,profile-wifi-wpa2-smoltcp
```
Task-stack, supplicant-arena, and final-image totals remain marked uncalibrated
until the runtime and HIL admission contracts can supply them truthfully.
Public [`hisi_rf::Error`](https://docs.rs/hisi-rf/latest/hisi_rf/enum.Error.html)
values expose `diagnostic()`, a versioned, allocation-free view with a stable
machine code, stage, recovery action, documentation anchor, optional raw
backend code, immutable profile revision, and a four-entry numeric trace. Its
JSON form reports trace truncation and cannot contain SSIDs, passphrases, or key
material because those values are not part of the diagnostic type.
This crate is an early alpha. The current public surface may change while WS63
connectivity parity is established on real silicon.