Line | |
---|
1 | function [socketHandles,packetNum] = warplab_initialize(varargin) |
---|
2 | |
---|
3 | % Create arp entry for magic sync |
---|
4 | % we change this manually |
---|
5 | !arp -s 10.0.0.244 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 | % nodes |
---|
27 | IPAddrs = warplab_IP2int('10.0.0.0') + nodes; |
---|
28 | UDP_Ports = 9000 + nodes-1; |
---|
29 | |
---|
30 | %Define the magic SYNC address; this must match the address hard-coded in the FPGA |
---|
31 | MagicSyncAddr = '10.0.0.244'; |
---|
32 | |
---|
33 | %Define an initial packet number |
---|
34 | packetNum = 1; |
---|
35 | |
---|
36 | socketHandles = warplab_initNets(MagicSyncAddr, IPAddrs, UDP_Ports); |
---|
37 | warplab_initNodes(socketHandles); |
---|
Note: See
TracBrowser
for help on using the repository browser.