root/ResearchApps/PHY/WARPLAB/WARPLab_SISO_MIMO2x2/M_Code/warplab_initialize.m
| Revision 850, 1.1 kB (checked in by MelissaDuarte, 6 months ago) |
|---|
| Line | |
|---|---|
| 1 | function [socketHandles,packetNum] = warplab_initialize(varargin) |
| 2 | |
| 3 | % Create arp entry for magic sync |
| 4 | !arp -s 10.0.0.244 ff-ff-ff-ff-ff-ff 10.0.0.200 |
| 5 | |
| 6 | %Close any stale sockets before trying to create new ones |
| 7 | pnet('closeall'); |
| 8 | |
| 9 | % Check length of input argument |
| 10 | leninput = length(varargin); |
| 11 | |
| 12 | % Input argument varargin defines the number of nodes |
| 13 | if(0 == leninput) |
| 14 | % If there is no number of nodes specified then use 2 nodes as default |
| 15 | nodes = [1:2]; |
| 16 | else |
| 17 | % If there is a number of nodes specified then use that many number of |
| 18 | % nodes |
| 19 | nodes = [1:1:varargin{1}]; |
| 20 | end |
| 21 | |
| 22 | |
| 23 | %Define the nodes' IP addresses & UDP ports |
| 24 | % The IP address and UDP port ranges must match those hardc-coded in the FPGA |
| 25 | IPAddrs = warplab_IP2int('10.0.0.0') + nodes; |
| 26 | UDP_Ports = 9000 + nodes-1; |
| 27 | |
| 28 | %Define the magic SYNC address; this must match the address hard-coded in the FPGA |
| 29 | MagicSyncAddr = '10.0.0.244'; |
| 30 | |
| 31 | %Define an initial packet number |
| 32 | packetNum = 1; |
| 33 | |
| 34 | socketHandles = warplab_initNets(MagicSyncAddr, IPAddrs, UDP_Ports); |
| 35 | warplab_initNodes(socketHandles); |
Note: See TracBrowser
for help on using the browser.