CO_SRDO.h
Go to the documentation of this file.
#ifndef CO_SRDO_H
#define CO_SRDO_H
#include "301/CO_driver.h"
#include "301/CO_SDOserver.h"
#include "301/CO_Emergency.h"
#include "301/CO_NMT_Heartbeat.h"
/* default configuration, see CO_config.h */
#ifndef CO_CONFIG_SRDO
#define CO_CONFIG_SRDO (0)
#endif
#ifndef CO_CONFIG_SRDO_MINIMUM_DELAY
#define CO_CONFIG_SRDO_MINIMUM_DELAY 0
#endif
#if ((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) || defined CO_DOXYGEN
#ifdef __cplusplus
extern "C" {
#endif
typedef struct{
uint8_t maxSubIndex;
uint8_t informationDirection;
uint16_t safetyCycleTime;
uint8_t safetyRelatedValidationTime;
uint8_t transmissionType;
uint32_t COB_ID1_normal;
uint32_t COB_ID2_inverted;
}CO_SRDOCommPar_t;
typedef struct{
uint8_t numberOfMappedObjects;
uint32_t mappedObjects[16];
}CO_SRDOMapPar_t;
typedef struct{
CO_NMT_internalState_t *operatingState;
CO_NMT_internalState_t operatingStatePrev;
uint8_t *configurationValid;
uint8_t checkCRC;
}CO_SRDOGuard_t;
typedef struct{
CO_EM_t *em;
CO_SDO_t *SDO;
CO_SRDOGuard_t *SRDOGuard;
uint8_t *mapPointer[2][8];
uint8_t dataLength;
uint8_t nodeId;
uint16_t defaultCOB_ID[2];
uint8_t valid;
const CO_SRDOCommPar_t *SRDOCommPar;
const CO_SRDOMapPar_t *SRDOMapPar;
const uint16_t *checksum;
CO_CANmodule_t *CANdevRx;
CO_CANmodule_t *CANdevTx;
CO_CANtx_t *CANtxBuff[2];
uint16_t CANdevRxIdx[2];
uint16_t CANdevTxIdx[2];
uint8_t toogle;
uint32_t timer;
volatile void *CANrxNew[2];
uint8_t CANrxData[2][8];
void (*pFunctSignalSafe)(void *object);
void *functSignalObjectSafe;
#if ((CO_CONFIG_SRDO) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
void (*pFunctSignalPre)(void *object);
void *functSignalObjectPre;
#endif
}CO_SRDO_t;
CO_ReturnError_t CO_SRDOGuard_init(
CO_SRDOGuard_t *SRDOGuard,
CO_SDO_t *SDO,
CO_NMT_internalState_t *operatingState,
uint8_t *configurationValid,
uint16_t idx_SRDOvalid,
uint16_t idx_SRDOcrc);
uint8_t CO_SRDOGuard_process(
CO_SRDOGuard_t *SRDOGuard);
CO_ReturnError_t CO_SRDO_init(
CO_SRDO_t *SRDO,
CO_SRDOGuard_t *SRDOGuard,
CO_EM_t *em,
CO_SDO_t *SDO,
uint8_t nodeId,
uint16_t defaultCOB_ID,
const CO_SRDOCommPar_t *SRDOCommPar,
const CO_SRDOMapPar_t *SRDOMapPar,
const uint16_t *checksum,
uint16_t idx_SRDOCommPar,
uint16_t idx_SRDOMapPar,
CO_CANmodule_t *CANdevRx,
uint16_t CANdevRxIdxNormal,
uint16_t CANdevRxIdxInverted,
CO_CANmodule_t *CANdevTx,
uint16_t CANdevTxIdxNormal,
uint16_t CANdevTxIdxInverted);
#if ((CO_CONFIG_SRDO) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
void CO_SRDO_initCallbackPre(
CO_SRDO_t *SRDO,
void *object,
void (*pFunctSignalPre)(void *object));
#endif
void CO_SRDO_initCallbackEnterSafeState(
CO_SRDO_t *SRDO,
void *object,
void (*pFunctSignalSafe)(void *object));
CO_ReturnError_t CO_SRDO_requestSend(
CO_SRDO_t *SRDO);
void CO_SRDO_process(
CO_SRDO_t *SRDO,
uint8_t commands,
uint32_t timeDifference_us,
uint32_t *timerNext_us);
/* CO_SRDO */
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /* (CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE */
#endif /* CO_SRDO_H */
CO_SRDOGuard_init
CO_ReturnError_t CO_SRDOGuard_init(CO_SRDOGuard_t *SRDOGuard, CO_SDO_t *SDO, CO_NMT_internalState_t *operatingState, uint8_t *configurationValid, uint16_t idx_SRDOvalid, uint16_t idx_SRDOcrc)
Initialize SRDOGuard object.
uint32_t
unsigned long int uint32_t
UNSIGNED32 in CANopen (0007h), 32-bit unsigned integer.
Definition: CO_driver.h:155
CO_driver.h
Interface between CAN hardware and CANopenNode.
CO_SRDO_t::dataLength
uint8_t dataLength
Data length of the received SRDO message.
Definition: CO_SRDO.h:131
CO_SRDO_t::nodeId
uint8_t nodeId
From CO_SRDO_init()
Definition: CO_SRDO.h:132
CO_SRDO_t::SDO
CO_SDO_t * SDO
From CO_SRDO_init()
Definition: CO_SRDO.h:126
uint16_t
unsigned int uint16_t
UNSIGNED16 in CANopen (0006h), 16-bit unsigned integer.
Definition: CO_driver.h:153
CO_SRDOGuard_t::operatingStatePrev
CO_NMT_internalState_t operatingStatePrev
last operation state
Definition: CO_SRDO.h:116
CO_ReturnError_t
CO_ReturnError_t
Return values of some CANopen functions.
Definition: CO_driver.h:488
CO_SRDO_t::functSignalObjectPre
void * functSignalObjectPre
From CO_SRDO_initCallbackPre() or NULL.
Definition: CO_SRDO.h:158
CO_SRDOCommPar_t
SRDO communication parameter.
Definition: CO_SRDO.h:66
CO_SRDOCommPar_t::informationDirection
uint8_t informationDirection
Direction of the SRDO.
Definition: CO_SRDO.h:72
CO_SRDO_t::functSignalObjectSafe
void * functSignalObjectSafe
From CO_SRDO_initCallbackEnterSafeState() or NULL.
Definition: CO_SRDO.h:153
CO_SDOserver.h
CANopen Service Data Object - server protocol.
CO_SRDO_t::SRDOGuard
CO_SRDOGuard_t * SRDOGuard
From CO_SRDO_init()
Definition: CO_SRDO.h:127
CO_SRDO_t::CANdevTx
CO_CANmodule_t * CANdevTx
From CO_SRDO_init()
Definition: CO_SRDO.h:140
CO_SRDOCommPar_t::safetyRelatedValidationTime
uint8_t safetyRelatedValidationTime
SRVT.
Definition: CO_SRDO.h:80
CO_SRDO_t::timer
uint32_t timer
transmit timer and receive timeout
Definition: CO_SRDO.h:145
CO_SRDO_t::em
CO_EM_t * em
From CO_SRDO_init()
Definition: CO_SRDO.h:125
CO_SRDO_t::valid
uint8_t valid
0 - invalid, 1 - tx, 2 - rx
Definition: CO_SRDO.h:135
CO_EM_t
Emergency object.
Definition: CO_Emergency.h:369
CO_SRDOCommPar_t::safetyCycleTime
uint16_t safetyCycleTime
Refresh-time / SCT.
Definition: CO_SRDO.h:76
CO_SRDO_init
CO_ReturnError_t CO_SRDO_init(CO_SRDO_t *SRDO, CO_SRDOGuard_t *SRDOGuard, CO_EM_t *em, CO_SDO_t *SDO, uint8_t nodeId, uint16_t defaultCOB_ID, const CO_SRDOCommPar_t *SRDOCommPar, const CO_SRDOMapPar_t *SRDOMapPar, const uint16_t *checksum, uint16_t idx_SRDOCommPar, uint16_t idx_SRDOMapPar, CO_CANmodule_t *CANdevRx, uint16_t CANdevRxIdxNormal, uint16_t CANdevRxIdxInverted, CO_CANmodule_t *CANdevTx, uint16_t CANdevTxIdxNormal, uint16_t CANdevTxIdxInverted)
Initialize SRDO object.
CO_NMT_internalState_t
CO_NMT_internalState_t
Internal network state of the CANopen node.
Definition: CO_NMT_Heartbeat.h:77
CO_SRDO_process
void CO_SRDO_process(CO_SRDO_t *SRDO, uint8_t commands, uint32_t timeDifference_us, uint32_t *timerNext_us)
Process transmitting/receiving SRDO messages.
CO_NMT_Heartbeat.h
CANopen Network management and Heartbeat producer protocol.
CO_SRDOCommPar_t::maxSubIndex
uint8_t maxSubIndex
Equal to 6.
Definition: CO_SRDO.h:67
CO_SRDOCommPar_t::transmissionType
uint8_t transmissionType
Transmission type.
Definition: CO_SRDO.h:83
CO_SRDO_t::toogle
uint8_t toogle
defines the current state
Definition: CO_SRDO.h:144
CO_Emergency.h
CANopen Emergency protocol.
CO_SRDOCommPar_t::COB_ID2_inverted
uint32_t COB_ID2_inverted
Communication object identifier for message received.
Definition: CO_SRDO.h:91
CO_SRDO_t::SRDOMapPar
const CO_SRDOMapPar_t * SRDOMapPar
From CO_SRDO_init()
Definition: CO_SRDO.h:137
CO_SRDO_t::CANdevRx
CO_CANmodule_t * CANdevRx
From CO_SRDO_init()
Definition: CO_SRDO.h:139
CO_SRDO_t::SRDOCommPar
const CO_SRDOCommPar_t * SRDOCommPar
From CO_SRDO_init()
Definition: CO_SRDO.h:136
CO_CANmodule_t
Complete CAN module object.
Definition: CO_driver.h:319
CO_SRDO_initCallbackPre
void CO_SRDO_initCallbackPre(CO_SRDO_t *SRDO, void *object, void(*pFunctSignalPre)(void *object))
Initialize SRDO callback function.
CO_SRDOGuard_process
uint8_t CO_SRDOGuard_process(CO_SRDOGuard_t *SRDOGuard)
Process operation and valid state changes.
CO_SRDOGuard_t::operatingState
CO_NMT_internalState_t * operatingState
pointer to current operation state
Definition: CO_SRDO.h:115
CO_SRDO_t
SRDO object.
Definition: CO_SRDO.h:124
CO_SRDOCommPar_t::COB_ID1_normal
uint32_t COB_ID1_normal
Communication object identifier for message received.
Definition: CO_SRDO.h:87
CO_SRDOGuard_t
Gurad Object for SRDO monitors:
Definition: CO_SRDO.h:114
CO_SRDO_t::checksum
const uint16_t * checksum
From CO_SRDO_init()
Definition: CO_SRDO.h:138
CO_SRDO_initCallbackEnterSafeState
void CO_SRDO_initCallbackEnterSafeState(CO_SRDO_t *SRDO, void *object, void(*pFunctSignalSafe)(void *object))
Initialize SRDO callback function.
CO_SRDO_requestSend
CO_ReturnError_t CO_SRDO_requestSend(CO_SRDO_t *SRDO)
Send SRDO on event.
CO_SRDOGuard_t::checkCRC
uint8_t checkCRC
specifies whether a CRC check should be performed
Definition: CO_SRDO.h:118
CO_CANtx_t
Configuration object for CAN transmit message for specific CANopenNode Object.
Definition: CO_driver.h:299
CO_SRDOGuard_t::configurationValid
uint8_t * configurationValid
pointer to the configuration valid flag in OD
Definition: CO_SRDO.h:117
uint8_t
unsigned char uint8_t
UNSIGNED8 in CANopen (0005h), 8-bit unsigned integer.
Definition: CO_driver.h:151