author | greg |
Mon, 30 Apr 2007 16:56:21 +0200 | |
changeset 176 | 5d57fe1e3a5b |
parent 172 | 0248c2b148bb |
child 179 | 763b6d32c1a6 |
permissions | -rw-r--r-- |
0 | 1 |
/* |
2 |
This file is part of CanFestival, a library implementing CanOpen Stack. |
|
3 |
||
4 |
Copyright (C): Edouard TISSERANT and Francis DUPIN |
|
5 |
||
6 |
See COPYING file for copyrights details. |
|
7 |
||
8 |
This library is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU Lesser General Public |
|
10 |
License as published by the Free Software Foundation; either |
|
11 |
version 2.1 of the License, or (at your option) any later version. |
|
12 |
||
13 |
This library is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 |
Lesser General Public License for more details. |
|
17 |
||
18 |
You should have received a copy of the GNU Lesser General Public |
|
19 |
License along with this library; if not, write to the Free Software |
|
20 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
*/ |
|
22 |
||
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
23 |
#if defined(WIN32) && !defined(__CYGWIN__) |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
24 |
#include <windows.h> |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
25 |
#include "getopt.h" |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
26 |
void pause(void) |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
27 |
{ |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
28 |
system("PAUSE"); |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
29 |
} |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
30 |
#else |
0 | 31 |
#include <stdio.h> |
32 |
#include <string.h> |
|
169
90c0a676e631
Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents:
161
diff
changeset
|
33 |
#include <unistd.h> |
0 | 34 |
#include <stdlib.h> |
35 |
#include <signal.h> |
|
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
36 |
#endif |
0 | 37 |
|
156 | 38 |
#include "canfestival.h" |
39 |
//#include <can_driver.h> |
|
40 |
//#include <timers_driver.h> |
|
0 | 41 |
|
42 |
#include "Master.h" |
|
43 |
#include "Slave.h" |
|
44 |
#include "TestMasterSlave.h" |
|
45 |
||
46 |
UNS32 OnMasterMap1Update(CO_Data* d, const indextable * unsused_indextable, UNS8 unsused_bSubindex) |
|
47 |
{ |
|
48 |
eprintf("OnSlaveMap1Update:%d\n", SlaveMap1); |
|
31 | 49 |
return 0; |
0 | 50 |
} |
51 |
||
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
52 |
s_BOARD SlaveBoard = {"0", "500K"}; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
53 |
s_BOARD MasterBoard = {"1", "500K"}; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
54 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
55 |
#if !defined(WIN32) || defined(__CYGWIN__) |
0 | 56 |
void catch_signal(int sig) |
57 |
{ |
|
58 |
signal(SIGTERM, catch_signal); |
|
59 |
signal(SIGINT, catch_signal); |
|
32 | 60 |
eprintf("Got Signal %d\n",sig); |
61 |
} |
|
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
62 |
#endif |
0 | 63 |
|
64 |
void help() |
|
65 |
{ |
|
66 |
printf("**************************************************************\n"); |
|
67 |
printf("* TestMasterSlave *\n"); |
|
68 |
printf("* *\n"); |
|
69 |
printf("* A simple example for PC. It does implement 2 CanOpen *\n"); |
|
70 |
printf("* nodes in the same process. A master and a slave. Both *\n"); |
|
36
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
71 |
printf("* communicate together, exchanging periodically NMT, SYNC, *\n"); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
72 |
printf("* SDO and PDO. *\n"); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
73 |
printf("* *\n"); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
74 |
printf("* Usage: *\n"); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
75 |
printf("* ./TestMasterSlave [OPTIONS] *\n"); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
76 |
printf("* *\n"); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
77 |
printf("* OPTIONS: *\n"); |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
78 |
printf("* -l : Can library [\"libcanfestival_can_virtual.so\"] *\n"); |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
79 |
printf("* *\n"); |
36
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
80 |
printf("* Slave: *\n"); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
81 |
printf("* -s : bus name [\"0\"] *\n"); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
82 |
printf("* -S : 1M,500K,250K,125K,100K,50K,20K,10K,none(disable) *\n"); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
83 |
printf("* *\n"); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
84 |
printf("* Master: *\n"); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
85 |
printf("* -m : bus name [\"1\"] *\n"); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
86 |
printf("* -M : 1M,500K,250K,125K,100K,50K,20K,10K,none(disable) *\n"); |
0 | 87 |
printf("* *\n"); |
88 |
printf("**************************************************************\n"); |
|
89 |
} |
|
90 |
||
36
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
91 |
/*************************** INIT *****************************************/ |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
92 |
void InitNodes(CO_Data* d, UNS32 id) |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
93 |
{ |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
94 |
/****************************** INITIALISATION SLAVE *******************************/ |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
95 |
if(SlaveBoard.baudrate) { |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
96 |
/* Defining the node Id */ |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
97 |
setNodeId(&TestSlave_Data, 0x02); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
98 |
/* init */ |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
99 |
setState(&TestSlave_Data, Initialisation); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
100 |
} |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
101 |
|
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
102 |
/****************************** INITIALISATION MASTER *******************************/ |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
103 |
if(MasterBoard.baudrate){ |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
104 |
RegisterSetODentryCallBack(&TestMaster_Data, 0x2000, 0, &OnMasterMap1Update); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
105 |
|
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
106 |
/* Defining the node Id */ |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
107 |
setNodeId(&TestMaster_Data, 0x01); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
108 |
|
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
109 |
/* init */ |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
110 |
setState(&TestMaster_Data, Initialisation); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
111 |
|
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
112 |
/****************************** START *******************************/ |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
113 |
/* Put the master in operational mode */ |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
114 |
setState(&TestMaster_Data, Operational); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
115 |
|
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
116 |
/* Ask slave node to go in operational mode */ |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
117 |
masterSendNMTstateChange (&TestMaster_Data, 0x02, NMT_Start_Node); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
118 |
} |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
119 |
} |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
120 |
|
0 | 121 |
/****************************************************************************/ |
122 |
/*************************** MAIN *****************************************/ |
|
123 |
/****************************************************************************/ |
|
124 |
int main(int argc,char **argv) |
|
125 |
{ |
|
126 |
||
127 |
char c; |
|
128 |
extern char *optarg; |
|
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
129 |
char* LibraryPath="libcanfestival_can_virtual.so"; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
130 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
131 |
while ((c = getopt(argc, argv, "-m:s:M:S:l:")) != EOF) |
0 | 132 |
{ |
133 |
switch(c) |
|
134 |
{ |
|
135 |
case 's' : |
|
136 |
if (optarg[0] == 0) |
|
137 |
{ |
|
138 |
help(); |
|
139 |
exit(1); |
|
140 |
} |
|
141 |
SlaveBoard.busname = optarg; |
|
142 |
break; |
|
143 |
case 'm' : |
|
144 |
if (optarg[0] == 0) |
|
145 |
{ |
|
146 |
help(); |
|
147 |
exit(1); |
|
148 |
} |
|
149 |
MasterBoard.busname = optarg; |
|
150 |
break; |
|
36
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
151 |
case 'S' : |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
152 |
if (optarg[0] == 0) |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
153 |
{ |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
154 |
help(); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
155 |
exit(1); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
156 |
} |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
157 |
SlaveBoard.baudrate = optarg; |
36
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
158 |
break; |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
159 |
case 'M' : |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
160 |
if (optarg[0] == 0) |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
161 |
{ |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
162 |
help(); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
163 |
exit(1); |
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
164 |
} |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
165 |
MasterBoard.baudrate = optarg; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
166 |
break; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
167 |
case 'l' : |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
168 |
if (optarg[0] == 0) |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
169 |
{ |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
170 |
help(); |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
171 |
exit(1); |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
172 |
} |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
173 |
LibraryPath = optarg; |
36
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
174 |
break; |
0 | 175 |
default: |
176 |
help(); |
|
177 |
exit(1); |
|
178 |
} |
|
179 |
} |
|
180 |
||
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
181 |
#if !defined(WIN32) || defined(__CYGWIN__) |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
182 |
/* install signal handler for manual break */ |
0 | 183 |
signal(SIGTERM, catch_signal); |
184 |
signal(SIGINT, catch_signal); |
|
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
185 |
#endif |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
186 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
187 |
#ifndef NOT_USE_DYNAMIC_LOADING |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
188 |
LoadCanDriver(LibraryPath); |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
189 |
#endif |
0 | 190 |
// Open CAN devices |
169
90c0a676e631
Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents:
161
diff
changeset
|
191 |
if(strcmp( SlaveBoard.baudrate, "none")){ |
149 | 192 |
|
193 |
TestSlave_Data.heartbeatError = TestSlave_heartbeatError; |
|
194 |
TestSlave_Data.initialisation = TestSlave_initialisation; |
|
195 |
TestSlave_Data.preOperational = TestSlave_preOperational; |
|
196 |
TestSlave_Data.operational = TestSlave_operational; |
|
197 |
TestSlave_Data.stopped = TestSlave_stopped; |
|
198 |
TestSlave_Data.post_sync = TestSlave_post_sync; |
|
199 |
TestSlave_Data.post_TPDO = TestSlave_post_TPDO; |
|
161
c4908cc776a9
SetODEntry now call CO_data->storeODSubEntry(Index,SubIndex) for variables to be Stored (when column Save==True in GUI)
etisserant
parents:
156
diff
changeset
|
200 |
TestSlave_Data.storeODSubIndex = TestSlave_storeODSubIndex; |
149 | 201 |
|
202 |
if(!canOpen(&SlaveBoard,&TestSlave_Data)){ |
|
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
203 |
eprintf("Cannot open Slave Board (%s,%s)\n",SlaveBoard.busname, SlaveBoard.baudrate); |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
204 |
goto fail_slave; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
205 |
} |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
206 |
} |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
207 |
|
169
90c0a676e631
Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents:
161
diff
changeset
|
208 |
if(strcmp( MasterBoard.baudrate, "none")){ |
149 | 209 |
|
210 |
TestMaster_Data.heartbeatError = TestMaster_heartbeatError; |
|
211 |
TestMaster_Data.initialisation = TestMaster_initialisation; |
|
212 |
TestMaster_Data.preOperational = TestMaster_preOperational; |
|
213 |
TestMaster_Data.operational = TestMaster_operational; |
|
214 |
TestMaster_Data.stopped = TestMaster_stopped; |
|
215 |
TestMaster_Data.post_sync = TestMaster_post_sync; |
|
216 |
TestMaster_Data.post_TPDO = TestMaster_post_TPDO; |
|
217 |
||
218 |
if(!canOpen(&MasterBoard,&TestMaster_Data)){ |
|
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
219 |
eprintf("Cannot open Master Board (%s,%s)\n",SlaveBoard.busname, SlaveBoard.baudrate); |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
220 |
goto fail_master; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
221 |
} |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
40
diff
changeset
|
222 |
} |
0 | 223 |
|
32 | 224 |
// Start timer thread |
225 |
StartTimerLoop(&InitNodes); |
|
226 |
||
227 |
// wait Ctrl-C |
|
228 |
pause(); |
|
229 |
eprintf("Finishing.\n"); |
|
230 |
||
231 |
// Stop timer thread |
|
232 |
StopTimerLoop(); |
|
233 |
||
234 |
// Close CAN devices (and can threads) |
|
172
0248c2b148bb
Removed SDOTimeout application callback.Please use SDO callbacks instead.
etisserant
parents:
169
diff
changeset
|
235 |
if(strcmp( SlaveBoard.baudrate, "none")) canClose(&TestSlave_Data); |
36
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
236 |
fail_master: |
172
0248c2b148bb
Removed SDOTimeout application callback.Please use SDO callbacks instead.
etisserant
parents:
169
diff
changeset
|
237 |
if(strcmp( MasterBoard.baudrate, "none")) canClose(&TestMaster_Data); |
36
ff3ba4a90548
Added bauderate/disable option to TestMasterSlave Master and Slave nodes.
etisserant
parents:
32
diff
changeset
|
238 |
fail_slave: |
0 | 239 |
|
240 |
||
241 |
return 0; |
|
242 |
} |