CANopenNode
CANopen protocol stack
Loading...
Searching...
No Matches
CO_Node_Guarding.h
Go to the documentation of this file.
1
21#ifndef CO_NODE_GUARDING_H
22#define CO_NODE_GUARDING_H
23
24#include "301/CO_driver.h"
25#include "301/CO_ODinterface.h"
26#include "301/CO_Emergency.h"
28
29/* default configuration, see CO_config.h */
30#ifndef CO_CONFIG_NODE_GUARDING
31#define CO_CONFIG_NODE_GUARDING (0)
32#endif
33#ifndef CO_CONFIG_NODE_GUARDING_MASTER_COUNT
34#define CO_CONFIG_NODE_GUARDING_MASTER_COUNT 0x7F
35#endif
36
37#if (((CO_CONFIG_NODE_GUARDING)&CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE) != 0) || defined CO_DOXYGEN
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
88
109 OD_entry_t* OD_100D_LifeTimeFactor, CO_EM_t* em, uint16_t CANidNodeGuarding,
110 CO_CANmodule_t* CANdevRx, uint16_t CANdevRxIdx, CO_CANmodule_t* CANdevTx,
111 uint16_t CANdevTxIdx, uint32_t* errInfo);
112
125 uint32_t timeDifference_us, uint32_t* timerNext_us);
126
136static inline bool_t
140
141 /* CO_Node_Guarding */
142
143#ifdef __cplusplus
144}
145#endif /* __cplusplus */
146
147#endif /* (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE */
148
149#if (((CO_CONFIG_NODE_GUARDING)&CO_CONFIG_NODE_GUARDING_MASTER_ENABLE) != 0) || defined CO_DOXYGEN
150
151#if CO_CONFIG_NODE_GUARDING_MASTER_COUNT < 1 || CO_CONFIG_NODE_GUARDING_MASTER_COUNT > 127
152#error CO_CONFIG_NODE_GUARDING_MASTER_COUNT value is wrong!
153#endif
154
155#ifdef __cplusplus
156extern "C" {
157#endif
158
177
192
208 uint16_t CANdevRxIdx, CO_CANmodule_t* CANdevTx, uint16_t CANdevTxIdx);
209
223 uint16_t guardTime_ms);
224
234void CO_nodeGuardingMaster_process(CO_nodeGuardingMaster_t* ngm, uint32_t timeDifference_us, uint32_t* timerNext_us);
235
236 /* @addtogroup CO_Node_Guarding */
237
238#ifdef __cplusplus
239}
240#endif /* __cplusplus */
241
242#endif /* (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE */
243
244#endif /* CO_NODE_GUARDING_H */
CANopen Emergency protocol.
CANopen Network management and Heartbeat producer protocol.
CANopen Object Dictionary interface.
Interface between CAN hardware and CANopenNode.
CO_NMT_internalState_t
Internal network state of the CANopen node.
Definition CO_NMT_Heartbeat.h:70
static bool_t CO_nodeGuardingSlave_isTimeout(CO_nodeGuardingSlave_t *ngs)
Inquire, if Node guarding slave detected life time timeout.
Definition CO_Node_Guarding.h:137
void CO_nodeGuardingMaster_process(CO_nodeGuardingMaster_t *ngm, uint32_t timeDifference_us, uint32_t *timerNext_us)
Process Node Guarding master.
void CO_nodeGuardingSlave_process(CO_nodeGuardingSlave_t *ngs, CO_NMT_internalState_t NMTstate, bool_t slaveDisable, uint32_t timeDifference_us, uint32_t *timerNext_us)
Process Node Guarding slave.
CO_ReturnError_t CO_nodeGuardingMaster_init(CO_nodeGuardingMaster_t *ngm, CO_EM_t *em, CO_CANmodule_t *CANdevRx, uint16_t CANdevRxIdx, CO_CANmodule_t *CANdevTx, uint16_t CANdevTxIdx)
Initialize Node Guarding master object.
CO_ReturnError_t CO_nodeGuardingSlave_init(CO_nodeGuardingSlave_t *ngs, OD_entry_t *OD_100C_GuardTime, OD_entry_t *OD_100D_LifeTimeFactor, CO_EM_t *em, uint16_t CANidNodeGuarding, CO_CANmodule_t *CANdevRx, uint16_t CANdevRxIdx, CO_CANmodule_t *CANdevTx, uint16_t CANdevTxIdx, uint32_t *errInfo)
Initialize Node Guarding slave object.
CO_ReturnError_t CO_nodeGuardingMaster_initNode(CO_nodeGuardingMaster_t *ngm, uint8_t index, uint8_t nodeId, uint16_t guardTime_ms)
Initialize node inside Node Guarding master object.
#define CO_CONFIG_NODE_GUARDING_MASTER_COUNT
Maximum number of nodes monitored by master.
Definition CO_config.h:206
#define NULL
NULL, for general usage.
Definition CO_driver.h:123
unsigned int uint16_t
UNSIGNED16 in CANopen (0006h), 16-bit unsigned integer.
Definition CO_driver.h:132
unsigned long int uint32_t
UNSIGNED32 in CANopen (0007h), 32-bit unsigned integer.
Definition CO_driver.h:133
uint_fast8_t bool_t
Boolean data type for general use.
Definition CO_driver.h:126
unsigned char uint8_t
UNSIGNED8 in CANopen (0005h), 8-bit unsigned integer.
Definition CO_driver.h:131
CO_ReturnError_t
Return values of some CANopen functions.
Definition CO_driver.h:449
Complete CAN module object.
Definition CO_driver.h:268
Configuration object for CAN transmit message for specific CANopenNode Object.
Definition CO_driver.h:250
Emergency object.
Definition CO_Emergency.h:259
Node Guarding master - monitored node.
Definition CO_Node_Guarding.h:167
uint8_t toggle
toggle bit7, expected from the next received message
Definition CO_Node_Guarding.h:172
bool_t CANtxWasBusy
True, if CANtxBuff was busy since last processing.
Definition CO_Node_Guarding.h:174
uint16_t ident
CAN identifier (CO_CAN_ID_HEARTBEAT + Node Id)
Definition CO_Node_Guarding.h:170
bool_t monitoringActive
True, if monitoring is active (response within time).
Definition CO_Node_Guarding.h:175
uint32_t guardTimer
Guard timer in microseconds, counting down.
Definition CO_Node_Guarding.h:169
CO_NMT_internalState_t NMTstate
NMT operating state.
Definition CO_Node_Guarding.h:171
bool_t responseRecived
True, if response was received since last rtr message.
Definition CO_Node_Guarding.h:173
uint32_t guardTime_us
Guard time in microseconds.
Definition CO_Node_Guarding.h:168
Node Guarding master object.
Definition CO_Node_Guarding.h:181
uint16_t CANdevTxIdx
From CO_nodeGuardingMaster_init()
Definition CO_Node_Guarding.h:184
bool_t allMonitoredOperational
True, if all monitored nodes are NMT operational or no node is monitored.
Definition CO_Node_Guarding.h:188
CO_EM_t * em
From CO_nodeGuardingMaster_init()
Definition CO_Node_Guarding.h:182
bool_t allMonitoredActive
True, if all monitored nodes are active or no node is monitored.
Definition CO_Node_Guarding.h:186
CO_CANmodule_t * CANdevTx
From CO_nodeGuardingMaster_init()
Definition CO_Node_Guarding.h:183
CO_CANtx_t * CANtxBuff
CAN transmit buffer for the message.
Definition CO_Node_Guarding.h:185
Node Guarding slave object.
Definition CO_Node_Guarding.h:74
bool_t lifeTimeTimeout
True if rtr from master is missing.
Definition CO_Node_Guarding.h:82
OD_extension_t OD_100D_extension
Extension for OD object.
Definition CO_Node_Guarding.h:84
uint32_t lifeTime_us
Life time in microseconds, calculated from guardTime_us * lifeTimeFactor.
Definition CO_Node_Guarding.h:78
bool_t toggle
Toggle bit for response.
Definition CO_Node_Guarding.h:81
volatile void * CANrxNew
Indicates, if new rtr message received from CAN bus.
Definition CO_Node_Guarding.h:76
CO_CANmodule_t * CANdevTx
From CO_nodeGuardingSlave_init()
Definition CO_Node_Guarding.h:85
CO_EM_t * em
From CO_nodeGuardingSlave_init()
Definition CO_Node_Guarding.h:75
CO_CANtx_t * CANtxBuff
CAN transmit buffer for the message.
Definition CO_Node_Guarding.h:86
uint32_t lifeTimer
Timer for monitoring Life time, counting down from lifeTime_us.
Definition CO_Node_Guarding.h:79
uint8_t lifeTimeFactor
Life time factor, from OD_0x100D.
Definition CO_Node_Guarding.h:80
uint32_t guardTime_us
Guard time in microseconds, calculated from OD_0x100C.
Definition CO_Node_Guarding.h:77
OD_extension_t OD_100C_extension
Extension for OD object.
Definition CO_Node_Guarding.h:83
Object Dictionary entry for one OD object.
Definition CO_ODinterface.h:272
Extension of OD object, which can optionally be specified by application in initialization phase with...
Definition CO_ODinterface.h:245