45 lines
1.2 KiB
C
45 lines
1.2 KiB
C
#ifndef _TCPSERVER_H_
|
|
#define _TCPSERVER_H_
|
|
|
|
#include "main.h"
|
|
#include "lwip.h"
|
|
#include "lwip/netif.h"
|
|
#include "lwip/ip.h"
|
|
#include "lwip/tcp.h"
|
|
#include "lwip/init.h"
|
|
#include "netif/etharp.h"
|
|
#include "lwip/udp.h"
|
|
#include "lwip/pbuf.h"
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "modbus.h"
|
|
|
|
#define TCP_PORT_MODBUS 5010
|
|
#define TCP_PORT_HART1 5020
|
|
#define TCP_PORT_HART2 5030
|
|
#define TCP_PORT_HART3 5040
|
|
#define TCP_PORT_HART4 5050
|
|
|
|
#define TCP_DATA_LEN 512
|
|
|
|
extern struct netif gnetif;
|
|
|
|
extern struct tcp_pcb *server_pcb_modbus;
|
|
extern struct tcp_pcb *server_pcb_hart1;
|
|
extern struct tcp_pcb *server_pcb_hart2;
|
|
extern struct tcp_pcb *server_pcb_hart3;
|
|
extern struct tcp_pcb *server_pcb_hart4;
|
|
|
|
extern uint8_t modbus_rx_data[TCP_DATA_LEN],hart1_rx_data[TCP_DATA_LEN],hart2_rx_data[TCP_DATA_LEN],hart3_rx_data[TCP_DATA_LEN],hart4_rx_data[TCP_DATA_LEN]; // 接受数据缓存区
|
|
extern uint8_t modbus_tx_data[TCP_DATA_LEN],hart1_tx_data[TCP_DATA_LEN],hart2_tx_data[TCP_DATA_LEN],hart3_tx_data[TCP_DATA_LEN],hart4_tx_data[TCP_DATA_LEN]; // 发送数据缓存区
|
|
extern uint16_t modbus_rx_len,hart1_rx_len,hart2_rx_len,hart3_rx_len,hart4_rx_len;
|
|
extern uint16_t modbus_tx_len ,hart1_tx_len,hart2_tx_len,hart3_tx_len,hart4_tx_len;
|
|
|
|
|
|
void tcp_server_init(void);
|
|
|
|
#endif
|
|
|
|
|
|
|