examples/TestMasterMicroMod/TestMasterMicroMod.c
author Christian Taedcke <hacking@taedcke.com>
Mon, 21 May 2012 16:13:47 +0200
changeset 720 09dd61317f0f
parent 664 a03f0aa7d219
permissions -rw-r--r--
Win32 fixes:
- generate debug information for canopenshell in debug configuration
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
     1
/*
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
     2
This file is part of CanFestival, a library implementing CanOpen Stack. 
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
     3
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
     4
Copyright (C): Edouard TISSERANT and Francis DUPIN
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
     5
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
     6
See COPYING file for copyrights details.
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
     7
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
     8
This library is free software; you can redistribute it and/or
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
     9
modify it under the terms of the GNU Lesser General Public
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    10
License as published by the Free Software Foundation; either
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    11
version 2.1 of the License, or (at your option) any later version.
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    12
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    13
This library is distributed in the hope that it will be useful,
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    14
but WITHOUT ANY WARRANTY; without even the implied warranty of
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    16
Lesser General Public License for more details.
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    17
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    18
You should have received a copy of the GNU Lesser General Public
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    19
License along with this library; if not, write to the Free Software
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    21
*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    22
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    23
#if defined(WIN32) && !defined(__CYGWIN__)
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    24
#include <windows.h>
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    25
#include "getopt.h"
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    26
void pause(void)
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    27
{
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    28
	system("PAUSE");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    29
}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    30
#else
169
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
    31
#include <unistd.h>
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    32
#include <stdio.h>
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    33
#include <string.h>
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    34
#include <stdlib.h>
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    35
#include <signal.h>
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    36
#endif
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    37
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    38
#include "canfestival.h"
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    39
#include "TestMasterMicroMod.h"
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    40
#include "TestMaster.h"
540
6857b6ffb7a7 Removed some warnings.
etisserant
parents: 465
diff changeset
    41
unsigned int slavenodeid = 0x40;
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    42
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    43
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    44
/*****************************************************************************/
378
d2abf6c8c27b As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents: 335
diff changeset
    45
void TestMaster_heartbeatError(CO_Data* d, UNS8 heartbeatID)
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    46
{
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    47
	eprintf("TestMaster_heartbeatError %d\n", heartbeatID);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    48
}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    49
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    50
/********************************************************
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    51
 * ConfigureSlaveNode is responsible to
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    52
 *  - setup master RPDO 1 to receive TPDO 1 from id 0x40
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    53
 *  - setup master TPDO 1 to send RPDO 1 to id 0x40
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    54
 ********************************************************/
378
d2abf6c8c27b As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents: 335
diff changeset
    55
void TestMaster_initialisation(CO_Data* d)
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    56
{
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    57
	UNS32 PDO1_COBID = 0x0180 + slavenodeid; 
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    58
	UNS32 PDO2_COBID = 0x0200 + slavenodeid;
540
6857b6ffb7a7 Removed some warnings.
etisserant
parents: 465
diff changeset
    59
	UNS32 size = sizeof(UNS32); 
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    60
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    61
	eprintf("TestMaster_initialisation\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    62
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    63
	/*****************************************
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    64
	 * Define RPDOs to match slave ID=0x40 TPDOs*
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    65
	 *****************************************/
175
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 173
diff changeset
    66
	writeLocalDict( &TestMaster_Data, /*CO_Data* d*/
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    67
			0x1400, /*UNS16 index*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    68
			0x01, /*UNS8 subind*/ 
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    69
			&PDO1_COBID, /*void * pSourceData,*/ 
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    70
			&size, /* UNS8 * pExpectedSize*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    71
			RW);  /* UNS8 checkAccess */
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    72
			
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    73
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    74
	/*****************************************
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    75
	 * Define TPDOs to match slave ID=0x40 RPDOs*
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    76
	 *****************************************/
175
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 173
diff changeset
    77
	writeLocalDict( &TestMaster_Data, /*CO_Data* d*/
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    78
			0x1800, /*UNS16 index*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    79
			0x01, /*UNS8 subind*/ 
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    80
			&PDO2_COBID, /*void * pSourceData,*/ 
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    81
			&size, /* UNS8 * pExpectedSize*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    82
			RW);  /* UNS8 checkAccess */
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    83
}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    84
454
bc000083297a - add RTAI support
greg
parents: 378
diff changeset
    85
static int init_step = 0;
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
    86
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
    87
/*Froward declaration*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
    88
static void ConfigureSlaveNode(CO_Data* d, UNS8 nodeId);
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
    89
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
    90
/**/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
    91
static void CheckSDOAndContinue(CO_Data* d, UNS8 nodeId)
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
    92
{
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
    93
	UNS32 abortCode;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
    94
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
    95
	if(getWriteResultNetworkDict (d, nodeId, &abortCode) != SDO_FINISHED)
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
    96
		eprintf("Master : Failed in initializing slave %2.2x, step %d, AbortCode :%4.4x \n", nodeId, init_step, abortCode);
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
    97
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
    98
	/* Finalise last SDO transfer with this node */
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
    99
	closeSDOtransfer(&TestMaster_Data, nodeId, SDO_CLIENT);
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   100
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   101
	ConfigureSlaveNode(d, nodeId);
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   102
}
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   103
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   104
/********************************************************
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   105
 * ConfigureSlaveNode is responsible to
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   106
 *  - setup slave TPDO 1 transmit time
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   107
 *  - setup slave TPDO 2 transmit time
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   108
 *  - setup slave Heartbeat Producer time
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   109
 *  - switch to operational mode
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   110
 *  - send NMT to slave
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   111
 ********************************************************
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   112
 * This an example of :
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   113
 * Network Dictionary Access (SDO) with Callback 
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   114
 * Slave node state change request (NMT) 
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   115
 ********************************************************
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   116
 * This is called first by TestMaster_preOperational
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   117
 * then it called again each time a SDO exchange is
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   118
 * finished.
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   119
 ********************************************************/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   120
static void ConfigureSlaveNode(CO_Data* d, UNS8 nodeId)
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   121
{
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   122
	UNS8 res;
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   123
	eprintf("Master : ConfigureSlaveNode %2.2x\n", nodeId);
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   124
	switch(++init_step){
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   125
		case 1: 
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   126
		{	/*disable Slave's TPDO 1 */
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   127
			UNS32 TPDO_COBId = 0x80000180 + nodeId;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   128
			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   129
			eprintf("Master : disable slave %2.2x TPDO 1 \n", nodeId);
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   130
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   131
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   132
					nodeId, /*UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   133
					0x1800, /*UNS16 index*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   134
					0x01, /*UNS8 subindex*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   135
					4, /*UNS8 count*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   136
					0, /*UNS8 dataType*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   137
					&TPDO_COBId,/*void *data*/
664
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   138
					CheckSDOAndContinue, /*SDOCallback_t Callback*/
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   139
                    0); /* use block mode */
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   140
		}			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   141
		break;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   142
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   143
		case 2: 
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   144
		{	/*setup Slave's TPDO 1 to be transmitted on SYNC*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   145
			UNS8 Transmission_Type = 0x01;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   146
			
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   147
			eprintf("Master : set slave %2.2x TPDO 1 transmit type\n", nodeId);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   148
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   149
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   150
					nodeId, /*UNS8 nodeId*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   151
					0x1800, /*UNS16 index*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   152
					0x02, /*UNS8 subindex*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   153
					1, /*UNS8 count*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   154
					0, /*UNS8 dataType*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   155
					&Transmission_Type,/*void *data*/
664
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   156
					CheckSDOAndContinue, /*SDOCallback_t Callback*/
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   157
                    0); /* use block mode */
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   158
		}			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   159
		break;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   160
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   161
		case 3: 
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   162
		{	/*re-enable Slave's TPDO 1 */
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   163
			UNS32 TPDO_COBId = 0x00000180 + nodeId;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   164
			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   165
			eprintf("Master : re-enable slave %2.2x TPDO 1\n", nodeId);
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   166
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   167
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   168
					nodeId, /*UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   169
					0x1800, /*UNS16 index*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   170
					0x01, /*UNS8 subindex*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   171
					4, /*UNS8 count*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   172
					0, /*UNS8 dataType*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   173
					&TPDO_COBId,/*void *data*/
664
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   174
					CheckSDOAndContinue, /*SDOCallback_t Callback*/
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   175
                    0); /* use block mode */
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   176
		}			
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   177
		break;
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   178
					
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   179
		case 4: 
335
6052c980c3af fix some wrong comments in TestMasterMicroMod.c
greg
parents: 331
diff changeset
   180
		{	/*disable Slave's RPDO 1 */
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   181
			UNS32 TPDO_COBId = 0x80000200 + nodeId;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   182
			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   183
			eprintf("Master : disable slave %2.2x RPDO 1\n", nodeId);
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   184
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   185
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   186
					nodeId, /*UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   187
					0x1400, /*UNS16 index*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   188
					0x01, /*UNS8 subindex*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   189
					4, /*UNS8 count*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   190
					0, /*UNS8 dataType*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   191
					&TPDO_COBId,/*void *data*/
664
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   192
					CheckSDOAndContinue, /*SDOCallback_t Callback*/
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   193
                    0); /* use block mode */
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   194
		}			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   195
		break;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   196
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   197
					
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   198
		case 5:
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   199
		{	
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   200
			UNS8 Transmission_Type = 0x01;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   201
			
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   202
			eprintf("Master : set slave %2.2x RPDO 1 receive type\n", nodeId);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   203
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   204
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   205
					nodeId, /*UNS8 nodeId*/
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   206
					0x1400, /*UNS16 index*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   207
					0x02, /*UNS8 subindex*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   208
					1, /*UNS8 count*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   209
					0, /*UNS8 dataType*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   210
					&Transmission_Type,/*void *data*/
664
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   211
					CheckSDOAndContinue, /*SDOCallback_t Callback*/
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   212
                    0); /* use block mode */
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   213
		}	
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   214
		break;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   215
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   216
		case 6: 
335
6052c980c3af fix some wrong comments in TestMasterMicroMod.c
greg
parents: 331
diff changeset
   217
		{	/*re-enable Slave's RPDO 1 */
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   218
			UNS32 TPDO_COBId = 0x00000200 + nodeId;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   219
			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   220
			eprintf("Master : re-enable %2.2x RPDO 1\n", nodeId);
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   221
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   222
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   223
					nodeId, /*UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   224
					0x1400, /*UNS16 index*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   225
					0x01, /*UNS8 subindex*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   226
					4, /*UNS8 count*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   227
					0, /*UNS8 dataType*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   228
					&TPDO_COBId,/*void *data*/
664
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   229
					CheckSDOAndContinue, /*SDOCallback_t Callback*/
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   230
                    0); /* use block mode */
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   231
		}			
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   232
		break;
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   233
		
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   234
		case 7:	
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   235
		{
335
6052c980c3af fix some wrong comments in TestMasterMicroMod.c
greg
parents: 331
diff changeset
   236
			/*set the heartbeat Producer Time*/
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   237
			UNS16 Heartbeat_Producer_Time = 0x03E8; 
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   238
			eprintf("Master : set slave %2.2x heartbeat producer time \n", nodeId);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   239
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   240
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   241
					nodeId, /*UNS8 nodeId*/
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   242
					0x1017, /*UNS16 index*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   243
					0x00, /*UNS8 subindex*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   244
					2, /*UNS8 count*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   245
					0, /*UNS8 dataType*/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   246
					&Heartbeat_Producer_Time,/*void *data*/
664
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   247
					CheckSDOAndContinue, /*SDOCallback_t Callback*/
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   248
                    0); /* use block mode */
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   249
		}			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   250
		break;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   251
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   252
		case 8: 
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   253
		{	/*disable Slave's TPDO 2 */
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   254
			UNS32 TPDO_COBId = 0x80000280 + nodeId;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   255
			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   256
			eprintf("Master : disable slave %2.2x TPDO 2 \n", nodeId);
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   257
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   258
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   259
					nodeId, /*UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   260
					0x1801, /*UNS16 index*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   261
					0x01, /*UNS8 subindex*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   262
					4, /*UNS8 count*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   263
					0, /*UNS8 dataType*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   264
					&TPDO_COBId,/*void *data*/
664
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   265
					CheckSDOAndContinue, /*SDOCallback_t Callback*/
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   266
                    0); /* use block mode */
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   267
		}			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   268
		break;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   269
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   270
		case 9: 
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   271
		{	/*disable Slave's TPDO 3 */
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   272
			UNS32 TPDO_COBId = 0x80000380 + nodeId;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   273
			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   274
			eprintf("Master : disable slave %2.2x TPDO 3 \n", nodeId);
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   275
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   276
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   277
					nodeId, /*UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   278
					0x1802, /*UNS16 index*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   279
					0x01, /*UNS8 subindex*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   280
					4, /*UNS8 count*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   281
					0, /*UNS8 dataType*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   282
					&TPDO_COBId,/*void *data*/
664
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   283
					CheckSDOAndContinue, /*SDOCallback_t Callback*/
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   284
                    0); /* use block mode */
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   285
		}
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   286
		break;			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   287
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   288
		case 10: 
335
6052c980c3af fix some wrong comments in TestMasterMicroMod.c
greg
parents: 331
diff changeset
   289
		{	/*disable Slave's TPDO 4 */
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   290
			UNS32 TPDO_COBId = 0x80000480 + nodeId;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   291
			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   292
			eprintf("Master : disable slave %2.2x TPDO 4 \n", nodeId);
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   293
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   294
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   295
					nodeId, /*UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   296
					0x1803, /*UNS16 index*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   297
					0x01, /*UNS8 subindex*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   298
					4, /*UNS8 count*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   299
					0, /*UNS8 dataType*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   300
					&TPDO_COBId,/*void *data*/
664
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   301
					CheckSDOAndContinue, /*SDOCallback_t Callback*/
a03f0aa7d219 CHANGE: SDO block mode added, without CRC support
fbeaulier
parents: 540
diff changeset
   302
                    0); /* use block mode */
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   303
		}			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   304
		break;			
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   305
		
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   306
		case 11:
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   307
			/* Put the master in operational mode */
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   308
			setState(d, Operational);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   309
			  
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   310
			/* Ask slave node to go in operational mode */
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   311
			masterSendNMTstateChange (d, nodeId, NMT_Start_Node);
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   312
	}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   313
			
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   314
}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   315
378
d2abf6c8c27b As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents: 335
diff changeset
   316
void TestMaster_preOperational(CO_Data* d)
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   317
{
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   318
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   319
	eprintf("TestMaster_preOperational\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   320
	ConfigureSlaveNode(&TestMaster_Data, slavenodeid);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   321
	
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   322
}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   323
378
d2abf6c8c27b As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents: 335
diff changeset
   324
void TestMaster_operational(CO_Data* d)
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   325
{
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   326
	eprintf("TestMaster_operational\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   327
}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   328
378
d2abf6c8c27b As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents: 335
diff changeset
   329
void TestMaster_stopped(CO_Data* d)
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   330
{
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   331
	eprintf("TestMaster_stopped\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   332
}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   333
378
d2abf6c8c27b As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents: 335
diff changeset
   334
void TestMaster_post_sync(CO_Data* d)
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   335
{
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   336
	DO++;
201
2966cd34162a Boolean variable mapped in PDO
greg
parents: 191
diff changeset
   337
	eprintf("MicroMod Digital Out: %2.2x\n",DO);
2966cd34162a Boolean variable mapped in PDO
greg
parents: 191
diff changeset
   338
	eprintf("MicroMod Digital In (by bit): DI1: %2.2x DI2: %2.2x DI3: %2.2x DI4: %2.2x DI5: %2.2x DI6: %2.2x DI7: %2.2x DI8: %2.2x\n",DI1,DI2,DI3,DI4,DI5,DI6,DI7,DI8);
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   339
}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   340
378
d2abf6c8c27b As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents: 335
diff changeset
   341
void TestMaster_post_TPDO(CO_Data* d)
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   342
{
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   343
//	eprintf("TestMaster_post_TPDO\n");	
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   344
}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   345
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   346
//s_BOARD SlaveBoard = {"0", "500K"};
331
da55aa2f9e64 Minor changes, mostly PCAN/windows related.
etisserant
parents: 201
diff changeset
   347
s_BOARD MasterBoard = {"0", "125K"};
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   348
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   349
#if !defined(WIN32) || defined(__CYGWIN__)
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   350
void catch_signal(int sig)
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   351
{
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   352
  signal(SIGTERM, catch_signal);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   353
  signal(SIGINT, catch_signal);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   354
  
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   355
  eprintf("Got Signal %d\n",sig);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   356
}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   357
#endif
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   358
454
bc000083297a - add RTAI support
greg
parents: 378
diff changeset
   359
void help(void)
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   360
{
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   361
  printf("**************************************************************\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   362
  printf("*  TestMasterMicroMod                                        *\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   363
  printf("*                                                            *\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   364
  printf("*  A simple example for PC.                                  *\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   365
  printf("*  A CanOpen master that control a MicroMod module:          *\n");
180
9f7c60315168 Update help text.
greg
parents: 175
diff changeset
   366
  printf("*  - setup module TPDO 1 transmit type                       *\n");
9f7c60315168 Update help text.
greg
parents: 175
diff changeset
   367
  printf("*  - setup module RPDO 1 transmit type                       *\n");
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   368
  printf("*  - setup module hearbeatbeat period                        *\n");
180
9f7c60315168 Update help text.
greg
parents: 175
diff changeset
   369
  printf("*  - disable others TPDOs                                    *\n");
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   370
  printf("*  - set state to operational                                *\n");
180
9f7c60315168 Update help text.
greg
parents: 175
diff changeset
   371
  printf("*  - send periodic SYNC                                      *\n");
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   372
  printf("*  - send periodic RPDO 1 to Micromod (digital output)       *\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   373
  printf("*  - listen Micromod's TPDO 1 (digital input)                *\n");
201
2966cd34162a Boolean variable mapped in PDO
greg
parents: 191
diff changeset
   374
  printf("*  - Mapping RPDO 1 bit per bit (digital input)              *\n");
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   375
  printf("*                                                            *\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   376
  printf("*   Usage:                                                   *\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   377
  printf("*   ./TestMasterMicroMod  [OPTIONS]                          *\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   378
  printf("*                                                            *\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   379
  printf("*   OPTIONS:                                                 *\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   380
  printf("*     -l : Can library [\"libcanfestival_can_virtual.so\"]     *\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   381
  printf("*                                                            *\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   382
  printf("*    Slave:                                                  *\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   383
  printf("*     -i : Slave Node id format [0x01 , 0x7F]                *\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   384
  printf("*                                                            *\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   385
  printf("*    Master:                                                 *\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   386
  printf("*     -m : bus name [\"1\"]                                    *\n");
169
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   387
  printf("*     -M : 1M,500K,250K,125K,100K,50K,20K,10K                *\n");
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   388
  printf("*                                                            *\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   389
  printf("**************************************************************\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   390
}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   391
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   392
/***************************  INIT  *****************************************/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   393
void InitNodes(CO_Data* d, UNS32 id)
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   394
{
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   395
	/****************************** INITIALISATION MASTER *******************************/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   396
	if(MasterBoard.baudrate){
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   397
		/* Defining the node Id */
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   398
		setNodeId(&TestMaster_Data, 0x01);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   399
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   400
		/* init */
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   401
		setState(&TestMaster_Data, Initialisation);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   402
	}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   403
}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   404
454
bc000083297a - add RTAI support
greg
parents: 378
diff changeset
   405
/***************************  EXIT  *****************************************/
bc000083297a - add RTAI support
greg
parents: 378
diff changeset
   406
void Exit(CO_Data* d, UNS32 id)
bc000083297a - add RTAI support
greg
parents: 378
diff changeset
   407
{
465
2ef560acfa86 fix bug in exit function
greg
parents: 454
diff changeset
   408
	if(strcmp(MasterBoard.baudrate, "none")){
2ef560acfa86 fix bug in exit function
greg
parents: 454
diff changeset
   409
		masterSendNMTstateChange(&TestMaster_Data, 0x02, NMT_Reset_Node);
454
bc000083297a - add RTAI support
greg
parents: 378
diff changeset
   410
    
465
2ef560acfa86 fix bug in exit function
greg
parents: 454
diff changeset
   411
    	//Stop master
2ef560acfa86 fix bug in exit function
greg
parents: 454
diff changeset
   412
		setState(&TestMaster_Data, Stopped);
2ef560acfa86 fix bug in exit function
greg
parents: 454
diff changeset
   413
	}
454
bc000083297a - add RTAI support
greg
parents: 378
diff changeset
   414
}
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   415
/****************************************************************************/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   416
/***************************  MAIN  *****************************************/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   417
/****************************************************************************/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   418
int main(int argc,char **argv)
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   419
{
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   420
191
1e6e3d261b8f CleanUp and minor fixes
etisserant
parents: 180
diff changeset
   421
  int c;
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   422
  extern char *optarg;
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   423
  char* LibraryPath="libcanfestival_can_virtual.so";
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   424
  char *snodeid;
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   425
  while ((c = getopt(argc, argv, "-m:s:M:S:l:i:")) != EOF)
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   426
  {
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   427
    switch(c)
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   428
    {
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   429
      case 'm' :
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   430
        if (optarg[0] == 0)
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   431
        {
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   432
          help();
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   433
          exit(1);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   434
        }
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   435
        MasterBoard.busname = optarg;
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   436
        break;
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   437
      case 'M' :
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   438
        if (optarg[0] == 0)
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   439
        {
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   440
          help();
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   441
          exit(1);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   442
        }
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   443
        MasterBoard.baudrate = optarg;
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   444
        break;
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   445
      case 'l' :
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   446
        if (optarg[0] == 0)
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   447
        {
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   448
          help();
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   449
          exit(1);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   450
        }
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   451
        LibraryPath = optarg;
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   452
        break;
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   453
      case 'i' :
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   454
        if (optarg[0] == 0)
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   455
        {
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   456
          help();
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   457
          exit(1);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   458
        }
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   459
        snodeid = optarg;
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   460
		sscanf(snodeid,"%x",&slavenodeid);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   461
        break;
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   462
      default:
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   463
        help();
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   464
        exit(1);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   465
    }
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   466
  }
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   467
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   468
#if !defined(WIN32) || defined(__CYGWIN__)
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   469
  /* install signal handler for manual break */
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   470
	signal(SIGTERM, catch_signal);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   471
	signal(SIGINT, catch_signal);
454
bc000083297a - add RTAI support
greg
parents: 378
diff changeset
   472
	TimerInit();
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   473
#endif
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   474
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   475
#ifndef NOT_USE_DYNAMIC_LOADING
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   476
	LoadCanDriver(LibraryPath);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   477
#endif		
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   478
169
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   479
	TestMaster_Data.heartbeatError = TestMaster_heartbeatError;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   480
	TestMaster_Data.initialisation = TestMaster_initialisation;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   481
	TestMaster_Data.preOperational = TestMaster_preOperational;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   482
	TestMaster_Data.operational = TestMaster_operational;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   483
	TestMaster_Data.stopped = TestMaster_stopped;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   484
	TestMaster_Data.post_sync = TestMaster_post_sync;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   485
	TestMaster_Data.post_TPDO = TestMaster_post_TPDO;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   486
	
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   487
	if(!canOpen(&MasterBoard,&TestMaster_Data)){
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   488
		eprintf("Cannot open Master Board\n");
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   489
		goto fail_master;
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   490
	}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   491
	
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   492
	// Start timer thread
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   493
	StartTimerLoop(&InitNodes);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   494
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   495
	// wait Ctrl-C
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   496
	pause();
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   497
	eprintf("Finishing.\n");
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   498
	
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   499
	// Stop timer thread
454
bc000083297a - add RTAI support
greg
parents: 378
diff changeset
   500
	StopTimerLoop(&Exit);
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   501
	
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   502
fail_master:
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   503
	if(MasterBoard.baudrate) canClose(&TestMaster_Data);	
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   504
454
bc000083297a - add RTAI support
greg
parents: 378
diff changeset
   505
  TimerCleanup();
166
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   506
  return 0;
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   507
}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   508
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   509