source: PlatformSupport/WARPMAC/warpnet.c

Last change on this file was 1712, checked in by murphpo, 8 years ago

Updating code for OFDM ref design v17 in ISE 13.4 tools

  • Property svn:executable set to *
File size: 1.4 KB
Line 
1/* version 16.00 */
2#include "warpnet.h"
3#include "warpmac.h"
4#include "warpphy.h"
5#include "string.h"
6#include "xparameters.h"
7#include <sleep.h>
8
9unsigned char arpTemplate[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x17, 0xf2, 0xc6, 0x5f, 0x30, 0x08, 0x06, 0x00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, 0x00, 0x17, 0xf2, 0xc6, 0x5f, 0x30, 0xC0, 0xA8, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xA8, 0xFE, 0xFE};
10Netconfig configStruct;
11
12void warpnet_setMacAddr(void* macAddr){
13    memcpy((void *)&configStruct.macAddr, macAddr, 6);
14}
15
16void warpnet_sendGratuitousArp(char myID){
17    unsigned int i;
18   
19    //copy this node's wired MAC address into the source field of the arpTemplate
20    memcpy(&arpTemplate[6],&configStruct.macAddr,6);
21    memcpy(&arpTemplate[22],&configStruct.macAddr,6);
22   
23    arpTemplate[28]=192;
24    arpTemplate[29]=168;
25    arpTemplate[30]=1;
26    arpTemplate[31]=200+myID;
27   
28    arpTemplate[38]=arpTemplate[28];
29    arpTemplate[39]=arpTemplate[29];
30    arpTemplate[40]=arpTemplate[30];
31    arpTemplate[41]=arpTemplate[31];
32   
33    //This is a hack to get DMA to play nice with the packet we have created.
34    void* bufferAddr = (void *)warpphy_getBuffAddr(0);
35    memcpy((void *)bufferAddr,(void *)&arpTemplate[0],sizeof(arpTemplate));
36   
37    for(i=0;i<ARPREPEAT;i++){
38        warpmac_prepPktToNetwork(bufferAddr, sizeof(arpTemplate));
39        warpmac_startPktToNetwork(sizeof(arpTemplate));
40        usleep(10);
41    }
42}
Note: See TracBrowser for help on using the repository browser.