[1477] | 1 | /*! \file warpnet.h |
---|
| 2 | \brief Header file for the WARPMAC Framework. |
---|
[1203] | 3 | |
---|
[1616] | 4 | @version 16.00 |
---|
[1477] | 5 | @author Chris Hunter and Patrick Murphy |
---|
[1203] | 6 | |
---|
[1477] | 7 | This header file contains the macros, function prototypes, and typedefs required for WARPMAC. |
---|
| 8 | */ |
---|
[1203] | 9 | |
---|
[1477] | 10 | #ifndef WARPNET_H |
---|
| 11 | #define WARPNET_H |
---|
| 12 | |
---|
| 13 | #define ARPREPEAT 5 |
---|
[1537] | 14 | #define WARPNET_ETHTYPE_SVR2NODE 0x9090 |
---|
| 15 | #define WARPNET_ETHTYPE_NODE2SVR 0x9191 |
---|
| 16 | #define WARPNET_ETHTYPE_ARBTRAFFIC 0x9292 |
---|
| 17 | #define WARPNET_ETHTYPE_NODE2COPROC 0x9393 |
---|
[1546] | 18 | #define WARPNET_ETHTYPE_NODE2BER 0x9494 |
---|
[1477] | 19 | |
---|
[1252] | 20 | //Index of OFDM PHY pkt buffer used for sending WARPnet Ethernet packets |
---|
[1262] | 21 | #define WARPNET_SVR2NODE_PKTBUFFINDEX 0 |
---|
[1537] | 22 | |
---|
| 23 | #define WARPNET_NODE2COPROC_PKTBUFFINDEX 30 |
---|
| 24 | |
---|
[1262] | 25 | #define WARPNET_NODE2SVR_PKTBUFFINDEX 31 |
---|
| 26 | |
---|
[1252] | 27 | |
---|
[1491] | 28 | |
---|
| 29 | #define TXPACKET 0xFF |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | #define STRUCTID_CONTROL 0x13 |
---|
| 33 | #define STRUCTID_CONTROL_ACK 0x14 |
---|
| 34 | #define STRUCTID_OBSERVE_REQUEST_NORELAY 0x15 |
---|
| 35 | #define STRUCTID_OBSERVE_REQUEST_RELAY 0x19 |
---|
| 36 | #define STRUCTID_OBSERVE 0x16 |
---|
| 37 | #define STRUCTID_COMMAND 0x17 |
---|
| 38 | #define STRUCTID_COMMAND_ACK 0x18 |
---|
| 39 | #define STRUCTID_RTOBSERVE_REQUEST 0x1A |
---|
| 40 | #define STRUCTID_RTOBSERVE 0x1B |
---|
[1537] | 41 | #define STRUCTID_CONCAT 0x1C |
---|
| 42 | #define STRUCTID_RXPHYDUMP 0x1E |
---|
[1504] | 43 | /*******Patrick's**********/ |
---|
| 44 | #define STRUCTID_CFO 0x20 |
---|
| 45 | #define STRUCTID_PHYCTRL 0x22 |
---|
| 46 | #define STRUCTID_PHYCTRL_ACK 0x23 |
---|
| 47 | #define STRUCTID_OBSERVE_BER 0x24 |
---|
| 48 | #define STRUCTID_OBSERVE_BER_REQ 0x25 |
---|
[1516] | 49 | #define STRUCTID_OBSERVE_PER 0x26 |
---|
| 50 | #define STRUCTID_OBSERVE_PER_REQ 0x27 |
---|
[1537] | 51 | #define STRUCTID_OBSERVE_COOPBER 0x28 |
---|
| 52 | #define STRUCTID_OBSERVE_COOPBER_REQ 0x29 |
---|
| 53 | #define STRUCTID_RAWPKT 0x30 |
---|
| 54 | |
---|
[1625] | 55 | #define STRUCTID_OBSERVE_PER_MULTIRATE 0x32 |
---|
| 56 | #define STRUCTID_OBSERVE_PER_MULTIRATE_REQ 0x33 |
---|
| 57 | |
---|
| 58 | #define STRUCTID_RXSTATUS 0x34 |
---|
| 59 | #define STRUCTID_RXSTATUS_REQ 0x35 |
---|
| 60 | |
---|
[1504] | 61 | /*************************/ |
---|
[1491] | 62 | |
---|
[1478] | 63 | #define COMMANDID_STARTTRIAL 0x40 |
---|
| 64 | #define COMMANDID_STOPTRIAL 0x41 |
---|
| 65 | #define COMMANDID_RELAYSTATE 0x42 |
---|
| 66 | #define COMMANDPARAM_OFF 0x43 |
---|
| 67 | #define COMMANDPARAM_AF 0x44 |
---|
| 68 | #define COMMANDPARAM_DF 0x45 |
---|
| 69 | #define COMMANDPARAM_ALTERNATING 0x49 |
---|
| 70 | #define COMMANDID_PKTGEN 0x46 |
---|
| 71 | #define COMMANDPARAM_ENABLE 0x47 |
---|
| 72 | #define COMMANDPARAM_DISABLE 0x48 |
---|
[1516] | 73 | #define COMMANDID_RESET_PER 0x50 |
---|
[1620] | 74 | #define COMMANDID_ENABLE_BER_TESTING 0x51 |
---|
| 75 | #define COMMANDID_DISABLE_BER_TESTING 0x52 |
---|
[1478] | 76 | |
---|
| 77 | typedef struct { |
---|
| 78 | unsigned char controllerID; |
---|
| 79 | unsigned char controllerGrp; |
---|
| 80 | unsigned char access; |
---|
[1504] | 81 | unsigned char reserved0; |
---|
[1478] | 82 | } warpnetControllerGroup; |
---|
| 83 | |
---|
| 84 | typedef struct { |
---|
| 85 | unsigned char macAddr[6]; |
---|
| 86 | } Netconfig; |
---|
| 87 | |
---|
| 88 | //Struct representing raw Ethernet header + packet contents |
---|
| 89 | typedef struct { |
---|
| 90 | //Standard 14-byte Ethernet header (dest/src MAC addresses + EtherType) |
---|
| 91 | unsigned char dstAddr[6]; |
---|
| 92 | unsigned char srcAddr[6]; |
---|
| 93 | unsigned short ethType; |
---|
| 94 | //total number of bytes in pkt, including this header |
---|
| 95 | unsigned short pktLength; |
---|
| 96 | //number of warpnet structs that follow |
---|
| 97 | unsigned char numStructs; |
---|
| 98 | //Sequence number to match packets to ACKs |
---|
| 99 | unsigned char seqNum; |
---|
| 100 | } warpnetEthernetPktHeader; |
---|
| 101 | |
---|
| 102 | typedef struct { |
---|
| 103 | char structID; |
---|
| 104 | char nodeID; |
---|
| 105 | short cmdID; |
---|
| 106 | } warpnetAck; |
---|
| 107 | |
---|
| 108 | typedef struct { |
---|
| 109 | char structID; |
---|
| 110 | char nodeID; |
---|
| 111 | char txPower; |
---|
| 112 | char channel; |
---|
| 113 | char modOrderHeader; |
---|
| 114 | char modOrderPayload; |
---|
[1625] | 115 | char codeRatePayload; |
---|
| 116 | char reserved; |
---|
[1478] | 117 | int pktGen_period; |
---|
| 118 | int pktGen_length; |
---|
| 119 | } warpnetControl; |
---|
| 120 | |
---|
| 121 | typedef struct { |
---|
| 122 | char structID; |
---|
| 123 | char nodeID; |
---|
| 124 | char cmdID; |
---|
| 125 | char cmdParam; |
---|
| 126 | } warpnetCommand; |
---|
| 127 | |
---|
| 128 | typedef struct { |
---|
| 129 | unsigned char structID; |
---|
| 130 | unsigned char nodeID; |
---|
| 131 | unsigned short sourceNode; |
---|
| 132 | unsigned int numDataTx; |
---|
| 133 | unsigned int numNACKTx; |
---|
| 134 | unsigned int numDataRx; |
---|
| 135 | unsigned int numNACKRx; |
---|
| 136 | unsigned int numBadHeaderRx; |
---|
| 137 | unsigned int sumGains; |
---|
| 138 | unsigned int sumRSSI; |
---|
| 139 | unsigned int sumPacketCountRx; |
---|
| 140 | unsigned int trialDuration; |
---|
| 141 | unsigned int timeStamp; |
---|
| 142 | } warpnetObserve; |
---|
| 143 | |
---|
| 144 | typedef struct { |
---|
[1477] | 145 | unsigned char structID; |
---|
[1203] | 146 | unsigned char nodeID; |
---|
[1491] | 147 | unsigned short sequenceNumber; |
---|
| 148 | unsigned char pktType; |
---|
| 149 | unsigned char srcNode; |
---|
| 150 | unsigned char destNode; |
---|
| 151 | unsigned char relNode; |
---|
| 152 | unsigned char state; |
---|
| 153 | unsigned char reserved; |
---|
| 154 | unsigned short rssi; |
---|
| 155 | unsigned short gain; |
---|
| 156 | unsigned short timeStampHigh; |
---|
| 157 | unsigned int timeStampLow; |
---|
| 158 | } warpnetRTObserve; |
---|
[1368] | 159 | |
---|
[1504] | 160 | |
---|
| 161 | /********* Patrick's structs *************/ |
---|
[1368] | 162 | typedef struct { |
---|
[1504] | 163 | unsigned char structID; |
---|
| 164 | unsigned char nodeID; |
---|
| 165 | unsigned short sequenceNumber; |
---|
| 166 | unsigned int cfo_c; |
---|
| 167 | unsigned int cfo_p; |
---|
| 168 | unsigned int cfo_b; |
---|
| 169 | unsigned int txCFO; |
---|
[1524] | 170 | unsigned int pktStatus; |
---|
[1504] | 171 | } warpnetCFO; |
---|
| 172 | |
---|
| 173 | typedef struct { |
---|
| 174 | unsigned char structID; |
---|
| 175 | unsigned char nodeID; |
---|
| 176 | unsigned short param0; |
---|
| 177 | unsigned int param1; |
---|
| 178 | unsigned int param2; |
---|
| 179 | unsigned int param3; |
---|
| 180 | unsigned int param4; |
---|
[1541] | 181 | unsigned int param5; |
---|
| 182 | unsigned int param6; |
---|
| 183 | unsigned int param7; |
---|
| 184 | unsigned int param8; |
---|
[1546] | 185 | unsigned int param9; |
---|
[1504] | 186 | } warpnetPHYctrl; |
---|
[1507] | 187 | |
---|
| 188 | typedef struct { |
---|
| 189 | unsigned char structID; |
---|
| 190 | unsigned char nodeID; |
---|
| 191 | unsigned short sequenceNumber; |
---|
[1530] | 192 | |
---|
[1507] | 193 | unsigned char nodeID_tx; |
---|
| 194 | unsigned char nodeID_rx; |
---|
| 195 | unsigned short mac_seqNum; |
---|
[1530] | 196 | |
---|
| 197 | unsigned char mac_pktType; |
---|
| 198 | unsigned char reserved0; |
---|
| 199 | unsigned char reserved1; |
---|
| 200 | unsigned char reserved2; |
---|
| 201 | |
---|
[1507] | 202 | unsigned int bits_rx; |
---|
| 203 | unsigned int bits_errors; |
---|
| 204 | } warpnetObserveBER; |
---|
[1516] | 205 | |
---|
| 206 | typedef struct { |
---|
| 207 | unsigned char structID; |
---|
| 208 | unsigned char nodeID; |
---|
| 209 | unsigned char reqNum; |
---|
[1530] | 210 | unsigned char reqType; |
---|
[1516] | 211 | unsigned int numPkts_tx; |
---|
| 212 | unsigned int numPkts_rx_good; |
---|
| 213 | unsigned int numPkts_rx_goodHdrBadPyld; |
---|
[1524] | 214 | unsigned int numPkts_rx_badHdr; |
---|
[1516] | 215 | } warpnetObservePER; |
---|
| 216 | |
---|
[1530] | 217 | typedef struct { |
---|
| 218 | char structID; |
---|
| 219 | char nodeID; |
---|
| 220 | char reqNum; |
---|
| 221 | char reqType; |
---|
| 222 | } warpnetPERreq; |
---|
[1537] | 223 | |
---|
| 224 | typedef struct { |
---|
| 225 | unsigned char structID; |
---|
| 226 | unsigned char nodeID; |
---|
| 227 | unsigned short numBytes; |
---|
| 228 | } warpnetRawPkt; |
---|
| 229 | |
---|
| 230 | typedef struct { |
---|
| 231 | unsigned char structID; |
---|
| 232 | unsigned char nodeID; |
---|
| 233 | unsigned short seqNum; |
---|
| 234 | unsigned char pktType; |
---|
| 235 | unsigned char rxStatus; |
---|
| 236 | unsigned char includedData; //bitwise OR of RXPHYDUMP_INCLUDE_* |
---|
| 237 | unsigned char reserved0; |
---|
| 238 | unsigned short rssi; |
---|
| 239 | unsigned short rxGains; |
---|
[1597] | 240 | unsigned int cfoEst_coarse; |
---|
| 241 | unsigned int cfoEst_pilots; |
---|
[1537] | 242 | } warpnetRxPHYdump; |
---|
| 243 | |
---|
[1625] | 244 | //MS DEMO |
---|
| 245 | typedef struct { |
---|
| 246 | unsigned char structID; |
---|
| 247 | unsigned char nodeID; |
---|
| 248 | unsigned char reqNum; |
---|
| 249 | unsigned char reqType; |
---|
| 250 | unsigned int numPkts_tx[4]; |
---|
| 251 | unsigned int numPkts_rx_good[4]; |
---|
| 252 | unsigned int numPkts_rx_goodHdrBadPyld[4]; |
---|
| 253 | unsigned int numPkts_rx_badHdr; |
---|
| 254 | } warpnetObservePER_multiRate; |
---|
| 255 | |
---|
| 256 | typedef struct { |
---|
| 257 | unsigned char structID; |
---|
| 258 | unsigned char nodeID; |
---|
| 259 | unsigned char rxStatus; |
---|
| 260 | unsigned char reserved0; |
---|
| 261 | unsigned short rssi; |
---|
| 262 | unsigned short rxGains; |
---|
| 263 | } warpnetRxStatus; |
---|
[1504] | 264 | /********* END Patrick's structs *************/ |
---|
| 265 | |
---|
| 266 | typedef struct { |
---|
[1477] | 267 | char structID; |
---|
| 268 | char nodeID; |
---|
| 269 | short cmdID;//NOTE: We are going to overload cmdID to be the "source" packet |
---|
| 270 | } warpnetRequest; |
---|
[1203] | 271 | |
---|
[1494] | 272 | void warpnet_setMacAddr(void* macAddr); |
---|
[1477] | 273 | void warpnet_sendGratuitousArp(char myID); |
---|
[1203] | 274 | |
---|
| 275 | |
---|
[1252] | 276 | |
---|
[1477] | 277 | #endif//ifndef WARPNET_H |
---|