Sam Grove
/
canopen_slavenode
CANfestival - an open source CANopen framework
framework/include/lifegrd.h@0:6219434a0cb5, 2011-05-30 (annotated)
- Committer:
- sam_grove
- Date:
- Mon May 30 07:14:41 2011 +0000
- Revision:
- 0:6219434a0cb5
Initial public release of slave node framework port
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sam_grove |
0:6219434a0cb5 | 1 | /* |
sam_grove |
0:6219434a0cb5 | 2 | This file is part of CanFestival, a library implementing CanOpen Stack. |
sam_grove |
0:6219434a0cb5 | 3 | |
sam_grove |
0:6219434a0cb5 | 4 | Copyright (C): Edouard TISSERANT and Francis DUPIN |
sam_grove |
0:6219434a0cb5 | 5 | |
sam_grove |
0:6219434a0cb5 | 6 | See COPYING file for copyrights details. |
sam_grove |
0:6219434a0cb5 | 7 | |
sam_grove |
0:6219434a0cb5 | 8 | This library is free software; you can redistribute it and/or |
sam_grove |
0:6219434a0cb5 | 9 | modify it under the terms of the GNU Lesser General Public |
sam_grove |
0:6219434a0cb5 | 10 | License as published by the Free Software Foundation; either |
sam_grove |
0:6219434a0cb5 | 11 | version 2.1 of the License, or (at your option) any later version. |
sam_grove |
0:6219434a0cb5 | 12 | |
sam_grove |
0:6219434a0cb5 | 13 | This library is distributed in the hope that it will be useful, |
sam_grove |
0:6219434a0cb5 | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
sam_grove |
0:6219434a0cb5 | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
sam_grove |
0:6219434a0cb5 | 16 | Lesser General Public License for more details. |
sam_grove |
0:6219434a0cb5 | 17 | |
sam_grove |
0:6219434a0cb5 | 18 | You should have received a copy of the GNU Lesser General Public |
sam_grove |
0:6219434a0cb5 | 19 | License along with this library; if not, write to the Free Software |
sam_grove |
0:6219434a0cb5 | 20 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
sam_grove |
0:6219434a0cb5 | 21 | */ |
sam_grove |
0:6219434a0cb5 | 22 | |
sam_grove |
0:6219434a0cb5 | 23 | /** @defgroup heartbeato Heartbeat Object |
sam_grove |
0:6219434a0cb5 | 24 | * The heartbeat mechanism for a device is established through cyclically transmitting a message by a |
sam_grove |
0:6219434a0cb5 | 25 | * heartbeat producer. One or more devices in the network are aware of this heartbeat message. If the |
sam_grove |
0:6219434a0cb5 | 26 | * heartbeat cycle fails for the heartbeat producer the local application on the heartbeat consumer will be |
sam_grove |
0:6219434a0cb5 | 27 | * informed about that event. |
sam_grove |
0:6219434a0cb5 | 28 | * @ingroup comobj |
sam_grove |
0:6219434a0cb5 | 29 | */ |
sam_grove |
0:6219434a0cb5 | 30 | |
sam_grove |
0:6219434a0cb5 | 31 | #ifndef __lifegrd_h__ |
sam_grove |
0:6219434a0cb5 | 32 | #define __lifegrd_h__ |
sam_grove |
0:6219434a0cb5 | 33 | |
sam_grove |
0:6219434a0cb5 | 34 | |
sam_grove |
0:6219434a0cb5 | 35 | #include <applicfg.h> |
sam_grove |
0:6219434a0cb5 | 36 | |
sam_grove |
0:6219434a0cb5 | 37 | typedef void (*heartbeatError_t)(CO_Data*, UNS8); |
sam_grove |
0:6219434a0cb5 | 38 | void _heartbeatError(CO_Data* d, UNS8 heartbeatID); |
sam_grove |
0:6219434a0cb5 | 39 | |
sam_grove |
0:6219434a0cb5 | 40 | typedef void (*post_SlaveBootup_t)(CO_Data*, UNS8); |
sam_grove |
0:6219434a0cb5 | 41 | void _post_SlaveBootup(CO_Data* d, UNS8 SlaveID); |
sam_grove |
0:6219434a0cb5 | 42 | |
sam_grove |
0:6219434a0cb5 | 43 | typedef void (*post_SlaveStateChange_t)(CO_Data*, UNS8, e_nodeState); |
sam_grove |
0:6219434a0cb5 | 44 | void _post_SlaveStateChange(CO_Data* d, UNS8 nodeId, e_nodeState newNodeState); |
sam_grove |
0:6219434a0cb5 | 45 | |
sam_grove |
0:6219434a0cb5 | 46 | #include "data.h" |
sam_grove |
0:6219434a0cb5 | 47 | |
sam_grove |
0:6219434a0cb5 | 48 | /************************************************************************* |
sam_grove |
0:6219434a0cb5 | 49 | * Functions |
sam_grove |
0:6219434a0cb5 | 50 | *************************************************************************/ |
sam_grove |
0:6219434a0cb5 | 51 | |
sam_grove |
0:6219434a0cb5 | 52 | /** |
sam_grove |
0:6219434a0cb5 | 53 | * @ingroup statemachine |
sam_grove |
0:6219434a0cb5 | 54 | * @brief To read the state of a node |
sam_grove |
0:6219434a0cb5 | 55 | * This can be used by the master after having sent a life guard request, |
sam_grove |
0:6219434a0cb5 | 56 | * of by any node if it is waiting for heartbeat. |
sam_grove |
0:6219434a0cb5 | 57 | * @param *d Pointer on a CAN object data structure |
sam_grove |
0:6219434a0cb5 | 58 | * @param nodeId Id of a node |
sam_grove |
0:6219434a0cb5 | 59 | * @return e_nodeState State of the node corresponding to the nodeId |
sam_grove |
0:6219434a0cb5 | 60 | */ |
sam_grove |
0:6219434a0cb5 | 61 | e_nodeState getNodeState (CO_Data* d, UNS8 nodeId); |
sam_grove |
0:6219434a0cb5 | 62 | |
sam_grove |
0:6219434a0cb5 | 63 | /** |
sam_grove |
0:6219434a0cb5 | 64 | * @brief Start heartbeat consumer and producer |
sam_grove |
0:6219434a0cb5 | 65 | * with respect to 0x1016 and 0x1017 |
sam_grove |
0:6219434a0cb5 | 66 | * object dictionary entries |
sam_grove |
0:6219434a0cb5 | 67 | * @param *d Pointer on a CAN object data structure |
sam_grove |
0:6219434a0cb5 | 68 | */ |
sam_grove |
0:6219434a0cb5 | 69 | void heartbeatInit(CO_Data* d); |
sam_grove |
0:6219434a0cb5 | 70 | |
sam_grove |
0:6219434a0cb5 | 71 | /** |
sam_grove |
0:6219434a0cb5 | 72 | * @brief Stop heartbeat consumer and producer |
sam_grove |
0:6219434a0cb5 | 73 | * @param *d Pointer on a CAN object data structure |
sam_grove |
0:6219434a0cb5 | 74 | */ |
sam_grove |
0:6219434a0cb5 | 75 | void heartbeatStop(CO_Data* d); |
sam_grove |
0:6219434a0cb5 | 76 | |
sam_grove |
0:6219434a0cb5 | 77 | /** |
sam_grove |
0:6219434a0cb5 | 78 | * @brief This function is responsible to process a canopen-message which seams to be an NMT Error Control |
sam_grove |
0:6219434a0cb5 | 79 | * Messages. At them moment we assume that every NMT error control message |
sam_grove |
0:6219434a0cb5 | 80 | * is a heartbeat message. |
sam_grove |
0:6219434a0cb5 | 81 | * If a BootUp message is detected, it will return the nodeId of the Slave who booted up |
sam_grove |
0:6219434a0cb5 | 82 | * @param *d Pointer on a CAN object data structure |
sam_grove |
0:6219434a0cb5 | 83 | * @param *m Pointer on the CAN-message which has to be analysed. |
sam_grove |
0:6219434a0cb5 | 84 | */ |
sam_grove |
0:6219434a0cb5 | 85 | void proceedNODE_GUARD (CO_Data* d, Message* m); |
sam_grove |
0:6219434a0cb5 | 86 | |
sam_grove |
0:6219434a0cb5 | 87 | #endif /*__lifegrd_h__ */ |