source: ResearchApps/PHY/WARPLAB/WARPLab_v6p2/M_Code_Reference/warplab_initialize.m

Last change on this file was 1807, checked in by chunter, 12 years ago

renaming root

File size: 1.0 KB
Line 
1function [socketHandles,packetNum] = warplab_initialize(varargin)
2warplab_defines;
3
4% Create arp entry for magic sync
5%!arp -s 10.0.0.255 ff-ff-ff-ff-ff-ff 10.0.0.200
6
7%Close any stale sockets before trying to create new ones
8pnet('closeall');
9
10% Check length of input argument
11leninput = length(varargin);
12
13% Input argument varargin defines the number of nodes
14if(0 == leninput)
15    % If there is no number of nodes specified then use 2 nodes as default
16    nodes = [1:2];
17else
18    % If there is a number of nodes specified then use that many number of
19    % nodes
20    nodes = [1:1:varargin{1}];
21end
22   
23
24%Define the nodes' IP addresses & UDP ports
25% The IP address and UDP port ranges must match those hardc-coded in the FPGA
26IPAddrs = warplab_IP2int(strcat(WARP_subnet,'.0')) + nodes;
27UDP_Ports = NodeStartingPort + nodes-1;
28
29%Define an initial packet number
30packetNum = 1;
31
32socketHandles = warplab_initNets(strcat(WARP_subnet,SyncAddr), IPAddrs, UDP_Ports);
33warplab_initNodes(socketHandles);
Note: See TracBrowser for help on using the repository browser.