source: ResearchApps/Measurement/warpnet_coprocessors/phy_logger/phy_logger.h

Last change on this file was 1601, checked in by murphpo, 13 years ago

adding phy_logger warpnet coprocessor

  • Property svn:executable set to *
File size: 3.6 KB
Line 
1//Struct representing raw Ethernet header + packet contents
2typedef struct {
3    //Standard 14-byte Ethernet header (dest/src MAC addresses + EtherType)
4    unsigned char dstAddr[6];
5    unsigned char srcAddr[6];
6    unsigned short ethType;
7    //total number of bytes in pkt, including this header
8    unsigned short pktLength;
9    //number of warpnet structs that follow
10    unsigned char numStructs;
11    //Sequence number to match packets to ACKs
12    unsigned char seqNum;
13} warpnetEthernetPktHeader;
14
15typedef struct {
16    unsigned char controllerID;
17    unsigned char controllerGrp;
18    unsigned char access;
19    unsigned char reserved0;
20} warpnetControllerGroup;
21
22typedef struct {
23    unsigned char structID;
24    unsigned char nodeID;
25    unsigned short numStructs;
26    unsigned int trialIndex;
27    unsigned char innerStructs[1500];
28} warpnetConcatStruct;
29
30typedef struct {
31    unsigned char structID;
32    unsigned char nodeID;
33    unsigned short sequenceNumber;
34    unsigned char pktType;
35    unsigned char srcNode;
36    unsigned char destNode;
37    unsigned char relNode;
38    unsigned char phystatus;
39    unsigned char macstate;
40    unsigned short rssi;
41    unsigned short gain;
42    unsigned short timeStampHigh;
43    unsigned int timeStampLow;
44    unsigned int packetDetCount;
45} warpnetRTObserve;
46
47typedef struct {
48    unsigned char structID;
49    unsigned char nodeID;
50    unsigned short seqNum;
51    unsigned char pktType;
52    unsigned char rxStatus;
53    unsigned char includedData; //bitwise OR of RXPHYDUMP_INCLUDE_*
54    unsigned char reserved0;
55    unsigned short rssi;
56    unsigned short rxGains;
57    unsigned int cfoEst_coarse;
58    unsigned int cfoEst_pilots;
59} warpnetRxPHYdump;
60
61typedef struct {
62    char structID;
63    char nodeID;
64    short cmdID;
65} warpnetAck;
66
67typedef struct {
68    char structID;
69    char nodeID;
70    char cmdID;
71    char cmdParam;
72} warpnetCommand;
73
74typedef struct {
75    unsigned char structID;
76    unsigned char nodeID;
77   
78    unsigned short fileSuffix;
79   
80    unsigned int param0;
81    unsigned int param1;
82    unsigned int param2;
83    unsigned int param3;
84} warpnetLogParams; 
85
86#define STRUCTID_OBSERVE_BER                0x24
87#define STRUCTID_OBSERVE_BER_REQ            0x25
88
89#define STRUCTID_COMMAND                    0x17   
90#define STRUCTID_COMMAND_ACK                0x18
91
92#define STRUCTID_RTOBSERVE      0x1B
93#define STRUCTID_CONCAT         0x1C
94#define STRUCTID_RXPHYDUMP      0x1E
95
96#define STRUCTID_LOGPARAMS              0x32
97#define STRUCTID_LOGPARAMS_ACK          0x33
98
99#define WARPNET_ETHTYPE_SVR2NODE        0x9090
100#define WARPNET_ETHTYPE_NODE2SVR        0x9191
101#define WARPNET_ETHTYPE_NODE2COPROC     0x9393
102#define WARPNET_ETHTYPE_NODE2BER        0x9494
103
104//Rx PHY Dump magic numbers
105#define RXPHYDUMP_INCLUDE_EVMPERSC      0x1
106#define RXPHYDUMP_INCLUDE_EVMPERSYM     0x2
107#define RXPHYDUMP_INCLUDE_CHANESTAA     0x4
108#define RXPHYDUMP_INCLUDE_CHANESTBA     0x8
109
110#define RXPHYDUMP_SIZE_EVMPERSC         (4*64)
111#define RXPHYDUMP_SIZE_CHANEST          (4*64)
112
113//EVMPERSYM should be 4*256 bytes; the PHY has storage for 256 OFDM symbol's worth of EVM
114// It's set to 128 here so EVMPERSYM+EVMPERSC+CHANESTAA+CHANESTBA can all fit in one MTU
115//#define RXPHYDUMP_SIZE_EVMPERSYM      (4*256)
116#define RXPHYDUMP_SIZE_EVMPERSYM        (4*128)
117
118//Compile-time limits on numbers of nodes and controllers
119#define MAX_NUMWARPNODES 4
120
121//Maximum size of network buffers
122#define MAX_ETHPKTSIZE 1550
123
124int LogRxPHYDump(warpnetRxPHYdump* ptr_rxPHYdumpStruct, FILE* logFile);
125int LogRTobserve(warpnetRTObserve* ptr_rtObserve, unsigned int trialIndex, FILE* logFile);
126void SendStructToServer(warpnetControllerGroup* theGroupStruct, void *theStruct);
127void ProcessServerMessage(u_char *args, const struct pcap_pkthdr *header, const u_char *packet);
128void pcap_pktRx_handler(u_char *args, const struct pcap_pkthdr *header, const u_char *packet);
129void ProcessWARPnodeMessage(u_char *args, const struct pcap_pkthdr *header, const u_char *packet);
130int SetupLogFiles();
131int SetupPCAP();
Note: See TracBrowser for help on using the repository browser.