diff -r f45fd4cd3832 -r 34654679f262 doc/doxygen/html/TestMasterSlave_8c-source.html --- a/doc/doxygen/html/TestMasterSlave_8c-source.html Fri Jul 06 10:53:15 2007 +0200 +++ b/doc/doxygen/html/TestMasterSlave_8c-source.html Mon Jul 16 08:56:03 2007 +0200 @@ -18,7 +18,7 @@
00001 /* 00002 This file is part of CanFestival, a library implementing CanOpen Stack. 00003 @@ -64,25 +64,25 @@ 00043 #include "Slave.h" 00044 #include "TestMasterSlave.h" 00045 -00046 UNS32 OnMasterMap1Update(CO_Data* d, const indextable * unsused_indextable, UNS8 unsused_bSubindex) +00046 UNS32 OnMasterMap1Update(CO_Data* d, const indextable * unsused_indextable, UNS8 unsused_bSubindex) 00047 { -00048 eprintf("OnSlaveMap1Update:%d\n", SlaveMap1); +00048 eprintf("OnSlaveMap1Update:%d\n", SlaveMap1); 00049 return 0; 00050 } 00051 -00052 s_BOARD SlaveBoard = {"0", "125K"}; -00053 s_BOARD MasterBoard = {"1", "125K"}; +00052 s_BOARD SlaveBoard = {"0", "125K"}; +00053 s_BOARD MasterBoard = {"1", "125K"}; 00054 00055 #if !defined(WIN32) || defined(__CYGWIN__) -00056 void catch_signal(int sig) +00056 void catch_signal(int sig) 00057 { -00058 signal(SIGTERM, catch_signal); -00059 signal(SIGINT, catch_signal); -00060 eprintf("Got Signal %d\n",sig); +00058 signal(SIGTERM, catch_signal); +00059 signal(SIGINT, catch_signal); +00060 eprintf("Got Signal %d\n",sig); 00061 } 00062 #endif 00063 -00064 void help() +00064 void help() 00065 { 00066 printf("**************************************************************\n"); 00067 printf("* TestMasterSlave *\n"); @@ -111,25 +111,25 @@ 00090 } 00091 00092 /*************************** INIT *****************************************/ -00093 void InitNodes(CO_Data* d, UNS32 id) +00093 void InitNodes(CO_Data* d, UNS32 id) 00094 { 00095 /****************************** INITIALISATION SLAVE *******************************/ -00096 if(strcmp(SlaveBoard.baudrate, "none")) { +00096 if(strcmp(SlaveBoard.baudrate, "none")) { 00097 /* Defining the node Id */ -00098 setNodeId(&TestSlave_Data, 0x02); +00098 setNodeId(&TestSlave_Data, 0x02); 00099 /* init */ -00100 setState(&TestSlave_Data, Initialisation); +00100 setState(&TestSlave_Data, Initialisation); 00101 } 00102 00103 /****************************** INITIALISATION MASTER *******************************/ -00104 if(strcmp(MasterBoard.baudrate, "none")){ -00105 RegisterSetODentryCallBack(&TestMaster_Data, 0x2000, 0, &OnMasterMap1Update); +00104 if(strcmp(MasterBoard.baudrate, "none")){ +00105 RegisterSetODentryCallBack(&TestMaster_Data, 0x2000, 0, &OnMasterMap1Update); 00106 00107 /* Defining the node Id */ -00108 setNodeId(&TestMaster_Data, 0x01); +00108 setNodeId(&TestMaster_Data, 0x01); 00109 00110 /* init */ -00111 setState(&TestMaster_Data, Initialisation); +00111 setState(&TestMaster_Data, Initialisation); 00112 00113 } 00114 } @@ -137,130 +137,130 @@ 00116 /****************************************************************************/ 00117 /*************************** MAIN *****************************************/ 00118 /****************************************************************************/ -00119 int main(int argc,char **argv) +00119 int main(int argc,char **argv) 00120 { 00121 00122 int c; -00123 extern char *optarg; +00123 extern char *optarg; 00124 char* LibraryPath="libcanfestival_can_virtual.so"; 00125 -00126 while ((c = getopt(argc, argv, "-m:s:M:S:l:")) != EOF) +00126 while ((c = getopt(argc, argv, "-m:s:M:S:l:")) != EOF) 00127 { 00128 switch(c) 00129 { 00130 case 's' : 00131 if (optarg[0] == 0) 00132 { -00133 help(); +00133 help(); 00134 exit(1); 00135 } -00136 SlaveBoard.busname = optarg; +00136 SlaveBoard.busname = optarg; 00137 break; 00138 case 'm' : 00139 if (optarg[0] == 0) 00140 { -00141 help(); +00141 help(); 00142 exit(1); 00143 } -00144 MasterBoard.busname = optarg; +00144 MasterBoard.busname = optarg; 00145 break; 00146 case 'S' : 00147 if (optarg[0] == 0) 00148 { -00149 help(); +00149 help(); 00150 exit(1); 00151 } -00152 SlaveBoard.baudrate = optarg; +00152 SlaveBoard.baudrate = optarg; 00153 break; 00154 case 'M' : 00155 if (optarg[0] == 0) 00156 { -00157 help(); +00157 help(); 00158 exit(1); 00159 } -00160 MasterBoard.baudrate = optarg; +00160 MasterBoard.baudrate = optarg; 00161 break; 00162 case 'l' : 00163 if (optarg[0] == 0) 00164 { -00165 help(); +00165 help(); 00166 exit(1); 00167 } 00168 LibraryPath = optarg; 00169 break; 00170 default: -00171 help(); +00171 help(); 00172 exit(1); 00173 } 00174 } 00175 00176 #if !defined(WIN32) || defined(__CYGWIN__) 00177 /* install signal handler for manual break */ -00178 signal(SIGTERM, catch_signal); -00179 signal(SIGINT, catch_signal); +00178 signal(SIGTERM, catch_signal); +00179 signal(SIGINT, catch_signal); 00180 #endif 00181 00182 #ifndef NOT_USE_DYNAMIC_LOADING -00183 LoadCanDriver(LibraryPath); +00183 LoadCanDriver(LibraryPath); 00184 #endif 00185 // Open CAN devices 00186 -00187 if(strcmp(SlaveBoard.baudrate, "none")){ +00187 if(strcmp(SlaveBoard.baudrate, "none")){ 00188 -00189 TestSlave_Data.heartbeatError = TestSlave_heartbeatError; -00190 TestSlave_Data.initialisation = TestSlave_initialisation; -00191 TestSlave_Data.preOperational = TestSlave_preOperational; -00192 TestSlave_Data.operational = TestSlave_operational; -00193 TestSlave_Data.stopped = TestSlave_stopped; -00194 TestSlave_Data.post_sync = TestSlave_post_sync; -00195 TestSlave_Data.post_TPDO = TestSlave_post_TPDO; -00196 TestSlave_Data.storeODSubIndex = TestSlave_storeODSubIndex; +00189 TestSlave_Data.heartbeatError = TestSlave_heartbeatError; +00190 TestSlave_Data.initialisation = TestSlave_initialisation; +00191 TestSlave_Data.preOperational = TestSlave_preOperational; +00192 TestSlave_Data.operational = TestSlave_operational; +00193 TestSlave_Data.stopped = TestSlave_stopped; +00194 TestSlave_Data.post_sync = TestSlave_post_sync; +00195 TestSlave_Data.post_TPDO = TestSlave_post_TPDO; +00196 TestSlave_Data.storeODSubIndex = TestSlave_storeODSubIndex; 00197 -00198 if(!canOpen(&SlaveBoard,&TestSlave_Data)){ -00199 eprintf("Cannot open Slave Board (%s,%s)\n",SlaveBoard.busname, SlaveBoard.baudrate); +00198 if(!canOpen(&SlaveBoard,&TestSlave_Data)){ +00199 eprintf("Cannot open Slave Board (%s,%s)\n",SlaveBoard.busname, SlaveBoard.baudrate); 00200 goto fail_slave; 00201 } 00202 } -00203 if(strcmp(MasterBoard.baudrate, "none")){ +00203 if(strcmp(MasterBoard.baudrate, "none")){ 00204 -00205 TestMaster_Data.heartbeatError = TestMaster_heartbeatError; -00206 TestMaster_Data.initialisation = TestMaster_initialisation; -00207 TestMaster_Data.preOperational = TestMaster_preOperational; -00208 TestMaster_Data.operational = TestMaster_operational; -00209 TestMaster_Data.stopped = TestMaster_stopped; -00210 TestMaster_Data.post_sync = TestMaster_post_sync; -00211 TestMaster_Data.post_TPDO = TestMaster_post_TPDO; +00205 TestMaster_Data.heartbeatError = TestMaster_heartbeatError; +00206 TestMaster_Data.initialisation = TestMaster_initialisation; +00207 TestMaster_Data.preOperational = TestMaster_preOperational; +00208 TestMaster_Data.operational = TestMaster_operational; +00209 TestMaster_Data.stopped = TestMaster_stopped; +00210 TestMaster_Data.post_sync = TestMaster_post_sync; +00211 TestMaster_Data.post_TPDO = TestMaster_post_TPDO; 00212 -00213 if(!canOpen(&MasterBoard,&TestMaster_Data)){ -00214 eprintf("Cannot open Master Board (%s,%s)\n",MasterBoard.busname, MasterBoard.baudrate); +00213 if(!canOpen(&MasterBoard,&TestMaster_Data)){ +00214 eprintf("Cannot open Master Board (%s,%s)\n",MasterBoard.busname, MasterBoard.baudrate); 00215 goto fail_master; 00216 } 00217 } 00218 00219 // Start timer thread -00220 StartTimerLoop(&InitNodes); +00220 StartTimerLoop(&InitNodes); 00221 00222 // wait Ctrl-C 00223 00224 pause(); -00225 eprintf("Finishing.\n"); +00225 eprintf("Finishing.\n"); 00226 -00227 masterSendNMTstateChange (&TestMaster_Data, 0x02, NMT_Reset_Node); -00228 eprintf("reset\n"); +00227 masterSendNMTstateChange (&TestMaster_Data, 0x02, NMT_Reset_Node); +00228 eprintf("reset\n"); 00229 // Stop master -00230 setState(&TestMaster_Data, Stopped); +00230 setState(&TestMaster_Data, Stopped); 00231 00232 // Stop timer thread -00233 StopTimerLoop(); +00233 StopTimerLoop(); 00234 00235 // Close CAN devices (and can threads) -00236 if(strcmp(SlaveBoard.baudrate, "none")) canClose(&TestSlave_Data); +00236 if(strcmp(SlaveBoard.baudrate, "none")) canClose(&TestSlave_Data); 00237 fail_master: -00238 if(strcmp(MasterBoard.baudrate, "none")) canClose(&TestMaster_Data); +00238 if(strcmp(MasterBoard.baudrate, "none")) canClose(&TestMaster_Data); 00239 fail_slave: 00240 return 0; 00241 } -