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

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

initial checkin of WARPLABv06. Only change on the m-code side of things moving to a proper broadcast IP packet for the sync packet. This *should* keep us from having to hardcode the ARP entry every time.

File size: 1.1 KB
Line 
1function [socketHandles,packetNum] = warplab_initialize(varargin)
2
3% Create arp entry for magic sync
4%!arp -s 10.0.0.255 ff-ff-ff-ff-ff-ff 10.0.0.200
5
6%Close any stale sockets before trying to create new ones
7pnet('closeall');
8
9% Check length of input argument
10leninput = length(varargin);
11
12% Input argument varargin defines the number of nodes
13if(0 == leninput)
14    % If there is no number of nodes specified then use 2 nodes as default
15    nodes = [1:2];
16else
17    % If there is a number of nodes specified then use that many number of
18    % nodes
19    nodes = [1:1:varargin{1}];
20end
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
25IPAddrs = warplab_IP2int('10.0.0.0') + nodes;
26UDP_Ports = 9000 + nodes-1;
27
28%Define the magic SYNC address; this must match the address hard-coded in the FPGA
29MagicSyncAddr = '10.0.0.255';
30
31%Define an initial packet number
32packetNum = 1;
33
34socketHandles = warplab_initNets(MagicSyncAddr, IPAddrs, UDP_Ports);
35warplab_initNodes(socketHandles);
Note: See TracBrowser for help on using the repository browser.