examples/TestMasterMicroMod/TestMasterMicroMod.c
author leonid
Wed, 08 Aug 2007 01:43:02 +0200
changeset 252 b0dd37421d28
parent 201 2966cd34162a
child 331 da55aa2f9e64
permissions -rw-r--r--
*** empty log message ***
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"
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    41
UNS8 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
    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
/*****************************************************************************/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    45
void TestMaster_heartbeatError(UNS8 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
    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
 ********************************************************/
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    55
void TestMaster_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
    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;
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
    59
	UNS8 size = sizeof(UNS32); 
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
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
    85
static init_step = 0;
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*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   138
					CheckSDOAndContinue); /*SDOCallback_t Callback*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   139
		}			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   140
		break;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   141
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   142
		case 2: 
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   143
		{	/*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
   144
			UNS8 Transmission_Type = 0x01;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   145
			
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
   146
			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
   147
			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
   148
					/**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
   149
					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
   150
					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
   151
					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
   152
					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
   153
					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
   154
					&Transmission_Type,/*void *data*/
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   155
					CheckSDOAndContinue); /*SDOCallback_t Callback*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   156
		}			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   157
		break;
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
		case 3: 
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   160
		{	/*re-enable Slave's TPDO 1 */
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   161
			UNS32 TPDO_COBId = 0x00000180 + nodeId;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   162
			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   163
			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
   164
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   165
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   166
					nodeId, /*UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   167
					0x1800, /*UNS16 index*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   168
					0x01, /*UNS8 subindex*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   169
					4, /*UNS8 count*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   170
					0, /*UNS8 dataType*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   171
					&TPDO_COBId,/*void *data*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   172
					CheckSDOAndContinue); /*SDOCallback_t Callback*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   173
		}			
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
   174
		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
   175
					
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   176
		case 4: 
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   177
		{	/*disable Slave's TPDO 2 */
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   178
			UNS32 TPDO_COBId = 0x80000200 + nodeId;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   179
			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   180
			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
   181
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   182
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   183
					nodeId, /*UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   184
					0x1400, /*UNS16 index*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   185
					0x01, /*UNS8 subindex*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   186
					4, /*UNS8 count*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   187
					0, /*UNS8 dataType*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   188
					&TPDO_COBId,/*void *data*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   189
					CheckSDOAndContinue); /*SDOCallback_t Callback*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   190
		}			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   191
		break;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   192
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
   193
					
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   194
		case 5:
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   195
		{	
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   196
			UNS8 Transmission_Type = 0x01;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   197
			
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
   198
			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
   199
			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
   200
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   201
					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
   202
					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
   203
					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
   204
					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
   205
					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
   206
					&Transmission_Type,/*void *data*/
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   207
					CheckSDOAndContinue); /*SDOCallback_t Callback*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   208
		}	
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   209
		break;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   210
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   211
		case 6: 
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   212
		{	/*re-enable Slave's TPDO 1 */
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   213
			UNS32 TPDO_COBId = 0x00000200 + nodeId;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   214
			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   215
			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
   216
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   217
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   218
					nodeId, /*UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   219
					0x1400, /*UNS16 index*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   220
					0x01, /*UNS8 subindex*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   221
					4, /*UNS8 count*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   222
					0, /*UNS8 dataType*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   223
					&TPDO_COBId,/*void *data*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   224
					CheckSDOAndContinue); /*SDOCallback_t Callback*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   225
		}			
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
   226
		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
   227
		
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   228
		case 7:	
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   229
		{
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   230
			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
   231
			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
   232
			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
   233
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   234
					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
   235
					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
   236
					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
   237
					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
   238
					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
   239
					&Heartbeat_Producer_Time,/*void *data*/
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   240
					CheckSDOAndContinue); /*SDOCallback_t Callback*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   241
		}			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   242
		break;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   243
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   244
		case 8: 
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   245
		{	/*disable Slave's TPDO 2 */
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   246
			UNS32 TPDO_COBId = 0x80000280 + nodeId;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   247
			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   248
			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
   249
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   250
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   251
					nodeId, /*UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   252
					0x1801, /*UNS16 index*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   253
					0x01, /*UNS8 subindex*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   254
					4, /*UNS8 count*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   255
					0, /*UNS8 dataType*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   256
					&TPDO_COBId,/*void *data*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   257
					CheckSDOAndContinue); /*SDOCallback_t Callback*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   258
		}			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   259
		break;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   260
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   261
		case 9: 
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   262
		{	/*disable Slave's TPDO 3 */
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   263
			UNS32 TPDO_COBId = 0x80000380 + nodeId;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   264
			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   265
			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
   266
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   267
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   268
					nodeId, /*UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   269
					0x1802, /*UNS16 index*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   270
					0x01, /*UNS8 subindex*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   271
					4, /*UNS8 count*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   272
					0, /*UNS8 dataType*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   273
					&TPDO_COBId,/*void *data*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   274
					CheckSDOAndContinue); /*SDOCallback_t Callback*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   275
		}
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   276
		break;			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   277
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   278
		case 10: 
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   279
		{	/*disable Slave's TPDO 2 */
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   280
			UNS32 TPDO_COBId = 0x80000480 + nodeId;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   281
			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   282
			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
   283
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   284
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   285
					nodeId, /*UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   286
					0x1803, /*UNS16 index*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   287
					0x01, /*UNS8 subindex*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   288
					4, /*UNS8 count*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   289
					0, /*UNS8 dataType*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   290
					&TPDO_COBId,/*void *data*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   291
					CheckSDOAndContinue); /*SDOCallback_t Callback*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   292
		}			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   293
		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
   294
		
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   295
		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
   296
			/* 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
   297
			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
   298
			  
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   299
			/* Ask slave node to go in operational mode */
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   300
			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
   301
	}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   302
			
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   303
}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   304
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
void 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
   306
{
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
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
	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
   309
	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
   310
	
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   311
}
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
void TestMaster_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
   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
	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
   316
}
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
void TestMaster_stopped()
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
{
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
	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
   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
void TestMaster_post_sync()
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   324
{
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
	DO++;
201
2966cd34162a Boolean variable mapped in PDO
greg
parents: 191
diff changeset
   326
	eprintf("MicroMod Digital Out: %2.2x\n",DO);
2966cd34162a Boolean variable mapped in PDO
greg
parents: 191
diff changeset
   327
	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
   328
}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   329
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
void TestMaster_post_TPDO()
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
{
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
//	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
   333
}
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   334
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
//s_BOARD SlaveBoard = {"0", "500K"};
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
s_BOARD MasterBoard = {"32", "125K"};
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   337
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   338
#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
   339
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
   340
{
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   341
  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
   342
  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
   343
  
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
  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
   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
#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
   347
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
void 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
   349
{
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
  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
   351
  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
   352
  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
   353
  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
   354
  printf("*  A CanOpen master that control a MicroMod module:          *\n");
180
9f7c60315168 Update help text.
greg
parents: 175
diff changeset
   355
  printf("*  - setup module TPDO 1 transmit type                       *\n");
9f7c60315168 Update help text.
greg
parents: 175
diff changeset
   356
  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
   357
  printf("*  - setup module hearbeatbeat period                        *\n");
180
9f7c60315168 Update help text.
greg
parents: 175
diff changeset
   358
  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
   359
  printf("*  - set state to operational                                *\n");
180
9f7c60315168 Update help text.
greg
parents: 175
diff changeset
   360
  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
   361
  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
   362
  printf("*  - listen Micromod's TPDO 1 (digital input)                *\n");
201
2966cd34162a Boolean variable mapped in PDO
greg
parents: 191
diff changeset
   363
  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
   364
  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
   365
  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
   366
  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
   367
  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
   368
  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
   369
  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
   370
  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
   371
  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
   372
  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
   373
  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
   374
  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
   375
  printf("*     -m : bus name [\"1\"]                                    *\n");
169
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   376
  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
   377
  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
   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
}
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
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
/***************************  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
   382
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
   383
{
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
	/****************************** 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
   385
	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
   386
		/* 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
   387
		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
   388
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
		/* 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
   390
		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
   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
}
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
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
/***************************  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
   396
/****************************************************************************/
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
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
   398
{
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
191
1e6e3d261b8f CleanUp and minor fixes
etisserant
parents: 180
diff changeset
   400
  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
   401
  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
   402
  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
   403
  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
   404
  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
   405
  {
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   406
    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
   407
    {
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   408
      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
   409
        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
   410
        {
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   411
          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
   412
          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
   413
        }
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   414
        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
   415
        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
   416
      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
   417
        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
   418
        {
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
          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
   420
          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
   421
        }
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
        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
   423
        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
   424
      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
   425
        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
   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
          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
   428
          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
   429
        }
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
        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
   431
        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
   432
      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
   433
        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
   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
          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
   436
          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
   437
        }
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
        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
   439
		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
   440
        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
   441
      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
   442
        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
   443
        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
   444
    }
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
  }
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
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
#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
   448
  /* 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
   449
	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
   450
	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
   451
#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
   452
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
#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
   454
	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
   455
#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
   456
169
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   457
	TestMaster_Data.heartbeatError = TestMaster_heartbeatError;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   458
	TestMaster_Data.initialisation = TestMaster_initialisation;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   459
	TestMaster_Data.preOperational = TestMaster_preOperational;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   460
	TestMaster_Data.operational = TestMaster_operational;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   461
	TestMaster_Data.stopped = TestMaster_stopped;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   462
	TestMaster_Data.post_sync = TestMaster_post_sync;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   463
	TestMaster_Data.post_TPDO = TestMaster_post_TPDO;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   464
	
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   465
	if(!canOpen(&MasterBoard,&TestMaster_Data)){
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   466
		eprintf("Cannot open Master Board\n");
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   467
		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
   468
	}
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
	
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
	// 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
   471
	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
   472
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
	// 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
   474
	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
   475
	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
   476
	
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
	// Reset the slave node for next use (will stop emitting heartbeat)
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
	masterSendNMTstateChange (&TestMaster_Data, slavenodeid, NMT_Reset_Node);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   479
	
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   480
	// Stop 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
   481
	setState(&TestMaster_Data, Stopped);
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   482
	
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   483
	// Stop 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
   484
	StopTimerLoop();
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   485
	
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   486
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
   487
	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
   488
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   489
  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
   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