/* * 主机侧单测桩:cmsis_os.h(CMSIS-RTOS v1 兼容层) * 模块功能:为 App/fs/vol_lock.c 提供主机可编译的 CMSIS-RTOS 互斥量接口。 * * ⚠ 仅供 test/host/vol_lock/ 使用,不参与 MCU 构建。 * 真实头来自 Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os.h, * 会拖入整套 FreeRTOS(FreeRTOS.h / task.h / queue.h / semphr.h …),主机侧不引入。 * * 保真点(对齐 cmsis_os.h + cmsis_os2.h): * - osMutexId_t = void*(cmsis_os2.h:198); * - osMutexNew(const osMutexAttr_t *attr)(cmsis_os2.h:552); * - osMutexWait(osMutexId_t, uint32_t) —— 真实头是 `#define osMutexWait osMutexAcquire`, * 两者签名一致(cmsis_os.h:617); * - osMutexRelease(osMutexId_t)(cmsis_os.h:626); * - osStatus_t 枚举含 osOK = 0(cmsis_os.h:204)。 * 三个接口由测试单元给强符号桩(可注入"创建失败 / 等待超时")。 * * 创建日期:2026-10-10 */ #ifndef CMSIS_OS_H #define CMSIS_OS_H #include #ifdef __cplusplus extern "C" { #endif /* 不透明句柄(真实定义见 cmsis_os2.h:195/198) */ typedef void *osMutexId_t; typedef void *osEventFlagsId_t; /* 状态码(cmsis_os.h:204 起的枚举;此处只保留被测代码用到的子集) */ typedef enum { osOK = 0, /* 成功 */ osError = -1, /* 通用错误 */ osErrorTimeout = -2, /* 超时 */ osErrorResource = -3, /* 资源不可用 */ osErrorParameter = -4 /* 参数错误 */ } osStatus_t; /* 互斥量属性:被测代码只传 NULL,故仅占位 */ typedef struct { uint32_t attr_bits; } osMutexAttr_t; osMutexId_t osMutexNew(const osMutexAttr_t *attr); osStatus_t osMutexWait(osMutexId_t mutex_id, uint32_t millisec); osStatus_t osMutexRelease(osMutexId_t mutex_id); #ifdef __cplusplus } #endif #endif /* CMSIS_OS_H */