📄 net.h
字号:
#ifndef _OCRDM642_NET_H
#define _OCRDM642_NET_H
#include <csl.h>
#include <csl_cache.h>
#include <netmain.h>
#include "CommonDef.h"
#define MAXPACKET 128
#define CONFIG_GETIP_REQ 0xcf00
#define CONFIG_IP_REQ 0xcf01
#define CONFIG_DHCP_REQ 0xcf02
#define CONFIG_REPLY_OK 0xcf03
#define CONFIG_REPLY_FAIL 0xcf04
#define CONFIG_COMPLETE 0xcf05
//Ethernet config
typedef struct _tagETH_INFO
{
char strLocalIPAddr[20];
char strLocalIPMask[20];
char strGatewayIP[20];
char strDomainName[20];
char strHostName[20];
unsigned char bMacAddr[8];
char reserved1;
char reserved2;
}ETH_INFO;
typedef struct _tagIpHeader{
unsigned int h_len:4; // length of the header
unsigned int version:4; // Version of IP
unsigned char tos; // Type of service
unsigned short total_len; // total length of the packet
unsigned short ident; // unique identifier
unsigned short frag_and_flags; // flags
unsigned char ttl;
unsigned char proto; // protocol (TCP, UDP etc)
unsigned short checksum; // IP checksum
unsigned int sourceIP;
unsigned int destIP;
}IP_HDR;
typedef struct _tagConfigHeader{
unsigned int c_ip;
unsigned int c_gate;
unsigned int c_mask;
unsigned char c_mac[8];
unsigned short c_mode;
unsigned short c_id;
unsigned short c_reserve;
unsigned short c_cksum;
}CONFIG_HDR;
#ifdef __cplusplus
extern "C" {
#endif
void DM642EMAC_getConfig( unsigned char *pMacAddr, unsigned int *pIntVector );
void DM642EMAC_linkStatus( unsigned int phy, unsigned int linkStatus );
void NetworkOpen();
void NetworkClose();
void NetworkIPAddr( IPN IPAddr, unsigned int IfIdx, unsigned int fAdd );
void NetInit();
extern volatile int g_nNormStatus;
extern volatile int g_nPrioStatus;
extern volatile int g_nNeedReply;
extern volatile int g_nMakeCfgStatus;
extern volatile int g_nNetStackStoped;
extern volatile int g_nDhcpEnable;
//extern volatile int g_nDhcpStatus;
extern volatile unsigned int g_nDhcpIpAddress;
extern volatile int g_nNetOK;
extern ETH_INFO* g_pEthInfo;
extern CONFIG_HDR g_cfgIPHeader;
extern far char dataBuf[5242880];
extern volatile int g_nNetLinkStatus;
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -