examples/TestMasterSlave/Master.c
author groke6
Thu, 17 Jan 2008 16:24:01 +0100
changeset 362 1134fc19aa74
parent 349 1e6dd4ef46b9
child 378 d2abf6c8c27b
permissions -rw-r--r--
Added FastScan support to the LSS services.
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     1
/*
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     2
This file is part of CanFestival, a library implementing CanOpen Stack. 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     3
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     4
Copyright (C): Edouard TISSERANT and Francis DUPIN
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     5
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     6
See COPYING file for copyrights details.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     7
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     8
This library is free software; you can redistribute it and/or
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     9
modify it under the terms of the GNU Lesser General Public
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    10
License as published by the Free Software Foundation; either
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    11
version 2.1 of the License, or (at your option) any later version.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    12
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    13
This library is distributed in the hope that it will be useful,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    14
but WITHOUT ANY WARRANTY; without even the implied warranty of
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    16
Lesser General Public License for more details.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    17
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    18
You should have received a copy of the GNU Lesser General Public
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    19
License along with this library; if not, write to the Free Software
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    21
*/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    22
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    23
#include "Master.h"
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    24
#include "Slave.h"
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    25
#include "TestMasterSlave.h"
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    26
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    27
/*****************************************************************************/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    28
void TestMaster_heartbeatError(UNS8 heartbeatID)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    29
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    30
	eprintf("TestMaster_heartbeatError %d\n", heartbeatID);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    31
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    32
154
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    33
/********************************************************
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    34
 * ConfigureSlaveNode is responsible to
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    35
 *  - setup master RPDO 1 to receive TPDO 1 from id 2
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    36
 *  - setup master RPDO 2 to receive TPDO 2 from id 2
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    37
 ********************************************************/
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    38
void TestMaster_initialisation()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    39
{
154
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    40
	UNS32 PDO1_COBID = 0x0182; 
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    41
	UNS32 PDO2_COBID = 0x0282;
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    42
	UNS8 size = sizeof(UNS32); 
362
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
    43
	UNS32 SINC_cicle=0;
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
    44
	UNS8 data_type = 0;
179
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    45
	
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    46
	eprintf("TestMaster_initialisation\n");
154
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    47
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    48
	/*****************************************
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    49
	 * Define RPDOs to match slave ID=2 TPDOs*
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    50
	 *****************************************/
175
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 172
diff changeset
    51
	writeLocalDict( &TestMaster_Data, /*CO_Data* d*/
154
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    52
			0x1400, /*UNS16 index*/
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    53
			0x01, /*UNS8 subind*/ 
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    54
			&PDO1_COBID, /*void * pSourceData,*/ 
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    55
			&size, /* UNS8 * pExpectedSize*/
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    56
			RW);  /* UNS8 checkAccess */
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    57
			
175
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 172
diff changeset
    58
	writeLocalDict( &TestMaster_Data, /*CO_Data* d*/
154
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    59
			0x1401, /*UNS16 index*/
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    60
			0x01, /*UNS8 subind*/ 
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    61
			&PDO2_COBID, /*void * pSourceData,*/ 
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    62
			&size, /* UNS8 * pExpectedSize*/
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    63
			RW);  /* UNS8 checkAccess */
362
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
    64
			
154
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    65
}
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    66
179
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    67
// Step counts number of times ConfigureSlaveNode is called
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    68
static init_step = 0;
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    69
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    70
/*Froward declaration*/
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    71
static void ConfigureSlaveNode(CO_Data* d, UNS8 nodeId);
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    72
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    73
/**/
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    74
static void CheckSDOAndContinue(CO_Data* d, UNS8 nodeId)
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    75
{
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    76
	UNS32 abortCode;	
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    77
	if(getWriteResultNetworkDict (d, nodeId, &abortCode) != SDO_FINISHED)
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    78
		eprintf("Master : Failed in initializing slave %2.2x, step %d, AbortCode :%4.4x \n", nodeId, init_step, abortCode);
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    79
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    80
	/* Finalise last SDO transfer with this node */
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    81
	closeSDOtransfer(&TestMaster_Data, nodeId, SDO_CLIENT);
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    82
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    83
	ConfigureSlaveNode(d, nodeId);
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    84
}
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
    85
154
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    86
/********************************************************
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    87
 * ConfigureSlaveNode is responsible to
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    88
 *  - setup slave TPDO 1 transmit time
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    89
 *  - setup slave TPDO 2 transmit time
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    90
 *  - switch to operational mode
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    91
 *  - send NMT to slave
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    92
 ********************************************************
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    93
 * This an example of :
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    94
 * Network Dictionary Access (SDO) with Callback 
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    95
 * Slave node state change request (NMT) 
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    96
 ********************************************************
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    97
 * This is called first by TestMaster_preOperational
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    98
 * then it called again each time a SDO exchange is
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
    99
 * finished.
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   100
 ********************************************************/
179
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   101
 
154
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   102
static void ConfigureSlaveNode(CO_Data* d, UNS8 nodeId)
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   103
{
179
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   104
	/* Master configure heartbeat producer time at 1000 ms 
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   105
	 * for slave node-id 0x02 by DCF concise */
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   106
	 
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   107
	UNS8 Transmission_Type = 0x01;
154
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   108
	UNS32 abortCode;
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   109
	UNS8 res;
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   110
	eprintf("Master : ConfigureSlaveNode %2.2x\n", nodeId);
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   111
179
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   112
	switch(++init_step){
154
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   113
		case 1: /*First step : setup Slave's TPDO 1 to be transmitted on SYNC*/
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   114
			eprintf("Master : set slave %2.2x TPDO 1 transmit type\n", nodeId);
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   115
			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
179
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   116
					nodeId, /*UNS8 nodeId*/
154
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   117
					0x1800, /*UNS16 index*/
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   118
					0x02, /*UNS8 subindex*/
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   119
					1, /*UNS8 count*/
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   120
					0, /*UNS8 dataType*/
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   121
					&Transmission_Type,/*void *data*/
179
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   122
					CheckSDOAndContinue); /*SDOCallback_t Callback*/
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   123
					break;
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   124
		
154
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   125
		case 2:	/*Second step*/
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   126
			eprintf("Master : set slave %2.2x TPDO 2 transmit type\n", nodeId);
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   127
			writeNetworkDictCallBack (d, /*CO_Data* d*/
179
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   128
					nodeId, /*UNS8 nodeId*/
154
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   129
					0x1801, /*UNS16 index*/
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   130
					0x02, /*UNS16 index*/
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   131
					1, /*UNS8 count*/
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   132
					0, /*UNS8 dataType*/
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   133
					&Transmission_Type,/*void *data*/
179
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   134
					CheckSDOAndContinue); /*SDOCallback_t Callback*/
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   135
					break;
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   136
		case 3: 
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   137
		
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   138
		/****************************** START *******************************/
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   139
		
154
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   140
			/* Put the master in operational mode */
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   141
			setState(d, Operational);
179
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   142
		 
154
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   143
			/* Ask slave node to go in operational mode */
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   144
			masterSendNMTstateChange (d, nodeId, NMT_Start_Node);
179
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   145
			
154
1b3165f2d17d Implemented writeNetworkDictCallBack test in TestMasterSlave example. Fixed callback assignement race condition in sdo.c.
etisserant
parents: 149
diff changeset
   146
	}
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   147
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   148
343
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   149
#ifdef CO_ENABLE_LSS
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   150
static void ConfigureLSSNode(CO_Data* d);
362
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   151
// Step counts number of times ConfigureLSSNode is called
343
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   152
UNS8 init_step_LSS=1;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   153
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   154
static void CheckLSSAndContinue(CO_Data* d, UNS8 command)
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   155
{
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   156
	UNS32 dat1;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   157
	UNS8 dat2;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   158
	printf("CheckLSS->");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   159
	if(getConfigResultNetworkNode (d, command, &dat1, &dat2) != LSS_FINISHED){
362
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   160
		if(command==LSS_IDENT_REMOTE_NON_CONF){
343
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   161
			eprintf("Master : There are not no-configured slaves in the net\n", command);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   162
			return;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   163
		}
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   164
		else{
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   165
			eprintf("Master : Failed in LSS comand %d.  Trying again\n", command);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   166
		}
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   167
	}
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   168
	else
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   169
	{
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   170
		init_step_LSS++;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   171
	
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   172
		switch(command){
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   173
		case LSS_CONF_NODE_ID:
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   174
   			switch(dat1){
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   175
   				case 0: printf("Node ID change succesful\n");break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   176
   				case 1: printf("Node ID change error:out of range\n");break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   177
   				case 0xFF:printf("Node ID change error:specific error\n");break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   178
   				default:break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   179
   			}
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   180
   			break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   181
   		case LSS_CONF_BIT_TIMING:
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   182
   			switch(dat1){
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   183
   				case 0: printf("Baud rate change succesful\n");break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   184
   				case 1: printf("Baud rate change error: change baud rate not supported\n");break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   185
   				case 0xFF:printf("Baud rate change error:specific error\n");break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   186
   				default:break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   187
   			}
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   188
   			break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   189
   		case LSS_CONF_STORE:
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   190
   			switch(dat1){
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   191
   				case 0: printf("Store configuration succesful\n");break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   192
   				case 1: printf("Store configuration error:not supported\n");break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   193
   				case 0xFF:printf("Store configuration error:specific error\n");break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   194
   				default:break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   195
   			}
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   196
   			break;
362
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   197
		case LSS_SM_SELECTIVE_SERIAL:
343
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   198
   			printf("Slave in CONFIGURATION mode\n");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   199
   			break;
362
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   200
   		case LSS_IDENT_REMOTE_SERIAL_HIGH:
343
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   201
   			printf("node identified\n");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   202
   			break;
362
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   203
   		case LSS_IDENT_REMOTE_NON_CONF:
343
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   204
   			printf("non-configured remote slave in the net\n");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   205
   			break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   206
   		case LSS_INQ_VENDOR_ID:
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   207
   			printf("Slave VendorID %x\n", dat1);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   208
   			break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   209
   		case LSS_INQ_PRODUCT_CODE:
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   210
   			printf("Slave Product Code %x\n", dat1);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   211
   			break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   212
   		case LSS_INQ_REV_NUMBER:
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   213
   			printf("Slave Revision Number %x\n", dat1);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   214
   			break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   215
   		case LSS_INQ_SERIAL_NUMBER:
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   216
   			printf("Slave Serial Number %x\n", dat1);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   217
   			break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   218
   		case LSS_INQ_NODE_ID:
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   219
   			printf("Slave nodeid %x\n", dat1);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   220
   			break;
362
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   221
#ifdef CO_ENABLE_LSS_FS
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   222
   		case LSS_IDENT_FASTSCAN:
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   223
   			if(dat1==0)
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   224
   				printf("Slave node identified with FastScan\n");
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   225
   			else
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   226
   			{
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   227
   				printf("There is not unconfigured node in the net\n");
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   228
   				return;
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   229
   			}	
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   230
   			init_step_LSS++;
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   231
   			break;
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   232
#endif		
343
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   233
		}
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   234
	}
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   235
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   236
	printf("\n");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   237
	ConfigureLSSNode(d);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   238
}
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   239
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   240
362
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   241
/* First ask if there is a node with an invalid nodeID.
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   242
 * If FastScan is activated it is used to put the node in the state “configuration”.
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   243
 * If FastScan is not activated, identification services are used to identify the node.
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   244
 * Then  switch mode service is used to put it in configuration state.
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   245
 * Next all the inquire and configuration services are used.
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   246
 * Finally, the node LSS state is restored to “waiting” and all the process is repeated 
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   247
 * again until there isn't any node with a invalid nodeID.
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   248
 * */
343
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   249
static void ConfigureLSSNode(CO_Data* d)
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   250
{
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   251
	UNS32 Vendor_ID=0x12345678;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   252
	UNS32 Product_Code=0x90123456;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   253
	UNS32 Revision_Number=0x78901234;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   254
	UNS32 Serial_Number=0x56789012;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   255
	UNS32 Revision_Number_high=0x78901240;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   256
	UNS32 Revision_Number_low=0x78901230;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   257
	UNS32 Serial_Number_high=0x56789020;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   258
	UNS32 Serial_Number_low=0x56789010;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   259
	UNS8 NodeID=0x02;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   260
	UNS8 Baud_Table=0;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   261
	UNS8 Baud_BitTiming=3;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   262
	UNS16 Switch_delay=1;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   263
	UNS8 LSS_mode=LSS_WAITING_MODE;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   264
	UNS8 res;
362
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   265
	eprintf("ConfigureLSSNode -> ",0);
343
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   266
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   267
	switch(init_step_LSS){
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   268
		case 1:	/* LSS=>identify non-configured remote slave */
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   269
			eprintf("LSS=>identify non-configured remote slave\n");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   270
			res=configNetworkNodeCallBack(&TestMaster_Data,LSS_IDENT_REMOTE_NON_CONF,0,0,CheckLSSAndContinue);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   271
			break;
362
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   272
#ifdef CO_ENABLE_LSS_FS
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   273
		case 2:	/* LSS=>FastScan */
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   274
			eprintf("LSS=>FastScan\n");
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   275
			res=configNetworkNodeCallBack(&TestMaster_Data,LSS_IDENT_FASTSCAN,0,0,CheckLSSAndContinue);
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   276
			break;
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   277
#else
343
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   278
		case 2:	/* LSS=>identify node */
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   279
			eprintf("LSS=>identify node\n");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   280
			res=configNetworkNode(&TestMaster_Data,LSS_IDENT_REMOTE_VENDOR,&Vendor_ID,0);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   281
			res=configNetworkNode(&TestMaster_Data,LSS_IDENT_REMOTE_PRODUCT,&Product_Code,0);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   282
			res=configNetworkNode(&TestMaster_Data,LSS_IDENT_REMOTE_REV_LOW,&Revision_Number_low,0);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   283
			res=configNetworkNode(&TestMaster_Data,LSS_IDENT_REMOTE_REV_HIGH,&Revision_Number_high,0);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   284
			res=configNetworkNode(&TestMaster_Data,LSS_IDENT_REMOTE_SERIAL_LOW,&Serial_Number_low,0);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   285
			res=configNetworkNodeCallBack(&TestMaster_Data,LSS_IDENT_REMOTE_SERIAL_HIGH,&Serial_Number_high,0,CheckLSSAndContinue);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   286
			break;
362
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   287
		case 3: /*LSS=>put in configuration mode*/
343
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   288
			eprintf("LSS=>put in configuration mode\n");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   289
			res=configNetworkNode(&TestMaster_Data,LSS_SM_SELECTIVE_VENDOR,&Vendor_ID,0);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   290
			res=configNetworkNode(&TestMaster_Data,LSS_SM_SELECTIVE_PRODUCT,&Product_Code,0);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   291
			res=configNetworkNode(&TestMaster_Data,LSS_SM_SELECTIVE_REVISION,&Revision_Number,0);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   292
			res=configNetworkNodeCallBack(&TestMaster_Data,LSS_SM_SELECTIVE_SERIAL,&Serial_Number,0,CheckLSSAndContinue);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   293
			break;
362
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   294
#endif
343
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   295
		case 4:	/* LSS=>inquire nodeID */
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   296
			eprintf("LSS=>inquire nodeID\n");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   297
			res=configNetworkNodeCallBack(&TestMaster_Data,LSS_INQ_NODE_ID,0,0,CheckLSSAndContinue);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   298
			break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   299
		case 5:	/* LSS=>inquire VendorID */
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   300
			eprintf("LSS=>inquire VendorID\n");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   301
			res=configNetworkNodeCallBack(&TestMaster_Data,LSS_INQ_VENDOR_ID,0,0,CheckLSSAndContinue);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   302
			break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   303
		case 6:	/* LSS=>inquire Product code */
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   304
			eprintf("LSS=>inquire Product code\n");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   305
			res=configNetworkNodeCallBack(&TestMaster_Data,LSS_INQ_PRODUCT_CODE,0,0,CheckLSSAndContinue);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   306
			break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   307
		case 7:	/* LSS=>inquire Revision Number */
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   308
			eprintf("LSS=>inquire Revision Number\n");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   309
			res=configNetworkNodeCallBack(&TestMaster_Data,LSS_INQ_REV_NUMBER,0,0,CheckLSSAndContinue);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   310
			break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   311
		case 8:	/* LSS=>inquire Serial Number */
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   312
			eprintf("LSS=>inquire Serial Number\n");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   313
			res=configNetworkNodeCallBack(&TestMaster_Data,LSS_INQ_SERIAL_NUMBER,0,0,CheckLSSAndContinue);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   314
			break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   315
		case 9:	/* LSS=>change the nodeID */
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   316
			eprintf("LSS=>change the nodeId\n");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   317
			res=configNetworkNodeCallBack(&TestMaster_Data,LSS_CONF_NODE_ID,&NodeID,0,CheckLSSAndContinue);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   318
			break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   319
		case 10:	/* LSS=>change the Baud rate */
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   320
			eprintf("LSS=>change the Baud rate\n");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   321
			res=configNetworkNodeCallBack(&TestMaster_Data,LSS_CONF_BIT_TIMING,&Baud_Table,&Baud_BitTiming,CheckLSSAndContinue);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   322
			break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   323
		case 11:
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   324
			eprintf("LSS=>Activate Bit Timing\n");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   325
			res=configNetworkNode(&TestMaster_Data,LSS_CONF_ACT_BIT_TIMING,&Switch_delay,0);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   326
			/*no break;*/
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   327
			init_step_LSS++;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   328
		case 12:
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   329
			/*LSS=>store configuration*/
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   330
			/* It will fail the first time (time out) due to the switch delay */
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   331
			/* It will fail the second time because it is not implemented in the slave */
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   332
			eprintf("LSS=>store configuration\n");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   333
			res=configNetworkNodeCallBack(&TestMaster_Data,LSS_CONF_STORE,0,0,CheckLSSAndContinue);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   334
			break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   335
		case 13: /* LSS=>put in operation mod */
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   336
			eprintf("LSS=>put in operation mode\n");
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   337
			res=configNetworkNode(&TestMaster_Data,LSS_SM_GLOBAL,&LSS_mode,0);
362
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   338
			/* Search again for not-configured slaves*/
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   339
			eprintf("LSS=>identify not-configured remote slave\n");
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   340
			res=configNetworkNodeCallBack(&TestMaster_Data,LSS_IDENT_REMOTE_NON_CONF,0,0,CheckLSSAndContinue);
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   341
			init_step_LSS=1;
343
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   342
			break;
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   343
	}
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   344
}
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   345
#endif
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   346
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   347
void TestMaster_preOperational()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   348
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   349
	eprintf("TestMaster_preOperational\n");
343
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   350
#ifdef CO_ENABLE_LSS
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   351
	/* Ask slave node to go in stop mode */
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   352
	masterSendNMTstateChange (&TestMaster_Data, 0, NMT_Stop_Node);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   353
	ConfigureLSSNode(&TestMaster_Data);
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   354
#endif
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   355
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   356
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   357
void TestMaster_operational()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   358
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   359
	eprintf("TestMaster_operational\n");
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   360
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   361
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   362
void TestMaster_stopped()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   363
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   364
	eprintf("TestMaster_stopped\n");
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   365
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   366
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   367
void TestMaster_post_sync()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   368
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   369
	eprintf("TestMaster_post_sync\n");
236
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   370
	eprintf("Master: %d %d %d %d %d %d %d %d %d %x %x %d %d\n",
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   371
		MasterMap1,
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   372
		MasterMap2,
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   373
		MasterMap3, 
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   374
		MasterMap4,
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   375
		MasterMap5,
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   376
		MasterMap6,
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   377
		MasterMap7,
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   378
		MasterMap8,
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   379
		MasterMap9,
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   380
		MasterMap10,
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   381
		MasterMap11,
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   382
		MasterMap12,
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   383
		MasterMap13);
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   384
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   385
284
24bf3d692993 Implemented EMCY objects.
luis
parents: 236
diff changeset
   386
void TestMaster_post_emcy(UNS8 nodeID, UNS16 errCode, UNS8 errReg)
24bf3d692993 Implemented EMCY objects.
luis
parents: 236
diff changeset
   387
{
24bf3d692993 Implemented EMCY objects.
luis
parents: 236
diff changeset
   388
	eprintf("Master received EMCY message. Node: %2.2x  ErrorCode: %4.4x  ErrorRegister: %2.2x\n", nodeID, errCode, errReg);
24bf3d692993 Implemented EMCY objects.
luis
parents: 236
diff changeset
   389
}
24bf3d692993 Implemented EMCY objects.
luis
parents: 236
diff changeset
   390
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   391
char query_result = 0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   392
char waiting_answer = 0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   393
236
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   394
static void CheckSDO(CO_Data* d, UNS8 nodeId)
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   395
{
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   396
	UNS32 abortCode;	
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   397
	if(getWriteResultNetworkDict (d, nodeId, &abortCode) != SDO_FINISHED)
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   398
		eprintf("Master : Failed in changing Slave's transmit type AbortCode :%4.4x \n", abortCode);
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   399
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   400
	/* Finalise last SDO transfer with this node */
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   401
	closeSDOtransfer(&TestMaster_Data, nodeId, SDO_CLIENT);
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   402
}
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   403
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   404
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   405
static int MasterSyncCount = 0;
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   406
void TestMaster_post_TPDO()
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   407
{
236
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   408
	eprintf("TestMaster_post_TPDO MasterSyncCount = %d \n", MasterSyncCount);
179
763b6d32c1a6 Master configure slave's heartbeat producer time by concise DCF.
greg
parents: 175
diff changeset
   409
//
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   410
//	{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   411
//		char zero = 0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   412
//		if(MasterMap4 > 0x80){
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   413
//			writeNetworkDict (
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   414
//				&TestMaster_Data,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   415
//				TestSlave_Data->bDeviceNodeId,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   416
//				0x2002,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   417
//				0x00,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   418
//				1,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   419
//				0,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   420
//				&zero); 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   421
//		}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   422
//	}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   423
236
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   424
#if 0
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   425
	if(waiting_answer){
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   426
		UNS32 abortCode;			
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   427
		UNS8 size;			
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   428
		switch(getReadResultNetworkDict (
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   429
			&TestMaster_Data, 
201
2966cd34162a Boolean variable mapped in PDO
greg
parents: 179
diff changeset
   430
			0x02,
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   431
			&query_result,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   432
			&size,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   433
			&abortCode))
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   434
		{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   435
			case SDO_FINISHED:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   436
				/* Do something with result here !!*/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   437
				eprintf("Got SDO answer (0x2002, 0x00), %d %d\n",query_result,size);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   438
			case SDO_ABORTED_RCV:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   439
			case SDO_ABORTED_INTERNAL:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   440
			case SDO_RESET:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   441
				waiting_answer = 0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   442
				closeSDOtransfer(
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   443
					&TestMaster_Data,
201
2966cd34162a Boolean variable mapped in PDO
greg
parents: 179
diff changeset
   444
					0x02,
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   445
					SDO_CLIENT);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   446
			break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   447
			case SDO_DOWNLOAD_IN_PROGRESS:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   448
			case SDO_UPLOAD_IN_PROGRESS:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   449
			break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   450
		}
236
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   451
	}else if(MasterSyncCount % 10 == 0){
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   452
		readNetworkDict (
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   453
			&TestMaster_Data,
201
2966cd34162a Boolean variable mapped in PDO
greg
parents: 179
diff changeset
   454
			0x02,
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   455
			0x2002,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   456
			0x00,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   457
			0);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   458
		waiting_answer = 1;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   459
	}
236
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   460
#endif	
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   461
	if(MasterSyncCount % 17 == 0){
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   462
		eprintf("Master : Ask RTR PDO (0x1402)\n");
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   463
		sendPDOrequest(&TestMaster_Data, 0x1402 );
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   464
		sendPDOrequest(&TestMaster_Data, 0x1403 );
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   465
	}
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   466
	if(MasterSyncCount % 50 == 0){
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   467
		eprintf("Master : Change slave's transmit type to 0xFF\n");
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   468
		UNS8 transmitiontype = 0xFF;
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   469
		writeNetworkDictCallBack (&TestMaster_Data, /*CO_Data* d*/
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   470
					2, /*UNS8 nodeId*/
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   471
					0x1802, /*UNS16 index*/
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   472
					0x02, /*UNS16 index*/
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   473
					1, /*UNS8 count*/
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   474
					0, /*UNS8 dataType*/
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   475
					&transmitiontype,/*void *data*/
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   476
					CheckSDO); /*SDOCallback_t Callback*/
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   477
	}
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   478
	if(MasterSyncCount % 50 == 25){
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   479
		eprintf("Master : Change slave's transmit type to 0x00\n");
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   480
		UNS8 transmitiontype = 0x00;
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   481
		writeNetworkDictCallBack (&TestMaster_Data, /*CO_Data* d*/
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   482
					2, /*UNS8 nodeId*/
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   483
					0x1802, /*UNS16 index*/
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   484
					0x02, /*UNS16 index*/
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   485
					1, /*UNS8 count*/
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   486
					0, /*UNS8 dataType*/
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   487
					&transmitiontype,/*void *data*/
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   488
					CheckSDO); /*SDOCallback_t Callback*/
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   489
	}
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   490
	MasterSyncCount++;
905677ed00f3 Full preliminary implementation of TPDO transmit type:
etisserant
parents: 201
diff changeset
   491
}
343
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   492
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   493
void TestMaster_post_SlaveBootup(UNS8 nodeid)
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   494
{
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   495
	eprintf("TestMaster_post_SlaveBootup %x\n", nodeid);
362
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   496
	
343
118c1cabd0b0 Primary LSS support, thanks to Jorge Berzosa.
etisserant
parents: 284
diff changeset
   497
	ConfigureSlaveNode(&TestMaster_Data, nodeid);
362
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   498
}
1134fc19aa74 Added FastScan support to the LSS services.
groke6
parents: 349
diff changeset
   499