整理 App 与 test 目录:按职责分子目录并同步全库引用
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 模块名称:Storage Test Suite
|
||||
* 模块功能:FTL + FatFS 存储测试的声明与断言宏。实现见 storage_test_task.c,
|
||||
* 统一由 testTask 调度;正常产品构建下由 defaultTask 调用,
|
||||
* 行为与原 defaultTask 内联逻辑一致。
|
||||
* 适用平台:STM32F4 系列
|
||||
* 作者:王建锋
|
||||
* 创建日期:2026-08-26
|
||||
*/
|
||||
|
||||
#ifndef STORAGE_TEST_H
|
||||
#define STORAGE_TEST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct {
|
||||
uint16_t total;
|
||||
uint16_t passed;
|
||||
uint16_t failed;
|
||||
} storage_test_stats_t;
|
||||
|
||||
extern storage_test_stats_t g_storage_stats;
|
||||
|
||||
#define STORAGE_TEST_CHECK(cond, fmt, ...) do { \
|
||||
g_storage_stats.total++; \
|
||||
if (cond) { \
|
||||
g_storage_stats.passed++; \
|
||||
DBG_INFO(" [PASS] " fmt, ##__VA_ARGS__); \
|
||||
} else { \
|
||||
g_storage_stats.failed++; \
|
||||
DBG_ERROR(" [FAIL] " fmt, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define STORAGE_TEST_REPORT(name) do { \
|
||||
DBG_INFO("=== %s: %d/%d PASSED (failed=%d) ===", \
|
||||
name, g_storage_stats.passed, g_storage_stats.total, \
|
||||
g_storage_stats.failed); \
|
||||
} while (0)
|
||||
|
||||
/* 存储测试入口:FTL + FatFS 文件系统与性能测试 */
|
||||
void storage_test_run(void);
|
||||
|
||||
/* 存储套件恢复测试(默认关闭):取消注释并编译 STORAGE 套件运行一次,
|
||||
* 即可重建 BBT(清除 TC-STO-03 等注入的坏块)并重新格式化,恢复设备干净态。
|
||||
* 恢复完成后建议重新注释并编译正常构建。 */
|
||||
//#define ENABLE_STORAGE_RECOVERY_TESTS /* 台架已跑过一次恢复(2026-09-20 BBT 回出厂态),保持注释 */
|
||||
|
||||
/* 恢复模式的扩展(默认关闭,需与上面 ENABLE_STORAGE_RECOVERY_TESTS 同时打开):
|
||||
* 把 dhara 可见区**整片擦净**(连 journal checkpoint 一起),用于**把被扣掉的容量恢复回来**。
|
||||
* 原理(2026-09-21 读码 + 台架实证):dhara 把坏块计数持久化在 checkpoint 头里
|
||||
* (journal.c `hdr_set_bb_current/bb_last`),而 `dhara_journal_clear()` 只是
|
||||
* `bb_last = bb_current`(**不归零**)——所以 `nand_ftl_format()` 恢复不了容量(95200 卡住);
|
||||
* 只有让下次启动 `dhara_map_resume` 失败、走 `dhara_map_clear` 的**全新初始化**分支
|
||||
* (此时 bb_last = bb_current = 0)才能回满。2026-09-21 台架实测:95200 → **96064**(健康满值 ✓)。
|
||||
* 代价:卷内容全失(启动时 FatFs 自动重建)、约 2044 次块擦除(数十秒)。 */
|
||||
//#define STORAGE_RECOVERY_FULL_WIPE
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STORAGE_TEST_H */
|
||||
Reference in New Issue
Block a user