Line | |
---|
1 | function [socketHandles,packetNum] = warplab_initialize(varargin) |
---|
2 | warplab_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 |
---|
8 | pnet('closeall'); |
---|
9 | |
---|
10 | % Check length of input argument |
---|
11 | leninput = length(varargin); |
---|
12 | |
---|
13 | % Input argument varargin defines the number of nodes |
---|
14 | if(0 == leninput) |
---|
15 | % If there is no number of nodes specified then use 2 nodes as default |
---|
16 | nodes = [1:2]; |
---|
17 | else |
---|
18 | % If there is a number of nodes specified then use that many number of |
---|
19 | % nodes |
---|
20 | nodes = [1:1:varargin{1}]; |
---|
21 | end |
---|
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 |
---|
26 | IPAddrs = warplab_IP2int(strcat(WARP_subnet,'.0')) + nodes; |
---|
27 | UDP_Ports = NodeStartingPort + nodes-1; |
---|
28 | |
---|
29 | %Define an initial packet number |
---|
30 | packetNum = 1; |
---|
31 | |
---|
32 | socketHandles = warplab_initNets(strcat(WARP_subnet,SyncAddr), IPAddrs, UDP_Ports); |
---|
33 | warplab_initNodes(socketHandles); |
---|
Note: See
TracBrowser
for help on using the repository browser.