Files
wandering1 a2f5d1397a 主机单测:新增卷锁与时间同步两套用例(33+80 项)并登记钩子
- vol_lock(App/fs/vol_lock.c):33 用例。核心不变量是 fail-open——
  互斥量创建失败时 vol_lock_wait() 必须返回 1 且绝不阻塞,因为调用者
  defaultTask 是看门狗喂狗点;板端该路径只在内存耗尽时才可能走到。
- time_sync(App/sync/time_sync.c):80 用例。本模块是 N-17 看门狗风险的
  全部逻辑贡献者,用例钉死分片喂狗节奏、监听退避、报文重组(半包/粘连/
  EOF/真错/预算耗尽/tick 回绕)、重听门控;用 longjmp 跳出 for(;;) 任务循环。
- 两套均为纯逻辑主机侧测试,MSVC 离线编译真实源文件(#include 纳入)。
- 新增钩子 vol-lock-unit-test、time-sync-unit-test(7f/7g)。
- 全量主机单测:watchdog 39 + sys_clock 100 + cfg_file 149 + phasor 57
  + adc_input 70 + vol_lock 33 + time_sync 80 = 528 项,全绿。
2026-10-10 18:03:31 +08:00

35 lines
956 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* 主机侧单测桩:FreeRTOS.h
* 模块功能:为 App/sync/time_sync.c 提供主机可编译的最小 FreeRTOS 时基类型与宏。
*
* ⚠ 仅供 test/host/time_sync/ 使用,不参与 MCU 构建。
* 真实头在 Middlewares/Third_Party/FreeRTOS/Source/include/,会拖入 portmacro /
* projdefs / portable 层,主机侧不引入。
*
* 保真点:TickType_t = uint32_t;configTICK_RATE_HZ = 1000(Inc/FreeRTOSConfig.h)
* → pdMS_TO_TICKS(ms) == ms。被断言"片长 = 50ms"的用例依赖此等式。
*
* 创建日期:2026-10-10
*/
#ifndef FREERTOS_H
#define FREERTOS_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef uint32_t TickType_t;
/* 与 Inc/FreeRTOSConfig.h 一致:1000 Hz → 1 tick = 1 ms */
#define configTICK_RATE_HZ 1000U
#define pdMS_TO_TICKS(ms) ((TickType_t)((uint32_t)(ms) * (1000U / configTICK_RATE_HZ)))
#ifdef __cplusplus
}
#endif
#endif /* FREERTOS_H */