|
file | CO_SRDO.c |
| CANopen Safety Related Data Object protocol.
|
|
file | CO_SRDO.h |
| CANopen Safety Related Data Object protocol.
|
|
|
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. More...
|
|
uint8_t | CO_SRDOGuard_process (CO_SRDOGuard_t *SRDOGuard) |
| Process operation and valid state changes. More...
|
|
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. More...
|
|
void | CO_SRDO_initCallbackPre (CO_SRDO_t *SRDO, void *object, void(*pFunctSignalPre)(void *object)) |
| Initialize SRDO callback function. More...
|
|
void | CO_SRDO_initCallbackEnterSafeState (CO_SRDO_t *SRDO, void *object, void(*pFunctSignalSafe)(void *object)) |
| Initialize SRDO callback function. More...
|
|
CO_ReturnError_t | CO_SRDO_requestSend (CO_SRDO_t *SRDO) |
| Send SRDO on event. More...
|
|
void | CO_SRDO_process (CO_SRDO_t *SRDO, uint8_t commands, uint32_t timeDifference_us, uint32_t *timerNext_us) |
| Process transmitting/receiving SRDO messages. More...
|
|
CANopen Safety Related Data Object protocol.
The functionality is very similar to that of the PDOs. The main differences is every message is send and received twice. The second message must be bitwise inverted. The delay between the two messages and between each message pair is monitored. The distinction between sending and receiving SRDO is made at runtime (for PDO it is compile time). If the security protocol is used, at least one SRDO is mandatory.
◆ CO_SRDOGuard_init()
Initialize SRDOGuard object.
Function must be called in the communication reset section.
- Parameters
-
SRDOGuard | This object will be initialized. |
SDO | SDO object. |
operatingState | Pointer to variable indicating CANopen device NMT internal state. |
configurationValid | Pointer to variable with the SR valid flag |
idx_SRDOvalid | Index in Object Dictionary |
idx_SRDOcrc | Index in Object Dictionary |
- Returns
- CO_ReturnError_t: CO_ERROR_NO or CO_ERROR_ILLEGAL_ARGUMENT.
◆ CO_SRDOGuard_process()
Process operation and valid state changes.
- Parameters
-
- Returns
- uint8_t command for CO_SRDO_process().
- bit 0 entered operational
- bit 1 validate checksum
◆ 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.
Function must be called in the communication reset section.
- Parameters
-
SRDO | This object will be initialized. |
SRDOGuard | SRDOGuard object. |
em | Emergency object. |
SDO | SDO object. |
nodeId | CANopen Node ID of this device. If default COB_ID is used, value will be added. |
defaultCOB_ID | Default COB ID for this SRDO (without NodeId). |
SRDOCommPar | Pointer to SRDO communication parameter record from Object dictionary (index 0x1301+). |
SRDOMapPar | Pointer to SRDO mapping parameter record from Object dictionary (index 0x1381+). |
checksum | |
idx_SRDOCommPar | Index in Object Dictionary |
idx_SRDOMapPar | Index in Object Dictionary |
CANdevRx | CAN device used for SRDO reception. |
CANdevRxIdxNormal | Index of receive buffer in the above CAN device. |
CANdevRxIdxInverted | Index of receive buffer in the above CAN device. |
CANdevTx | CAN device used for SRDO transmission. |
CANdevTxIdxNormal | Index of transmit buffer in the above CAN device. |
CANdevTxIdxInverted | Index of transmit buffer in the above CAN device. |
- Returns
- CO_ReturnError_t: CO_ERROR_NO or CO_ERROR_ILLEGAL_ARGUMENT.
◆ CO_SRDO_initCallbackPre()
void CO_SRDO_initCallbackPre |
( |
CO_SRDO_t * |
SRDO, |
|
|
void * |
object, |
|
|
void(*)(void *object) |
pFunctSignalPre |
|
) |
| |
Initialize SRDO callback function.
Function initializes optional callback function, which should immediately start processing of CO_SRDO_process() function. Callback is called after SRDO message is received from the CAN bus.
- Parameters
-
SRDO | This object. |
object | Pointer to object, which will be passed to pFunctSignalPre(). Can be NULL |
pFunctSignalPre | Pointer to the callback function. Not called if NULL. |
◆ CO_SRDO_initCallbackEnterSafeState()
void CO_SRDO_initCallbackEnterSafeState |
( |
CO_SRDO_t * |
SRDO, |
|
|
void * |
object, |
|
|
void(*)(void *object) |
pFunctSignalSafe |
|
) |
| |
Initialize SRDO callback function.
Function initializes optional callback function, that is called when SRDO enters a safe state. This happens when a timeout is reached or the data is inconsistent. The safe state itself is not further defined. One measure, for example, would be to go back to the pre-operational state Callback is called from CO_SRDO_process().
- Parameters
-
SRDO | This object. |
object | Pointer to object, which will be passed to pFunctSignalSafe(). Can be NULL |
pFunctSignalSafe | Pointer to the callback function. Not called if NULL. |
◆ CO_SRDO_requestSend()
Send SRDO on event.
Sends SRDO before the next refresh timer tiggers. The message itself is send in CO_SRDO_process(). After the transmission the timer is reset to the full refresh time.
- Parameters
-
- Returns
- CO_ReturnError_t CO_ERROR_NO if request is granted
◆ CO_SRDO_process()
Process transmitting/receiving SRDO messages.
This function verifies the checksum on demand. This function also configures the SRDO on operation state change to operational
- Parameters
-
| SRDO | This object. |
| commands | result from CO_SRDOGuard_process(). |
| timeDifference_us | Time difference from previous function call in [microseconds]. |
[out] | timerNext_us | info to OS. |