radio_esp32::phy_init
The PHY’s initialisation parameters.
esp_phy_init_data_t — uint8_t params[128] — the first argument to
register_chipv7_phy. Espressif’s recommended defaults, transcribed from
esp-idf components/esp_phy/esp32/include/phy_init_data.h at tag v4.4,
the revision tools/fetch-blobs.sh pins the archives to.
Checked in rather than fetched
Section titled “Checked in rather than fetched”The archives are fetched because they are eight megabytes of binaries. This is 128 bytes of documented constants from an Apache-2.0 header, and fetching it would need a parser and a generated file in the build — more machinery than it saves. The provenance is recorded instead, and the regeneration recipe is in the tests.
107 values, 128 bytes
Section titled “107 values, 128 bytes”The C initialiser lists 107 entries and lets the compiler zero the rest. That is easy to miss and invisible from the header, so the tail is an explicit zero fill here and a test pins it: a table 21 bytes short would be handed to the PHY along with whatever followed it in memory.
Transmit power is a knob, not a constant
Section titled “Transmit power is a knob, not a constant”Six entries are LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 40, n) in the
header — a Kconfig value FlintOS has no equivalent of. It is a regulatory
and thermal choice rather than a chip fact, so it is a parameter here and
the clamping happens exactly as the macro does it.
Units are quarter-dBm, which is the multiply by four. The six cover different modulations and their ceilings differ (78, 72, 66, 60, 56, 52) because the higher-rate ones cannot be driven as hard.
Functions
Section titled “Functions”init_data
Section titled “init_data”const fn init_data(max_tx_power_dbm: i32) -> [u8; 128]Build the init data for a maximum transmit power, in dBm.
const fn, so a board’s table is computed at build time and costs nothing
at boot.
Constants
Section titled “Constants”PHY_INIT_DATA_LEN
Section titled “PHY_INIT_DATA_LEN”const PHY_INIT_DATA_LEN: usize;sizeof(esp_phy_init_data_t).
TX_POWER_CEILINGS
Section titled “TX_POWER_CEILINGS”const TX_POWER_CEILINGS: [u8; 6];The per-modulation ceilings, in quarter-dBm, in slot order.
TX_POWER_FLOOR
Section titled “TX_POWER_FLOOR”const TX_POWER_FLOOR: u8;The floor every entry is clamped up to.
TX_POWER_SLOTS
Section titled “TX_POWER_SLOTS”const TX_POWER_SLOTS: [usize; 6];Where the six transmit-power entries sit, from the header’s ordering.
Named so the tests can check the knob reaches them, rather than inferring the positions by differencing two tables and hoping.