etisserant@0: /* etisserant@0: This file is part of CanFestival, a library implementing CanOpen Stack. etisserant@0: etisserant@0: Copyright (C): Edouard TISSERANT and Francis DUPIN etisserant@0: etisserant@0: See COPYING file for copyrights details. etisserant@0: etisserant@0: This library is free software; you can redistribute it and/or etisserant@0: modify it under the terms of the GNU Lesser General Public etisserant@0: License as published by the Free Software Foundation; either etisserant@0: version 2.1 of the License, or (at your option) any later version. etisserant@0: etisserant@0: This library is distributed in the hope that it will be useful, etisserant@0: but WITHOUT ANY WARRANTY; without even the implied warranty of etisserant@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU etisserant@0: Lesser General Public License for more details. etisserant@0: etisserant@0: You should have received a copy of the GNU Lesser General Public etisserant@0: License along with this library; if not, write to the Free Software etisserant@0: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA etisserant@0: */ etisserant@0: greg@529: /** @defgroup heartbeato Heartbeat Object greg@529: * The heartbeat mechanism for a device is established through cyclically transmitting a message by a greg@529: * heartbeat producer. One or more devices in the network are aware of this heartbeat message. If the greg@529: * heartbeat cycle fails for the heartbeat producer the local application on the heartbeat consumer will be greg@529: * informed about that event. greg@529: * @ingroup comobj greg@529: */ mwildbolz@750: mwildbolz@750: /** @defgroup nodeguardo Node-guarding Object mwildbolz@750: * The node-guarding mechanism for a device is established through cyclically polling all slaves by the NMT mwildbolz@750: * master. If one polled slave does not respond during a specified time (LifeTime), the local application mwildbolz@750: * will be informed about that event.
mwildbolz@750: * It is also possible for the slaves to monitor the node-guarding requests coming from the master to mwildbolz@750: * determine, if the master operates in a right way mwildbolz@750: * @ingroup comobj mwildbolz@750: * mwildbolz@750: * @todo The implementation is very basic. The toggle bit of the nodes confirmation is not checked at the moment mwildbolz@750: */ mwildbolz@750: mwildbolz@750: /** mwildbolz@750: ** @file lifegrd.h mwildbolz@750: ** @author Markus WILDBOLZ mwildbolz@750: ** @date Mon Oct 01 14:44:36 CEST 2012 mwildbolz@750: ** mwildbolz@750: ** @brief mwildbolz@750: ** mwildbolz@750: ** mwildbolz@750: */ mwildbolz@750: etisserant@0: #ifndef __lifegrd_h__ etisserant@0: #define __lifegrd_h__ etisserant@0: etisserant@0: etisserant@0: #include etisserant@0: etisserant@378: typedef void (*heartbeatError_t)(CO_Data*, UNS8); etisserant@378: void _heartbeatError(CO_Data* d, UNS8 heartbeatID); etisserant@0: etisserant@378: typedef void (*post_SlaveBootup_t)(CO_Data*, UNS8); etisserant@378: void _post_SlaveBootup(CO_Data* d, UNS8 SlaveID); etisserant@343: Christian@635: typedef void (*post_SlaveStateChange_t)(CO_Data*, UNS8, e_nodeState); Christian@635: void _post_SlaveStateChange(CO_Data* d, UNS8 nodeId, e_nodeState newNodeState); Christian@635: mwildbolz@750: typedef void (*nodeguardError_t)(CO_Data*, UNS8); mwildbolz@750: void _nodeguardError(CO_Data* d, UNS8 id); mwildbolz@750: etisserant@0: #include "data.h" etisserant@0: frdupin@71: /************************************************************************* frdupin@71: * Functions frdupin@74: *************************************************************************/ mwildbolz@750: /** mwildbolz@750: * @brief Start node guarding with respect to 0x100C and 0x100D mwildbolz@750: * in the object dictionary mwildbolz@750: * mwildbolz@750: * @param *d Pointer on a CAN object data structure mwildbolz@750: * @ingroup nodeguardo mwildbolz@750: */ mwildbolz@750: void nodeguardInit(CO_Data* d); mwildbolz@750: mwildbolz@750: /** mwildbolz@750: * @brief Stop producing node guarding messages mwildbolz@750: * mwildbolz@750: * @param *d Pointer on a CAN object data structure mwildbolz@750: * @ingroup nodeguardo mwildbolz@750: */ mwildbolz@750: void nodeguardStop(CO_Data* d); mwildbolz@750: mwildbolz@750: /** mwildbolz@750: * @brief Start the life guarding service (heartbeat/node guarding). mwildbolz@750: * This service handles NMT error control messages either by using mwildbolz@750: * heartbeats and/or by using node guarding messages (defined via the mwildbolz@750: * object dictionary) mwildbolz@750: * mwildbolz@750: * @param *d Pointer on a CAN object data structure mwildbolz@750: */ mwildbolz@750: void lifeGuardInit(CO_Data* d); mwildbolz@750: mwildbolz@750: /** mwildbolz@750: * @brief Stop the life guarding service (heartbeat/node guarding). mwildbolz@750: * mwildbolz@750: * @param *d Pointer on a CAN object data structure mwildbolz@750: */ mwildbolz@750: void lifeGuardStop(CO_Data* d); etisserant@0: greg@528: /** greg@529: * @ingroup statemachine greg@528: * @brief To read the state of a node greg@528: * This can be used by the master after having sent a life guard request, greg@528: * of by any node if it is waiting for heartbeat. greg@528: * @param *d Pointer on a CAN object data structure greg@528: * @param nodeId Id of a node greg@528: * @return e_nodeState State of the node corresponding to the nodeId etisserant@0: */ etisserant@0: e_nodeState getNodeState (CO_Data* d, UNS8 nodeId); etisserant@0: greg@528: /** greg@528: * @brief Start heartbeat consumer and producer greg@528: * with respect to 0x1016 and 0x1017 greg@528: * object dictionary entries greg@528: * @param *d Pointer on a CAN object data structure mwildbolz@750: * @ingroup heartbeato etisserant@0: */ etisserant@0: void heartbeatInit(CO_Data* d); etisserant@0: greg@528: /** greg@528: * @brief Stop heartbeat consumer and producer greg@528: * @param *d Pointer on a CAN object data structure mwildbolz@750: * @ingroup heartbeato etisserant@0: */ etisserant@0: void heartbeatStop(CO_Data* d); etisserant@0: greg@528: /** greg@528: * @brief This function is responsible to process a canopen-message which seams to be an NMT Error Control mwildbolz@750: * Messages. greg@528: * If a BootUp message is detected, it will return the nodeId of the Slave who booted up greg@528: * @param *d Pointer on a CAN object data structure greg@528: * @param *m Pointer on the CAN-message which has to be analysed. mwildbolz@750: * @ingroup nodeguardo etisserant@0: */ etisserant@0: void proceedNODE_GUARD (CO_Data* d, Message* m); etisserant@0: mwildbolz@750: frdupin@71: #endif /*__lifegrd_h__ */