feat(ioboard): wire 6 new CubeMX pins into 10-channel DO driver

Flat-expand the board output driver from 4 to 10 channels as decided:
IOBOARD_DO_COUNT 4->10, mask uint8_t->uint16_t, IOBOARD_DO_MASK_ALL
0x03FF.  The 6 new pins keep their bit positions: KO_LED1=PF2(bit4),
KO_LED2=PF3(bit5), KO_24V=PF4(bit6), KO4=PF5(bit7), KO5=PC15(bit8),
KO_LED3=PE6(bit9); the original 4 (KO6/TRIP/ERT/CLZ) keep bit0..3.
Backups-domain PC15 is used as a signal bit only (+/-3 mA limit).

No 24V supply interlock and no LED special-casing: the driver writes
KO_24V as an ordinary bit; callers needing relay power sequencing must
assert it before energizing a channel.  do_write/get/read_level and the
shadow register are all uint16_t; do_apply flushes four port segments
(GPIOC/GPIOF/GPIOC/GPIOE) and do_read_level caches three port ODRs.

UI: UI_DATA_DO_N 4->10, dio_do_mask uint16_t, UI_DATA_VER 3->4 because
dio_do_valid shifts 211->212; feed mask and dio row table extended;
content-page golden references regenerated for 51 rows / 7 pages.
Host ioboard tests 127/127 and ui_data tests 305/305 pass; Keil rebuild
0 errors 0 warnings.  RAM ledger, memory snapshot and size attestation
refilled from the authoritative map.  Docs: ioboard spec v1.2->v1.3 and
the resolved 6-pin question closed out.
This commit is contained in:
2026-11-18 14:25:32 +08:00
parent afd43f51e8
commit 74efa671bb
22 changed files with 438 additions and 294 deletions
+18 -10
View File
@@ -58,9 +58,10 @@
* 值区一字不动;解闭锁后重新提交可成功
* TC-UIDATA-020 apply 中途失败(预检与执行不一致的防御分支):如实 ERR_RANGE,
* 已生效的前几项不回滚(prot_set 无回滚接口,谎称整批未写更坏)
* TC-UIDATA-021 v2/v3 帧扩展:UI_DATA_VER == 3、既有字段偏移逐字节见证(只允许尾
* 追加)、cal_block 两种态(未标定/已标定)整帧往返、rt 帧 v3
* 尾追加的板级开入开出四字段落在 208..211(既有字段不挪位)
* TC-UIDATA-021 v2/v3/v4 帧扩展:UI_DATA_VER == 4、既有字段偏移逐字节见证(只允许尾
* 追加)、cal_block 两种态(未标定/已标定)整帧往返、rt 帧 v3/v4
* 尾追加的板级开入开出四字段落在 208..212(do_mask 210..211 两字节,
* do_valid 顺延到 212;其余既有字段不挪位)
* ── 以下 5 组 = 装置维护通道与时钟换算(道F task-3,
* docs/任务规划/UI补齐.md §2 第 3 行「装置维护 3 页」的地基)──
* TC-UIDATA-022 时钟换算与"无效值拒收":12 条锚点正向换算 + 反函数互逆 +
@@ -870,10 +871,12 @@ static void tc_param_frame_v2(void)
{
ui_data_par_t src;
ui_data_par_t got;
ui_data_rt_t layout_probe; /* 只为 sizeof 字段宽度,不求值、不发布 */
/* 版本号是页面与写侧唯一对齐凭据;v2 = par 尾追加 cal_block,
* v3 = rt 尾追加板级开入开出四字段(ui_data.h 文件头「追加即升此值」) */
CHECK(UI_DATA_VER == 3u, "TC-UIDATA-021a contract version is 3");
* v3 = rt 尾追加板级开入开出四字段,v4 = dio_do_mask 加宽为 uint16_t
* (do_valid 从 211 顺延到 212,旧布局读新帧会把 mask 高字节误当 valid) */
CHECK(UI_DATA_VER == 4u, "TC-UIDATA-021a contract version is 4");
/* v1 布局逐字节见证:字段只允许尾追加,任何插入/重排都会让下面四条红
* (页面按名字取字段,错位是静默的——只有把偏移钉死才照得出来) */
CHECK(offsetof(ui_data_par_t, seq) == 0u, "TC-UIDATA-021b seq offset unchanged");
@@ -888,8 +891,9 @@ static void tc_param_frame_v2(void)
/* rt 帧尺寸(MSVC x64 / ARMCC 实测均 216 B):v3 只是尾追加 4 个 uint8(恰好
* 落在旧尾部填充里,字段偏移 208..211 连续),但**整 struct 由 208 涨到 216**——
* 尾部 char[20] 之后有 4 B 对齐填充,加 4 B 正好把它顶满、再补 4 B 新填充
* (24 B 数组区 → 需要 8 的倍数)。所以 s_scr union 的真实增量是 8 B 而不是 4 B,
* 写侧 .bss 台账按 216 算(这条断言就是"别猜、量出来"的落点) */
* (24 B 数组区 → 需要 8 的倍数)。10 路开出把 dio_do_mask 加宽为 uint16_t,
* do_valid 顺延到 212,但尾填充吸收了这 1 B,实测 sizeof 仍为 216 B,
* 所以 s_scr union 上界不变(数值由 UI agent 用 cl.exe x64 探针实测给出)。 */
CHECK(sizeof(ui_data_rt_t) == 216u, "TC-UIDATA-021g rt frame is 216 B (v3 +8, union follows rt)");
CHECK(sizeof(ui_data_par_t) < sizeof(ui_data_rt_t),
"TC-UIDATA-021h par still smaller than rt (shared scratch follows rt)");
@@ -910,9 +914,13 @@ static void tc_param_frame_v2(void)
CHECK(offsetof(ui_data_rt_t, dio_di_valid) == 209u,
"TC-UIDATA-021p rt dio_di_valid offset 209");
CHECK(offsetof(ui_data_rt_t, dio_do_mask) == 210u,
"TC-UIDATA-021q rt dio_do_mask offset 210");
CHECK(offsetof(ui_data_rt_t, dio_do_valid) == 211u,
"TC-UIDATA-021r rt dio_do_valid offset 211");
"TC-UIDATA-021q rt dio_do_mask offset 210 (uint16_t spans 210..211)");
CHECK(offsetof(ui_data_rt_t, dio_do_valid) == 212u,
"TC-UIDATA-021r rt dio_do_valid offset 212 (+1 after do_mask widened to uint16_t)");
CHECK(sizeof(layout_probe.dio_do_mask) == sizeof(uint16_t),
"TC-UIDATA-021s rt dio_do_mask is uint16_t wide");
CHECK(UI_DATA_DO_N == 10u,
"TC-UIDATA-021t 10 DO channels in UI contract");
/* 闭锁态:1 = 未标定(写侧按 UA/UN/IA 三路 VALID 现算,本层只存真值) */
ui_data_init();