equal
deleted
inserted
replaced
80 &PDO2_COBID, /*void * pSourceData,*/ |
80 &PDO2_COBID, /*void * pSourceData,*/ |
81 &size, /* UNS8 * pExpectedSize*/ |
81 &size, /* UNS8 * pExpectedSize*/ |
82 RW); /* UNS8 checkAccess */ |
82 RW); /* UNS8 checkAccess */ |
83 } |
83 } |
84 |
84 |
85 static init_step = 0; |
85 static int init_step = 0; |
86 |
86 |
87 /*Froward declaration*/ |
87 /*Froward declaration*/ |
88 static void ConfigureSlaveNode(CO_Data* d, UNS8 nodeId); |
88 static void ConfigureSlaveNode(CO_Data* d, UNS8 nodeId); |
89 |
89 |
90 /**/ |
90 /**/ |
344 |
344 |
345 eprintf("Got Signal %d\n",sig); |
345 eprintf("Got Signal %d\n",sig); |
346 } |
346 } |
347 #endif |
347 #endif |
348 |
348 |
349 void help() |
349 void help(void) |
350 { |
350 { |
351 printf("**************************************************************\n"); |
351 printf("**************************************************************\n"); |
352 printf("* TestMasterMicroMod *\n"); |
352 printf("* TestMasterMicroMod *\n"); |
353 printf("* *\n"); |
353 printf("* *\n"); |
354 printf("* A simple example for PC. *\n"); |
354 printf("* A simple example for PC. *\n"); |
390 /* init */ |
390 /* init */ |
391 setState(&TestMaster_Data, Initialisation); |
391 setState(&TestMaster_Data, Initialisation); |
392 } |
392 } |
393 } |
393 } |
394 |
394 |
|
395 /*************************** EXIT *****************************************/ |
|
396 void Exit(CO_Data* d, UNS32 id) |
|
397 { |
|
398 masterSendNMTstateChange(&TestMaster_Data, 0x02, NMT_Reset_Node); |
|
399 |
|
400 //Stop master |
|
401 setState(&TestMaster_Data, Stopped); |
|
402 } |
395 /****************************************************************************/ |
403 /****************************************************************************/ |
396 /*************************** MAIN *****************************************/ |
404 /*************************** MAIN *****************************************/ |
397 /****************************************************************************/ |
405 /****************************************************************************/ |
398 int main(int argc,char **argv) |
406 int main(int argc,char **argv) |
399 { |
407 { |
447 |
455 |
448 #if !defined(WIN32) || defined(__CYGWIN__) |
456 #if !defined(WIN32) || defined(__CYGWIN__) |
449 /* install signal handler for manual break */ |
457 /* install signal handler for manual break */ |
450 signal(SIGTERM, catch_signal); |
458 signal(SIGTERM, catch_signal); |
451 signal(SIGINT, catch_signal); |
459 signal(SIGINT, catch_signal); |
|
460 TimerInit(); |
452 #endif |
461 #endif |
453 |
462 |
454 #ifndef NOT_USE_DYNAMIC_LOADING |
463 #ifndef NOT_USE_DYNAMIC_LOADING |
455 LoadCanDriver(LibraryPath); |
464 LoadCanDriver(LibraryPath); |
456 #endif |
465 #endif |
473 |
482 |
474 // wait Ctrl-C |
483 // wait Ctrl-C |
475 pause(); |
484 pause(); |
476 eprintf("Finishing.\n"); |
485 eprintf("Finishing.\n"); |
477 |
486 |
478 // Reset the slave node for next use (will stop emitting heartbeat) |
|
479 masterSendNMTstateChange (&TestMaster_Data, slavenodeid, NMT_Reset_Node); |
|
480 |
|
481 // Stop master |
|
482 setState(&TestMaster_Data, Stopped); |
|
483 |
|
484 // Stop timer thread |
487 // Stop timer thread |
485 StopTimerLoop(); |
488 StopTimerLoop(&Exit); |
486 |
489 |
487 fail_master: |
490 fail_master: |
488 if(MasterBoard.baudrate) canClose(&TestMaster_Data); |
491 if(MasterBoard.baudrate) canClose(&TestMaster_Data); |
489 |
492 |
|
493 TimerCleanup(); |
490 return 0; |
494 return 0; |
491 } |
495 } |
492 |
496 |
493 |
497 |