examples/TestMasterSlaveLSS/SlaveB.c
author Edouard Tisserant
Mon, 23 Apr 2018 12:32:03 +0200
changeset 805 570e3a444023
parent 517 003679edc437
permissions -rw-r--r--
Workaround Alchemy task not beeing waken up when closing file descriptor it is waiting on, sequel of Xenomai3 all posix file ops
381
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
     1
/*
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
     2
This file is part of CanFestival, a library implementing CanOpen Stack. 
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
     3
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
     4
Copyright (C): Edouard TISSERANT and Francis DUPIN
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
     5
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
     6
See COPYING file for copyrights details.
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
     7
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
     8
This library is free software; you can redistribute it and/or
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
     9
modify it under the terms of the GNU Lesser General Public
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    10
License as published by the Free Software Foundation; either
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    11
version 2.1 of the License, or (at your option) any later version.
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    12
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    13
This library is distributed in the hope that it will be useful,
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    14
but WITHOUT ANY WARRANTY; without even the implied warranty of
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    16
Lesser General Public License for more details.
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    17
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    18
You should have received a copy of the GNU Lesser General Public
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    19
License along with this library; if not, write to the Free Software
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    21
*/
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    22
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    23
#include "SlaveB.h"
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    24
#include "Master.h"
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    25
#include "TestMasterSlaveLSS.h"
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    26
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    27
/*****************************************************************************/
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    28
void TestSlaveB_heartbeatError(CO_Data* d, UNS8 heartbeatID)
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    29
{
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    30
	eprintf("TestSlaveB_heartbeatError %d\n", heartbeatID);
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    31
}
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    32
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    33
void TestSlaveB_initialisation(CO_Data* d)
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    34
{
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    35
	eprintf("TestSlaveB_initialisation\n");
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    36
}
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    37
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    38
void TestSlaveB_preOperational(CO_Data* d)
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    39
{
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    40
	eprintf("TestSlaveB_preOperational\n");
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    41
}
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    42
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    43
void TestSlaveB_operational(CO_Data* d)
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    44
{
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    45
	eprintf("TestSlaveB_operational\n");
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    46
}
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    47
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    48
void TestSlaveB_stopped(CO_Data* d)
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    49
{
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    50
	eprintf("TestSlaveB_stopped\n");
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    51
}
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    52
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    53
void TestSlaveB_post_sync(CO_Data* d)
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    54
{
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    55
      eprintf("TestSlaveB_post_sync\n");
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    56
}
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    57
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    58
void TestSlaveB_post_TPDO(CO_Data* d)
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    59
{
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    60
	eprintf("TestSlaveB_post_TPDO\n");	
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    61
	SlaveBMap1+=16;
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    62
}
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    63
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    64
void TestSlaveB_storeODSubIndex(CO_Data* d, UNS16 wIndex, UNS8 bSubindex)
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    65
{
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    66
	/*TODO : 
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    67
	 * - call getODEntry for index and subindex, 
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    68
	 * - save content to file, database, flash, nvram, ...
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    69
	 * 
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    70
	 * To ease flash organisation, index of variable to store
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    71
	 * can be established by scanning d->objdict[d->ObjdictSize]
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    72
	 * for variables to store.
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    73
	 * 
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    74
	 * */
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    75
	eprintf("TestSlaveB_storeODSubIndex : %4.4x %2.2x\n", wIndex,  bSubindex);
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    76
}
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    77
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    78
void TestSlaveB_post_emcy(CO_Data* d, UNS8 nodeID, UNS16 errCode, UNS8 errReg)
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    79
{
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    80
	eprintf("SlaveB received EMCY message. Node: %2.2x  ErrorCode: %4.4x  ErrorRegister: %2.2x\n", nodeID, errCode, errReg);
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    81
}
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    82
517
003679edc437 FastScan review
groke6
parents: 384
diff changeset
    83
void TestSlaveB_NMT_Slave_Communications_Reset_Callback(CO_Data* d)
003679edc437 FastScan review
groke6
parents: 384
diff changeset
    84
{
003679edc437 FastScan review
groke6
parents: 384
diff changeset
    85
	eprintf("TestSlaveB_NMT_Slave_Communications_Reset_Callback\n");
003679edc437 FastScan review
groke6
parents: 384
diff changeset
    86
}
003679edc437 FastScan review
groke6
parents: 384
diff changeset
    87
381
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    88
void TestSlaveB_StoreConfiguration(CO_Data* d, UNS8 *error, UNS8 *spec_error)
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    89
{
517
003679edc437 FastScan review
groke6
parents: 384
diff changeset
    90
	eprintf("TestSlaveB_StoreConfiguration\n");
381
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    91
}
854c43cdc24a added TestMasterSlaveLSS. LSS protocol revised.
groke6
parents:
diff changeset
    92