/* * 主机侧单测桩:dbg_log.h * 模块功能:为 Drivers/BSP/GD5F2GQ5UE/nand_ftl.c 提供主机可编译的日志宏 * (DBG_* 映射为计数,不真正打印,避免污染测试输出)。 * * ⚠ 仅供 test/host/nand_port/ 使用,不参与 MCU 构建。 * MCU 版(Drivers/BSP/dbg_log.h)依赖 sys_clock(RTC 时间戳)与 console, * 并在 DBG_ENABLE_* 开关下展开成行缓冲 + 时间戳格式化。 * * 被测源在 `#include "dbg_log.h"` 之前自定义了 DBG_LINE_BUF_MAX / DBG_TAG, * 本桩不使用它们(宏重定义无副作用:本桩不定义同名宏)。 * * 为什么计数而不是直通 printf: * nand_ftl.c 的日志只在 disk_initialize / 缓存回写路径上,本套件测的是 * dhara HAL 六个入口;直通打印会让"越界不产生任何芯片访问"这类断言的 * 输出被日志淹没。留计数则仍可断言"错误路径确有留痕"。 * * 创建日期:2026-10-15 */ #ifndef DBG_LOG_H #define DBG_LOG_H #include /* 测试观测计数(在 nand_port_test.c 实现): * g_nandtest_err_count —— DBG_ERROR 次数 * g_nandtest_info_count —— DBG_INFO 次数 * g_nandtest_debug_count —— DBG_DEBUG 次数 */ extern int g_nandtest_err_count; extern int g_nandtest_info_count; extern int g_nandtest_debug_count; #define DBG_INFO(fmt, ...) do { g_nandtest_info_count++; } while (0) #define DBG_DEBUG(fmt, ...) do { g_nandtest_debug_count++; } while (0) #define DBG_ERROR(fmt, ...) do { g_nandtest_err_count++; } while (0) #endif /* DBG_LOG_H */