examples/TestMasterMicroMod/TestMasterMicroMod.c
author etisserant
Fri, 01 Feb 2008 18:01:05 +0100
changeset 376 b082ffeef254
parent 335 6052c980c3af
child 378 d2abf6c8c27b
permissions -rw-r--r--
little fix on arch detection when using mingw32-only compiler from within cygwin's bash
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"
331
da55aa2f9e64 Minor changes, mostly PCAN/windows related.
etisserant
parents: 201
diff changeset
    41
UNS8 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
/*****************************************************************************/
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: 
335
6052c980c3af fix some wrong comments in TestMasterMicroMod.c
greg
parents: 331
diff changeset
   177
		{	/*disable Slave's RPDO 1 */
173
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: 
335
6052c980c3af fix some wrong comments in TestMasterMicroMod.c
greg
parents: 331
diff changeset
   212
		{	/*re-enable Slave's RPDO 1 */
173
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
		{
335
6052c980c3af fix some wrong comments in TestMasterMicroMod.c
greg
parents: 331
diff changeset
   230
			/*set the heartbeat Producer Time*/
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   231
			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
   232
			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
   233
			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
   234
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   235
					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
   236
					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
   237
					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
   238
					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
   239
					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
   240
					&Heartbeat_Producer_Time,/*void *data*/
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   241
					CheckSDOAndContinue); /*SDOCallback_t Callback*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   242
		}			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   243
		break;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   244
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   245
		case 8: 
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   246
		{	/*disable Slave's TPDO 2 */
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   247
			UNS32 TPDO_COBId = 0x80000280 + nodeId;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   248
			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   249
			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
   250
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   251
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   252
					nodeId, /*UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   253
					0x1801, /*UNS16 index*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   254
					0x01, /*UNS8 subindex*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   255
					4, /*UNS8 count*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   256
					0, /*UNS8 dataType*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   257
					&TPDO_COBId,/*void *data*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   258
					CheckSDOAndContinue); /*SDOCallback_t Callback*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   259
		}			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   260
		break;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   261
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   262
		case 9: 
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   263
		{	/*disable Slave's TPDO 3 */
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   264
			UNS32 TPDO_COBId = 0x80000380 + nodeId;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   265
			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   266
			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
   267
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   268
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   269
					nodeId, /*UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   270
					0x1802, /*UNS16 index*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   271
					0x01, /*UNS8 subindex*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   272
					4, /*UNS8 count*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   273
					0, /*UNS8 dataType*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   274
					&TPDO_COBId,/*void *data*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   275
					CheckSDOAndContinue); /*SDOCallback_t Callback*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   276
		}
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   277
		break;			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   278
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   279
		case 10: 
335
6052c980c3af fix some wrong comments in TestMasterMicroMod.c
greg
parents: 331
diff changeset
   280
		{	/*disable Slave's TPDO 4 */
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   281
			UNS32 TPDO_COBId = 0x80000480 + nodeId;
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   282
			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   283
			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
   284
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   285
					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   286
					nodeId, /*UNS8 nodeId*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   287
					0x1803, /*UNS16 index*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   288
					0x01, /*UNS8 subindex*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   289
					4, /*UNS8 count*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   290
					0, /*UNS8 dataType*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   291
					&TPDO_COBId,/*void *data*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   292
					CheckSDOAndContinue); /*SDOCallback_t Callback*/
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   293
		}			
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   294
		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
   295
		
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   296
		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
   297
			/* 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
   298
			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
   299
			  
b6fbc1c59a44 Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
diff changeset
   300
			/* Ask slave node to go in operational mode */
173
d776314a1efc Set PDO transmit time according to ESA perceptionof CanOpen
etisserant
parents: 172
diff changeset
   301
			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
   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
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
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
   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
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
	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
   310
	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
   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
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
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
   315
{
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
	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
   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
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
   320
{
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
	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
   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
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
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
   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
	DO++;
201
2966cd34162a Boolean variable mapped in PDO
greg
parents: 191
diff changeset
   327
	eprintf("MicroMod Digital Out: %2.2x\n",DO);
2966cd34162a Boolean variable mapped in PDO
greg
parents: 191
diff changeset
   328
	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
   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
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
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
   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
//	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
   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
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 SlaveBoard = {"0", "500K"};
331
da55aa2f9e64 Minor changes, mostly PCAN/windows related.
etisserant
parents: 201
diff changeset
   337
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
   338
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
#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
   340
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
   341
{
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(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
   343
  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
   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
  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
   346
}
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
#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
   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
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
   350
{
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("**************************************************************\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("*  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
   353
  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
   354
  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
   355
  printf("*  A CanOpen master that control a MicroMod module:          *\n");
180
9f7c60315168 Update help text.
greg
parents: 175
diff changeset
   356
  printf("*  - setup module TPDO 1 transmit type                       *\n");
9f7c60315168 Update help text.
greg
parents: 175
diff changeset
   357
  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
   358
  printf("*  - setup module hearbeatbeat period                        *\n");
180
9f7c60315168 Update help text.
greg
parents: 175
diff changeset
   359
  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
   360
  printf("*  - set state to operational                                *\n");
180
9f7c60315168 Update help text.
greg
parents: 175
diff changeset
   361
  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
   362
  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
   363
  printf("*  - listen Micromod's TPDO 1 (digital input)                *\n");
201
2966cd34162a Boolean variable mapped in PDO
greg
parents: 191
diff changeset
   364
  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
   365
  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
   366
  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
   367
  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
   368
  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
   369
  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
   370
  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
   371
  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
   372
  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
   373
  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
   374
  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
   375
  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
   376
  printf("*     -m : bus name [\"1\"]                                    *\n");
169
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   377
  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
   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("**************************************************************\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
}
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
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
/***************************  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
   383
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
   384
{
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
	/****************************** 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
   386
	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
   387
		/* 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
   388
		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
   389
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
		/* 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
   391
		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
   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
/****************************************************************************/
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
/***************************  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
   397
/****************************************************************************/
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
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
   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
191
1e6e3d261b8f CleanUp and minor fixes
etisserant
parents: 180
diff changeset
   401
  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
   402
  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
   403
  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
   404
  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
   405
  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
   406
  {
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
    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
   408
    {
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
      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
   410
        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
   411
        {
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
          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
   413
          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
   414
        }
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
        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
   416
        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
   417
      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
   418
        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
   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
          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
   421
          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
   422
        }
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
        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
   424
        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
   425
      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
   426
        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
   427
        {
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
          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
   429
          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
   430
        }
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
        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
   432
        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
   433
      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
   434
        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
   435
        {
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
          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
   437
          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
   438
        }
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
        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
   440
		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
   441
        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
   442
      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
   443
        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
   444
        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
   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
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
#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
   449
  /* 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
   450
	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
   451
	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
   452
#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
   453
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
#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
   455
	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
   456
#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
   457
169
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   458
	TestMaster_Data.heartbeatError = TestMaster_heartbeatError;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   459
	TestMaster_Data.initialisation = TestMaster_initialisation;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   460
	TestMaster_Data.preOperational = TestMaster_preOperational;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   461
	TestMaster_Data.operational = TestMaster_operational;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   462
	TestMaster_Data.stopped = TestMaster_stopped;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   463
	TestMaster_Data.post_sync = TestMaster_post_sync;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   464
	TestMaster_Data.post_TPDO = TestMaster_post_TPDO;
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   465
	
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   466
	if(!canOpen(&MasterBoard,&TestMaster_Data)){
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   467
		eprintf("Cannot open Master Board\n");
90c0a676e631 Removed compilation warnings with some GCC. + Fixed test for baudrate = none
etisserant
parents: 166
diff changeset
   468
		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
   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
	
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
	// 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
   472
	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
   473
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
	// 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
   475
	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
   476
	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
   477
	
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
	// 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
   479
	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
   480
	
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
	// 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
   482
	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
   483
	
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
	// 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
   485
	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
   486
	
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
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
   488
	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
   489
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
  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
   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
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