📄 nu_xm28l1_api.h
字号:
#ifndef NU_XM28L1_API_H
#define NU_XM28L1_API_H
#include "Nu_Types.h"
#include "Nu_SYS_API.h"
#define XM28L1_COUNTERREPORT_ID 0x0100
#define XM28L1_LINKSTATUSREPORT_ID 0x80FC
#define XM28L1_BOARDSTATUSREPORT_ID 0x0500
#define XM28L1_READPHYREPORT_ID 0x0600
#define XM28L1_PINGREPORT_ID 0x0700
#define XM28L1_GROUPIDREPORT_ID 0x0C00
#define XM28L1_RXXTRAILERREPORT_ID 0x0D00
#define XM28L1_CARDTYPE 18
#define XM28L1_PADPATTERN_LEN 1514
/* *****************************************************************************
* ++ XM28L1 Packet Format Structure ++
******************************************************************************/
// Simple command packet format
typedef struct{
UI16_T chasid;
UI8_T boardid;
UI8_T portid;
}XM28L1_SIMPLETYPE_T;
// FILLTXPKT Packet Format
typedef struct{
UI16_T chasid;
UI8_T boardid;
UI8_T portid;
UI8_T frame_type;
UI8_T frame_802_hdr[4];
UI8_T DA[6];
UI8_T SA[6];
UI8_T ether_type_len[2];
UI16_T DA_mask[6];
UI16_T DA_ctrl;
UI64_T DA_loop_cnt; // only use 6 bytes
UI64_T DA_step_cnt; // only use 6 bytes
UI16_T SA_mask[6];
UI16_T SA_ctrl;
UI64_T SA_loop_cnt; // only use 6 bytes
UI64_T SA_step_cnt; // only use 6 bytes
BOOLEAN_T Tx_vlan_frame;
UI8_T vlan_tag[4];
UI8_T vlan_tag_mask[4];
UI16_T vlan_cos_ctrl;
UI16_T vlan_vid_ctrl;
UI16_T vlan_cos_loop_cnt;
UI16_T vlan_vid_loop_cnt;
BOOLEAN_T Tx_IP_frame;
UI8_T IPhdr_ver_len;
UI8_T IPhdr_tos;
UI16_T IPhdr_total_len;
UI16_T IPhdr_id;
UI16_T IPhdr_frag;
UI8_T IPhdr_ttl;
UI8_T IPhdr_protocol;
UI16_T IPhdr_chksum;
UI8_T IPhdr_SIP[4];
UI8_T IPhdr_DIP[4];
UI8_T SIP_mask[4];
UI16_T SIP_ctrl;
UI32_T SIP_loop_cnt;
UI32_T SIP_step_cnt;
UI8_T DIP_mask[4];
UI16_T DIP_ctrl;
UI32_T DIP_loop_cnt;
UI32_T DIP_step_cnt;
UI8_T IP_tos_ctrl;
UI8_T IP_diffsrv_ctrl;
UI8_T IP_ttl_ctrl;
UI8_T IP_flag;
UI8_T IP_tos_loop_cnt;
UI8_T IP_diffsrv_loop_cnt;
UI8_T IP_ttl_loop_cnt;
UI8_T IP_tos_mask;
UI8_T IP_diffsrv_mask;
UI8_T IP_ttl_mask;
BOOLEAN_T Tx_MPLS_frame;
UI8_T tagB[4];
UI8_T tagB_mask[4];
UI16_T tagB_label_ctrl;
UI16_T tagB_cos_ctrl;
UI32_T tagB_label_loop;
UI32_T tagB_cos_loop;
UI16_T tagB_ttl_ctrl;
UI16_T tagB_ttl_loop;
BOOLEAN_T Tx_MPLS_Tunnel_frame;
UI8_T tagC[4];
UI8_T tagC_mask[4];
UI16_T tagC_label_ctrl;
UI16_T tagC_cos_ctrl;
UI32_T tagC_label_loop;
UI32_T tagC_cos_loop;
UI16_T tagC_ttl_ctrl;
UI16_T tagC_ttl_loop;
UI16_T Tx_ctrl;
UI8_T IPhdr_offset;
UI16_T DI_offset;
UI64_T frame_cnt;
UI16_T frame_len_ctrl;
UI16_T frame_len;
UI16_T frame_len_bgn;
UI16_T frame_len_end;
UI8_T frame_len_mask[4];
UI16_T frame_gap_ctrl;
UI32_T frame_gap;
UI32_T frame_gap_bgn;
UI32_T frame_gap_end;
UI8_T frame_gap_mask[4];
UI16_T preamble_cnt;
UI16_T payload_ctrl;
UI8_T user_pad_patn[XM28L1_PADPATTERN_LEN];
UI32_T user_pad_patn_len;
UI16_T user_pad_patn_offset;
UI32_T burst_cnt;
UI16_T burst_gap_ctrl;
UI32_T interburst_gap;
UI32_T burst_gap_bgn;
UI32_T burst_gap_end;
UI8_T burst_gap_mask[4];
UI8_T burst_reinit;
UI8_T usr_loop_frame_len_mode;
UI16_T usr_loop_frame_len1;
UI16_T usr_loop_frame_len2;
UI16_T usr_loop_frame_len3;
UI16_T usr_loop_frame_len4;
}XM28L1_TXOP_T;
// PING Packet Format
typedef struct{
UI16_T chasid;
UI8_T boardid;
UI8_T portid;
UI8_T DIP[4];
UI8_T SIP[4];
UI32_T num_of_ping;
}XM28L1_PING_T;
// DOWNLOADFW Packet Format
typedef struct{
UI16_T chasid;
UI8_T boardid;
UI8_T portid;
I8_T importfile[100];
}XM28L1_DOWNLOADFW_T;
// DOWNLOADFPGA Packet Format
typedef struct{
UI16_T chasid;
UI8_T boardid;
UI8_T portid;
I8_T importfile[100];
}XM28L1_DOWNLOADFPGA_T;
// SETRXXTRAILER Packet Format
typedef struct{
UI16_T chasid;
UI8_T boardid;
UI8_T portid;
BOOLEAN_T enable_DI;
BOOLEAN_T enable_serialnum;
UI16_T DI_offset;
}XM28L1_SETRXXTRAILER_T;
// WRITEPHY Packet Format
typedef struct{
UI16_T chasid;
UI8_T boardid;
UI8_T portid;
UI16_T port_addr;
UI16_T device_addr;
UI16_T reg_addr;
UI16_T reg_data;
}XM28L1_WRITEPHY_T;
// WRITEPHY Packet Format
typedef struct{
UI16_T chasid;
UI8_T boardid;
UI8_T portid;
UI16_T port_addr;
UI16_T dev_addr;
UI16_T reg_addr;
}XM28L1_READPHY_T;
// STARTTRIGGERCOUNTER Packet Format
typedef struct{
UI16_T chasid;
UI8_T boardid;
UI8_T portid;
UI32_T trigger1_offset;
UI32_T trigger2_offset;
UI32_T trigger3_offset;
UI32_T trigger4_offset;
UI8_T trigger1[6];
UI8_T trigger2[6];
UI8_T trigger3[6];
UI8_T trigger4[6];
UI8_T trigger1_bitmap;
UI8_T trigger2_bitmap;
UI8_T trigger3_bitmap;
UI8_T trigger4_bitmap;
UI32_T trigger_ctrl;
}XM28L1_STARTTGRCTR_T;
// SETLOOPBACK Packet Format
typedef struct{
UI16_T chasid;
UI8_T boardid;
UI8_T portid;
UI8_T mode;
UI8_T speed;
}XM28L1_SETLOOPBACK_T;
// STARTAUTOARPREPLY Packet Format
typedef struct{
UI16_T chasid;
UI8_T boardid;
UI8_T portid;
UI8_T SIP[4];
UI8_T SIP_mask[4];
UI8_T gateway_IP[4];
UI8_T SA[6];
}XM28L1_STARTAUTOARPREPLY_T;
// COUNTERREPORT Packet Format
typedef struct{
UI16_T chasid;
UI8_T boardid;
UI8_T portid;
UI64_T TxPkt;
UI64_T TxByte;
UI64_T RxPkt;
UI64_T RxBcast;
UI64_T RxMcast;
UI64_T RxUnicast;
UI64_T RxPause;
UI64_T RxVLAN;
UI64_T RxCRCErr;
UI64_T RxChkSumErr;
UI64_T RxSerNumErr;
UI64_T RxOverSize;
UI64_T RxUnderSize;
UI64_T RxTrigger1;
UI64_T RxTrigger2;
UI64_T RxTrigger3;
UI64_T RxTrigger4;
UI64_T RxIPChkSumErr;
UI64_T RxByte;
UI64_T TxARPReply;
UI64_T TxARPRequest;
UI64_T TxICMPReply;
UI64_T TxICMPRequest;
UI64_T RxARPReply;
UI64_T RxARPRequest;
UI64_T RxICMPReply;
UI64_T RxICMPRequest;
UI32_T TimeStamp;
}XM28L1_COUNTERREPORT_T;
// LINKSTATUSREPORT Packet Format
typedef struct{
UI16_T chasid;
UI8_T boardid;
UI8_T portid;
UI8_T linkstatus;
UI8_T force_flag;
}XM28L1_LINKSTATUSREPORT_T;
// BOARDSTATUSREPORT Packet Format
typedef struct{
UI16_T chasid;
UI8_T boardid;
UI8_T portid;
UI16_T generalstatus;
UI16_T FWMajorVersion;
UI16_T FWMinorVersion;
UI16_T PROMMajorVersion;
UI16_T PROMMinorVersion;
UI16_T HWMajorVersion;
UI16_T HWMinorVerion;
UI16_T PCBVersion;
UI32_T reserved;
}XM28L1_BOARDSTATUSREPORT_T;
// GROUPIDREPORT Packet Format
typedef struct{
UI16_T chasid;
UI8_T boardid;
UI8_T portid;
UI8_T groupid;
UI32_T reserved;
}XM28L1_GROOUPIDREPORT_T;
// READPHYREPORT Packet Format
typedef struct{
UI16_T chasid;
UI8_T boardid;
UI8_T portid;
UI16_T port_addr;
UI16_T device_addr;
UI16_T reg_addr;
UI16_T reg_data;
}XM28L1_READPHYREPORT_T;
// RXXTRAILERREPORT Packet Format
typedef struct{
UI16_T chasid;
UI8_T boardid;
UI8_T portid;
UI16_T DI_serialnum;
UI16_T DI_offset;
}XM28L1_RXXTRAILERREPORT_T;
// Overall Packet Format
typedef struct{
UI16_T cmdid;
UI16_T clientid;
UI32_T seqnum;
UI16_T cardtype;
UI16_T reserved;
UI8_T reserved1[7];
UI8_T groupid;
union{
XM28L1_SIMPLETYPE_T simple;
XM28L1_COUNTERREPORT_T ctr;
XM28L1_BOARDSTATUSREPORT_T boardstatus_rpt;
XM28L1_READPHYREPORT_T phy_rpt;
XM28L1_RXXTRAILERREPORT_T rxxtrailer_rpt;
UI8_T data[2000];
}para;
}XM28L1_PKT_FORMAT_T;
/*******************************************************************************
* ++ XM28L1 API Function ++
******************************************************************************/
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_MediaType(UI16_T, UI8_T, UI8_T, UI16_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_FillTxPkt(UI16_T, UI8_T, UI8_T, XM28L1_TXOP_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_StartTxPkt(UI16_T, UI8_T, UI8_T, UI16_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_StopTxPkt(UI16_T, UI8_T, UI8_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_PauseTxPkt(UI16_T, UI8_T, UI8_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_ResumeTxPkt(UI16_T, UI8_T, UI8_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_StartCounterStatistics(UI16_T, UI8_T, UI8_T, UI16_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_ClearCounterStatistics(UI16_T, UI8_T, UI8_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_ReadCounterStatistics(UI16_T, UI8_T, UI8_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_StopCounterStatistics(UI16_T, UI8_T, UI8_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_LinkStatus(UI16_T, UI8_T, UI8_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_BoardStatus(UI16_T, UI8_T, UI8_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_WritePhy(UI16_T, UI8_T, UI8_T, XM28L1_WRITEPHY_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_ReadPhy(UI16_T, UI8_T, UI8_T, XM28L1_READPHY_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_Ping(UI16_T, UI8_T, UI8_T, XM28L1_PING_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_DownLoadFW(UI16_T, UI8_T, UI8_T, XM28L1_DOWNLOADFW_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_DownLoadFPGA(UI16_T, UI8_T, UI8_T, XM28L1_DOWNLOADFPGA_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_GetGroupID(UI16_T, UI8_T, UI8_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_SetTimeStamp(UI16_T, UI8_T, UI8_T, UI32_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_SetRxXTrailer(UI16_T, UI8_T, UI8_T, XM28L1_SETRXXTRAILER_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_GetRxXTrailer(UI16_T, UI8_T, UI8_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_StartTriggerCounter(UI16_T, UI8_T, UI8_T, XM28L1_STARTTGRCTR_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_StopTriggerCounter(UI16_T, UI8_T, UI8_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_SetLoopBack(UI16_T, UI8_T, UI8_T, XM28L1_SETLOOPBACK_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_StartAutoARPReply(UI16_T, UI8_T, UI8_T, XM28L1_STARTAUTOARPREPLY_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_StopAutoARPReply(UI16_T, UI8_T, UI8_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_PauseControl(UI16_T, UI8_T, UI8_T, BOOLEAN_T);
extern "C" __declspec (dllimport) BOOLEAN_T __stdcall Nu_XM28L1_CheckTxEnd(UI16_T, UI8_T, UI8_T, UI16_T);
/*******************************************************************************
* -- XM28L1 API Function --
******************************************************************************/
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -