修改测试

This commit is contained in:
2026-07-22 11:14:22 +08:00
parent c646df5c2a
commit a7f367f6a3
77 changed files with 1691 additions and 950 deletions

View File

@@ -9,6 +9,7 @@
* v1.0 2026-07-19 王建锋 创建初始版本
* v1.1 2026-07-19 王建锋 migrate from freertos.c StartNetTask
* v1.2 2026-07-21 王建锋 网络初始化移入本任务net_init + TCP 监听)
* v1.3 2026-07-22 王建锋 单连接模式重构,增加大文件/边界/KeepAlive 测试
*/
#include <string.h>
@@ -22,7 +23,8 @@
#define DBG_TAG "[NET_TASK]"
#include "dbg_log.h"
static uint8_t s_net_buf[1500];
/* 测试缓冲大小定义(供各 Phase 测试使用) */
#define NET_TASK_BUF_SIZE 65536
/*
* 函数功能:网络任务初始化
@@ -74,25 +76,24 @@ void net_task_func(void const *arg)
DBG_ERROR("net init: FAIL");
}
DBG_INFO("netTask: started, processing messages (FTP mode)");
DBG_INFO("netTask: started (single-socket mode)");
/* ==================== 主轮询循环 ==================== */
for (;;) {
net_poll();
net_process_messages();
/*
* 以下测试共用 Socket 0单连接模式
* Phase 4 — TCP Echo 基础收发
* Phase 5 — 大文件传输
* Phase 7 — Select/Poll
* Phase 8 — 边界条件
* Phase 10 — KeepAlive
* 各 Phase 通过 ch395f_test.h 中的宏独立开关
*/
#ifdef ENABLE_PHASE4_TESTS
for (int i = 1; i < 8; i++) {
net_sock_t *p_sk = net_get_sock(i);
if (p_sk == NULL || p_sk->state != NET_SOCK_STATE_ESTABLISHED) {
continue;
}
int n = net_recv_sock(p_sk, s_net_buf, sizeof(s_net_buf), NET_MSG_DONTWAIT);
if (n > 0) {
net_send_sock(p_sk, s_net_buf, n);
}
}
ch395f_phase4_tests();
#endif
#ifdef ENABLE_PHASE5_TESTS
@@ -103,6 +104,14 @@ void net_task_func(void const *arg)
ch395f_phase7_tests();
#endif
#ifdef ENABLE_PHASE8_TESTS
ch395f_phase8_tests();
#endif
#ifdef ENABLE_PHASE10_TESTS
ch395f_phase10_tests();
#endif
osDelay(10);
}
}