Files
STM32F4-Base/App/time_sync.h
2026-08-28 16:42:44 +08:00

41 lines
1.3 KiB
C
Raw 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.
/*
* 模块名称Time Sync — PC 本地时间推送接收TCP
* 模块功能:以 TCP Server 方式监听 TIME_SYNC_PORT接收 PC 推送的本地时间包,
* 更新系统墙钟并写回 SD2506 RTC
* 适用平台STM32F407ZGTx + CH395F
* 作者:王建锋
* 创建日期2026-08-27
* 修改记录:
* v1.0 2026-08-27 王建锋 创建初始版本UDP 推送)
* v1.1 2026-08-28 王建锋 改为 TCP Server迁入独立任务 timeSyncTask
*/
#ifndef __TIME_SYNC_H
#define __TIME_SYNC_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* 监听端口PC 推送端TCP 客户端)需连到本端口 */
#define TIME_SYNC_PORT 8888
/*
* 函数功能:时间同步任务主体(独立 FreeRTOS 任务)
* 入口参数argument - FreeRTOS 传入参数(未使用)
* 返回值:无
* 限定条件net_init() 已由 netTask 完成;网络消息队列由 netTask 处理
* 函数说明:以 TCP Server 方式监听 TIME_SYNC_PORT接收 PC 推送的本地时间包,
* 经消息队列(由 netTask 串行执行)完成 socket 操作,更新系统墙钟。
* 该任务与 FTP 等其它网络任务并发安全。
*/
void timeSyncTask(void *argument);
#ifdef __cplusplus
}
#endif
#endif /* __TIME_SYNC_H */