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

📄 nu_mptp.h

📁 流量C++驱动的一些源代码,主要是模仿SMARTBIT 的硬件对应的代码
💻 H
字号:
#ifndef NU_MPTP_H          /* prevent multiple inclusion of the header file */
#define NU_MPTP_H

//////////////////////////////////////////////////////////////
#define     NUM_OF_CASCADE_CHASSIS      256
#define     NUM_OF_PORT_IN_CHASSIS      32
#define     SIZE_OF_CLIENT_CMD_HDR      20

#define		MAX_NUM_OF_CHASSIS	6		// max num of chassis in test
#define		MAX_NUM_OF_BOARD		16		// max num of board per chassis
//#define		MAX_NUM_OF_PORT		8
#define		MAX_PORT_OF_DUT		60		// Max ports of DUT
#define		MAX_NUM_OF_TASK		20
#define		GROUPID_TX				4

////////// Type of Module Cards ////////////////////////////////////////////////////
#define		CARD_2202				0x0001
#define		CARD_2301				0x0002
#define		CARD_2301G				0x0003
#define		CARD_22L8				0x0008
#define		CARD_23L4				0x0009
#define		CARD_23L4G				0x000A
#define		CARD_28L1				0x0012

//////////////////////////////////////////////////////////////////////
#define QUERY_ACK_ID					0x80FE
#define COUNTERREPORT_ID			0x0100
#define PKTCAPTURED_ID				0x0200
#define BOARDSTATUSREPORT_ID		0x0500
#define READPHYREPORT_ID			0x0600
#define PINGREPORT_ID				0x0700
#define LINKSTATUSREPORT_ID		0x80FC
#define REBOOT_ALARM_ID				0x80F8


typedef struct
{
	CString				serverip;
	CString				log_name;

	UI16_T				num_port_DUT;
	UI16_T				num_task;
}mst_ConfigEnv;

typedef struct
{
	CString				task;
	UI16_T				taskid;
	UI16_T				framelength;
	UI16_T				framedata;
	UI32_T				framecount;
	UI32_T				framegap;
	UI32_T				burstcount;
	UI32_T				burstgap;
	UI32_T				durationtest;
	UI32_T				runintimer;
	UI32_T				mediatypewait;
	UI32_T				txpktwait;
	UI32_T				haltflag;
	UI32_T				allowerror;

	UI16_T				learn_count;
	UI16_T				learn_gap;
	UI16_T				learn_wait;

	struct
	{
		UI16_T			DA;
	}SA[MAX_PORT_OF_DUT];
}mst_ConfigTask;

// Structure: Active Ports
typedef struct
{
	UI16_T		chassisid;
	UI16_T		boardid;
	UI16_T		portid;

	UI16_T		cardtype;
	UI16_T		client_id;
	UI16_T		status;		// 0:Unlock, 1:Lock by me, 2:Lock by others

	// Firmware Version
	UI16_T		FW_ver_major;
	UI16_T		FW_ver_minor;
	UI32_T		Firmware_data;

	// PROM Code Version
	UI16_T		PROM_ver_major;
	UI16_T		PROM_ver_minor;

	// FPGA Version
	UI16_T		HW_ver_major;
	UI16_T		HW_ver_minor;

	// For NuLite Series: XM-22L8, XM-23L4(G)
	UI32_T		FW_DateCode;		
	UI32_T		PROM_DateCode;
	UI32_T		HW_DateCode;
}mst_ActivePorts;

// Structure: Initialization of ports
typedef struct
{
	UI16_T				chassisid;
	UI8_T					boardid;
	UI8_T					portid;

	UI16_T				cardtype;
	UI32_T				MAC;

	UI16_T				status;	// 0: Unused, 1: used

	CStatic				title;
	CStatic				task_LED[MAX_NUM_OF_TASK];
}mst_InitPorts;

// Port information structure
typedef struct
{
	UI16_T				chassisid;
	UI8_T					boardid;
	UI8_T					portid;
	UI8_T					cardtype;		// 2202, 2301, 2301G
	//UI8_T					portstatus;
	//UI8_T					used;
	//UI32_T				MAC;

	unsigned __int64	TxPkt;
	unsigned __int64	RxPkt;
	unsigned __int64	RxCRCErr;
	unsigned __int64	RxChkSumErr;
	unsigned __int64	RxAlignErr;
	unsigned __int64	RxDribbleErr;
	unsigned __int64	RxPause;
	unsigned __int64	RxUnderSize;
	unsigned __int64	RxOverSize;
	unsigned __int64	RxTrigger1;
	unsigned __int64	RxTrigger2;
}mst_PortInfo;

typedef struct{
	struct
	{
		UI32_T sa;
		UI32_T da;
	}SA_DA[MAX_PORT_OF_DUT];
	
	UI32_T end;
}mst_SADA_MAC;

// Ethernet Header
typedef struct
{
	UI8_T 				DA[6]; 			// DA
	UI8_T 				SA[6]; 			// SA
	UI16_T				type_len;		// type/len
}ETHERNET_HEADER;

// IP Header
typedef struct
{
	unsigned char 		h_verlen; 			//4

⌨️ 快捷键说明

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