⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 global.h

📁 基于单片机的一款可裁减的tcpip协议
💻 H
字号:
#ifdef GLOBAL_GLOBALS
#define GLOBAL_EXT
#else
#define GLOBAL_EXT extern 
#endif
GLOBAL_EXT xdata 	struct  Socket_Type TCP1024;
GLOBAL_EXT xdata 	union 	Ip_Address_Type My_Ip_Address ;     //本机IP地址
GLOBAL_EXT xdata 	union 	Ip_Address_Type Gateway_Ip_Address;	//网关IP地址
GLOBAL_EXT xdata 	union 	Ip_Address_Type Mask_Ip_Address;   	//子网掩码
GLOBAL_EXT xdata 	union 	Ip_Address_Type Ping_Ip_Address;   	//保存PING命令的目的主机的物理地址
GLOBAL_EXT xdata 	union 	Netcard  RxdNetBuff;			//数据接收缓冲区
GLOBAL_EXT xdata 	union 	Netcard  TxdNetBuff;			//数据发送缓冲区
GLOBAL_EXT xdata 	union 	Netcard  Resend_Buff;
GLOBAL_EXT xdata 	union 	Ethernet_Address_Type Gateway_MAC; 	//网关的物理地址
GLOBAL_EXT xdata 	union 	Ethernet_Address_Type Ping_MAC;		//PING的物理地址
GLOBAL_EXT union 	u 	RemotePort;


GLOBAL_EXT bit 	BiSecond;			//两秒时,该标志置1
GLOBAL_EXT bit 	Tcp_Timeout;		//TCP超时标志,定时器0中断中将该标志置位
GLOBAL_EXT bit 	TcpConnected;
GLOBAL_EXT bit 	ComTxdBufempty;

GLOBAL_EXT uchar 	Msec;				//10毫秒
GLOBAL_EXT uchar 	Sec;				//秒钟
GLOBAL_EXT uchar 	Min;				//分钟
GLOBAL_EXT uchar 	Gateway_IP_TTL;
GLOBAL_EXT uchar 	Ping_IP_TTL;
GLOBAL_EXT uchar 	Ping_Count;       	//ping的次数,决定本地回显次数
GLOBAL_EXT uchar 	Udp_Count;
GLOBAL_EXT uchar 	RtTime;			//重发时间
GLOBAL_EXT uchar   Tcp_Drop_Count;
GLOBAL_EXT uint 	FrameIndex;

GLOBAL_EXT uint 	ComTxdRead; 	//串口接收读指针
GLOBAL_EXT uint 	ComRxdRead;   	//串口发送读指针
GLOBAL_EXT uint 	ComRxdWrite;  	//串口接收写指针
GLOBAL_EXT uint 	ComTxdWrite;  	//串口发送写指针
GLOBAL_EXT xdata	uchar   ComRxdBuf[];  //串口的接收缓冲区
GLOBAL_EXT xdata	uchar   ComTxdBuf[];  //串口的发送缓冲区

GLOBAL_EXT uchar 	code 	HexTable[];
GLOBAL_EXT xdata 	uchar 	Command_Buf[COMMAND_BUFF_SIZE];//命令缓冲区
GLOBAL_EXT xdata   unsigned char IpStr[16];
GLOBAL_EXT xdata	unsigned char PortStr[5];

GLOBAL_EXT void initial_system();
GLOBAL_EXT bit  Rec_NewPacket();
GLOBAL_EXT unsigned char  VerifyIpHeadCrc();
GLOBAL_EXT unsigned char  VerifyTcpCrc();
GLOBAL_EXT uint  CreateIpHeadCrc();
GLOBAL_EXT uint  CreateIcmpCrc();//
GLOBAL_EXT unsigned char  VerifyUdpCrc();
GLOBAL_EXT uint CreateTcpCrc();
GLOBAL_EXT void Create_Ip_Frame(uint length,uint IPH,uint IPL,uchar NextProtocal);
GLOBAL_EXT union Ip_Address_Type *IP_Str2Hex(unsigned char *Str);    //IP字符串转换到IP地址值
GLOBAL_EXT void Delay_MS(uint ms_number);
GLOBAL_EXT void IP_Hex2Str(union Ip_Address_Type ip)    ;
GLOBAL_EXT void Port_Hex2Str(unsigned int portnum);    //IP地址值转换到IP字符串
GLOBAL_EXT void Send_Packet(union Netcard *TxdNetBuff,uint length);


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -