feat: 完成TCP2UART透传核心集成

集成CH390驱动、LwIP协议栈和FreeRTOS多任务透传框架,确保TCP Server/Client与UART链路按配置稳定联动。
This commit is contained in:
2026-03-30 11:39:40 +08:00
parent d5803ca7dd
commit 4996b451d9
235 changed files with 80607 additions and 27 deletions
+63
View File
@@ -0,0 +1,63 @@
/**
* @file ethernetif.h
* @brief Ethernet interface header for CH390 + LwIP + FreeRTOS
*/
#ifndef __ETHERNETIF_H__
#define __ETHERNETIF_H__
#include "lwip/netif.h"
#include "lwip/err.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Ethernet interface state structure */
struct ethernetif {
uint16_t rx_len;
uint8_t rx_status;
};
/* Global network interface */
extern struct netif ch390_netif;
/**
* @brief Initialize the ethernet interface
* @param netif Network interface structure
* @return ERR_OK on success
*/
err_t ethernetif_init(struct netif *netif);
/**
* @brief Process received ethernet packets
* @param netif Network interface structure
* @note Call this from the LwIP task when packets are available
*/
void ethernetif_input(struct netif *netif);
/**
* @brief Initialize LwIP network interface with static IP
* @param ipaddr IP address
* @param netmask Network mask
* @param gw Gateway address
*/
void lwip_netif_init(const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw);
/**
* @brief Check and handle CH390 interrupt status
* @note Call this from the LwIP task periodically or on interrupt
*/
void ethernetif_check_link(void);
/**
* @brief Process all pending RX packets
* @note Call this from the LwIP task when RX interrupt occurs
*/
void ethernetif_poll(void);
#ifdef __cplusplus
}
#endif
#endif /* __ETHERNETIF_H__ */