ui_net_sink 拆分为协议层与平台后端,新增 RemoDispBus 设计文档
This commit is contained in:
@@ -16,9 +16,17 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include "net_types.h"
|
||||
|
||||
/*
|
||||
* OS 相关接口(FreeRTOS 消息队列 / 任务句柄 / netTask 内部 API)仅在启用
|
||||
* RTOS 的构建(MCU)编译;纯 PC 模拟器定义 NET_NO_OS 后只保留 BSD Socket 核心 API。
|
||||
*/
|
||||
#ifndef NET_NO_OS
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#endif /* NET_NO_OS */
|
||||
|
||||
#ifndef NET_NO_OS
|
||||
/*
|
||||
* 消息队列类型定义
|
||||
*/
|
||||
@@ -43,6 +51,7 @@ typedef struct {
|
||||
struct net_sockaddr_in addr; /* 连接地址 */
|
||||
int addrlen; /* 地址长度 */
|
||||
} net_msg_t;
|
||||
#endif /* NET_NO_OS */
|
||||
|
||||
/*
|
||||
* 网络初始化接口
|
||||
@@ -294,6 +303,7 @@ uint32_t net_htonl(uint32_t hostlong);
|
||||
*/
|
||||
uint32_t net_ntohl(uint32_t netlong);
|
||||
|
||||
#ifndef NET_NO_OS
|
||||
/*
|
||||
* 函数功能:处理消息队列中的请求(必须在 netTask 主循环中调用)
|
||||
* 限定条件:net_init() 已调用
|
||||
@@ -301,6 +311,7 @@ uint32_t net_ntohl(uint32_t netlong);
|
||||
* 在 netTask 上下文中串行化执行所有 CH395F 操作
|
||||
*/
|
||||
void net_process_messages(void);
|
||||
#endif /* NET_NO_OS */
|
||||
|
||||
/*
|
||||
* 函数功能:获取 Socket 控制块指针(内部使用)
|
||||
@@ -319,6 +330,7 @@ net_sock_t *net_get_sock(int sockfd);
|
||||
*/
|
||||
int net_getsockname(int sockfd, struct net_sockaddr *addr, int *addrlen);
|
||||
|
||||
#ifndef NET_NO_OS
|
||||
/*
|
||||
* 内部 API(需在 netTask 上下文中调用,绕过消息队列)
|
||||
*/
|
||||
@@ -359,6 +371,7 @@ int net_close_sock(net_sock_t *p_sock);
|
||||
* 限定条件:必须在 netTask 上下文中调用
|
||||
*/
|
||||
int net_listen_locked(int sockfd);
|
||||
#endif /* NET_NO_OS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -75,15 +75,20 @@ struct net_sockaddr {
|
||||
char sa_data[14]; /* 地址数据 */
|
||||
};
|
||||
|
||||
/*
|
||||
* IPv4 地址(镜像 BSD in_addr;用命名结构体保证 ARMCC / MSVC 双端兼容)
|
||||
*/
|
||||
struct net_in_addr {
|
||||
uint32_t s_addr; /* IP 地址(网络字节序) */
|
||||
};
|
||||
|
||||
/*
|
||||
* IPv4 套接字地址结构体
|
||||
*/
|
||||
struct net_sockaddr_in {
|
||||
uint16_t sin_family; /* 地址族,必须为 AF_INET */
|
||||
uint16_t sin_port; /* 端口号(网络字节序) */
|
||||
struct {
|
||||
uint32_t s_addr; /* IP 地址(网络字节序) */
|
||||
} sin_addr;
|
||||
struct net_in_addr sin_addr; /* IP 地址(网络字节序) */
|
||||
char sin_zero[8]; /* 填充字节 */
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user