static analysis: conditional of #if does not evaluate to 0 or 1 [MISRA 2012 Rule 20.8, required]
This commit is contained in:
parent
7399d31447
commit
d4e7214f4d
41 changed files with 606 additions and 606 deletions
|
|
@ -48,8 +48,8 @@
|
|||
* to process to process to process full *
|
||||
******************************************************************************/
|
||||
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PROD_CONFIGURABLE
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) != 0
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PROD_CONFIGURABLE) != 0
|
||||
/*
|
||||
* Custom functions for read/write OD object "COB-ID EMCY"
|
||||
*
|
||||
|
|
@ -146,7 +146,7 @@ static ODR_t OD_read_1014_default(OD_stream_t *stream, void *buf,
|
|||
}
|
||||
#endif /* (CO_CONFIG_EM) & CO_CONFIG_EM_PROD_CONFIGURABLE */
|
||||
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT) != 0
|
||||
/*
|
||||
* Custom function for writing OD object "Inhibit time EMCY"
|
||||
*
|
||||
|
|
@ -243,7 +243,7 @@ static ODR_t OD_write_1003(OD_stream_t *stream, const void *buf,
|
|||
}
|
||||
#endif /* (CO_CONFIG_EM) & CO_CONFIG_EM_HISTORY */
|
||||
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_STATUS_BITS
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_STATUS_BITS) != 0
|
||||
/*
|
||||
* Custom functions for read/write OD object _OD_statusBits_, optional
|
||||
*
|
||||
|
|
@ -308,7 +308,7 @@ static ODR_t OD_write_statusBits(OD_stream_t *stream, const void *buf,
|
|||
}
|
||||
#endif /* (CO_CONFIG_EM) & CO_CONFIG_EM_STATUS_BITS */
|
||||
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) != 0
|
||||
/*
|
||||
* Read received message from CAN module.
|
||||
*
|
||||
|
|
@ -345,24 +345,24 @@ static void CO_EM_receive(void *object, void *msg) {
|
|||
CO_ReturnError_t CO_EM_init(CO_EM_t *em,
|
||||
CO_CANmodule_t *CANdevTx,
|
||||
const OD_entry_t *OD_1001_errReg,
|
||||
#if (CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)
|
||||
#if ((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) != 0
|
||||
CO_EM_fifo_t *fifo,
|
||||
uint8_t fifoSize,
|
||||
#endif
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) != 0
|
||||
OD_entry_t *OD_1014_cobIdEm,
|
||||
uint16_t CANdevTxIdx,
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT) != 0
|
||||
OD_entry_t *OD_1015_InhTime,
|
||||
#endif
|
||||
#endif
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_HISTORY
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_HISTORY) != 0
|
||||
OD_entry_t *OD_1003_preDefErr,
|
||||
#endif
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_STATUS_BITS
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_STATUS_BITS) != 0
|
||||
OD_entry_t *OD_statusBits,
|
||||
#endif
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) != 0
|
||||
CO_CANmodule_t *CANdevRx,
|
||||
uint16_t CANdevRxIdx,
|
||||
#endif
|
||||
|
|
@ -374,17 +374,17 @@ CO_ReturnError_t CO_EM_init(CO_EM_t *em,
|
|||
|
||||
/* verify arguments */
|
||||
if ((em == NULL) || (OD_1001_errReg == NULL)
|
||||
#if (CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)
|
||||
#if ((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) != 0
|
||||
|| ((fifo == NULL) && (fifoSize >= 2U))
|
||||
#endif
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) != 0
|
||||
|| (OD_1014_cobIdEm == NULL) || (CANdevTx == NULL)
|
||||
|| (nodeId < 1U) || (nodeId > 127U)
|
||||
#endif
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_HISTORY
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_HISTORY) != 0
|
||||
|| OD_1003_preDefErr == NULL
|
||||
#endif
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) != 0
|
||||
|| CANdevRx == NULL
|
||||
#endif
|
||||
) {
|
||||
|
|
@ -405,11 +405,11 @@ CO_ReturnError_t CO_EM_init(CO_EM_t *em,
|
|||
}
|
||||
*em->errorRegister = 0;
|
||||
|
||||
#if (CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)
|
||||
#if ((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) != 0
|
||||
em->fifo = fifo;
|
||||
em->fifoSize = fifoSize;
|
||||
#endif
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) != 0
|
||||
/* get initial and verify "COB-ID EMCY" from Object Dictionary */
|
||||
uint32_t COB_IDEmergency32;
|
||||
ODR_t odRet;
|
||||
|
|
@ -420,7 +420,7 @@ CO_ReturnError_t CO_EM_init(CO_EM_t *em,
|
|||
if (odRet != ODR_OK) { return CO_ERROR_OD_PARAMETERS; }
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PROD_CONFIGURABLE
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PROD_CONFIGURABLE) != 0
|
||||
uint16_t producerCanId = (uint16_t)(COB_IDEmergency32 & 0x7FF);
|
||||
em->producerEnabled = (COB_IDEmergency32 & 0x80000000) == 0
|
||||
&& producerCanId != 0;
|
||||
|
|
@ -469,7 +469,7 @@ CO_ReturnError_t CO_EM_init(CO_EM_t *em,
|
|||
return CO_ERROR_ILLEGAL_ARGUMENT;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT) != 0
|
||||
/* get and verify optional "Inhibit time EMCY" from Object Dictionary */
|
||||
em->inhibitEmTime_us = 0;
|
||||
em->inhibitEmTimer = 0;
|
||||
|
|
@ -487,7 +487,7 @@ CO_ReturnError_t CO_EM_init(CO_EM_t *em,
|
|||
#endif /* (CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER */
|
||||
|
||||
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_HISTORY
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_HISTORY) != 0
|
||||
/* If OD entry available, make access to em->preDefErr */
|
||||
em->OD_1003_extension.object = em;
|
||||
em->OD_1003_extension.read = OD_read_1003;
|
||||
|
|
@ -496,7 +496,7 @@ CO_ReturnError_t CO_EM_init(CO_EM_t *em,
|
|||
#endif /* (CO_CONFIG_EM) & CO_CONFIG_EM_HISTORY */
|
||||
|
||||
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_STATUS_BITS
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_STATUS_BITS) != 0
|
||||
/* If OD entry available, make access to em->errorStatusBits */
|
||||
em->OD_statusBits_extension.object = em;
|
||||
em->OD_statusBits_extension.read = OD_read_statusBits;
|
||||
|
|
@ -505,7 +505,7 @@ CO_ReturnError_t CO_EM_init(CO_EM_t *em,
|
|||
#endif /* (CO_CONFIG_EM) & CO_CONFIG_EM_STATUS_BITS */
|
||||
|
||||
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) != 0
|
||||
em->pFunctSignalRx = NULL;
|
||||
/* configure SDO server CAN reception */
|
||||
ret = CO_CANrxBufferInit(
|
||||
|
|
@ -523,7 +523,7 @@ CO_ReturnError_t CO_EM_init(CO_EM_t *em,
|
|||
|
||||
|
||||
/******************************************************************************/
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) != 0
|
||||
void CO_EM_initCallbackRx(CO_EM_t *em,
|
||||
void (*pFunctSignalRx)(const uint16_t ident,
|
||||
const uint16_t errorCode,
|
||||
|
|
@ -537,7 +537,7 @@ void CO_EM_initCallbackRx(CO_EM_t *em,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
void CO_EM_initCallbackPre(CO_EM_t *em,
|
||||
void *object,
|
||||
void (*pFunctSignal)(void *object))
|
||||
|
|
@ -633,11 +633,11 @@ void CO_EM_process(CO_EM_t *em,
|
|||
}
|
||||
|
||||
/* post-process Emergency message in fifo buffer. */
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) != 0
|
||||
if (em->fifoSize >= 2U) {
|
||||
uint8_t fifoPpPtr = em->fifoPpPtr;
|
||||
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT) != 0
|
||||
if (em->inhibitEmTimer < em->inhibitEmTime_us) {
|
||||
em->inhibitEmTimer += timeDifference_us;
|
||||
}
|
||||
|
|
@ -657,7 +657,7 @@ void CO_EM_process(CO_EM_t *em,
|
|||
sizeof(em->CANtxBuff->data));
|
||||
CO_CANsend(em->CANdevTx, em->CANtxBuff);
|
||||
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) != 0
|
||||
/* report also own emergency messages */
|
||||
if (em->pFunctSignalRx != NULL) {
|
||||
uint32_t errMsg = em->fifo[fifoPpPtr].msg;
|
||||
|
|
@ -685,8 +685,8 @@ void CO_EM_process(CO_EM_t *em,
|
|||
}
|
||||
else { /* MISRA C 2004 14.10 */ }
|
||||
}
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT) != 0
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
else if (timerNext_us != NULL
|
||||
&& em->inhibitEmTimer < em->inhibitEmTime_us)
|
||||
{
|
||||
|
|
@ -699,7 +699,7 @@ void CO_EM_process(CO_EM_t *em,
|
|||
#endif
|
||||
#endif
|
||||
}
|
||||
#elif (CO_CONFIG_EM) & CO_CONFIG_EM_HISTORY
|
||||
#elif ((CO_CONFIG_EM) & CO_CONFIG_EM_HISTORY) != 0
|
||||
if (em->fifoSize >= 2) {
|
||||
uint8_t fifoPpPtr = em->fifoPpPtr;
|
||||
while (fifoPpPtr != em->fifoWrPtr) {
|
||||
|
|
@ -752,10 +752,10 @@ void CO_error(CO_EM_t *em, bool_t setError, const CO_EM_errorStatusBits_t errorB
|
|||
errorCode = CO_EMC_NO_ERROR;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)
|
||||
#if ((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) != 0
|
||||
/* prepare emergency message. Error register will be added in post-process*/
|
||||
uint32_t errMsg = ((uint32_t)errorBit << 24) | CO_SWAP_16(errorCode);
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) != 0
|
||||
uint32_t infoCodeSwapped = CO_SWAP_32(infoCode);
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -765,7 +765,7 @@ void CO_error(CO_EM_t *em, bool_t setError, const CO_EM_errorStatusBits_t errorB
|
|||
if (setError) { *errorStatusBits |= bitmask; }
|
||||
else { *errorStatusBits &= ~bitmask; }
|
||||
|
||||
#if (CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)
|
||||
#if ((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) != 0
|
||||
if (em->fifoSize >= 2) {
|
||||
uint8_t fifoWrPtr = em->fifoWrPtr;
|
||||
uint8_t fifoWrPtrNext = fifoWrPtr + 1;
|
||||
|
|
@ -778,7 +778,7 @@ void CO_error(CO_EM_t *em, bool_t setError, const CO_EM_errorStatusBits_t errorB
|
|||
}
|
||||
else {
|
||||
em->fifo[fifoWrPtr].msg = errMsg;
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) != 0
|
||||
em->fifo[fifoWrPtr].info = infoCodeSwapped;
|
||||
#endif
|
||||
em->fifoWrPtr = fifoWrPtrNext;
|
||||
|
|
@ -789,8 +789,8 @@ void CO_error(CO_EM_t *em, bool_t setError, const CO_EM_errorStatusBits_t errorB
|
|||
|
||||
CO_UNLOCK_EMCY(em->CANdevTx);
|
||||
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) != 0
|
||||
/* Optional signal to RTOS, which can resume task, which handles
|
||||
* CO_EM_process */
|
||||
if (em->pFunctSignalPre != NULL && em->producerEnabled) {
|
||||
|
|
|
|||
|
|
@ -360,14 +360,14 @@ typedef enum {
|
|||
|
||||
|
||||
|
||||
#if ((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) \
|
||||
#if (((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) != 0) \
|
||||
|| defined CO_DOXYGEN
|
||||
/**
|
||||
* Fifo buffer for emergency producer and error history
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t msg;
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) != 0) || defined CO_DOXYGEN
|
||||
uint32_t info;
|
||||
#endif
|
||||
} CO_EM_fifo_t;
|
||||
|
|
@ -387,7 +387,7 @@ typedef struct {
|
|||
/** From CO_EM_init() */
|
||||
CO_CANmodule_t *CANdevTx;
|
||||
|
||||
#if ((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) \
|
||||
#if (((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) != 0) \
|
||||
|| defined CO_DOXYGEN
|
||||
/** Internal circular FIFO buffer for storing pre-processed emergency
|
||||
* messages. Messages are added by @ref CO_error() function. All messages
|
||||
|
|
@ -411,7 +411,7 @@ typedef struct {
|
|||
uint8_t fifoCount;
|
||||
#endif /* (CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY) */
|
||||
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) != 0) || defined CO_DOXYGEN
|
||||
/** True, if emergency producer is enabled, from Object dictionary */
|
||||
bool_t producerEnabled;
|
||||
/** Copy of CANopen node ID, from CO_EM_init() */
|
||||
|
|
@ -420,13 +420,13 @@ typedef struct {
|
|||
CO_CANtx_t *CANtxBuff;
|
||||
/** Extension for OD object */
|
||||
OD_extension_t OD_1014_extension;
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PROD_CONFIGURABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_EM) & CO_CONFIG_EM_PROD_CONFIGURABLE) != 0) || defined CO_DOXYGEN
|
||||
/** COB ID of emergency message, from Object dictionary */
|
||||
uint16_t producerCanId;
|
||||
/** From CO_EM_init() */
|
||||
uint16_t CANdevTxIdx;
|
||||
#endif
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT) != 0) || defined CO_DOXYGEN
|
||||
/** Inhibit time for emergency message, from Object dictionary */
|
||||
uint32_t inhibitEmTime_us;
|
||||
/**< Internal timer for inhibit time */
|
||||
|
|
@ -436,17 +436,17 @@ typedef struct {
|
|||
#endif
|
||||
#endif /* (CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER */
|
||||
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_HISTORY) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_EM) & CO_CONFIG_EM_HISTORY) != 0) || defined CO_DOXYGEN
|
||||
/** Extension for OD object */
|
||||
OD_extension_t OD_1003_extension;
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_STATUS_BITS) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_EM) & CO_CONFIG_EM_STATUS_BITS) != 0) || defined CO_DOXYGEN
|
||||
/** Extension for OD object */
|
||||
OD_extension_t OD_statusBits_extension;
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_EM_initCallbackRx() or NULL */
|
||||
void (*pFunctSignalRx)(const uint16_t ident,
|
||||
const uint16_t errorCode,
|
||||
|
|
@ -455,7 +455,7 @@ typedef struct {
|
|||
const uint32_t infoCode);
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_EM) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_EM_initCallbackPre() or NULL */
|
||||
void (*pFunctSignalPre)(void *object);
|
||||
/** From CO_EM_initCallbackPre() or NULL */
|
||||
|
|
@ -501,25 +501,25 @@ typedef struct {
|
|||
CO_ReturnError_t CO_EM_init(CO_EM_t *em,
|
||||
CO_CANmodule_t *CANdevTx,
|
||||
const OD_entry_t *OD_1001_errReg,
|
||||
#if ((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) \
|
||||
#if (((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) != 0) \
|
||||
|| defined CO_DOXYGEN
|
||||
CO_EM_fifo_t *fifo,
|
||||
uint8_t fifoSize,
|
||||
#endif
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) != 0) || defined CO_DOXYGEN
|
||||
OD_entry_t *OD_1014_cobIdEm,
|
||||
uint16_t CANdevTxIdx,
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT) != 0) || defined CO_DOXYGEN
|
||||
OD_entry_t *OD_1015_InhTime,
|
||||
#endif
|
||||
#endif
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_HISTORY) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_EM) & CO_CONFIG_EM_HISTORY) != 0) || defined CO_DOXYGEN
|
||||
OD_entry_t *OD_1003_preDefErr,
|
||||
#endif
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_STATUS_BITS) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_EM) & CO_CONFIG_EM_STATUS_BITS) != 0) || defined CO_DOXYGEN
|
||||
OD_entry_t *OD_statusBits,
|
||||
#endif
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) != 0) || defined CO_DOXYGEN
|
||||
CO_CANmodule_t *CANdevRx,
|
||||
uint16_t CANdevRxIdx,
|
||||
#endif
|
||||
|
|
@ -527,7 +527,7 @@ CO_ReturnError_t CO_EM_init(CO_EM_t *em,
|
|||
uint32_t *errInfo);
|
||||
|
||||
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_EM) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Initialize Emergency callback function.
|
||||
*
|
||||
|
|
@ -548,7 +548,7 @@ void CO_EM_initCallbackPre(CO_EM_t *em,
|
|||
#endif
|
||||
|
||||
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Initialize Emergency received callback function.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@
|
|||
|
||||
#include "301/CO_HBconsumer.h"
|
||||
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE) != 0
|
||||
|
||||
/* Verify HB consumer configuration *******************************************/
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE \
|
||||
&& (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI
|
||||
#if (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE) != 0) \
|
||||
&& (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI) != 0)
|
||||
#error CO_CONFIG_HB_CONS_CALLBACK_CHANGE and CO_CONFIG_HB_CONS_CALLBACK_MULTI cannot be set simultaneously!
|
||||
#endif
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ static void CO_HBcons_receive(void *object, void *msg) {
|
|||
/* copy data and set 'new message' flag. */
|
||||
HBconsNode->NMTstate = (CO_NMT_internalState_t)data[0];
|
||||
CO_FLAG_SET(HBconsNode->CANrxNew);
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/* Optional signal to RTOS, which can resume task, which handles HBcons. */
|
||||
if (HBconsNode->pFunctSignalPre != NULL) {
|
||||
HBconsNode->pFunctSignalPre(HBconsNode->functSignalObjectPre);
|
||||
|
|
@ -77,7 +77,7 @@ static CO_ReturnError_t CO_HBconsumer_initEntry(CO_HBconsumer_t *HBcons,
|
|||
uint16_t consumerTime_ms);
|
||||
|
||||
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
/*
|
||||
* Custom function for writing OD object "Consumer heartbeat time"
|
||||
*
|
||||
|
|
@ -161,7 +161,7 @@ CO_ReturnError_t CO_HBconsumer_init(CO_HBconsumer_t *HBcons,
|
|||
}
|
||||
|
||||
/* configure extension for OD */
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
HBcons->OD_1016_extension.object = HBcons;
|
||||
HBcons->OD_1016_extension.read = OD_readOriginal;
|
||||
HBcons->OD_1016_extension.write = OD_write_1016;
|
||||
|
|
@ -207,8 +207,8 @@ static CO_ReturnError_t CO_HBconsumer_initEntry(CO_HBconsumer_t *HBcons,
|
|||
monitoredNode->nodeId = nodeId;
|
||||
monitoredNode->time_us = (int32_t)consumerTime_ms * 1000;
|
||||
monitoredNode->NMTstate = CO_NMT_UNKNOWN;
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE \
|
||||
|| (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI
|
||||
#if (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE) != 0) \
|
||||
|| (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI) != 0)
|
||||
monitoredNode->NMTstatePrev = CO_NMT_UNKNOWN;
|
||||
#endif
|
||||
CO_FLAG_CLEAR(monitoredNode->CANrxNew);
|
||||
|
|
@ -237,7 +237,7 @@ static CO_ReturnError_t CO_HBconsumer_initEntry(CO_HBconsumer_t *HBcons,
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/******************************************************************************/
|
||||
void CO_HBconsumer_initCallbackPre(
|
||||
CO_HBconsumer_t *HBcons,
|
||||
|
|
@ -255,7 +255,7 @@ void CO_HBconsumer_initCallbackPre(
|
|||
#endif
|
||||
|
||||
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE) != 0
|
||||
/******************************************************************************/
|
||||
void CO_HBconsumer_initCallbackNmtChanged(
|
||||
CO_HBconsumer_t *HBcons,
|
||||
|
|
@ -276,7 +276,7 @@ void CO_HBconsumer_initCallbackNmtChanged(
|
|||
#endif
|
||||
|
||||
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI) != 0
|
||||
/******************************************************************************/
|
||||
void CO_HBconsumer_initCallbackNmtChanged(
|
||||
CO_HBconsumer_t *HBcons,
|
||||
|
|
@ -379,7 +379,7 @@ void CO_HBconsumer_process(
|
|||
if (CO_FLAG_READ(monitoredNode->CANrxNew)) {
|
||||
if (monitoredNode->NMTstate == CO_NMT_INITIALIZING) {
|
||||
/* bootup message*/
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI) != 0
|
||||
if (monitoredNode->pFunctSignalRemoteReset != NULL) {
|
||||
monitoredNode->pFunctSignalRemoteReset(
|
||||
monitoredNode->nodeId, i,
|
||||
|
|
@ -396,7 +396,7 @@ void CO_HBconsumer_process(
|
|||
}
|
||||
else {
|
||||
/* heartbeat message */
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI) != 0
|
||||
if (monitoredNode->HBstate != CO_HBconsumer_ACTIVE &&
|
||||
monitoredNode->pFunctSignalHbStarted != NULL) {
|
||||
monitoredNode->pFunctSignalHbStarted(
|
||||
|
|
@ -418,7 +418,7 @@ void CO_HBconsumer_process(
|
|||
|
||||
if (monitoredNode->timeoutTimer >= monitoredNode->time_us) {
|
||||
/* timeout expired */
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI) != 0
|
||||
if (monitoredNode->pFunctSignalTimeout!=NULL) {
|
||||
monitoredNode->pFunctSignalTimeout(
|
||||
monitoredNode->nodeId, i,
|
||||
|
|
@ -431,7 +431,7 @@ void CO_HBconsumer_process(
|
|||
monitoredNode->HBstate = CO_HBconsumer_TIMEOUT;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
else if (timerNext_us != NULL) {
|
||||
/* Calculate timerNext_us for next timeout checking. */
|
||||
uint32_t diff = monitoredNode->time_us
|
||||
|
|
@ -449,11 +449,11 @@ void CO_HBconsumer_process(
|
|||
if (monitoredNode->NMTstate != CO_NMT_OPERATIONAL) {
|
||||
allMonitoredOperationalCurrent = false;
|
||||
}
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE \
|
||||
|| (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI
|
||||
#if (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE) != 0) \
|
||||
|| (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI) != 0)
|
||||
/* Verify, if NMT state of monitored node changed */
|
||||
if(monitoredNode->NMTstate != monitoredNode->NMTstatePrev) {
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE) != 0
|
||||
if (HBcons->pFunctSignalNmtChanged != NULL) {
|
||||
HBcons->pFunctSignalNmtChanged(
|
||||
monitoredNode->nodeId, i, monitoredNode->NMTstate,
|
||||
|
|
@ -475,8 +475,8 @@ void CO_HBconsumer_process(
|
|||
for(uint8_t i=0; i<HBcons->numberOfMonitoredNodes; i++) {
|
||||
CO_HBconsNode_t * const monitoredNode = &HBcons->monitoredNodes[i];
|
||||
monitoredNode->NMTstate = CO_NMT_UNKNOWN;
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE \
|
||||
|| (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI
|
||||
#if (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE) != 0) \
|
||||
|| (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI) != 0)
|
||||
monitoredNode->NMTstatePrev = CO_NMT_UNKNOWN;
|
||||
#endif
|
||||
CO_FLAG_CLEAR(monitoredNode->CANrxNew);
|
||||
|
|
@ -502,7 +502,7 @@ void CO_HBconsumer_process(
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_QUERY_FUNCT
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_QUERY_FUNCT) != 0
|
||||
/******************************************************************************/
|
||||
int8_t CO_HBconsumer_getIdxByNodeId(
|
||||
CO_HBconsumer_t *HBcons,
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
CO_CONFIG_GLOBAL_FLAG_OD_DYNAMIC)
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -91,19 +91,19 @@ typedef struct {
|
|||
uint32_t time_us;
|
||||
/** Indication if new Heartbeat message received from the CAN bus */
|
||||
volatile void *CANrxNew;
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_HB_CONS) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_HBconsumer_initCallbackPre() or NULL */
|
||||
void (*pFunctSignalPre)(void *object);
|
||||
/** From CO_HBconsumer_initCallbackPre() or NULL */
|
||||
void *functSignalObjectPre;
|
||||
#endif
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE) \
|
||||
|| ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI) \
|
||||
#if (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE) != 0) \
|
||||
|| (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI) != 0) \
|
||||
|| defined CO_DOXYGEN
|
||||
/** Previous value of the remote node (Heartbeat payload) */
|
||||
CO_NMT_internalState_t NMTstatePrev;
|
||||
#endif
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI) != 0) || defined CO_DOXYGEN
|
||||
/** Callback for remote NMT changed event.
|
||||
* From CO_HBconsumer_initCallbackNmtChanged() or NULL. */
|
||||
void (*pFunctSignalNmtChanged)(uint8_t nodeId, uint8_t idx,
|
||||
|
|
@ -156,11 +156,11 @@ typedef struct {
|
|||
CO_CANmodule_t *CANdevRx;
|
||||
/** From CO_HBconsumer_init() */
|
||||
uint16_t CANdevRxIdxStart;
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_FLAG_OD_DYNAMIC) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_HB_CONS) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0) || defined CO_DOXYGEN
|
||||
/** Extension for OD object */
|
||||
OD_extension_t OD_1016_extension;
|
||||
#endif
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE) != 0) || defined CO_DOXYGEN
|
||||
/** Callback for remote NMT changed event.
|
||||
* From CO_HBconsumer_initCallbackNmtChanged() or NULL. */
|
||||
void (*pFunctSignalNmtChanged)(uint8_t nodeId, uint8_t idx,
|
||||
|
|
@ -201,7 +201,7 @@ CO_ReturnError_t CO_HBconsumer_init(CO_HBconsumer_t *HBcons,
|
|||
uint32_t *errInfo);
|
||||
|
||||
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_HB_CONS) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Initialize Heartbeat consumer callback function.
|
||||
*
|
||||
|
|
@ -219,8 +219,8 @@ void CO_HBconsumer_initCallbackPre(
|
|||
void (*pFunctSignal)(void *object));
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE) \
|
||||
|| ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI) \
|
||||
#if (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_CHANGE) != 0) \
|
||||
|| (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI) != 0) \
|
||||
|| defined CO_DOXYGEN
|
||||
/**
|
||||
* Initialize Heartbeat consumer NMT changed callback function.
|
||||
|
|
@ -244,7 +244,7 @@ void CO_HBconsumer_initCallbackNmtChanged(
|
|||
void *object));
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_CALLBACK_MULTI) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Initialize Heartbeat consumer started callback function.
|
||||
*
|
||||
|
|
@ -317,7 +317,7 @@ void CO_HBconsumer_process(
|
|||
uint32_t *timerNext_us);
|
||||
|
||||
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_QUERY_FUNCT) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_QUERY_FUNCT) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Get the heartbeat producer object index by node ID
|
||||
*
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ static void CO_NMT_receive(void *object, void *msg) {
|
|||
if ((DLC == 2U) && ((nodeId == 0U) || (nodeId == NMT->nodeId))) {
|
||||
NMT->internalCommand = command;
|
||||
|
||||
#if (CO_CONFIG_NMT) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/* Optional signal to RTOS, which can resume task, which handles NMT. */
|
||||
if (NMT->pFunctSignalPre != NULL) {
|
||||
NMT->pFunctSignalPre(NMT->functSignalObjectPre);
|
||||
|
|
@ -89,7 +89,7 @@ CO_ReturnError_t CO_NMT_init(CO_NMT_t *NMT,
|
|||
CO_CANmodule_t *NMT_CANdevRx,
|
||||
uint16_t NMT_rxIdx,
|
||||
uint16_t CANidRxNMT,
|
||||
#if (CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER) != 0
|
||||
CO_CANmodule_t *NMT_CANdevTx,
|
||||
uint16_t NMT_txIdx,
|
||||
uint16_t CANidTxNMT,
|
||||
|
|
@ -104,7 +104,7 @@ CO_ReturnError_t CO_NMT_init(CO_NMT_t *NMT,
|
|||
/* verify arguments */
|
||||
if ((NMT == NULL) || (OD_1017_ProducerHbTime == NULL) || (em == NULL)
|
||||
|| (NMT_CANdevRx == NULL) || (HB_CANdevTx == NULL)
|
||||
#if (CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER) != 0
|
||||
|| (NMT_CANdevTx == NULL)
|
||||
#endif
|
||||
) {
|
||||
|
|
@ -157,7 +157,7 @@ CO_ReturnError_t CO_NMT_init(CO_NMT_t *NMT,
|
|||
return ret;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER) != 0
|
||||
/* configure NMT CAN transmission */
|
||||
NMT->NMT_CANdevTx = NMT_CANdevTx;
|
||||
NMT->NMT_TXbuff = CO_CANtxBufferInit(
|
||||
|
|
@ -189,7 +189,7 @@ CO_ReturnError_t CO_NMT_init(CO_NMT_t *NMT,
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_NMT) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
void CO_NMT_initCallbackPre(CO_NMT_t *NMT,
|
||||
void *object,
|
||||
void (*pFunctSignal)(void *object))
|
||||
|
|
@ -202,7 +202,7 @@ void CO_NMT_initCallbackPre(CO_NMT_t *NMT,
|
|||
#endif
|
||||
|
||||
|
||||
#if (CO_CONFIG_NMT) & CO_CONFIG_NMT_CALLBACK_CHANGE
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_NMT_CALLBACK_CHANGE) != 0
|
||||
/******************************************************************************/
|
||||
void CO_NMT_initCallbackChanged(CO_NMT_t *NMT,
|
||||
void (*pFunctNMT)(CO_NMT_internalState_t state))
|
||||
|
|
@ -300,7 +300,7 @@ CO_NMT_reset_cmd_t CO_NMT_process(CO_NMT_t *NMT,
|
|||
}
|
||||
else { /* MISRA C 2004 14.10 */ }
|
||||
|
||||
#if (CO_CONFIG_NMT) & CO_CONFIG_NMT_CALLBACK_CHANGE
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_NMT_CALLBACK_CHANGE) != 0
|
||||
/* Notify operating state change */
|
||||
if (NMT->operatingStatePrev != NMTstateCpy || NNTinit) {
|
||||
if (NMT->pFunctNMT != NULL) {
|
||||
|
|
@ -309,7 +309,7 @@ CO_NMT_reset_cmd_t CO_NMT_process(CO_NMT_t *NMT,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_NMT) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
/* Calculate, when next Heartbeat needs to be send */
|
||||
if (NMT->HBproducerTime_us != 0 && timerNext_us != NULL) {
|
||||
if (NMT->operatingStatePrev != NMTstateCpy) {
|
||||
|
|
@ -328,7 +328,7 @@ CO_NMT_reset_cmd_t CO_NMT_process(CO_NMT_t *NMT,
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER) != 0
|
||||
/******************************************************************************/
|
||||
CO_ReturnError_t CO_NMT_sendCommand(CO_NMT_t *NMT,
|
||||
CO_NMT_command_t command,
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ typedef struct {
|
|||
OD_extension_t OD_1017_extension;
|
||||
/** From CO_NMT_init() */
|
||||
CO_EM_t *em;
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_NMT_init() */
|
||||
CO_CANmodule_t *NMT_CANdevTx;
|
||||
/** CAN transmit buffer for NMT master message */
|
||||
|
|
@ -191,13 +191,13 @@ typedef struct {
|
|||
CO_CANmodule_t *HB_CANdevTx;
|
||||
/** CAN transmit buffer for heartbeat message */
|
||||
CO_CANtx_t *HB_TXbuff;
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_NMT) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_NMT_initCallbackPre() or NULL */
|
||||
void (*pFunctSignalPre)(void *object);
|
||||
/** From CO_NMT_initCallbackPre() or NULL */
|
||||
void *functSignalObjectPre;
|
||||
#endif
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_NMT_CALLBACK_CHANGE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_NMT) & CO_CONFIG_NMT_CALLBACK_CHANGE) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_NMT_initCallbackChanged() or NULL */
|
||||
void (*pFunctNMT)(CO_NMT_internalState_t state);
|
||||
#endif
|
||||
|
|
@ -242,7 +242,7 @@ CO_ReturnError_t CO_NMT_init(CO_NMT_t *NMT,
|
|||
CO_CANmodule_t *NMT_CANdevRx,
|
||||
uint16_t NMT_rxIdx,
|
||||
uint16_t CANidRxNMT,
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER) != 0) || defined CO_DOXYGEN
|
||||
CO_CANmodule_t *NMT_CANdevTx,
|
||||
uint16_t NMT_txIdx,
|
||||
uint16_t CANidTxNMT,
|
||||
|
|
@ -253,7 +253,7 @@ CO_ReturnError_t CO_NMT_init(CO_NMT_t *NMT,
|
|||
uint32_t *errInfo);
|
||||
|
||||
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_NMT) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Initialize NMT callback function after message preprocessed.
|
||||
*
|
||||
|
|
@ -272,7 +272,7 @@ void CO_NMT_initCallbackPre(CO_NMT_t *NMT,
|
|||
#endif
|
||||
|
||||
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_NMT_CALLBACK_CHANGE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_NMT) & CO_CONFIG_NMT_CALLBACK_CHANGE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Initialize NMT callback function.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "301/CO_Node_Guarding.h"
|
||||
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE) != 0
|
||||
|
||||
/*
|
||||
* Read received message from CAN module.
|
||||
|
|
@ -240,7 +240,7 @@ void CO_nodeGuardingSlave_process(CO_nodeGuardingSlave_t *ngs,
|
|||
else if (ngs->lifeTimer > 0U) {
|
||||
if (timeDifference_us < ngs->lifeTimer) {
|
||||
ngs->lifeTimer -= timeDifference_us;
|
||||
#if (CO_CONFIG_NMT) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
/* Calculate, when timeout expires */
|
||||
if (timerNext_us != NULL && *timerNext_us > ngs->lifeTimer) {
|
||||
*timerNext_us = ngs->lifeTimer;
|
||||
|
|
@ -265,7 +265,7 @@ void CO_nodeGuardingSlave_process(CO_nodeGuardingSlave_t *ngs,
|
|||
|
||||
|
||||
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE) != 0
|
||||
/*
|
||||
* Read received message from CAN module.
|
||||
*
|
||||
|
|
@ -402,7 +402,7 @@ void CO_nodeGuardingMaster_process(CO_nodeGuardingMaster_t *ngm,
|
|||
if (node->guardTime_us > 0 && node->ident > CO_CAN_ID_HEARTBEAT) {
|
||||
if (timeDifference_us < node->guardTimer) {
|
||||
node->guardTimer -= timeDifference_us;
|
||||
#if (CO_CONFIG_NMT) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
/* Calculate, when timeout expires */
|
||||
if (timerNext_us != NULL && *timerNext_us > node->guardTimer) {
|
||||
*timerNext_us = node->guardTimer;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
#define CO_CONFIG_NODE_GUARDING_MASTER_COUNT 0x7F
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -186,7 +186,7 @@ static inline bool_t CO_nodeGuardingSlave_isTimeout(CO_nodeGuardingSlave_t *ngs)
|
|||
|
||||
|
||||
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#if CO_CONFIG_NODE_GUARDING_MASTER_COUNT < 1 || CO_CONFIG_NODE_GUARDING_MASTER_COUNT > 127
|
||||
#error CO_CONFIG_NODE_GUARDING_MASTER_COUNT value is wrong!
|
||||
|
|
|
|||
98
301/CO_PDO.c
98
301/CO_PDO.c
|
|
@ -27,15 +27,15 @@
|
|||
|
||||
#include "301/CO_PDO.h"
|
||||
|
||||
#if (CO_CONFIG_PDO) & (CO_CONFIG_RPDO_ENABLE | CO_CONFIG_TPDO_ENABLE)
|
||||
#if ((CO_CONFIG_PDO) & (CO_CONFIG_RPDO_ENABLE | CO_CONFIG_TPDO_ENABLE)) != 0
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_OD_IO_ACCESS) == 0
|
||||
#error Dynamic PDO mapping is not possible without CO_CONFIG_PDO_OD_IO_ACCESS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_OD_IO_ACCESS
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_OD_IO_ACCESS) != 0
|
||||
/*
|
||||
* Custom function for write dummy OD object. Will be used only from RPDO.
|
||||
*
|
||||
|
|
@ -222,7 +222,7 @@ static CO_ReturnError_t PDO_initMapping(CO_PDO_common_t *PDO,
|
|||
return CO_ERROR_NO;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
/*
|
||||
* Custom function for writing OD object "PDO mapping parameter"
|
||||
*
|
||||
|
|
@ -404,7 +404,7 @@ static CO_ReturnError_t PDO_initMapping(CO_PDO_common_t *PDO,
|
|||
#endif /* ((CO_CONFIG_PDO) & CO_CONFIG_PDO_OD_IO_ACCESS) == 0 */
|
||||
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
/*
|
||||
* Custom function for reading OD object "PDO communication parameter"
|
||||
*
|
||||
|
|
@ -441,7 +441,7 @@ static ODR_t OD_read_PDO_commParam(OD_stream_t *stream, void *buf,
|
|||
/*******************************************************************************
|
||||
* R P D O
|
||||
******************************************************************************/
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE) != 0
|
||||
/*
|
||||
* States for RPDO->receiveError indicates received RPDOs with wrong length.
|
||||
*/
|
||||
|
|
@ -482,7 +482,7 @@ static void CO_PDO_receive(void *object, void *msg) {
|
|||
|
||||
/* Determine, to which of the two rx buffers copy the message. */
|
||||
uint8_t bufNo = 0;
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0
|
||||
if (RPDO->synchronous && (RPDO->SYNC != NULL)
|
||||
&& RPDO->SYNC->CANrxToggle
|
||||
) {
|
||||
|
|
@ -494,7 +494,7 @@ static void CO_PDO_receive(void *object, void *msg) {
|
|||
(void)memcpy(RPDO->CANrxData[bufNo], data,sizeof(RPDO->CANrxData[bufNo]));
|
||||
CO_FLAG_SET(RPDO->CANrxNew[bufNo]);
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/* Optional signal to RTOS, which can resume task, which handles
|
||||
* the RPDO. */
|
||||
if (RPDO->pFunctSignalPre != NULL) {
|
||||
|
|
@ -512,7 +512,7 @@ static void CO_PDO_receive(void *object, void *msg) {
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
/*
|
||||
* Custom function for writing OD object "RPDO communication parameter"
|
||||
*
|
||||
|
|
@ -574,7 +574,7 @@ static ODR_t OD_write_14xx(OD_stream_t *stream, const void *buf,
|
|||
else {
|
||||
PDO->valid = false;
|
||||
CO_FLAG_CLEAR(RPDO->CANrxNew[0]);
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0
|
||||
CO_FLAG_CLEAR(RPDO->CANrxNew[1]);
|
||||
#endif
|
||||
if (ret != CO_ERROR_NO) {
|
||||
|
|
@ -587,7 +587,7 @@ static ODR_t OD_write_14xx(OD_stream_t *stream, const void *buf,
|
|||
|
||||
case 2: { /* transmission type */
|
||||
uint8_t transmissionType = CO_getUint8(buf);
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0
|
||||
if ((transmissionType > (uint8_t)CO_PDO_TRANSM_TYPE_SYNC_240)
|
||||
&& (transmissionType < (uint8_t)CO_PDO_TRANSM_TYPE_SYNC_EVENT_LO)
|
||||
) {
|
||||
|
|
@ -609,7 +609,7 @@ static ODR_t OD_write_14xx(OD_stream_t *stream, const void *buf,
|
|||
break;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE) != 0
|
||||
case 5: { /* event-timer */
|
||||
uint32_t eventTime = CO_getUint16(buf);
|
||||
RPDO->timeoutTime_us = eventTime * 1000U;
|
||||
|
|
@ -632,7 +632,7 @@ static ODR_t OD_write_14xx(OD_stream_t *stream, const void *buf,
|
|||
CO_ReturnError_t CO_RPDO_init(CO_RPDO_t *RPDO,
|
||||
OD_t *OD,
|
||||
CO_EM_t *em,
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0
|
||||
CO_SYNC_t *SYNC,
|
||||
#endif
|
||||
uint16_t preDefinedCanId,
|
||||
|
|
@ -720,7 +720,7 @@ CO_ReturnError_t CO_RPDO_init(CO_RPDO_t *RPDO,
|
|||
|
||||
|
||||
/* Configure communication parameter - transmission type */
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0
|
||||
uint8_t transmissionType = CO_PDO_TRANSM_TYPE_SYNC_EVENT_LO;
|
||||
odRet = OD_get_u8(OD_14xx_RPDOCommPar, 2, &transmissionType, true);
|
||||
if (odRet != ODR_OK) {
|
||||
|
|
@ -736,7 +736,7 @@ CO_ReturnError_t CO_RPDO_init(CO_RPDO_t *RPDO,
|
|||
|
||||
|
||||
/* Configure communication parameter - event-timer (optional) */
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE) != 0
|
||||
uint16_t eventTime = 0;
|
||||
odRet = OD_get_u16(OD_14xx_RPDOCommPar, 5, &eventTime, true);
|
||||
RPDO->timeoutTime_us = (uint32_t)eventTime * 1000U;
|
||||
|
|
@ -744,7 +744,7 @@ CO_ReturnError_t CO_RPDO_init(CO_RPDO_t *RPDO,
|
|||
|
||||
|
||||
/* Configure OD extensions */
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
PDO->isRPDO = true;
|
||||
PDO->OD = OD;
|
||||
PDO->CANdevIdx = CANdevRxIdx;
|
||||
|
|
@ -764,7 +764,7 @@ CO_ReturnError_t CO_RPDO_init(CO_RPDO_t *RPDO,
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
void CO_RPDO_initCallbackPre(CO_RPDO_t *RPDO,
|
||||
void *object,
|
||||
void (*pFunctSignalPre)(void *object))
|
||||
|
|
@ -779,7 +779,7 @@ void CO_RPDO_initCallbackPre(CO_RPDO_t *RPDO,
|
|||
|
||||
/******************************************************************************/
|
||||
void CO_RPDO_process(CO_RPDO_t *RPDO,
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE) != 0
|
||||
uint32_t timeDifference_us,
|
||||
uint32_t *timerNext_us,
|
||||
#endif
|
||||
|
|
@ -790,7 +790,7 @@ void CO_RPDO_process(CO_RPDO_t *RPDO,
|
|||
CO_PDO_common_t *PDO = &RPDO->PDO_common;
|
||||
|
||||
if (PDO->valid && NMTisOperational
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0
|
||||
&& (syncWas || !RPDO->synchronous)
|
||||
#endif
|
||||
) {
|
||||
|
|
@ -807,7 +807,7 @@ void CO_RPDO_process(CO_RPDO_t *RPDO,
|
|||
|
||||
/* Determine, which of the two rx buffers contains relevant message. */
|
||||
uint8_t bufNo = 0;
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0
|
||||
if (RPDO->synchronous && (RPDO->SYNC != NULL)
|
||||
&& !RPDO->SYNC->CANrxToggle) {
|
||||
bufNo = 1;
|
||||
|
|
@ -824,7 +824,7 @@ void CO_RPDO_process(CO_RPDO_t *RPDO,
|
|||
* by receive thread, then copy the latest data again. */
|
||||
CO_FLAG_CLEAR(RPDO->CANrxNew[bufNo]);
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_OD_IO_ACCESS
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_OD_IO_ACCESS) != 0
|
||||
for (uint8_t i = 0; i < PDO->mappedObjectsCount; i++) {
|
||||
OD_IO_t *OD_IO = &PDO->OD_IO[i];
|
||||
|
||||
|
|
@ -884,7 +884,7 @@ void CO_RPDO_process(CO_RPDO_t *RPDO,
|
|||
|
||||
/* verify RPDO timeout */
|
||||
(void) rpdoReceived;
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE) != 0
|
||||
if (RPDO->timeoutTime_us > 0U) {
|
||||
if (rpdoReceived) {
|
||||
if (RPDO->timeoutTimer > RPDO->timeoutTime_us) {
|
||||
|
|
@ -905,7 +905,7 @@ void CO_RPDO_process(CO_RPDO_t *RPDO,
|
|||
}
|
||||
}
|
||||
else { /* MISRA C 2004 14.10 */ }
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
if (timerNext_us != NULL
|
||||
&& RPDO->timeoutTimer < RPDO->timeoutTime_us
|
||||
) {
|
||||
|
|
@ -920,17 +920,17 @@ void CO_RPDO_process(CO_RPDO_t *RPDO,
|
|||
} /* if (PDO->valid && NMTisOperational) */
|
||||
else {
|
||||
/* not valid and operational, clear CAN receive flags and timeoutTimer*/
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0
|
||||
if (!PDO->valid || !NMTisOperational) {
|
||||
CO_FLAG_CLEAR(RPDO->CANrxNew[0]);
|
||||
CO_FLAG_CLEAR(RPDO->CANrxNew[1]);
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE) != 0
|
||||
RPDO->timeoutTimer = 0;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
CO_FLAG_CLEAR(RPDO->CANrxNew[0]);
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE) != 0
|
||||
RPDO->timeoutTimer = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -942,8 +942,8 @@ void CO_RPDO_process(CO_RPDO_t *RPDO,
|
|||
/*******************************************************************************
|
||||
* T P D O
|
||||
******************************************************************************/
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE) != 0
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
/*
|
||||
* Custom function for writing OD object "TPDO communication parameter"
|
||||
*
|
||||
|
|
@ -1011,7 +1011,7 @@ static ODR_t OD_write_18xx(OD_stream_t *stream, const void *buf,
|
|||
|
||||
case 2: { /* transmission type */
|
||||
uint8_t transmissionType = CO_getUint8(buf);
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0
|
||||
if ((transmissionType > (uint8_t)CO_PDO_TRANSM_TYPE_SYNC_240)
|
||||
&& (transmissionType < (uint8_t)CO_PDO_TRANSM_TYPE_SYNC_EVENT_LO)
|
||||
) {
|
||||
|
|
@ -1027,13 +1027,13 @@ static ODR_t OD_write_18xx(OD_stream_t *stream, const void *buf,
|
|||
#endif
|
||||
TPDO->transmissionType = transmissionType;
|
||||
TPDO->sendRequest = true;
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE) != 0
|
||||
TPDO->inhibitTimer = TPDO->eventTimer = 0;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE) != 0
|
||||
case 3: { /* inhibit time */
|
||||
if (PDO->valid) {
|
||||
return ODR_INVALID_VALUE;
|
||||
|
|
@ -1052,7 +1052,7 @@ static ODR_t OD_write_18xx(OD_stream_t *stream, const void *buf,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0
|
||||
case 6: { /* SYNC start value */
|
||||
uint8_t syncStartValue = CO_getUint8(buf);
|
||||
|
||||
|
|
@ -1078,7 +1078,7 @@ static ODR_t OD_write_18xx(OD_stream_t *stream, const void *buf,
|
|||
CO_ReturnError_t CO_TPDO_init(CO_TPDO_t *TPDO,
|
||||
OD_t *OD,
|
||||
CO_EM_t *em,
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0
|
||||
CO_SYNC_t *SYNC,
|
||||
#endif
|
||||
uint16_t preDefinedCanId,
|
||||
|
|
@ -1128,7 +1128,7 @@ CO_ReturnError_t CO_TPDO_init(CO_TPDO_t *TPDO,
|
|||
return CO_ERROR_OD_PARAMETERS;
|
||||
}
|
||||
if ((transmissionType < (uint8_t)CO_PDO_TRANSM_TYPE_SYNC_EVENT_LO)
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0
|
||||
&& (transmissionType > (uint8_t)CO_PDO_TRANSM_TYPE_SYNC_240)
|
||||
#endif
|
||||
) {
|
||||
|
|
@ -1184,7 +1184,7 @@ CO_ReturnError_t CO_TPDO_init(CO_TPDO_t *TPDO,
|
|||
|
||||
|
||||
/* Configure communication parameter - inhibit time and event-timer (opt) */
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE) != 0
|
||||
uint16_t inhibitTime = 0;
|
||||
uint16_t eventTime = 0;
|
||||
odRet = OD_get_u16(OD_18xx_TPDOCommPar, 3, &inhibitTime, true);
|
||||
|
|
@ -1195,7 +1195,7 @@ CO_ReturnError_t CO_TPDO_init(CO_TPDO_t *TPDO,
|
|||
|
||||
|
||||
/* Configure communication parameter - SYNC start value (optional) */
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0
|
||||
TPDO->syncStartValue = 0;
|
||||
odRet = OD_get_u8(OD_18xx_TPDOCommPar, 6, &TPDO->syncStartValue, true);
|
||||
TPDO->SYNC = SYNC;
|
||||
|
|
@ -1204,7 +1204,7 @@ CO_ReturnError_t CO_TPDO_init(CO_TPDO_t *TPDO,
|
|||
|
||||
|
||||
/* Configure OD extensions */
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
PDO->isRPDO = false;
|
||||
PDO->OD = OD;
|
||||
PDO->CANdevIdx = CANdevTxIdx;
|
||||
|
|
@ -1243,7 +1243,7 @@ static CO_ReturnError_t CO_TPDOsend(CO_TPDO_t *TPDO) {
|
|||
|| (TPDO->transmissionType >= (uint8_t)CO_PDO_TRANSM_TYPE_SYNC_EVENT_LO));
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_OD_IO_ACCESS
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_OD_IO_ACCESS) != 0
|
||||
for (uint8_t i = 0; i < PDO->mappedObjectsCount; i++) {
|
||||
OD_IO_t *OD_IO = &PDO->OD_IO[i];
|
||||
OD_stream_t *stream = &OD_IO->stream;
|
||||
|
|
@ -1317,7 +1317,7 @@ static CO_ReturnError_t CO_TPDOsend(CO_TPDO_t *TPDO) {
|
|||
#endif /* (CO_CONFIG_PDO) & CO_CONFIG_PDO_OD_IO_ACCESS */
|
||||
|
||||
TPDO->sendRequest = false;
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE) != 0
|
||||
TPDO->eventTimer = TPDO->eventTime_us;
|
||||
TPDO->inhibitTimer = TPDO->inhibitTime_us;
|
||||
#endif
|
||||
|
|
@ -1327,7 +1327,7 @@ static CO_ReturnError_t CO_TPDOsend(CO_TPDO_t *TPDO) {
|
|||
|
||||
/******************************************************************************/
|
||||
void CO_TPDO_process(CO_TPDO_t *TPDO,
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
uint32_t timeDifference_us,
|
||||
uint32_t *timerNext_us,
|
||||
#endif
|
||||
|
|
@ -1335,7 +1335,7 @@ void CO_TPDO_process(CO_TPDO_t *TPDO,
|
|||
bool_t syncWas)
|
||||
{
|
||||
CO_PDO_common_t *PDO = &TPDO->PDO_common;
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE)
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE)) != 0
|
||||
(void) timerNext_us;
|
||||
#endif
|
||||
(void) syncWas;
|
||||
|
|
@ -1343,19 +1343,19 @@ void CO_TPDO_process(CO_TPDO_t *TPDO,
|
|||
if (PDO->valid && NMTisOperational) {
|
||||
|
||||
/* check for event timer or application event */
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE) || (OD_FLAGS_PDO_SIZE > 0)
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE) != 0) || (OD_FLAGS_PDO_SIZE > 0)
|
||||
if ((TPDO->transmissionType == (uint8_t)CO_PDO_TRANSM_TYPE_SYNC_ACYCLIC)
|
||||
|| (TPDO->transmissionType >= (uint8_t)CO_PDO_TRANSM_TYPE_SYNC_EVENT_LO)
|
||||
) {
|
||||
/* event timer */
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE) != 0
|
||||
if (TPDO->eventTime_us != 0U) {
|
||||
TPDO->eventTimer = (TPDO->eventTimer > timeDifference_us)
|
||||
? (TPDO->eventTimer - timeDifference_us) : 0U;
|
||||
if (TPDO->eventTimer == 0U) {
|
||||
TPDO->sendRequest = true;
|
||||
}
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
if (timerNext_us != NULL && *timerNext_us > TPDO->eventTimer) {
|
||||
/* Schedule for next event time */
|
||||
*timerNext_us = TPDO->eventTimer;
|
||||
|
|
@ -1383,7 +1383,7 @@ void CO_TPDO_process(CO_TPDO_t *TPDO,
|
|||
|
||||
/* Send PDO by application request or by Event timer */
|
||||
if (TPDO->transmissionType >= (uint8_t)CO_PDO_TRANSM_TYPE_SYNC_EVENT_LO) {
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE) != 0
|
||||
TPDO->inhibitTimer = (TPDO->inhibitTimer > timeDifference_us)
|
||||
? (TPDO->inhibitTimer - timeDifference_us) : 0U;
|
||||
|
||||
|
|
@ -1392,7 +1392,7 @@ void CO_TPDO_process(CO_TPDO_t *TPDO,
|
|||
CO_TPDOsend(TPDO);
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
if (TPDO->sendRequest
|
||||
&& timerNext_us != NULL && *timerNext_us > TPDO->inhibitTimer
|
||||
) {
|
||||
|
|
@ -1408,7 +1408,7 @@ void CO_TPDO_process(CO_TPDO_t *TPDO,
|
|||
} /* if (TPDO->transmissionType >= CO_PDO_TRANSM_TYPE_SYNC_EVENT_LO) */
|
||||
|
||||
/* Synchronous PDOs */
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0
|
||||
else if ((TPDO->SYNC != NULL) && syncWas) {
|
||||
/* send synchronous acyclic TPDO */
|
||||
if (TPDO->transmissionType == (uint8_t)CO_PDO_TRANSM_TYPE_SYNC_ACYCLIC) {
|
||||
|
|
@ -1452,10 +1452,10 @@ void CO_TPDO_process(CO_TPDO_t *TPDO,
|
|||
else {
|
||||
/* Not operational or valid, reset triggers */
|
||||
TPDO->sendRequest = true;
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE) != 0
|
||||
TPDO->inhibitTimer = TPDO->eventTimer = 0;
|
||||
#endif
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0
|
||||
TPDO->syncCounter = 255;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
32
301/CO_PDO.h
32
301/CO_PDO.h
|
|
@ -43,7 +43,7 @@
|
|||
CO_CONFIG_GLOBAL_FLAG_OD_DYNAMIC)
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_PDO) & (CO_CONFIG_RPDO_ENABLE | CO_CONFIG_TPDO_ENABLE)) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & (CO_CONFIG_RPDO_ENABLE | CO_CONFIG_TPDO_ENABLE)) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -197,7 +197,7 @@ typedef struct {
|
|||
CO_PDO_size_t dataLength;
|
||||
/** Number of mapped objects in PDO */
|
||||
uint8_t mappedObjectsCount;
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_OD_IO_ACCESS) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_PDO_OD_IO_ACCESS) != 0) || defined CO_DOXYGEN
|
||||
/** Object dictionary interface for all mapped entries. OD_IO.dataOffset has
|
||||
* special usage with PDO. It stores information about mappedLength of
|
||||
* the variable. mappedLength can be less or equal to the OD_IO.dataLength.
|
||||
|
|
@ -219,7 +219,7 @@ typedef struct {
|
|||
uint8_t flagPDObitmask[CO_PDO_MAX_SIZE];
|
||||
#endif
|
||||
#endif
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_FLAG_OD_DYNAMIC) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0) || defined CO_DOXYGEN
|
||||
/** True for RPDO, false for TPDO */
|
||||
bool_t isRPDO;
|
||||
/** From CO_xPDO_init() */
|
||||
|
|
@ -241,11 +241,11 @@ typedef struct {
|
|||
/*******************************************************************************
|
||||
* R P D O
|
||||
******************************************************************************/
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Number of buffers for received CAN message for RPDO
|
||||
*/
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
#define CO_RPDO_CAN_BUFFERS_COUNT 2
|
||||
#else
|
||||
#define CO_RPDO_CAN_BUFFERS_COUNT 1
|
||||
|
|
@ -264,20 +264,20 @@ typedef struct {
|
|||
uint8_t CANrxData[CO_RPDO_CAN_BUFFERS_COUNT][CO_PDO_MAX_SIZE];
|
||||
/** Indication of RPDO length errors, use with CO_PDO_receiveErrors_t */
|
||||
uint8_t receiveError;
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_RPDO_init() */
|
||||
CO_SYNC_t *SYNC;
|
||||
/** True if transmissionType <= 240 */
|
||||
bool_t synchronous;
|
||||
#endif
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/** Maximum timeout time between received PDOs in microseconds. Configurable
|
||||
* by OD variable RPDO communication parameter, event-timer. */
|
||||
uint32_t timeoutTime_us;
|
||||
/** Timeout timer variable in microseconds */
|
||||
uint32_t timeoutTimer;
|
||||
#endif
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_RPDO_initCallbackPre() or NULL */
|
||||
void (*pFunctSignalPre)(void *object);
|
||||
/** From CO_RPDO_initCallbackPre() or NULL */
|
||||
|
|
@ -312,7 +312,7 @@ typedef struct {
|
|||
CO_ReturnError_t CO_RPDO_init(CO_RPDO_t *RPDO,
|
||||
OD_t *OD,
|
||||
CO_EM_t *em,
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
CO_SYNC_t *SYNC,
|
||||
#endif
|
||||
uint16_t preDefinedCanId,
|
||||
|
|
@ -323,7 +323,7 @@ CO_ReturnError_t CO_RPDO_init(CO_RPDO_t *RPDO,
|
|||
uint32_t *errInfo);
|
||||
|
||||
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Initialize RPDO callback function.
|
||||
*
|
||||
|
|
@ -357,7 +357,7 @@ void CO_RPDO_initCallbackPre(CO_RPDO_t *RPDO,
|
|||
* transmitted.
|
||||
*/
|
||||
void CO_RPDO_process(CO_RPDO_t *RPDO,
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
uint32_t timeDifference_us,
|
||||
uint32_t *timerNext_us,
|
||||
#endif
|
||||
|
|
@ -369,7 +369,7 @@ void CO_RPDO_process(CO_RPDO_t *RPDO,
|
|||
/*******************************************************************************
|
||||
* T P D O
|
||||
******************************************************************************/
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* TPDO object.
|
||||
*/
|
||||
|
|
@ -383,7 +383,7 @@ typedef struct {
|
|||
/** If this flag is set and TPDO is event driven (transmission type is 0,
|
||||
* 254 or 255), then PDO will be sent by CO_TPDO_process(). */
|
||||
bool_t sendRequest;
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_TPDO_init() */
|
||||
CO_SYNC_t *SYNC;
|
||||
/** Copy of the variable from object dictionary */
|
||||
|
|
@ -391,7 +391,7 @@ typedef struct {
|
|||
/** SYNC counter used for PDO sending */
|
||||
uint8_t syncCounter;
|
||||
#endif
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/** Inhibit time from object dictionary translated to microseconds */
|
||||
uint32_t inhibitTime_us;
|
||||
/** Event time from object dictionary translated to microseconds */
|
||||
|
|
@ -430,7 +430,7 @@ typedef struct {
|
|||
CO_ReturnError_t CO_TPDO_init(CO_TPDO_t *TPDO,
|
||||
OD_t *OD,
|
||||
CO_EM_t *em,
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
CO_SYNC_t *SYNC,
|
||||
#endif
|
||||
uint16_t preDefinedCanId,
|
||||
|
|
@ -469,7 +469,7 @@ static inline void CO_TPDOsendRequest(CO_TPDO_t *TPDO) {
|
|||
* transmitted.
|
||||
*/
|
||||
void CO_TPDO_process(CO_TPDO_t *TPDO,
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
uint32_t timeDifference_us,
|
||||
uint32_t *timerNext_us,
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -26,23 +26,23 @@
|
|||
|
||||
#include "301/CO_SDOclient.h"
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE) != 0
|
||||
|
||||
/* verify configuration */
|
||||
#if CO_CONFIG_SDO_CLI_BUFFER_SIZE < 7
|
||||
#error CO_CONFIG_SDO_CLI_BUFFER_SIZE must be set to 7 or more.
|
||||
#endif
|
||||
#if !((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ENABLE)
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ENABLE) == 0
|
||||
#error CO_CONFIG_FIFO_ENABLE must be enabled.
|
||||
#endif
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK
|
||||
#if !((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED)
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) != 0
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED) == 0
|
||||
#error CO_CONFIG_SDO_CLI_SEGMENTED must be enabled.
|
||||
#endif
|
||||
#if !((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ALT_READ)
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ALT_READ) == 0
|
||||
#error CO_CONFIG_FIFO_ALT_READ must be enabled.
|
||||
#endif
|
||||
#if !((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_CRC16_CCITT)
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_CRC16_CCITT) == 0
|
||||
#error CO_CONFIG_FIFO_CRC16_CCITT must be enabled.
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -70,7 +70,7 @@ static void CO_SDOclient_receive(void *object, void *msg) {
|
|||
if ((SDO_C->state != CO_SDO_ST_IDLE) && (DLC == 8U)
|
||||
&& (!CO_FLAG_READ(SDO_C->CANrxNew) || (data[0] == 0x80U))
|
||||
) {
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) != 0
|
||||
if ((data[0] == 0x80U) /* abort from server */
|
||||
|| ((SDO_C->state != CO_SDO_ST_UPLOAD_BLK_SUBBLOCK_SREQ)
|
||||
&& (SDO_C->state != CO_SDO_ST_UPLOAD_BLK_SUBBLOCK_CRSP))
|
||||
|
|
@ -79,7 +79,7 @@ static void CO_SDOclient_receive(void *object, void *msg) {
|
|||
/* copy data and set 'new message' flag */
|
||||
(void)memcpy((void *)&SDO_C->CANrxData[0], (const void *)&data[0], 8);
|
||||
CO_FLAG_SET(SDO_C->CANrxNew);
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/* Optional signal to RTOS, which can resume task, which handles
|
||||
* SDO client processing. */
|
||||
if (SDO_C->pFunctSignal != NULL) {
|
||||
|
|
@ -87,7 +87,7 @@ static void CO_SDOclient_receive(void *object, void *msg) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) != 0
|
||||
}
|
||||
else if (SDO_C->state == CO_SDO_ST_UPLOAD_BLK_SUBBLOCK_SREQ) {
|
||||
/* block upload, copy data directly */
|
||||
|
|
@ -153,7 +153,7 @@ static void CO_SDOclient_receive(void *object, void *msg) {
|
|||
* barrier here with CO_FLAG_CLEAR() call. */
|
||||
CO_FLAG_CLEAR(SDO_C->CANrxNew);
|
||||
SDO_C->state = state;
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/* Optional signal to RTOS, which can resume task, which handles
|
||||
* SDO client processing. */
|
||||
if (SDO_C->pFunctSignal != NULL) {
|
||||
|
|
@ -167,7 +167,7 @@ static void CO_SDOclient_receive(void *object, void *msg) {
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
/*
|
||||
* Custom function for writing OD object _SDO client parameter_
|
||||
*
|
||||
|
|
@ -267,7 +267,7 @@ CO_ReturnError_t CO_SDOclient_init(CO_SDOclient_t *SDO_C,
|
|||
}
|
||||
|
||||
/* Configure object variables */
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_LOCAL
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_LOCAL) != 0
|
||||
SDO_C->OD = OD;
|
||||
SDO_C->nodeId = nodeId;
|
||||
#endif
|
||||
|
|
@ -275,7 +275,7 @@ CO_ReturnError_t CO_SDOclient_init(CO_SDOclient_t *SDO_C,
|
|||
SDO_C->CANdevRxIdx = CANdevRxIdx;
|
||||
SDO_C->CANdevTx = CANdevTx;
|
||||
SDO_C->CANdevTxIdx = CANdevTxIdx;
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
SDO_C->pFunctSignal = NULL;
|
||||
SDO_C->functSignalObject = NULL;
|
||||
#endif
|
||||
|
|
@ -299,7 +299,7 @@ CO_ReturnError_t CO_SDOclient_init(CO_SDOclient_t *SDO_C,
|
|||
return CO_ERROR_OD_PARAMETERS;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
SDO_C->OD_1280_extension.object = SDO_C;
|
||||
SDO_C->OD_1280_extension.read = OD_readOriginal;
|
||||
SDO_C->OD_1280_extension.write = OD_write_1280;
|
||||
|
|
@ -328,7 +328,7 @@ CO_ReturnError_t CO_SDOclient_init(CO_SDOclient_t *SDO_C,
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/******************************************************************************/
|
||||
void CO_SDOclient_initCallbackPre(CO_SDOclient_t *SDOclient,
|
||||
void *object,
|
||||
|
|
@ -341,7 +341,7 @@ void CO_SDOclient_initCallbackPre(CO_SDOclient_t *SDOclient,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_LOCAL) && defined CO_BIG_ENDIAN
|
||||
#if (((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_LOCAL) != 0) && defined CO_BIG_ENDIAN
|
||||
static inline void reverseBytes(void *start, OD_size_t size) {
|
||||
uint8_t *lo = (uint8_t *)start;
|
||||
uint8_t *hi = (uint8_t *)start + size - 1;
|
||||
|
|
@ -371,7 +371,7 @@ CO_SDO_return_t CO_SDOclient_setup(CO_SDOclient_t *SDO_C,
|
|||
CO_FLAG_CLEAR(SDO_C->CANrxNew);
|
||||
SDO_C->nodeIDOfTheSDOServer = nodeIDOfTheSDOServer;
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
/* proceed only, if parameters change */
|
||||
if ((COB_IDClientToServer == SDO_C->COB_IDClientToServer)
|
||||
&& (COB_IDServerToClient == SDO_C->COB_IDServerToClient)
|
||||
|
|
@ -451,7 +451,7 @@ CO_SDO_return_t CO_SDOclientDownloadInitiate(CO_SDOclient_t *SDO_C,
|
|||
SDO_C->timeoutTimer = 0;
|
||||
CO_fifo_reset(&SDO_C->bufFifo);
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_LOCAL
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_LOCAL) != 0
|
||||
/* if node-ID of the SDO server is the same as node-ID of this node, then
|
||||
* transfer data within this node */
|
||||
if ((SDO_C->OD != NULL) && (SDO_C->nodeId != 0U)
|
||||
|
|
@ -462,7 +462,7 @@ CO_SDO_return_t CO_SDOclientDownloadInitiate(CO_SDOclient_t *SDO_C,
|
|||
}
|
||||
else
|
||||
#endif
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) != 0
|
||||
if (blockEnable && ((sizeIndicated == 0U) ||
|
||||
(sizeIndicated > CO_CONFIG_SDO_CLI_PST))
|
||||
) {
|
||||
|
|
@ -485,7 +485,7 @@ void CO_SDOclientDownloadInitiateSize(CO_SDOclient_t *SDO_C,
|
|||
{
|
||||
if (SDO_C != NULL) {
|
||||
SDO_C->sizeInd = sizeIndicated;
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) != 0
|
||||
if ((SDO_C->state == CO_SDO_ST_DOWNLOAD_BLK_INITIATE_REQ)
|
||||
&& (sizeIndicated > 0U) && (sizeIndicated <= CO_CONFIG_SDO_CLI_PST)
|
||||
) {
|
||||
|
|
@ -530,7 +530,7 @@ CO_SDO_return_t CO_SDOclientDownload(CO_SDOclient_t *SDO_C,
|
|||
else if (SDO_C->state == CO_SDO_ST_IDLE) {
|
||||
ret = CO_SDO_RT_ok_communicationEnd;
|
||||
}
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_LOCAL
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_LOCAL) != 0
|
||||
/* Transfer data locally **************************************************/
|
||||
else if ((SDO_C->state == CO_SDO_ST_DOWNLOAD_LOCAL_TRANSFER) && !abort) {
|
||||
/* search object dictionary in first pass */
|
||||
|
|
@ -661,7 +661,7 @@ CO_SDO_return_t CO_SDOclientDownload(CO_SDOclient_t *SDO_C,
|
|||
if (ret != CO_SDO_RT_waitingLocalTransfer) {
|
||||
SDO_C->state = CO_SDO_ST_IDLE;
|
||||
}
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
/* Inform OS to call this function again without delay. */
|
||||
else if (timerNext_us != NULL) {
|
||||
*timerNext_us = 0;
|
||||
|
|
@ -699,7 +699,7 @@ CO_SDO_return_t CO_SDOclientDownload(CO_SDOclient_t *SDO_C,
|
|||
break;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED) != 0
|
||||
if (SDO_C->finished) {
|
||||
/* expedited transfer */
|
||||
SDO_C->state = CO_SDO_ST_IDLE;
|
||||
|
|
@ -723,7 +723,7 @@ CO_SDO_return_t CO_SDOclientDownload(CO_SDOclient_t *SDO_C,
|
|||
break;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED) != 0
|
||||
case CO_SDO_ST_DOWNLOAD_SEGMENT_RSP: {
|
||||
if ((SDO_C->CANrxData[0] & 0xEFU) == 0x20U) {
|
||||
/* verify and alternate toggle bit */
|
||||
|
|
@ -752,7 +752,7 @@ CO_SDO_return_t CO_SDOclientDownload(CO_SDOclient_t *SDO_C,
|
|||
}
|
||||
#endif /* (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED */
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) != 0
|
||||
case CO_SDO_ST_DOWNLOAD_BLK_INITIATE_RSP: {
|
||||
if ((SDO_C->CANrxData[0] & 0xFBU) == 0xA0U) {
|
||||
/* verify index and subindex */
|
||||
|
|
@ -862,7 +862,7 @@ CO_SDO_return_t CO_SDOclientDownload(CO_SDOclient_t *SDO_C,
|
|||
abortCode = CO_SDO_AB_TIMEOUT;
|
||||
SDO_C->state = CO_SDO_ST_ABORT;
|
||||
}
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
else if (timerNext_us != NULL) {
|
||||
/* check again after timeout time elapsed */
|
||||
uint32_t diff = SDO_C->SDOtimeoutTime_us - SDO_C->timeoutTimer;
|
||||
|
|
@ -917,7 +917,7 @@ CO_SDO_return_t CO_SDOclientDownload(CO_SDOclient_t *SDO_C,
|
|||
SDO_C->finished = true;
|
||||
}
|
||||
else {
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED) != 0
|
||||
/* segmented transfer, indicate data size */
|
||||
if (SDO_C->sizeInd > 0U) {
|
||||
uint32_t size = CO_SWAP_32((uint32_t)SDO_C->sizeInd);
|
||||
|
|
@ -939,7 +939,7 @@ CO_SDO_return_t CO_SDOclientDownload(CO_SDOclient_t *SDO_C,
|
|||
break;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED) != 0
|
||||
case CO_SDO_ST_DOWNLOAD_SEGMENT_REQ: {
|
||||
/* fill data bytes */
|
||||
count = CO_fifo_read(&SDO_C->bufFifo,
|
||||
|
|
@ -977,7 +977,7 @@ CO_SDO_return_t CO_SDOclientDownload(CO_SDOclient_t *SDO_C,
|
|||
}
|
||||
#endif /* (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED */
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) != 0
|
||||
case CO_SDO_ST_DOWNLOAD_BLK_INITIATE_REQ: {
|
||||
SDO_C->CANtxBuff->data[0] = 0xC4;
|
||||
SDO_C->CANtxBuff->data[1] = (uint8_t)SDO_C->index;
|
||||
|
|
@ -1034,7 +1034,7 @@ CO_SDO_return_t CO_SDOclientDownload(CO_SDOclient_t *SDO_C,
|
|||
else if (SDO_C->block_seqno >= SDO_C->block_blksize) {
|
||||
SDO_C->state = CO_SDO_ST_DOWNLOAD_BLK_SUBBLOCK_RSP;
|
||||
}
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
else {
|
||||
/* Inform OS to call this function again without delay. */
|
||||
if (timerNext_us != NULL) {
|
||||
|
|
@ -1081,7 +1081,7 @@ CO_SDO_return_t CO_SDOclientDownload(CO_SDOclient_t *SDO_C,
|
|||
SDO_C->state = CO_SDO_ST_IDLE;
|
||||
ret = CO_SDO_RT_endedWithClientAbort;
|
||||
}
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) != 0
|
||||
else if (SDO_C->state == CO_SDO_ST_DOWNLOAD_BLK_SUBBLOCK_REQ) {
|
||||
ret = CO_SDO_RT_blockDownldInProgress;
|
||||
}
|
||||
|
|
@ -1122,11 +1122,11 @@ CO_SDO_return_t CO_SDOclientUploadInitiate(CO_SDOclient_t *SDO_C,
|
|||
CO_fifo_reset(&SDO_C->bufFifo);
|
||||
SDO_C->SDOtimeoutTime_us = (uint32_t)SDOtimeoutTime_ms * 1000U;
|
||||
SDO_C->timeoutTimer = 0;
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) != 0
|
||||
SDO_C->block_SDOtimeoutTime_us = (uint32_t)SDOtimeoutTime_ms * 700U;
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_LOCAL
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_LOCAL) != 0
|
||||
/* if node-ID of the SDO server is the same as node-ID of this node, then
|
||||
* transfer data within this node */
|
||||
if (((SDO_C->OD != NULL) && (SDO_C->nodeId != 0U))
|
||||
|
|
@ -1137,7 +1137,7 @@ CO_SDO_return_t CO_SDOclientUploadInitiate(CO_SDOclient_t *SDO_C,
|
|||
}
|
||||
else
|
||||
#endif
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) != 0
|
||||
if (blockEnable) {
|
||||
SDO_C->state = CO_SDO_ST_UPLOAD_BLK_INITIATE_REQ;
|
||||
}
|
||||
|
|
@ -1174,7 +1174,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
|
|||
else if (SDO_C->state == CO_SDO_ST_IDLE) {
|
||||
ret = CO_SDO_RT_ok_communicationEnd;
|
||||
}
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_LOCAL
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_LOCAL)
|
||||
/* Transfer data locally **************************************************/
|
||||
else if ((SDO_C->state == CO_SDO_ST_UPLOAD_LOCAL_TRANSFER) && !abort) {
|
||||
/* search object dictionary in first pass */
|
||||
|
|
@ -1276,7 +1276,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
|
|||
) {
|
||||
SDO_C->state = CO_SDO_ST_IDLE;
|
||||
}
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
/* Inform OS to call this function again without delay. */
|
||||
else if (timerNext_us != NULL) {
|
||||
*timerNext_us = 0;
|
||||
|
|
@ -1330,7 +1330,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
|
|||
ret = CO_SDO_RT_ok_communicationEnd;
|
||||
}
|
||||
else {
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED) != 0
|
||||
/* segmented transfer, is size indicated? */
|
||||
if (SDO_C->CANrxData[0] & 0x01U) {
|
||||
uint32_t size;
|
||||
|
|
@ -1352,7 +1352,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
|
|||
break;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED) != 0
|
||||
case CO_SDO_ST_UPLOAD_SEGMENT_RSP: {
|
||||
if ((SDO_C->CANrxData[0] & 0xE0U) == 0x00U) {
|
||||
size_t count, countWr;
|
||||
|
|
@ -1414,7 +1414,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
|
|||
}
|
||||
#endif /* (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED */
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) != 0
|
||||
case CO_SDO_ST_UPLOAD_BLK_INITIATE_RSP: {
|
||||
if ((SDO_C->CANrxData[0] & 0xF9U) == 0xC0U) {
|
||||
uint16_t index;
|
||||
|
|
@ -1570,7 +1570,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
|
|||
}
|
||||
SDO_C->state = CO_SDO_ST_ABORT;
|
||||
}
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
else if (timerNext_us != NULL) {
|
||||
/* check again after timeout time elapsed */
|
||||
uint32_t diff = SDO_C->SDOtimeoutTime_us - SDO_C->timeoutTimer;
|
||||
|
|
@ -1580,7 +1580,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) != 0
|
||||
/* Timeout for sub-block reception */
|
||||
if (SDO_C->state == CO_SDO_ST_UPLOAD_BLK_SUBBLOCK_SREQ) {
|
||||
if (SDO_C->block_timeoutTimer < SDO_C->block_SDOtimeoutTime_us) {
|
||||
|
|
@ -1592,7 +1592,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
|
|||
SDO_C->state = CO_SDO_ST_UPLOAD_BLK_SUBBLOCK_CRSP;
|
||||
CO_FLAG_CLEAR(SDO_C->CANrxNew);
|
||||
}
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
else if (timerNext_us != NULL) {
|
||||
/* check again after timeout time elapsed */
|
||||
uint32_t diff = SDO_C->block_SDOtimeoutTime_us -
|
||||
|
|
@ -1612,7 +1612,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
|
|||
|
||||
/* Transmit CAN data ******************************************************/
|
||||
if (ret == CO_SDO_RT_waitingResponse) {
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) != 0
|
||||
size_t count;
|
||||
#endif
|
||||
(void)memset((void *)&SDO_C->CANtxBuff->data[0], 0, 8);
|
||||
|
|
@ -1631,7 +1631,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
|
|||
break;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED) != 0
|
||||
case CO_SDO_ST_UPLOAD_SEGMENT_REQ: {
|
||||
/* verify, if there is enough space in data buffer */
|
||||
if (CO_fifo_getSpace(&SDO_C->bufFifo) < 7U) {
|
||||
|
|
@ -1648,7 +1648,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
|
|||
}
|
||||
#endif /* (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED */
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) != 0
|
||||
case CO_SDO_ST_UPLOAD_BLK_INITIATE_REQ: {
|
||||
SDO_C->CANtxBuff->data[0] = 0xA4;
|
||||
SDO_C->CANtxBuff->data[1] = (uint8_t)SDO_C->index;
|
||||
|
|
@ -1729,7 +1729,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
|
|||
CO_DEBUG_SDO_CLIENT(msg);
|
||||
}
|
||||
#endif
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
/* Inform OS to call this function again without delay. */
|
||||
if (timerNext_us != NULL) {
|
||||
*timerNext_us = 0;
|
||||
|
|
@ -1792,7 +1792,7 @@ CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
|
|||
SDO_C->state = CO_SDO_ST_IDLE;
|
||||
ret = CO_SDO_RT_endedWithClientAbort;
|
||||
}
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) != 0
|
||||
else if (SDO_C->state == CO_SDO_ST_UPLOAD_BLK_SUBBLOCK_SREQ) {
|
||||
ret = CO_SDO_RT_blockUploadInProgress;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,14 +37,14 @@
|
|||
#define CO_CONFIG_SDO_CLI (0)
|
||||
#endif
|
||||
#ifndef CO_CONFIG_SDO_CLI_BUFFER_SIZE
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) != 0
|
||||
#define CO_CONFIG_SDO_CLI_BUFFER_SIZE 1000
|
||||
#else
|
||||
#define CO_CONFIG_SDO_CLI_BUFFER_SIZE 32
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -174,7 +174,7 @@ CO_SDO_abortCode_t write_SDO(CO_SDOclient_t *SDO_C, uint8_t nodeId,
|
|||
* SDO client object
|
||||
*/
|
||||
typedef struct {
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_LOCAL) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_LOCAL) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_SDOclient_init() */
|
||||
OD_t *OD;
|
||||
/** From CO_SDOclient_init() */
|
||||
|
|
@ -192,7 +192,7 @@ typedef struct {
|
|||
uint16_t CANdevTxIdx;
|
||||
/** CAN transmit buffer inside CANdevTx for CAN tx message */
|
||||
CO_CANtx_t *CANtxBuff;
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_OD_DYNAMIC) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0) || defined CO_DOXYGEN
|
||||
/** Copy of CANopen COB_ID Client -> Server, meaning of the specific bits:
|
||||
- Bit 0...10: 11-bit CAN identifier.
|
||||
- Bit 11..30: reserved, must be 0.
|
||||
|
|
@ -234,17 +234,17 @@ typedef struct {
|
|||
volatile void *CANrxNew;
|
||||
/** 8 data bytes of the received message */
|
||||
uint8_t CANrxData[8];
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_SDOclient_initCallbackPre() or NULL */
|
||||
void (*pFunctSignal)(void *object);
|
||||
/** From CO_SDOclient_initCallbackPre() or NULL */
|
||||
void *functSignalObject;
|
||||
#endif
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_SEGMENTED) != 0) || defined CO_DOXYGEN
|
||||
/** Toggle bit toggled in each segment in segmented transfer */
|
||||
uint8_t toggle;
|
||||
#endif
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_BLOCK) != 0) || defined CO_DOXYGEN
|
||||
/** Timeout time for SDO sub-block upload, half of #SDOtimeoutTime_us */
|
||||
uint32_t block_SDOtimeoutTime_us;
|
||||
/** Timeout timer for SDO sub-block upload */
|
||||
|
|
@ -297,7 +297,7 @@ CO_ReturnError_t CO_SDOclient_init(CO_SDOclient_t *SDO_C,
|
|||
uint32_t *errInfo);
|
||||
|
||||
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SDO_CLI) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Initialize SDOclient callback function.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -29,16 +29,16 @@
|
|||
#include "301/crc16-ccitt.h"
|
||||
|
||||
/* verify configuration */
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) != 0
|
||||
#if CO_CONFIG_SDO_SRV_BUFFER_SIZE < 20
|
||||
#error CO_CONFIG_SDO_SRV_BUFFER_SIZE must be greater or equal than 20.
|
||||
#endif
|
||||
#endif
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK
|
||||
#if !((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED)
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK) != 0
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) == 0
|
||||
#error CO_CONFIG_SDO_SRV_SEGMENTED must be enabled.
|
||||
#endif
|
||||
#if !((CO_CONFIG_CRC16) & CO_CONFIG_CRC16_ENABLE)
|
||||
#if ((CO_CONFIG_CRC16) & CO_CONFIG_CRC16_ENABLE) == 0
|
||||
#error CO_CONFIG_CRC16_ENABLE must be enabled.
|
||||
#endif
|
||||
#if CO_CONFIG_SDO_SRV_BUFFER_SIZE < 900
|
||||
|
|
@ -67,7 +67,7 @@ static void CO_SDO_receive(void *object, void *msg) {
|
|||
else if (CO_FLAG_READ(SDO->CANrxNew)) {
|
||||
/* ignore message if previous message was not processed yet */
|
||||
}
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK) != 0
|
||||
else if (SDO->state == CO_SDO_ST_UPLOAD_BLK_END_CRSP && data[0]==0xA1) {
|
||||
/* SDO block download successfully transferred, just make idle */
|
||||
SDO->state = CO_SDO_ST_IDLE;
|
||||
|
|
@ -132,7 +132,7 @@ static void CO_SDO_receive(void *object, void *msg) {
|
|||
* CO_FLAG_CLEAR() call. */
|
||||
CO_FLAG_CLEAR(SDO->CANrxNew);
|
||||
SDO->state = state;
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/* Optional signal to RTOS, which can resume task, which
|
||||
* handles SDO server processing. */
|
||||
if (SDO->pFunctSignalPre != NULL) {
|
||||
|
|
@ -151,7 +151,7 @@ static void CO_SDO_receive(void *object, void *msg) {
|
|||
* CO_SDOserver_process() */
|
||||
(void)memcpy(SDO->CANrxData, data, DLC);
|
||||
CO_FLAG_SET(SDO->CANrxNew);
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/* Optional signal to RTOS, which can resume task, which handles
|
||||
* SDO server processing. */
|
||||
if (SDO->pFunctSignalPre != NULL) {
|
||||
|
|
@ -171,7 +171,7 @@ static CO_ReturnError_t CO_SDOserver_init_canRxTx(CO_SDOserver_t *SDO,
|
|||
uint32_t COB_IDClientToServer,
|
||||
uint32_t COB_IDServerToClient)
|
||||
{
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
/* proceed only, if parameters change */
|
||||
if ((COB_IDClientToServer == SDO->COB_IDClientToServer)
|
||||
&& (COB_IDServerToClient == SDO->COB_IDServerToClient)
|
||||
|
|
@ -225,7 +225,7 @@ static CO_ReturnError_t CO_SDOserver_init_canRxTx(CO_SDOserver_t *SDO,
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
/*
|
||||
* Custom function for writing OD object _SDO server parameter_, additional
|
||||
* channels
|
||||
|
|
@ -332,15 +332,15 @@ CO_ReturnError_t CO_SDOserver_init(CO_SDOserver_t *SDO,
|
|||
/* Configure object variables */
|
||||
SDO->OD = OD;
|
||||
SDO->nodeId = nodeId;
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED)
|
||||
#if (((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED)) != 0
|
||||
SDO->SDOtimeoutTime_us = (uint32_t)SDOtimeoutTime_ms * 1000U;
|
||||
#endif
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK) != 0
|
||||
SDO->block_SDOtimeoutTime_us = (uint32_t)SDOtimeoutTime_ms * 700;
|
||||
#endif
|
||||
SDO->state = CO_SDO_ST_IDLE;
|
||||
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
SDO->pFunctSignalPre = NULL;
|
||||
SDO->functSignalObjectPre = NULL;
|
||||
#endif
|
||||
|
|
@ -399,7 +399,7 @@ CO_ReturnError_t CO_SDOserver_init(CO_SDOserver_t *SDO,
|
|||
CanId_ServerToClient = ((COB_IDServerToClient32 & 0x80000000U) == 0U)
|
||||
? (uint16_t)(COB_IDServerToClient32 & 0x7FFU) : 0U;
|
||||
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
SDO->OD_1200_extension.object = SDO;
|
||||
SDO->OD_1200_extension.read = OD_readOriginal;
|
||||
SDO->OD_1200_extension.write = OD_write_1201_additional;
|
||||
|
|
@ -418,7 +418,7 @@ CO_ReturnError_t CO_SDOserver_init(CO_SDOserver_t *SDO,
|
|||
CO_FLAG_CLEAR(SDO->CANrxNew);
|
||||
|
||||
/* store the parameters and configure CANrx and CANtx */
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
SDO->CANdevRx = CANdevRx;
|
||||
SDO->CANdevRxIdx = CANdevRxIdx;
|
||||
SDO->CANdevTxIdx = CANdevTxIdx;
|
||||
|
|
@ -437,7 +437,7 @@ CO_ReturnError_t CO_SDOserver_init(CO_SDOserver_t *SDO,
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/******************************************************************************/
|
||||
void CO_SDOserver_initCallbackPre(CO_SDOserver_t *SDO,
|
||||
void *object,
|
||||
|
|
@ -464,7 +464,7 @@ static inline void reverseBytes(void *start, OD_size_t size) {
|
|||
#endif
|
||||
|
||||
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) != 0
|
||||
/** Helper function for writing data to Object dictionary. Function swaps data
|
||||
* if necessary, calcualtes (and verifies CRC) writes data to OD and verifies
|
||||
* data lengths.
|
||||
|
|
@ -539,7 +539,7 @@ static bool_t validateAndWriteToOD(CO_SDOserver_t *SDO,
|
|||
}
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK) != 0
|
||||
/* calculate crc on current data */
|
||||
if (SDO->block_crcEnabled && crcOperation > 0) {
|
||||
SDO->block_crc = crc16_ccitt(SDO->buf, bufOffsetWrOrig, SDO->block_crc);
|
||||
|
|
@ -671,7 +671,7 @@ static bool_t readFromOd(CO_SDOserver_t *SDO,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK) != 0
|
||||
/* update the crc */
|
||||
if (calculateCrc && SDO->block_crcEnabled) {
|
||||
SDO->block_crc = crc16_ccitt(bufShifted, countRd, SDO->block_crc);
|
||||
|
|
@ -724,7 +724,7 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
upload = true;
|
||||
SDO->state = CO_SDO_ST_UPLOAD_INITIATE_REQ;
|
||||
}
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK) != 0
|
||||
else if ((SDO->CANrxData[0] & 0xF9) == 0xC0) {
|
||||
SDO->state = CO_SDO_ST_DOWNLOAD_BLK_INITIATE_REQ;
|
||||
}
|
||||
|
|
@ -772,7 +772,7 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
}
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) != 0
|
||||
/* load data from object dictionary, if upload and no error */
|
||||
if (upload && (abortCode == CO_SDO_AB_NONE)) {
|
||||
SDO->bufOffsetRd = SDO->bufOffsetWr = 0;
|
||||
|
|
@ -872,13 +872,13 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
}
|
||||
else {
|
||||
SDO->state = CO_SDO_ST_DOWNLOAD_INITIATE_RSP;
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) != 0
|
||||
SDO->finished = true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else {
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) != 0
|
||||
/* segmented transfer, is size indicated? */
|
||||
if (SDO->CANrxData[0] & 0x01U) {
|
||||
uint32_t size;
|
||||
|
|
@ -918,7 +918,7 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
break;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) != 0
|
||||
case CO_SDO_ST_DOWNLOAD_SEGMENT_REQ: {
|
||||
if ((SDO->CANrxData[0] & 0xE0U) == 0x00U) {
|
||||
SDO->finished = (SDO->CANrxData[0] & 0x01U) != 0U;
|
||||
|
|
@ -970,7 +970,7 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
break;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) != 0
|
||||
case CO_SDO_ST_UPLOAD_SEGMENT_REQ: {
|
||||
if ((SDO->CANrxData[0] & 0xEFU) == 0x60U) {
|
||||
/* verify and alternate toggle bit */
|
||||
|
|
@ -990,7 +990,7 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
}
|
||||
#endif /* (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED */
|
||||
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK) != 0
|
||||
case CO_SDO_ST_DOWNLOAD_BLK_INITIATE_REQ: {
|
||||
SDO->block_crcEnabled = (SDO->CANrxData[0] & 0x04) != 0;
|
||||
|
||||
|
|
@ -1168,7 +1168,7 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
}
|
||||
} /* switch (SDO->state) */
|
||||
} /* if (SDO->state != CO_SDO_ST_IDLE && SDO->state != CO_SDO_ST_ABORT) */
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) != 0
|
||||
SDO->timeoutTimer = 0;
|
||||
#endif
|
||||
timeDifference_us = 0;
|
||||
|
|
@ -1177,7 +1177,7 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
else { /* MISRA C 2004 14.10 */ }
|
||||
|
||||
/* Timeout timers and transmit bufferFull flag ****************************/
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) != 0
|
||||
if (ret == CO_SDO_RT_waitingResponse) {
|
||||
if (SDO->timeoutTimer < SDO->SDOtimeoutTime_us) {
|
||||
SDO->timeoutTimer += timeDifference_us;
|
||||
|
|
@ -1186,7 +1186,7 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
abortCode = CO_SDO_AB_TIMEOUT;
|
||||
SDO->state = CO_SDO_ST_ABORT;
|
||||
}
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
else if (timerNext_us != NULL) {
|
||||
/* check again after timeout time elapsed */
|
||||
uint32_t diff = SDO->SDOtimeoutTime_us - SDO->timeoutTimer;
|
||||
|
|
@ -1196,7 +1196,7 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK) != 0
|
||||
/* Timeout for sub-block transmission */
|
||||
if (SDO->state == CO_SDO_ST_DOWNLOAD_BLK_SUBBLOCK_REQ) {
|
||||
if (SDO->block_timeoutTimer < SDO->block_SDOtimeoutTime_us) {
|
||||
|
|
@ -1208,7 +1208,7 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
SDO->state = CO_SDO_ST_DOWNLOAD_BLK_SUBBLOCK_RSP;
|
||||
CO_FLAG_CLEAR(SDO->CANrxNew);
|
||||
}
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
else if (timerNext_us != NULL) {
|
||||
/* check again after timeout time elapsed */
|
||||
uint32_t diff = SDO->block_SDOtimeoutTime_us -
|
||||
|
|
@ -1240,11 +1240,11 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
SDO->CANtxBuff->data[3] = SDO->subIndex;
|
||||
|
||||
/* reset timeout timer and send message */
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) != 0
|
||||
SDO->timeoutTimer = 0;
|
||||
#endif
|
||||
CO_CANsend(SDO->CANdevTx, SDO->CANtxBuff);
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) != 0
|
||||
if (SDO->finished) {
|
||||
SDO->state = CO_SDO_ST_IDLE;
|
||||
ret = CO_SDO_RT_ok_communicationEnd;
|
||||
|
|
@ -1263,7 +1263,7 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
break;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) != 0
|
||||
case CO_SDO_ST_DOWNLOAD_SEGMENT_RSP: {
|
||||
SDO->CANtxBuff->data[0] = 0x20U | SDO->toggle;
|
||||
SDO->toggle = (SDO->toggle == 0x00U) ? 0x10U : 0x00U;
|
||||
|
|
@ -1283,7 +1283,7 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
#endif
|
||||
|
||||
case CO_SDO_ST_UPLOAD_INITIATE_RSP: {
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) != 0
|
||||
/* data were already loaded from OD variable */
|
||||
if ((SDO->sizeInd > 0U) && (SDO->sizeInd <= 4U)) {
|
||||
/* expedited transfer */
|
||||
|
|
@ -1351,7 +1351,7 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
break;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) != 0
|
||||
case CO_SDO_ST_UPLOAD_SEGMENT_RSP: {
|
||||
/* refill the data buffer if necessary */
|
||||
if (!readFromOd(SDO, &abortCode, 7, false)) {
|
||||
|
|
@ -1406,7 +1406,7 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
}
|
||||
#endif /* (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED */
|
||||
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK) != 0
|
||||
case CO_SDO_ST_DOWNLOAD_BLK_INITIATE_RSP: {
|
||||
SDO->CANtxBuff->data[0] = 0xA4;
|
||||
SDO->CANtxBuff->data[1] = (uint8_t)SDO->index;
|
||||
|
|
@ -1564,7 +1564,7 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
) {
|
||||
SDO->state = CO_SDO_ST_UPLOAD_BLK_SUBBLOCK_CRSP;
|
||||
}
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
else {
|
||||
/* Inform OS to call this function again without delay. */
|
||||
if (timerNext_us != NULL) {
|
||||
|
|
@ -1611,7 +1611,7 @@ CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO,
|
|||
SDO->state = CO_SDO_ST_IDLE;
|
||||
ret = CO_SDO_RT_endedWithServerAbort;
|
||||
}
|
||||
#if (CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK) != 0
|
||||
else if (SDO->state == CO_SDO_ST_DOWNLOAD_BLK_SUBBLOCK_REQ) {
|
||||
ret = CO_SDO_RT_blockDownldInProgress;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -463,7 +463,7 @@ typedef struct {
|
|||
volatile void *CANrxNew;
|
||||
/** 8 data bytes of the received message */
|
||||
uint8_t CANrxData[8];
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_OD_DYNAMIC) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_SDOserver_init() */
|
||||
CO_CANmodule_t *CANdevRx;
|
||||
/** From CO_SDOserver_init() */
|
||||
|
|
@ -480,7 +480,7 @@ typedef struct {
|
|||
/** Extension for OD object */
|
||||
OD_extension_t OD_1200_extension;
|
||||
#endif
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) != 0) || defined CO_DOXYGEN
|
||||
/** Size of data, which will be transferred. It is optionally indicated by
|
||||
* client in case of download or by server in case of upload. */
|
||||
OD_size_t sizeInd;
|
||||
|
|
@ -502,7 +502,7 @@ typedef struct {
|
|||
/** Offset of first data available for read in the buffer */
|
||||
OD_size_t bufOffsetRd;
|
||||
#endif
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK) != 0) || defined CO_DOXYGEN
|
||||
/** Timeout time for SDO sub-block download, half of #SDOtimeoutTime_us */
|
||||
uint32_t block_SDOtimeoutTime_us;
|
||||
/** Timeout timer for SDO sub-block download */
|
||||
|
|
@ -518,7 +518,7 @@ typedef struct {
|
|||
/** Calculated CRC checksum */
|
||||
uint16_t block_crc;
|
||||
#endif
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_SDOserver_initCallbackPre() or NULL */
|
||||
void (*pFunctSignalPre)(void *object);
|
||||
/** From CO_SDOserver_initCallbackPre() or NULL */
|
||||
|
|
@ -561,7 +561,7 @@ CO_ReturnError_t CO_SDOserver_init(CO_SDOserver_t *SDO,
|
|||
uint32_t *errInfo);
|
||||
|
||||
|
||||
#if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Initialize SDOrx callback function.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "301/CO_SYNC.h"
|
||||
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE) != 0
|
||||
|
||||
/*
|
||||
* Read received message from CAN module.
|
||||
|
|
@ -64,7 +64,7 @@ static void CO_SYNC_receive(void *object, void *msg) {
|
|||
|
||||
CO_FLAG_SET(SYNC->CANrxNew);
|
||||
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/* Optional signal to RTOS, which can resume task, which handles SYNC.*/
|
||||
if (SYNC->pFunctSignalPre != NULL) {
|
||||
SYNC->pFunctSignalPre(SYNC->functSignalObjectPre);
|
||||
|
|
@ -74,7 +74,7 @@ static void CO_SYNC_receive(void *object, void *msg) {
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
/*
|
||||
* Custom function for writing OD object "COB-ID sync message"
|
||||
*
|
||||
|
|
@ -94,7 +94,7 @@ static ODR_t OD_write_1005(OD_stream_t *stream, const void *buf,
|
|||
uint16_t CAN_ID = (uint16_t)(cobIdSync & 0x7FFU);
|
||||
|
||||
/* verify written value */
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0
|
||||
bool_t isProducer = (cobIdSync & 0x40000000) != 0;
|
||||
if ((cobIdSync & 0xBFFFF800) != 0 || CO_IS_RESTRICTED_CAN_ID(CAN_ID)
|
||||
|| (SYNC->isProducer && isProducer && CAN_ID != SYNC->CAN_ID)
|
||||
|
|
@ -122,7 +122,7 @@ static ODR_t OD_write_1005(OD_stream_t *stream, const void *buf,
|
|||
return ODR_DEV_INCOMPAT;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0
|
||||
SYNC->CANtxBuff = CO_CANtxBufferInit(
|
||||
SYNC->CANdevTx, /* CAN device */
|
||||
SYNC->CANdevTxIdx, /* index of specific buffer inside CAN module */
|
||||
|
|
@ -140,7 +140,7 @@ static ODR_t OD_write_1005(OD_stream_t *stream, const void *buf,
|
|||
SYNC->CAN_ID = CAN_ID;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0
|
||||
SYNC->isProducer = isProducer;
|
||||
if (isProducer) {
|
||||
SYNC->counter = 0;
|
||||
|
|
@ -152,7 +152,7 @@ static ODR_t OD_write_1005(OD_stream_t *stream, const void *buf,
|
|||
return OD_writeOriginal(stream, buf, count, countWritten);
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0
|
||||
/*
|
||||
* Custom function for writing OD object "Synchronous counter overflow value"
|
||||
*
|
||||
|
|
@ -210,7 +210,7 @@ CO_ReturnError_t CO_SYNC_init(CO_SYNC_t *SYNC,
|
|||
OD_entry_t *OD_1019_syncCounterOvf,
|
||||
CO_CANmodule_t *CANdevRx,
|
||||
uint16_t CANdevRxIdx,
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0
|
||||
CO_CANmodule_t *CANdevTx,
|
||||
uint16_t CANdevTxIdx,
|
||||
#endif
|
||||
|
|
@ -220,7 +220,7 @@ CO_ReturnError_t CO_SYNC_init(CO_SYNC_t *SYNC,
|
|||
|
||||
/* verify arguments */
|
||||
if ((SYNC == NULL) || (em == NULL) || (OD_1005_cobIdSync == NULL)
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0
|
||||
|| (OD_1006_commCyclePeriod == NULL) || (CANdevTx == NULL)
|
||||
#endif
|
||||
|| (CANdevRx == NULL)
|
||||
|
|
@ -239,7 +239,7 @@ CO_ReturnError_t CO_SYNC_init(CO_SYNC_t *SYNC,
|
|||
if (errInfo != NULL) { *errInfo = OD_getIndex(OD_1005_cobIdSync); }
|
||||
return CO_ERROR_OD_PARAMETERS;
|
||||
}
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
SYNC->OD_1005_extension.object = SYNC;
|
||||
SYNC->OD_1005_extension.read = OD_readOriginal;
|
||||
SYNC->OD_1005_extension.write = OD_write_1005;
|
||||
|
|
@ -249,7 +249,7 @@ CO_ReturnError_t CO_SYNC_init(CO_SYNC_t *SYNC,
|
|||
/* get and verify "Communication cycle period" from OD */
|
||||
SYNC->OD_1006_period = OD_getPtr(OD_1006_commCyclePeriod, 0,
|
||||
sizeof(uint32_t), NULL);
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0
|
||||
if (SYNC->OD_1006_period == NULL) {
|
||||
if (errInfo != NULL) {
|
||||
*errInfo = OD_getIndex(OD_1006_commCyclePeriod);
|
||||
|
|
@ -291,8 +291,8 @@ CO_ReturnError_t CO_SYNC_init(CO_SYNC_t *SYNC,
|
|||
else if (syncCounterOvf > 240U) { syncCounterOvf = 240; }
|
||||
else { /* MISRA C 2004 14.10 */ }
|
||||
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0
|
||||
SYNC->OD_1019_extension.object = SYNC;
|
||||
SYNC->OD_1019_extension.read = OD_readOriginal;
|
||||
SYNC->OD_1019_extension.write = OD_write_1019;
|
||||
|
|
@ -304,14 +304,14 @@ CO_ReturnError_t CO_SYNC_init(CO_SYNC_t *SYNC,
|
|||
|
||||
/* Configure object variables */
|
||||
SYNC->em = em;
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0
|
||||
SYNC->isProducer = (cobIdSync & 0x40000000U) != 0U;
|
||||
#endif
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
SYNC->CAN_ID = cobIdSync & 0x7FFU;
|
||||
SYNC->CANdevRx = CANdevRx;
|
||||
SYNC->CANdevRxIdx = CANdevRxIdx;
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0
|
||||
SYNC->CANdevTx = CANdevTx;
|
||||
SYNC->CANdevTxIdx = CANdevTxIdx;
|
||||
#endif
|
||||
|
|
@ -330,7 +330,7 @@ CO_ReturnError_t CO_SYNC_init(CO_SYNC_t *SYNC,
|
|||
return ret;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0
|
||||
SYNC->CANtxBuff = CO_CANtxBufferInit(
|
||||
CANdevTx, /* CAN device */
|
||||
CANdevTxIdx, /* index of specific buffer inside CAN module */
|
||||
|
|
@ -348,7 +348,7 @@ CO_ReturnError_t CO_SYNC_init(CO_SYNC_t *SYNC,
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/******************************************************************************/
|
||||
void CO_SYNC_initCallbackPre(
|
||||
CO_SYNC_t *SYNC,
|
||||
|
|
@ -389,13 +389,13 @@ CO_SYNC_status_t CO_SYNC_process(CO_SYNC_t *SYNC,
|
|||
? *SYNC->OD_1006_period : 0U;
|
||||
|
||||
if (OD_1006_period > 0U) {
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0
|
||||
if (SYNC->isProducer) {
|
||||
if (SYNC->timer >= OD_1006_period) {
|
||||
syncStatus = CO_SYNC_RX_TX;
|
||||
CO_SYNCsend(SYNC);
|
||||
}
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
/* Calculate when next SYNC needs to be sent */
|
||||
if (timerNext_us != NULL) {
|
||||
uint32_t diff = OD_1006_period - SYNC->timer;
|
||||
|
|
@ -421,7 +421,7 @@ CO_SYNC_status_t CO_SYNC_process(CO_SYNC_t *SYNC,
|
|||
CO_EMC_COMMUNICATION, SYNC->timer);
|
||||
SYNC->timeoutError = 2;
|
||||
}
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
else if (timerNext_us != NULL) {
|
||||
uint32_t diff = periodTimeout - SYNC->timer;
|
||||
if (*timerNext_us > diff) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
CO_CONFIG_GLOBAL_FLAG_OD_DYNAMIC)
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -106,7 +106,7 @@ typedef struct {
|
|||
/** Pointer to variable in OD, "Synchronous window length" in microseconds*/
|
||||
uint32_t *OD_1007_window;
|
||||
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0) || defined CO_DOXYGEN
|
||||
/** True, if device is SYNC producer. Calculated from _COB ID SYNC Message_
|
||||
variable from Object dictionary (index 0x1005). */
|
||||
bool_t isProducer;
|
||||
|
|
@ -124,7 +124,7 @@ typedef struct {
|
|||
/** CAN ID of the SYNC message. Calculated from _COB ID SYNC Message_
|
||||
variable from Object dictionary (index 0x1005). */
|
||||
uint16_t CAN_ID;
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_SYNC_init() */
|
||||
CO_CANmodule_t *CANdevTx;
|
||||
/** From CO_SYNC_init() */
|
||||
|
|
@ -134,7 +134,7 @@ typedef struct {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SYNC) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_SYNC_initCallbackPre() or NULL */
|
||||
void (*pFunctSignalPre)(void *object);
|
||||
/** From CO_SYNC_initCallbackPre() or NULL */
|
||||
|
|
@ -185,14 +185,14 @@ CO_ReturnError_t CO_SYNC_init(CO_SYNC_t *SYNC,
|
|||
OD_entry_t *OD_1019_syncCounterOvf,
|
||||
CO_CANmodule_t *CANdevRx,
|
||||
uint16_t CANdevRxIdx,
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0) || defined CO_DOXYGEN
|
||||
CO_CANmodule_t *CANdevTx,
|
||||
uint16_t CANdevTxIdx,
|
||||
#endif
|
||||
uint32_t *errInfo);
|
||||
|
||||
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SYNC) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Initialize SYNC callback function.
|
||||
*
|
||||
|
|
@ -210,7 +210,7 @@ void CO_SYNC_initCallbackPre(CO_SYNC_t *SYNC,
|
|||
#endif
|
||||
|
||||
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Send SYNC message.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include "301/CO_TIME.h"
|
||||
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE) != 0
|
||||
|
||||
/*
|
||||
* Read received message from CAN module.
|
||||
|
|
@ -45,7 +45,7 @@ static void CO_TIME_receive(void *object, void *msg) {
|
|||
(void)memcpy(TIME->timeStamp, data, sizeof(TIME->timeStamp));
|
||||
CO_FLAG_SET(TIME->CANrxNew);
|
||||
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/* Optional signal to RTOS, which can resume task, which handles TIME.*/
|
||||
if (TIME->pFunctSignalPre != NULL) {
|
||||
TIME->pFunctSignalPre(TIME->functSignalObjectPre);
|
||||
|
|
@ -55,7 +55,7 @@ static void CO_TIME_receive(void *object, void *msg) {
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
/*
|
||||
* Custom function for writing OD object "COB-ID time stamp"
|
||||
*
|
||||
|
|
@ -93,7 +93,7 @@ CO_ReturnError_t CO_TIME_init(CO_TIME_t *TIME,
|
|||
OD_entry_t *OD_1012_cobIdTimeStamp,
|
||||
CO_CANmodule_t *CANdevRx,
|
||||
uint16_t CANdevRxIdx,
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER) != 0
|
||||
CO_CANmodule_t *CANdevTx,
|
||||
uint16_t CANdevTxIdx,
|
||||
#endif
|
||||
|
|
@ -101,7 +101,7 @@ CO_ReturnError_t CO_TIME_init(CO_TIME_t *TIME,
|
|||
{
|
||||
/* verify arguments */
|
||||
if ((TIME == NULL) || (OD_1012_cobIdTimeStamp == NULL) || (CANdevRx == NULL)
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER) != 0
|
||||
|| CANdevTx == NULL
|
||||
#endif
|
||||
) {
|
||||
|
|
@ -117,7 +117,7 @@ CO_ReturnError_t CO_TIME_init(CO_TIME_t *TIME,
|
|||
if (errInfo != NULL) { *errInfo = OD_getIndex(OD_1012_cobIdTimeStamp); }
|
||||
return CO_ERROR_OD_PARAMETERS;
|
||||
}
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_FLAG_OD_DYNAMIC
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0
|
||||
TIME->OD_1012_extension.object = TIME;
|
||||
TIME->OD_1012_extension.read = OD_readOriginal;
|
||||
TIME->OD_1012_extension.write = OD_write_1012;
|
||||
|
|
@ -145,7 +145,7 @@ CO_ReturnError_t CO_TIME_init(CO_TIME_t *TIME,
|
|||
}
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER) != 0
|
||||
/* configure TIME producer message transmission */
|
||||
TIME->CANdevTx = CANdevTx;
|
||||
TIME->CANtxBuff = CO_CANtxBufferInit(
|
||||
|
|
@ -165,7 +165,7 @@ CO_ReturnError_t CO_TIME_init(CO_TIME_t *TIME,
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
void CO_TIME_initCallbackPre(CO_TIME_t *TIME,
|
||||
void *object,
|
||||
void (*pFunctSignalPre)(void *object))
|
||||
|
|
@ -214,7 +214,7 @@ bool_t CO_TIME_process(CO_TIME_t *TIME,
|
|||
}
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER) != 0
|
||||
if (NMTisPreOrOperational && TIME->isProducer
|
||||
&& TIME->producerInterval_ms > 0
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
CO_CONFIG_GLOBAL_FLAG_OD_DYNAMIC)
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -95,7 +95,7 @@ typedef struct {
|
|||
bool_t isProducer;
|
||||
/** Variable indicates, if new TIME message received from CAN bus */
|
||||
volatile void *CANrxNew;
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER) != 0) || defined CO_DOXYGEN
|
||||
/** Interval for time producer in milli seconds */
|
||||
uint32_t producerInterval_ms;
|
||||
/** Sync producer timer */
|
||||
|
|
@ -105,13 +105,13 @@ typedef struct {
|
|||
/** CAN transmit buffer */
|
||||
CO_CANtx_t *CANtxBuff;
|
||||
#endif
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_TIME) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_TIME_initCallbackPre() or NULL */
|
||||
void (*pFunctSignalPre)(void *object);
|
||||
/** From CO_TIME_initCallbackPre() or NULL */
|
||||
void *functSignalObjectPre;
|
||||
#endif
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_FLAG_OD_DYNAMIC) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_TIME) & CO_CONFIG_FLAG_OD_DYNAMIC) != 0) || defined CO_DOXYGEN
|
||||
/** Extension for OD object */
|
||||
OD_extension_t OD_1012_extension;
|
||||
#endif
|
||||
|
|
@ -138,14 +138,14 @@ CO_ReturnError_t CO_TIME_init(CO_TIME_t *TIME,
|
|||
OD_entry_t *OD_1012_cobIdTimeStamp,
|
||||
CO_CANmodule_t *CANdevRx,
|
||||
uint16_t CANdevRxIdx,
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER) != 0) || defined CO_DOXYGEN
|
||||
CO_CANmodule_t *CANdevTx,
|
||||
uint16_t CANdevTxIdx,
|
||||
#endif
|
||||
uint32_t *errInfo);
|
||||
|
||||
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_TIME) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Initialize TIME callback function.
|
||||
*
|
||||
|
|
@ -182,7 +182,7 @@ static inline void CO_TIME_set(CO_TIME_t *TIME,
|
|||
TIME->residual_us = 0;
|
||||
TIME->ms = ms;
|
||||
TIME->days = days;
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER)
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER) != 0
|
||||
TIME->producerTimer_ms = TIME->producerInterval_ms =producerInterval_ms;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,14 +25,14 @@
|
|||
|
||||
#include "301/CO_fifo.h"
|
||||
|
||||
#if (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ENABLE
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ENABLE) != 0
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include "crc16-ccitt.h"
|
||||
|
||||
#if (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_COMMANDS
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_COMMANDS) != 0
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
|
|
@ -45,8 +45,8 @@
|
|||
#endif /* (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_COMMANDS */
|
||||
|
||||
/* verify configuration */
|
||||
#if (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_CRC16_CCITT
|
||||
#if !((CO_CONFIG_CRC16) & CO_CONFIG_CRC16_ENABLE)
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_CRC16_CCITT) != 0
|
||||
#if ((CO_CONFIG_CRC16) & CO_CONFIG_CRC16_ENABLE) == 0
|
||||
#error CO_CONFIG_CRC16_ENABLE must be enabled.
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -104,7 +104,7 @@ size_t CO_fifo_write(CO_fifo_t *fifo,
|
|||
|
||||
*bufDest = *buf;
|
||||
|
||||
#if (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_CRC16_CCITT
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_CRC16_CCITT) != 0
|
||||
if (crc != NULL) {
|
||||
crc16_ccitt_single(crc, *buf);
|
||||
}
|
||||
|
|
@ -159,7 +159,7 @@ size_t CO_fifo_read(CO_fifo_t *fifo, uint8_t *buf, size_t count, bool_t *eof) {
|
|||
}
|
||||
i--;
|
||||
|
||||
#if (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_COMMANDS
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_COMMANDS) != 0
|
||||
/* is delimiter? */
|
||||
if ((eof != NULL) && (c == DELIM_COMMAND)) {
|
||||
*eof = true;
|
||||
|
|
@ -172,7 +172,7 @@ size_t CO_fifo_read(CO_fifo_t *fifo, uint8_t *buf, size_t count, bool_t *eof) {
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ALT_READ
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ALT_READ) != 0
|
||||
/******************************************************************************/
|
||||
size_t CO_fifo_altBegin(CO_fifo_t *fifo, size_t offset) {
|
||||
size_t i;
|
||||
|
|
@ -209,7 +209,7 @@ void CO_fifo_altFinish(CO_fifo_t *fifo, uint16_t *crc) {
|
|||
else {
|
||||
const uint8_t *bufSrc = &fifo->buf[fifo->readPtr];
|
||||
while (fifo->readPtr != fifo->altReadPtr) {
|
||||
#if (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_CRC16_CCITT
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_CRC16_CCITT) != 0
|
||||
crc16_ccitt_single(crc, *bufSrc);
|
||||
#endif
|
||||
/* increment variable */
|
||||
|
|
@ -254,7 +254,7 @@ size_t CO_fifo_altRead(CO_fifo_t *fifo, uint8_t *buf, size_t count) {
|
|||
#endif /* (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ALT_READ */
|
||||
|
||||
|
||||
#if (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_COMMANDS
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_COMMANDS) != 0
|
||||
/******************************************************************************/
|
||||
bool_t CO_fifo_CommSearch(CO_fifo_t *fifo, bool_t clear) {
|
||||
bool_t newCommand = false;
|
||||
|
|
@ -465,7 +465,7 @@ size_t CO_fifo_readToken(CO_fifo_t *fifo,
|
|||
#endif /* (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_COMMANDS */
|
||||
|
||||
|
||||
#if (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_DATATYPES
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_DATATYPES) != 0
|
||||
/******************************************************************************/
|
||||
/* Tables for mime-base64 encoding, as specified in RFC 2045, (without CR-LF,
|
||||
* but one long string). Base64 is used for encoding binary data into easy
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
#define CO_CONFIG_FIFO (0)
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -68,11 +68,11 @@ typedef struct {
|
|||
size_t writePtr;
|
||||
/** Location in the buffer, which will be next read. */
|
||||
size_t readPtr;
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ALT_READ) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ALT_READ) != 0) || defined CO_DOXYGEN
|
||||
/** Location in the buffer, which will be next read. */
|
||||
size_t altReadPtr;
|
||||
#endif
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_DATATYPES) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_DATATYPES) != 0) || defined CO_DOXYGEN
|
||||
/** helper variable, set to false in CO_fifo_reset(), used in some
|
||||
* functions. */
|
||||
bool_t started;
|
||||
|
|
@ -103,7 +103,7 @@ static inline void CO_fifo_reset(CO_fifo_t *fifo) {
|
|||
if (fifo != NULL) {
|
||||
fifo->readPtr = 0;
|
||||
fifo->writePtr = 0;
|
||||
#if (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_DATATYPES
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_DATATYPES) != 0
|
||||
fifo->started = false;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -267,7 +267,7 @@ size_t CO_fifo_write(CO_fifo_t *fifo,
|
|||
size_t CO_fifo_read(CO_fifo_t *fifo, uint8_t *buf, size_t count, bool_t *eof);
|
||||
|
||||
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ALT_READ) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ALT_READ) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Initializes alternate read with #CO_fifo_altRead
|
||||
*
|
||||
|
|
@ -326,7 +326,7 @@ size_t CO_fifo_altRead(CO_fifo_t *fifo, uint8_t *buf, size_t count);
|
|||
#endif /* #if (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ALT_READ */
|
||||
|
||||
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_COMMANDS) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_COMMANDS) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Search command inside FIFO
|
||||
*
|
||||
|
|
@ -416,7 +416,7 @@ size_t CO_fifo_readToken(CO_fifo_t *fifo,
|
|||
#endif /* (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_COMMANDS */
|
||||
|
||||
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_DATATYPES) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_DATATYPES) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Read uint8_t variable from fifo and output as ascii string.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@
|
|||
|
||||
#include "301/crc16-ccitt.h"
|
||||
|
||||
#if (CO_CONFIG_CRC16) & CO_CONFIG_CRC16_ENABLE
|
||||
#if !((CO_CONFIG_CRC16) & CO_CONFIG_CRC16_EXTERNAL)
|
||||
#if ((CO_CONFIG_CRC16) & CO_CONFIG_CRC16_ENABLE) != 0
|
||||
#if ((CO_CONFIG_CRC16) & CO_CONFIG_CRC16_EXTERNAL) == 0
|
||||
|
||||
/*
|
||||
* CRC table calculated by the following algorithm:
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#define CO_CONFIG_CRC16 (0)
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_CRC16) & CO_CONFIG_CRC16_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_CRC16) & CO_CONFIG_CRC16_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "303/CO_LEDs.h"
|
||||
|
||||
#if (CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE
|
||||
#if ((CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE) != 0
|
||||
|
||||
/******************************************************************************/
|
||||
CO_ReturnError_t CO_LEDs_init(CO_LEDs_t *LEDs) {
|
||||
|
|
@ -142,7 +142,7 @@ void CO_LEDs_process(CO_LEDs_t *LEDs,
|
|||
LEDs->LEDgreen = gr;
|
||||
} /* if (tick) */
|
||||
|
||||
#if (CO_CONFIG_LEDS) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_LEDS) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
if (timerNext_us != NULL) {
|
||||
uint32_t diff = 50000 - LEDs->LEDtmr50ms;
|
||||
if (*timerNext_us > diff) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
CO_CONFIG_GLOBAL_FLAG_TIMERNEXT)
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
10
304/CO_GFC.c
10
304/CO_GFC.c
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "304/CO_GFC.h"
|
||||
|
||||
#if (CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE) != 0
|
||||
|
||||
/*
|
||||
* Custom function for reading or writing OD object.
|
||||
|
|
@ -52,7 +52,7 @@ OD_write_1300(OD_stream_t* stream, const void* buf, OD_size_t count, OD_size_t*
|
|||
return OD_writeOriginal(stream, buf, count, countWritten);
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_GFC) & CO_CONFIG_GFC_CONSUMER
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_CONSUMER) != 0
|
||||
static void
|
||||
CO_GFC_receive(void* object, void* msg) {
|
||||
CO_GFC_t* GFC;
|
||||
|
|
@ -98,7 +98,7 @@ CO_GFC_init(CO_GFC_t* GFC, OD_entry_t* OD_1300_gfcParameter, CO_CANmodule_t* GFC
|
|||
GFC->OD_gfcParam_ext.write = OD_write_1300;
|
||||
(void)OD_extension_init(OD_1300_gfcParameter, &GFC->OD_gfcParam_ext);
|
||||
|
||||
#if (CO_CONFIG_GFC) & CO_CONFIG_GFC_PRODUCER
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_PRODUCER) != 0
|
||||
GFC->CANdevTx = GFC_CANdevTx;
|
||||
GFC->CANtxBuff = CO_CANtxBufferInit(GFC->CANdevTx, /* CAN device */
|
||||
GFC_txIdx, /* index of specific buffer inside CAN module */
|
||||
|
|
@ -115,7 +115,7 @@ CO_GFC_init(CO_GFC_t* GFC, OD_entry_t* OD_1300_gfcParameter, CO_CANmodule_t* GFC
|
|||
(void)CANidTxGFC; /* unused */
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_GFC) & CO_CONFIG_GFC_CONSUMER
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_CONSUMER) != 0
|
||||
GFC->functSignalObjectSafe = NULL;
|
||||
GFC->pFunctSignalSafe = NULL;
|
||||
const CO_ReturnError_t r = CO_CANrxBufferInit(GFC_CANdevRx, /* CAN device */
|
||||
|
|
@ -136,7 +136,7 @@ CO_GFC_init(CO_GFC_t* GFC, OD_entry_t* OD_1300_gfcParameter, CO_CANmodule_t* GFC
|
|||
return CO_ERROR_NO;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_GFC) & CO_CONFIG_GFC_PRODUCER
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_PRODUCER) != 0
|
||||
CO_ReturnError_t
|
||||
CO_GFCsend(CO_GFC_t* GFC) {
|
||||
if (GFC->valid) {
|
||||
|
|
|
|||
10
304/CO_GFC.h
10
304/CO_GFC.h
|
|
@ -35,7 +35,7 @@
|
|||
#define CO_CONFIG_GFC (0)
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -60,11 +60,11 @@ extern "C" {
|
|||
typedef struct {
|
||||
bool_t valid; /**< From OD parameter 1300 */
|
||||
OD_extension_t OD_gfcParam_ext; /**< Extension for OD object */
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_PRODUCER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GFC) & CO_CONFIG_GFC_PRODUCER) != 0) || defined CO_DOXYGEN
|
||||
CO_CANmodule_t* CANdevTx; /**< From CO_GFC_init() */
|
||||
CO_CANtx_t* CANtxBuff; /**< CAN transmit buffer inside CANdevTx */
|
||||
#endif
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_CONSUMER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GFC) & CO_CONFIG_GFC_CONSUMER) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_GFC_initCallbackEnterSafeState() or NULL */
|
||||
void (*pFunctSignalSafe)(void* object);
|
||||
/** From CO_GFC_initCallbackEnterSafeState() or NULL */
|
||||
|
|
@ -93,7 +93,7 @@ CO_ReturnError_t CO_GFC_init(CO_GFC_t* GFC, OD_entry_t* OD_1300_gfcParameter,
|
|||
CO_CANmodule_t* GFC_CANdevRx, uint16_t GFC_rxIdx, uint16_t CANidRxGFC,
|
||||
CO_CANmodule_t* GFC_CANdevTx, uint16_t GFC_txIdx, uint16_t CANidTxGFC);
|
||||
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_CONSUMER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GFC) & CO_CONFIG_GFC_CONSUMER) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Initialize GFC callback function.
|
||||
*
|
||||
|
|
@ -108,7 +108,7 @@ CO_ReturnError_t CO_GFC_init(CO_GFC_t* GFC, OD_entry_t* OD_1300_gfcParameter,
|
|||
void CO_GFC_initCallbackEnterSafeState(CO_GFC_t* GFC, void* object, void (*pFunctSignalSafe)(void* object));
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_PRODUCER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GFC) & CO_CONFIG_GFC_PRODUCER) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Send GFC message.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@
|
|||
|
||||
#include "304/CO_SRDO.h"
|
||||
|
||||
#if (CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) != 0
|
||||
|
||||
#include "301/crc16-ccitt.h"
|
||||
|
||||
/* verify configuration */
|
||||
#if !((CO_CONFIG_CRC16) & CO_CONFIG_CRC16_ENABLE)
|
||||
#if ((CO_CONFIG_CRC16) & CO_CONFIG_CRC16_ENABLE) == 0
|
||||
#error CO_CONFIG_CRC16_ENABLE must be enabled.
|
||||
#endif
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ CO_SRDO_receive_normal(void* object, void* msg) {
|
|||
(void)memcpy(SRDO->CANrxData[0], data, sizeof(SRDO->CANrxData[0]));
|
||||
CO_FLAG_SET(SRDO->CANrxNew[0]);
|
||||
|
||||
#if (CO_CONFIG_SRDO) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/* Optional signal to RTOS, which can resume task, which handles SRDO. */
|
||||
if (SRDO->pFunctSignalPre != NULL) {
|
||||
SRDO->pFunctSignalPre(SRDO->functSignalObjectPre);
|
||||
|
|
@ -84,7 +84,7 @@ CO_SRDO_receive_inverted(void* object, void* msg) {
|
|||
(void)memcpy(SRDO->CANrxData[1], data, sizeof(SRDO->CANrxData[1]));
|
||||
CO_FLAG_SET(SRDO->CANrxNew[1]);
|
||||
|
||||
#if (CO_CONFIG_SRDO) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/* Optional signal to RTOS, which can resume task, which handles SRDO. */
|
||||
if (SRDO->pFunctSignalPre != NULL) {
|
||||
SRDO->pFunctSignalPre(SRDO->functSignalObjectPre);
|
||||
|
|
@ -341,7 +341,7 @@ OD_write_13FF(OD_stream_t* stream, const void* buf, OD_size_t count, OD_size_t*
|
|||
return OD_writeOriginal(stream, buf, count, countWritten);
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SRDO) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
void
|
||||
CO_SRDO_initCallbackPre(CO_SRDO_t* SRDO, void* object, void (*pFunctSignalPre)(void* object)) {
|
||||
if (SRDO != NULL) {
|
||||
|
|
@ -828,7 +828,7 @@ CO_SRDO_process(CO_SRDO_t* SRDO, uint32_t timeDifference_us, uint32_t* timerNext
|
|||
}
|
||||
else {
|
||||
bool_t data_ok = true;
|
||||
#if (CO_CONFIG_SRDO) & CO_CONFIG_SRDO_CHECK_TX
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_CHECK_TX) != 0
|
||||
/* check data before sending (optional) */
|
||||
for (uint8_t i = 0; i < SRDO->dataLength; i++) {
|
||||
if ((uint8_t)(~SRDO->CANtxBuff[0]->data[i]) != SRDO->CANtxBuff[1]->data[i]) {
|
||||
|
|
@ -858,7 +858,7 @@ CO_SRDO_process(CO_SRDO_t* SRDO, uint32_t timeDifference_us, uint32_t* timerNext
|
|||
}
|
||||
SRDO->nextIsNormal = !SRDO->nextIsNormal;
|
||||
}
|
||||
#if (CO_CONFIG_SRDO) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
if (timerNext_us != NULL) {
|
||||
if (*timerNext_us > SRDO->cycleTimer) {
|
||||
*timerNext_us = SRDO->cycleTimer; /* Schedule for the next message timer */
|
||||
|
|
@ -980,7 +980,7 @@ CO_SRDO_process(CO_SRDO_t* SRDO, uint32_t timeDifference_us, uint32_t* timerNext
|
|||
else {
|
||||
/* MISRA C 2004 14.10 */
|
||||
}
|
||||
#if (CO_CONFIG_SRDO) & CO_CONFIG_FLAG_TIMERNEXT
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_FLAG_TIMERNEXT) != 0
|
||||
if (timerNext_us != NULL) {
|
||||
if (*timerNext_us > SRDO->cycleTimer) {
|
||||
*timerNext_us = SRDO->cycleTimer; /* Schedule for the next message timer */
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
#define CO_CONFIG_SRDO_MINIMUM_DELAY 0U
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -185,7 +185,7 @@ typedef struct {
|
|||
OD_extension_t OD_communicationParam_ext;
|
||||
/** Extension for OD object */
|
||||
OD_extension_t OD_mappingParam_extension;
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SRDO) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/** From CO_SRDO_initCallbackPre() or NULL */
|
||||
void (*pFunctSignalPre)(void* object);
|
||||
/** From CO_SRDO_initCallbackPre() or NULL */
|
||||
|
|
@ -259,7 +259,7 @@ CO_ReturnError_t CO_SRDO_init(CO_SRDO_t* SRDO, uint8_t SRDO_Index, CO_SRDOGuard_
|
|||
CO_CANmodule_t* CANdevTxNormal, CO_CANmodule_t* CANdevTxInverted,
|
||||
uint16_t CANdevTxIdxNormal, uint16_t CANdevTxIdxInverted, uint32_t* errInfo);
|
||||
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SRDO) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Initialize SRDO callback function.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
CO_CONFIG_GLOBAL_FLAG_CALLBACK_PRE)
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_LSS) & (CO_CONFIG_LSS_SLAVE | CO_CONFIG_LSS_MASTER)) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_LSS) & (CO_CONFIG_LSS_SLAVE | CO_CONFIG_LSS_MASTER)) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "305/CO_LSSmaster.h"
|
||||
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER) != 0
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ static void CO_LSSmaster_receive(void *object, void *msg)
|
|||
|
||||
CO_FLAG_SET(LSSmaster->CANrxNew);
|
||||
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/* Optional signal to RTOS, which can resume task, which handles further processing. */
|
||||
if(LSSmaster->pFunctSignal != NULL) {
|
||||
LSSmaster->pFunctSignal(LSSmaster->functSignalObject);
|
||||
|
|
@ -147,7 +147,7 @@ CO_ReturnError_t CO_LSSmaster_init(
|
|||
LSSmaster->timeoutTimer = 0;
|
||||
CO_FLAG_CLEAR(LSSmaster->CANrxNew);
|
||||
(void)memset(LSSmaster->CANrxData, 0, sizeof(LSSmaster->CANrxData));
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
LSSmaster->pFunctSignal = NULL;
|
||||
LSSmaster->functSignalObject = NULL;
|
||||
#endif
|
||||
|
|
@ -191,7 +191,7 @@ void CO_LSSmaster_changeTimeout(
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/******************************************************************************/
|
||||
void CO_LSSmaster_initCallbackPre(
|
||||
CO_LSSmaster_t *LSSmaster,
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include "305/CO_LSS.h"
|
||||
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -117,7 +117,7 @@ typedef struct{
|
|||
|
||||
volatile void *CANrxNew; /**< Indication if new LSS message is received from CAN bus. It needs to be cleared when received message is completely processed. */
|
||||
uint8_t CANrxData[8]; /**< 8 data bytes of the received message */
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
void (*pFunctSignal)(void *object); /**< From CO_LSSmaster_initCallbackPre() or NULL */
|
||||
void *functSignalObject;/**< Pointer to object */
|
||||
#endif
|
||||
|
|
@ -185,7 +185,7 @@ void CO_LSSmaster_changeTimeout(
|
|||
uint16_t timeout_ms);
|
||||
|
||||
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Initialize LSSmasterRx callback function.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include "305/CO_LSSslave.h"
|
||||
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) != 0
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
|
@ -161,7 +161,7 @@ static void CO_LSSslave_receive(void *object, void *msg)
|
|||
}
|
||||
else { /* MISRA C 2004 14.10 */ }
|
||||
if (ack) {
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE_FASTSCAN_DIRECT_RESPOND
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE_FASTSCAN_DIRECT_RESPOND) != 0
|
||||
LSSslave->TXbuff->data[0] = CO_LSS_IDENT_SLAVE;
|
||||
(void)memset(&LSSslave->TXbuff->data[1], 0,
|
||||
sizeof(LSSslave->TXbuff->data) - 1);
|
||||
|
|
@ -187,7 +187,7 @@ static void CO_LSSslave_receive(void *object, void *msg)
|
|||
|
||||
if (request_LSSslave_process) {
|
||||
CO_FLAG_SET(LSSslave->sendResponse);
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/* Optional signal to RTOS, which can resume task,
|
||||
* which handles further processing. */
|
||||
if (LSSslave->pFunctSignalPre != NULL) {
|
||||
|
|
@ -265,7 +265,7 @@ CO_ReturnError_t CO_LSSslave_init(
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0
|
||||
/******************************************************************************/
|
||||
void CO_LSSslave_initCallbackPre(
|
||||
CO_LSSslave_t *LSSslave,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "305/CO_LSS.h"
|
||||
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -102,7 +102,7 @@ typedef struct{
|
|||
CO_LSS_cs_t service; /**< Service, which will have to be processed by mainline processing function */
|
||||
uint8_t CANdata[8]; /**< Received CAN data, which will be processed by mainline processing function */
|
||||
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
void (*pFunctSignalPre)(void *object); /**< From CO_LSSslave_initCallbackPre() or NULL */
|
||||
void *functSignalObjectPre;/**< Pointer to object */
|
||||
#endif
|
||||
|
|
@ -194,7 +194,7 @@ static inline CO_LSS_state_t CO_LSSslave_getState(CO_LSSslave_t *LSSslave) {
|
|||
}
|
||||
|
||||
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_LSS) & CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Initialize LSSslaveRx callback function.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "309/CO_gateway_ascii.h"
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII) != 0
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
@ -35,32 +35,32 @@
|
|||
#include <stdio.h>
|
||||
|
||||
/* verify configuration */
|
||||
#if !((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ENABLE)
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ENABLE) == 0
|
||||
#error CO_CONFIG_FIFO_ENABLE must be enabled.
|
||||
#endif
|
||||
#if !((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_COMMANDS)
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_COMMANDS) == 0
|
||||
#error CO_CONFIG_FIFO_ASCII_COMMANDS must be enabled.
|
||||
#endif
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO
|
||||
#if !((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_DATATYPES)
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) != 0
|
||||
#if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_DATATYPES) == 0
|
||||
#error CO_CONFIG_FIFO_ASCII_DATATYPES must be enabled.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
CO_ReturnError_t CO_GTWA_init(CO_GTWA_t* gtwa,
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) != 0) || defined CO_DOXYGEN
|
||||
CO_SDOclient_t* SDO_C,
|
||||
uint16_t SDOclientTimeoutTime_ms,
|
||||
bool_t SDOclientBlockTransfer,
|
||||
#endif
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT) != 0) || defined CO_DOXYGEN
|
||||
CO_NMT_t *NMT,
|
||||
#endif
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS) != 0) || defined CO_DOXYGEN
|
||||
CO_LSSmaster_t *LSSmaster,
|
||||
#endif
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS) != 0) || defined CO_DOXYGEN
|
||||
CO_LEDs_t *LEDs,
|
||||
#endif
|
||||
uint8_t dummy)
|
||||
|
|
@ -68,16 +68,16 @@ CO_ReturnError_t CO_GTWA_init(CO_GTWA_t* gtwa,
|
|||
(void)dummy;
|
||||
/* verify arguments */
|
||||
if (gtwa == NULL
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) != 0
|
||||
|| SDO_C == NULL || SDOclientTimeoutTime_ms == 0
|
||||
#endif
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT) != 0
|
||||
|| NMT == NULL
|
||||
#endif
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS) != 0
|
||||
|| LSSmaster == NULL
|
||||
#endif
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS) != 0
|
||||
|| LEDs == NULL
|
||||
#endif
|
||||
) {
|
||||
|
|
@ -88,18 +88,18 @@ CO_ReturnError_t CO_GTWA_init(CO_GTWA_t* gtwa,
|
|||
(void)memset(gtwa, 0, sizeof(CO_GTWA_t));
|
||||
|
||||
/* initialize variables */
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) != 0
|
||||
gtwa->SDO_C = SDO_C;
|
||||
gtwa->SDOtimeoutTime = SDOclientTimeoutTime_ms;
|
||||
gtwa->SDOblockTransferEnable = SDOclientBlockTransfer;
|
||||
#endif
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT) != 0
|
||||
gtwa->NMT = NMT;
|
||||
#endif
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS) != 0
|
||||
gtwa->LSSmaster = LSSmaster;
|
||||
#endif
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS) != 0
|
||||
gtwa->LEDs = LEDs;
|
||||
#endif
|
||||
gtwa->net_default = -1;
|
||||
|
|
@ -111,7 +111,7 @@ CO_ReturnError_t CO_GTWA_init(CO_GTWA_t* gtwa,
|
|||
>wa->commBuf[0],
|
||||
CO_CONFIG_GTWA_COMM_BUF_SIZE + 1);
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG) != 0
|
||||
CO_fifo_init(>wa->logFifo,
|
||||
>wa->logBuf[0],
|
||||
CO_CONFIG_GTWA_LOG_BUF_SIZE + 1);
|
||||
|
|
@ -137,7 +137,7 @@ void CO_GTWA_initRead(CO_GTWA_t* gtwa,
|
|||
|
||||
|
||||
/******************************************************************************/
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG) != 0
|
||||
void CO_GTWA_log_print(CO_GTWA_t* gtwa, const char *message) {
|
||||
if ((gtwa != NULL) && (message != NULL)) {
|
||||
const char *c;
|
||||
|
|
@ -153,7 +153,7 @@ void CO_GTWA_log_print(CO_GTWA_t* gtwa, const char *message) {
|
|||
/*******************************************************************************
|
||||
* HELPER FUNCTIONS
|
||||
******************************************************************************/
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_HELP
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_HELP) != 0
|
||||
/* help strings ("\n" is used between string, "\r\n" closes the response.) */
|
||||
static const char CO_GTWA_helpString[] =
|
||||
"\nCommand strings start with '\"[\"<sequence>\"]\"' followed by:\n" \
|
||||
|
|
@ -224,7 +224,7 @@ static const char CO_GTWA_helpStringLss[] =
|
|||
"* <scanType>: 0=fastscan, 1=ignore, 2=match value in next parameter\r\n";
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS) != 0
|
||||
#define CO_GTWA_LED_PRINTOUTS_SIZE 5
|
||||
static const char *CO_GTWA_LED_PRINTOUTS[CO_GTWA_LED_PRINTOUTS_SIZE] = {
|
||||
" CANopen status LEDs: R G \r",
|
||||
|
|
@ -266,7 +266,7 @@ static bool_t checkNetNode(CO_GTWA_t *gtwa,
|
|||
eCode = CO_GTWA_respErrorUnsupportedNode;
|
||||
e = true;
|
||||
}
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_MULTI_NET
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_MULTI_NET) != 0
|
||||
else if (net == -1) {
|
||||
eCode = CO_GTWA_respErrorNoDefaultNetSet;
|
||||
e = true;
|
||||
|
|
@ -291,7 +291,7 @@ static bool_t checkNetNode(CO_GTWA_t *gtwa,
|
|||
static bool_t checkNet(CO_GTWA_t *gtwa, int32_t net,
|
||||
CO_GTWA_respErrorCode_t *errCode)
|
||||
{
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_MULTI_NET
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_MULTI_NET) != 0
|
||||
bool_t e = false;
|
||||
CO_GTWA_respErrorCode_t eCode;
|
||||
|
||||
|
|
@ -321,7 +321,7 @@ static bool_t checkNet(CO_GTWA_t *gtwa, int32_t net,
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) != 0
|
||||
/* data types for SDO read or write */
|
||||
static const CO_GTWA_dataType_t dataTypes[] = {
|
||||
{"hex", 0, CO_fifo_readHex2a, CO_fifo_cpyTok2Hex}, /* hex, non-standard */
|
||||
|
|
@ -401,7 +401,7 @@ static bool_t respBufTransfer(CO_GTWA_t *gtwa) {
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_ERROR_DESC
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_ERROR_DESC) != 0
|
||||
#ifndef CO_CONFIG_GTW_ASCII_ERROR_DESC_STRINGS
|
||||
#define CO_CONFIG_GTW_ASCII_ERROR_DESC_STRINGS
|
||||
typedef struct {
|
||||
|
|
@ -438,7 +438,7 @@ static const errorDescs_t errorDescs[] = {
|
|||
{505, "LSS command failed because of media error."},
|
||||
{600, "Running out of memory."}
|
||||
};
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) != 0
|
||||
static const errorDescs_t errorDescsSDO[] = {
|
||||
{0x00000000, "No abort."},
|
||||
{0x05030000, "Toggle bit not altered."},
|
||||
|
|
@ -496,7 +496,7 @@ static void responseWithError(CO_GTWA_t *gtwa,
|
|||
respBufTransfer(gtwa);
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) != 0
|
||||
static void responseWithErrorSDO(CO_GTWA_t *gtwa,
|
||||
CO_SDO_abortCode_t abortCode,
|
||||
bool_t postponed)
|
||||
|
|
@ -537,7 +537,7 @@ static inline void responseWithError(CO_GTWA_t *gtwa,
|
|||
respBufTransfer(gtwa);
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) != 0
|
||||
static inline void responseWithErrorSDO(CO_GTWA_t *gtwa,
|
||||
CO_SDO_abortCode_t abortCode,
|
||||
bool_t postponed)
|
||||
|
|
@ -574,7 +574,7 @@ static inline void responseWithEmpty(CO_GTWA_t *gtwa) {
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS) != 0
|
||||
static void responseLSS(CO_GTWA_t *gtwa, CO_LSSmaster_return_t lss_ret) {
|
||||
if (lss_ret == CO_LSSmaster_OK) {
|
||||
responseWithOK(gtwa);
|
||||
|
|
@ -804,7 +804,7 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
|
|||
gtwa->node_default = value;
|
||||
responseWithOK(gtwa);
|
||||
}
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) != 0
|
||||
/* 'set sdo_timeout <value_ms>' */
|
||||
else if (strcmp(tok, "sdo_timeout") == 0) {
|
||||
bool_t NodeErr = checkNet(gtwa, net, &respErrorCode);
|
||||
|
|
@ -853,7 +853,7 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
|
|||
}
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) != 0
|
||||
/* Upload SDO command - 'r[ead] <index> <subindex> <datatype>' */
|
||||
else if ((strcmp(tok, "r") == 0) || (strcmp(tok, "read") == 0)) {
|
||||
uint16_t idx;
|
||||
|
|
@ -1011,7 +1011,7 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
|
|||
}
|
||||
#endif /* (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO */
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT) != 0
|
||||
/* NMT start node - 'start' */
|
||||
else if (strcmp(tok, "start") == 0) {
|
||||
CO_ReturnError_t ret;
|
||||
|
|
@ -1121,7 +1121,7 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
|
|||
}
|
||||
#endif /* (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT */
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS) != 0
|
||||
/* Switch state global command - 'lss_switch_glob <0|1>' */
|
||||
else if (strcmp(tok, "lss_switch_glob") == 0) {
|
||||
bool_t NodeErr = checkNet(gtwa, net, &respErrorCode);
|
||||
|
|
@ -1463,7 +1463,7 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
|
|||
}
|
||||
#endif /* (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS */
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG) != 0
|
||||
/* Print message log */
|
||||
else if (strcmp(tok, "log") == 0) {
|
||||
if (closed == 0) {
|
||||
|
|
@ -1474,7 +1474,7 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
|
|||
}
|
||||
#endif /* (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG */
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_HELP
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_HELP) != 0
|
||||
/* Print help */
|
||||
else if (strcmp(tok, "help") == 0) {
|
||||
if (closed == 1) {
|
||||
|
|
@ -1504,7 +1504,7 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
|
|||
}
|
||||
#endif /* (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_HELP */
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS) != 0
|
||||
/* Print status led diodes */
|
||||
else if (strcmp(tok, "led") == 0) {
|
||||
if (closed == 0) {
|
||||
|
|
@ -1548,7 +1548,7 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
|
|||
return; /* skip timerNext_us calculation */
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) != 0
|
||||
/* SDO upload state */
|
||||
case CO_GTWA_ST_READ: {
|
||||
CO_SDO_abortCode_t abortCode;
|
||||
|
|
@ -1708,7 +1708,7 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
|
|||
}
|
||||
#endif /* (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO */
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS) != 0
|
||||
case CO_GTWA_ST_LSS_SWITCH_GLOB: {
|
||||
CO_LSSmaster_return_t ret;
|
||||
ret = CO_LSSmaster_switchStateSelect(gtwa->LSSmaster,
|
||||
|
|
@ -1985,7 +1985,7 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
|
|||
} /* CO_GTWA_ST_LSS_ALLNODES */
|
||||
#endif /* (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS */
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG) != 0
|
||||
/* print message log */
|
||||
case CO_GTWA_ST_LOG: {
|
||||
do {
|
||||
|
|
@ -2003,7 +2003,7 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
|
|||
}
|
||||
#endif /* (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG */
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_HELP
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_HELP) != 0
|
||||
/* Print help string (in multiple segments if necessary) */
|
||||
case CO_GTWA_ST_HELP: {
|
||||
size_t lenBuf = CO_GTWA_RESP_BUF_SIZE;
|
||||
|
|
@ -2030,7 +2030,7 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS) != 0
|
||||
/* print CANopen status LED diodes */
|
||||
case CO_GTWA_ST_LED: {
|
||||
uint8_t i;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
#define CO_CONFIG_GTW (0)
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -263,7 +263,7 @@ typedef enum {
|
|||
} CO_GTWA_state_t;
|
||||
|
||||
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) != 0) || defined CO_DOXYGEN
|
||||
/*
|
||||
* CANopen Gateway-ascii data types structure
|
||||
*/
|
||||
|
|
@ -343,7 +343,7 @@ typedef struct {
|
|||
CO_GTWA_state_t state;
|
||||
/** Timeout timer for the current state */
|
||||
uint32_t stateTimeoutTmr;
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) != 0) || defined CO_DOXYGEN
|
||||
/** SDO client object from CO_GTWA_init() */
|
||||
CO_SDOclient_t *SDO_C;
|
||||
/** Timeout time for SDO transfer in milliseconds, if no response */
|
||||
|
|
@ -357,11 +357,11 @@ typedef struct {
|
|||
/** Data type of variable in current SDO communication */
|
||||
const CO_GTWA_dataType_t *SDOdataType;
|
||||
#endif
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT) != 0) || defined CO_DOXYGEN
|
||||
/** NMT object from CO_GTWA_init() */
|
||||
CO_NMT_t *NMT;
|
||||
#endif
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS) != 0) || defined CO_DOXYGEN
|
||||
/** LSSmaster object from CO_GTWA_init() */
|
||||
CO_LSSmaster_t *LSSmaster;
|
||||
/** 128 bit number, uniquely identifying each node */
|
||||
|
|
@ -383,18 +383,18 @@ typedef struct {
|
|||
/** LSS allnodes timeout parameter */
|
||||
uint16_t lssTimeout_ms;
|
||||
#endif
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG) != 0) || defined CO_DOXYGEN
|
||||
/** Message log buffer of usable size @ref CO_CONFIG_GTWA_LOG_BUF_SIZE */
|
||||
uint8_t logBuf[CO_CONFIG_GTWA_LOG_BUF_SIZE + 1];
|
||||
/** CO_fifo_t object for message log (not pointer) */
|
||||
CO_fifo_t logFifo;
|
||||
#endif
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_HELP) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_HELP) != 0) || defined CO_DOXYGEN
|
||||
/** Offset, when printing help text */
|
||||
const char *helpString;
|
||||
size_t helpStringOffset;
|
||||
#endif
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS) != 0) || defined CO_DOXYGEN
|
||||
/** CO_LEDs_t object for CANopen status LEDs imitation from CO_GTWA_init()*/
|
||||
CO_LEDs_t *LEDs;
|
||||
uint8_t ledStringPreviousIndex;
|
||||
|
|
@ -417,18 +417,18 @@ typedef struct {
|
|||
* @return #CO_ReturnError_t: CO_ERROR_NO or CO_ERROR_ILLEGAL_ARGUMENT
|
||||
*/
|
||||
CO_ReturnError_t CO_GTWA_init(CO_GTWA_t* gtwa,
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) != 0) || defined CO_DOXYGEN
|
||||
CO_SDOclient_t* SDO_C,
|
||||
uint16_t SDOclientTimeoutTime_ms,
|
||||
bool_t SDOclientBlockTransfer,
|
||||
#endif
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT) != 0) || defined CO_DOXYGEN
|
||||
CO_NMT_t *NMT,
|
||||
#endif
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS) != 0) || defined CO_DOXYGEN
|
||||
CO_LSSmaster_t *LSSmaster,
|
||||
#endif
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS) != 0) || defined CO_DOXYGEN
|
||||
CO_LEDs_t *LEDs,
|
||||
#endif
|
||||
uint8_t dummy);
|
||||
|
|
@ -491,7 +491,7 @@ static inline size_t CO_GTWA_write(CO_GTWA_t* gtwa,
|
|||
}
|
||||
|
||||
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Print message log string into fifo buffer
|
||||
*
|
||||
|
|
|
|||
306
CANopen.c
306
CANopen.c
|
|
@ -48,7 +48,7 @@
|
|||
#error OD_CNT_NMT from OD.h not correct!
|
||||
#endif
|
||||
#define CO_RX_CNT_NMT_SLV OD_CNT_NMT
|
||||
#if (CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER) != 0
|
||||
#define CO_TX_CNT_NMT_MST 1
|
||||
#else
|
||||
#define CO_TX_CNT_NMT_MST 0
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
#elif OD_CNT_HB_CONS < 0 || OD_CNT_HB_CONS > 1
|
||||
#error OD_CNT_HB_CONS from OD.h not correct!
|
||||
#endif
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE) && OD_CNT_HB_CONS == 1
|
||||
#if (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE) != 0) && OD_CNT_HB_CONS == 1
|
||||
#if OD_CNT_ARR_1016 < 1 || OD_CNT_ARR_1016 > 127
|
||||
#error OD_CNT_ARR_1016 is not defined in Object Dictionary or value is wrong!
|
||||
#endif
|
||||
|
|
@ -72,14 +72,14 @@
|
|||
#define CO_RX_CNT_HB_CONS 0
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE) != 0
|
||||
#define CO_RX_CNT_NG_SLV 1
|
||||
#define CO_TX_CNT_NG_SLV 1
|
||||
#else
|
||||
#define CO_RX_CNT_NG_SLV 0
|
||||
#define CO_TX_CNT_NG_SLV 0
|
||||
#endif
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE) != 0
|
||||
#define CO_RX_CNT_NG_MST 1
|
||||
#define CO_TX_CNT_NG_MST 1
|
||||
#else
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
#ifndef OD_CNT_ARR_1003
|
||||
#define OD_CNT_ARR_1003 8
|
||||
#endif
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) != 0
|
||||
#if OD_CNT_EM_PROD == 1
|
||||
#define CO_TX_CNT_EM_PROD OD_CNT_EM_PROD
|
||||
#else
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
#else
|
||||
#define CO_TX_CNT_EM_PROD 0
|
||||
#endif
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) != 0
|
||||
#define CO_RX_CNT_EM_CONS 1
|
||||
#else
|
||||
#define CO_RX_CNT_EM_CONS 0
|
||||
|
|
@ -123,7 +123,7 @@
|
|||
#define CO_RX_CNT_SDO_SRV OD_CNT_SDO_SRV
|
||||
#define CO_TX_CNT_SDO_SRV OD_CNT_SDO_SRV
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE) != 0
|
||||
#if !defined OD_CNT_SDO_CLI
|
||||
#define OD_CNT_SDO_CLI 0
|
||||
#define OD_ENTRY_H1280 NULL
|
||||
|
|
@ -137,7 +137,7 @@
|
|||
#define CO_TX_CNT_SDO_CLI 0
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE) != 0
|
||||
#if !defined OD_CNT_TIME
|
||||
#define OD_CNT_TIME 0
|
||||
#define OD_ENTRY_H1012 NULL
|
||||
|
|
@ -145,7 +145,7 @@
|
|||
#error OD_CNT_TIME from OD.h not correct!
|
||||
#endif
|
||||
#define CO_RX_CNT_TIME OD_CNT_TIME
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER) != 0
|
||||
#define CO_TX_CNT_TIME OD_CNT_TIME
|
||||
#else
|
||||
#define CO_TX_CNT_TIME 0
|
||||
|
|
@ -155,7 +155,7 @@
|
|||
#define CO_TX_CNT_TIME 0
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE) != 0
|
||||
#if !defined OD_CNT_SYNC
|
||||
#define OD_CNT_SYNC 0
|
||||
#define OD_ENTRY_H1005 NULL
|
||||
|
|
@ -164,7 +164,7 @@
|
|||
#error OD_CNT_SYNC from OD.h not correct!
|
||||
#endif
|
||||
#define CO_RX_CNT_SYNC OD_CNT_SYNC
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0
|
||||
#define CO_TX_CNT_SYNC OD_CNT_SYNC
|
||||
#else
|
||||
#define CO_TX_CNT_SYNC 0
|
||||
|
|
@ -180,7 +180,7 @@
|
|||
#define CO_TX_CNT_SYNC 0
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE) != 0
|
||||
#if !defined OD_CNT_RPDO
|
||||
#define OD_CNT_RPDO 0
|
||||
#define OD_ENTRY_H1400 NULL
|
||||
|
|
@ -193,7 +193,7 @@
|
|||
#define CO_RX_CNT_RPDO 0
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE) != 0
|
||||
#if !defined OD_CNT_TPDO
|
||||
#define OD_CNT_TPDO 0
|
||||
#define OD_ENTRY_H1800 NULL
|
||||
|
|
@ -206,11 +206,11 @@
|
|||
#define CO_TX_CNT_TPDO 0
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE
|
||||
#if ((CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE) != 0
|
||||
#define OD_CNT_LEDS 1
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE) != 0
|
||||
#if !defined OD_CNT_GFC
|
||||
#define OD_CNT_GFC 0
|
||||
#define OD_ENTRY_H1300 NULL
|
||||
|
|
@ -224,7 +224,7 @@
|
|||
#define CO_TX_CNT_GFC 0
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) != 0
|
||||
#if !defined OD_CNT_SRDO
|
||||
#define OD_CNT_SRDO 0
|
||||
#define OD_ENTRY_H1301 NULL
|
||||
|
|
@ -241,7 +241,7 @@
|
|||
#define CO_TX_CNT_SRDO 0
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) != 0
|
||||
#define OD_CNT_LSS_SLV 1
|
||||
#else
|
||||
#define OD_CNT_LSS_SLV 0
|
||||
|
|
@ -249,7 +249,7 @@
|
|||
#define CO_RX_CNT_LSS_SLV OD_CNT_LSS_SLV
|
||||
#define CO_TX_CNT_LSS_SLV OD_CNT_LSS_SLV
|
||||
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER) != 0
|
||||
#define OD_CNT_LSS_MST 1
|
||||
#else
|
||||
#define OD_CNT_LSS_MST 0
|
||||
|
|
@ -257,7 +257,7 @@
|
|||
#define CO_RX_CNT_LSS_MST OD_CNT_LSS_MST
|
||||
#define CO_TX_CNT_LSS_MST OD_CNT_LSS_MST
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII) != 0
|
||||
#define OD_CNT_GTWA 1
|
||||
#endif
|
||||
|
||||
|
|
@ -388,13 +388,13 @@ CO_t *CO_new(CO_config_t *config, uint32_t *heapMemoryUsed) {
|
|||
if (CO_GET_CNT(NMT) == 1) {
|
||||
CO_alloc_break_on_fail(co->NMT, CO_GET_CNT(NMT), sizeof(*co->NMT));
|
||||
ON_MULTI_OD(RX_CNT_NMT_SLV = 1);
|
||||
#if (CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER) != 0
|
||||
ON_MULTI_OD(TX_CNT_NMT_MST = 1);
|
||||
#endif
|
||||
ON_MULTI_OD(TX_CNT_HB_PROD = 1);
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE) != 0
|
||||
ON_MULTI_OD(uint8_t RX_CNT_HB_CONS = 0);
|
||||
if (CO_GET_CNT(HB_CONS) == 1) {
|
||||
uint8_t countOfMonitoredNodes = CO_GET_CNT(ARR_1016);
|
||||
|
|
@ -405,10 +405,10 @@ CO_t *CO_new(CO_config_t *config, uint32_t *heapMemoryUsed) {
|
|||
#endif
|
||||
|
||||
/* Node guarding */
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE) != 0
|
||||
CO_alloc_break_on_fail(co->NGslave, 1, sizeof(*co->NGslave));
|
||||
#endif
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE) != 0
|
||||
CO_alloc_break_on_fail(co->NGmaster, 1, sizeof(*co->NGmaster));
|
||||
#endif
|
||||
|
||||
|
|
@ -417,13 +417,13 @@ CO_t *CO_new(CO_config_t *config, uint32_t *heapMemoryUsed) {
|
|||
ON_MULTI_OD(uint8_t TX_CNT_EM_PROD = 0);
|
||||
if (CO_GET_CNT(EM) == 1) {
|
||||
CO_alloc_break_on_fail(co->em, CO_GET_CNT(EM), sizeof(*co->em));
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) != 0
|
||||
ON_MULTI_OD(RX_CNT_EM_CONS = 1);
|
||||
#endif
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) != 0
|
||||
ON_MULTI_OD(TX_CNT_EM_PROD = 1);
|
||||
#endif
|
||||
#if (CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)
|
||||
#if ((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) != 0
|
||||
uint8_t fifoSize = CO_GET_CNT(ARR_1003) + 1;
|
||||
if (fifoSize >= 2) {
|
||||
CO_alloc_break_on_fail(co->em_fifo, fifoSize, sizeof(*co->em_fifo));
|
||||
|
|
@ -440,7 +440,7 @@ CO_t *CO_new(CO_config_t *config, uint32_t *heapMemoryUsed) {
|
|||
ON_MULTI_OD(TX_CNT_SDO_SRV = config->CNT_SDO_SRV);
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE) != 0
|
||||
ON_MULTI_OD(uint8_t RX_CNT_SDO_CLI = 0);
|
||||
ON_MULTI_OD(uint8_t TX_CNT_SDO_CLI = 0);
|
||||
if (CO_GET_CNT(SDO_CLI) > 0) {
|
||||
|
|
@ -450,31 +450,31 @@ CO_t *CO_new(CO_config_t *config, uint32_t *heapMemoryUsed) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE) != 0
|
||||
ON_MULTI_OD(uint8_t RX_CNT_TIME = 0);
|
||||
ON_MULTI_OD(uint8_t TX_CNT_TIME = 0);
|
||||
if (CO_GET_CNT(TIME) == 1) {
|
||||
CO_alloc_break_on_fail(co->TIME, CO_GET_CNT(TIME), sizeof(*co->TIME));
|
||||
ON_MULTI_OD(RX_CNT_TIME = 1);
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER) != 0
|
||||
ON_MULTI_OD(TX_CNT_TIME = 1);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE) != 0
|
||||
ON_MULTI_OD(uint8_t RX_CNT_SYNC = 0);
|
||||
ON_MULTI_OD(uint8_t TX_CNT_SYNC = 0);
|
||||
if (CO_GET_CNT(SYNC) == 1) {
|
||||
CO_alloc_break_on_fail(co->SYNC, CO_GET_CNT(SYNC), sizeof(*co->SYNC));
|
||||
ON_MULTI_OD(RX_CNT_SYNC = 1);
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0
|
||||
ON_MULTI_OD(TX_CNT_SYNC = 1);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE) != 0
|
||||
ON_MULTI_OD(uint16_t RX_CNT_RPDO = 0);
|
||||
if (CO_GET_CNT(RPDO) > 0) {
|
||||
CO_alloc_break_on_fail(co->RPDO, CO_GET_CNT(RPDO), sizeof(*co->RPDO));
|
||||
|
|
@ -482,7 +482,7 @@ CO_t *CO_new(CO_config_t *config, uint32_t *heapMemoryUsed) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE) != 0
|
||||
ON_MULTI_OD(uint16_t TX_CNT_TPDO = 0);
|
||||
if (CO_GET_CNT(TPDO) > 0) {
|
||||
CO_alloc_break_on_fail(co->TPDO, CO_GET_CNT(TPDO), sizeof(*co->TPDO));
|
||||
|
|
@ -490,13 +490,13 @@ CO_t *CO_new(CO_config_t *config, uint32_t *heapMemoryUsed) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE
|
||||
#if ((CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE) != 0
|
||||
if (CO_GET_CNT(LEDS) == 1) {
|
||||
CO_alloc_break_on_fail(co->LEDs, CO_GET_CNT(LEDS), sizeof(*co->LEDs));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE
|
||||
#if (CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE) != 0
|
||||
ON_MULTI_OD(uint8_t RX_CNT_GFC = 0);
|
||||
ON_MULTI_OD(uint8_t TX_CNT_GFC = 0);
|
||||
if (CO_GET_CNT(GFC) == 1) {
|
||||
|
|
@ -506,7 +506,7 @@ CO_t *CO_new(CO_config_t *config, uint32_t *heapMemoryUsed) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) != 0
|
||||
ON_MULTI_OD(uint8_t RX_CNT_SRDO = 0);
|
||||
ON_MULTI_OD(uint8_t TX_CNT_SRDO = 0);
|
||||
if (CO_GET_CNT(SRDO) > 0) {
|
||||
|
|
@ -517,7 +517,7 @@ CO_t *CO_new(CO_config_t *config, uint32_t *heapMemoryUsed) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) != 0
|
||||
ON_MULTI_OD(uint8_t RX_CNT_LSS_SLV = 0);
|
||||
ON_MULTI_OD(uint8_t TX_CNT_LSS_SLV = 0);
|
||||
if (CO_GET_CNT(LSS_SLV) == 1) {
|
||||
|
|
@ -527,7 +527,7 @@ CO_t *CO_new(CO_config_t *config, uint32_t *heapMemoryUsed) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER) != 0
|
||||
ON_MULTI_OD(uint8_t RX_CNT_LSS_MST = 0);
|
||||
ON_MULTI_OD(uint8_t TX_CNT_LSS_MST = 0);
|
||||
if (CO_GET_CNT(LSS_MST) == 1) {
|
||||
|
|
@ -537,7 +537,7 @@ CO_t *CO_new(CO_config_t *config, uint32_t *heapMemoryUsed) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII) != 0
|
||||
if (CO_GET_CNT(GTWA) == 1) {
|
||||
CO_alloc_break_on_fail(co->gtwa, CO_GET_CNT(GTWA), sizeof(*co->gtwa));
|
||||
}
|
||||
|
|
@ -555,76 +555,76 @@ CO_t *CO_new(CO_config_t *config, uint32_t *heapMemoryUsed) {
|
|||
* highest priority of the CAN identifier are listed first. */
|
||||
int16_t idxRx = 0;
|
||||
co->RX_IDX_NMT_SLV = idxRx; idxRx += RX_CNT_NMT_SLV;
|
||||
#if (CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE) != 0
|
||||
co->RX_IDX_GFC = idxRx; idxRx += RX_CNT_GFC;
|
||||
#endif
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE) != 0
|
||||
co->RX_IDX_SYNC = idxRx; idxRx += RX_CNT_SYNC;
|
||||
#endif
|
||||
co->RX_IDX_EM_CONS = idxRx; idxRx += RX_CNT_EM_CONS;
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE) != 0
|
||||
co->RX_IDX_TIME = idxRx; idxRx += RX_CNT_TIME;
|
||||
#endif
|
||||
#if (CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) != 0
|
||||
co->RX_IDX_SRDO = idxRx; idxRx += RX_CNT_SRDO * 2;
|
||||
#endif
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE) != 0
|
||||
co->RX_IDX_RPDO = idxRx; idxRx += RX_CNT_RPDO;
|
||||
#endif
|
||||
co->RX_IDX_SDO_SRV = idxRx; idxRx += RX_CNT_SDO_SRV;
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE) != 0
|
||||
co->RX_IDX_SDO_CLI = idxRx; idxRx += RX_CNT_SDO_CLI;
|
||||
#endif
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE) != 0
|
||||
co->RX_IDX_HB_CONS = idxRx; idxRx += RX_CNT_HB_CONS;
|
||||
#endif
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE) != 0
|
||||
co->RX_IDX_NG_SLV = idxRx; idxRx += 1;
|
||||
#endif
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE) != 0
|
||||
co->RX_IDX_NG_MST = idxRx; idxRx += 1;
|
||||
#endif
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) != 0
|
||||
co->RX_IDX_LSS_SLV = idxRx; idxRx += RX_CNT_LSS_SLV;
|
||||
#endif
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER) != 0
|
||||
co->RX_IDX_LSS_MST = idxRx; idxRx += RX_CNT_LSS_MST;
|
||||
#endif
|
||||
co->CNT_ALL_RX_MSGS = idxRx;
|
||||
|
||||
int16_t idxTx = 0;
|
||||
co->TX_IDX_NMT_MST = idxTx; idxTx += TX_CNT_NMT_MST;
|
||||
#if (CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE) != 0
|
||||
co->TX_IDX_GFC = idxTx; idxTx += TX_CNT_GFC;
|
||||
#endif
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE) != 0
|
||||
co->TX_IDX_SYNC = idxTx; idxTx += TX_CNT_SYNC;
|
||||
#endif
|
||||
co->TX_IDX_EM_PROD = idxTx; idxTx += TX_CNT_EM_PROD;
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE) != 0
|
||||
co->TX_IDX_TIME = idxTx; idxTx += TX_CNT_TIME;
|
||||
#endif
|
||||
#if (CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) != 0
|
||||
co->TX_IDX_SRDO = idxTx; idxTx += TX_CNT_SRDO * 2;
|
||||
#endif
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE) != 0
|
||||
co->TX_IDX_TPDO = idxTx; idxTx += TX_CNT_TPDO;
|
||||
#endif
|
||||
co->TX_IDX_SDO_SRV = idxTx; idxTx += TX_CNT_SDO_SRV;
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE) != 0
|
||||
co->TX_IDX_SDO_CLI = idxTx; idxTx += TX_CNT_SDO_CLI;
|
||||
#endif
|
||||
co->TX_IDX_HB_PROD = idxTx; idxTx += TX_CNT_HB_PROD;
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE) != 0
|
||||
co->TX_IDX_NG_SLV = idxTx; idxTx += 1;
|
||||
#endif
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE) != 0
|
||||
co->TX_IDX_NG_MST = idxTx; idxTx += 1;
|
||||
#endif
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) != 0
|
||||
co->TX_IDX_LSS_SLV = idxTx; idxTx += TX_CNT_LSS_SLV;
|
||||
#endif
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER) != 0
|
||||
co->TX_IDX_LSS_MST = idxTx; idxTx += TX_CNT_LSS_MST;
|
||||
#endif
|
||||
co->CNT_ALL_TX_MSGS = idxTx;
|
||||
|
|
@ -669,48 +669,48 @@ void CO_delete(CO_t *co) {
|
|||
CO_free(co->trace);
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII) != 0
|
||||
CO_free(co->gtwa);
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER) != 0
|
||||
CO_free(co->LSSmaster);
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) != 0
|
||||
CO_free(co->LSSslave);
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) != 0
|
||||
CO_free(co->SRDO);
|
||||
CO_free(co->SRDOGuard);
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE) != 0
|
||||
CO_free(co->GFC);
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE
|
||||
#if ((CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE) != 0
|
||||
CO_free(co->LEDs);
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE) != 0
|
||||
CO_free(co->TPDO);
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE) != 0
|
||||
CO_free(co->RPDO);
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE) != 0
|
||||
CO_free(co->SYNC);
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE) != 0
|
||||
CO_free(co->TIME);
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE) != 0
|
||||
free(co->SDOclient);
|
||||
#endif
|
||||
|
||||
|
|
@ -719,18 +719,18 @@ void CO_delete(CO_t *co) {
|
|||
|
||||
/* Emergency */
|
||||
CO_free(co->em);
|
||||
#if (CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)
|
||||
#if ((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) != 0
|
||||
CO_free(co->em_fifo);
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE) != 0
|
||||
CO_free(co->NGslave);
|
||||
#endif
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE) != 0
|
||||
CO_free(co->NGmaster);
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE) != 0)
|
||||
CO_free(co->HBconsMonitoredNodes);
|
||||
CO_free(co->HBcons);
|
||||
#endif
|
||||
|
|
@ -754,56 +754,56 @@ void CO_delete(CO_t *co) {
|
|||
static CO_CANrx_t COO_CANmodule_rxArray[CO_CNT_ALL_RX_MSGS];
|
||||
static CO_CANtx_t COO_CANmodule_txArray[CO_CNT_ALL_TX_MSGS];
|
||||
static CO_NMT_t COO_NMT;
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE) != 0
|
||||
static CO_HBconsumer_t COO_HBcons;
|
||||
static CO_HBconsNode_t COO_HBconsMonitoredNodes[OD_CNT_ARR_1016];
|
||||
#endif
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE) != 0
|
||||
static CO_nodeGuardingSlave_t COO_NGslave;
|
||||
#endif
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE) != 0
|
||||
static CO_nodeGuardingMaster_t COO_NGmaster;
|
||||
#endif
|
||||
static CO_EM_t COO_EM;
|
||||
#if (CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)
|
||||
#if ((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) != 0
|
||||
static CO_EM_fifo_t COO_EM_FIFO[CO_GET_CNT(ARR_1003) + 1U];
|
||||
#endif
|
||||
static CO_SDOserver_t COO_SDOserver[OD_CNT_SDO_SRV];
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE) != 0
|
||||
static CO_SDOclient_t COO_SDOclient[OD_CNT_SDO_CLI];
|
||||
#endif
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE) != 0
|
||||
static CO_TIME_t COO_TIME;
|
||||
#endif
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE) != 0
|
||||
static CO_SYNC_t COO_SYNC;
|
||||
#endif
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE) != 0
|
||||
static CO_RPDO_t COO_RPDO[OD_CNT_RPDO];
|
||||
#endif
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE) != 0
|
||||
static CO_TPDO_t COO_TPDO[OD_CNT_TPDO];
|
||||
#endif
|
||||
#if (CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE
|
||||
#if ((CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE) != 0
|
||||
static CO_LEDs_t COO_LEDs;
|
||||
#endif
|
||||
#if (CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE) != 0
|
||||
static CO_GFC_t COO_GFC;
|
||||
#endif
|
||||
#if (CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) != 0
|
||||
static CO_SRDOGuard_t COO_SRDOGuard;
|
||||
static CO_SRDO_t COO_SRDO[OD_CNT_SRDO];
|
||||
#endif
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) != 0
|
||||
static CO_LSSslave_t COO_LSSslave;
|
||||
#endif
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER) != 0
|
||||
static CO_LSSmaster_t COO_LSSmaster;
|
||||
#endif
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII) != 0
|
||||
static CO_GTWA_t COO_gtwa;
|
||||
#endif
|
||||
#if (CO_CONFIG_TRACE) & CO_CONFIG_TRACE_ENABLE
|
||||
#if ((CO_CONFIG_TRACE) & CO_CONFIG_TRACE_ENABLE) != 0
|
||||
#ifndef CO_TRACE_BUFFER_SIZE_FIXED
|
||||
#define CO_TRACE_BUFFER_SIZE_FIXED 100
|
||||
#endif
|
||||
|
|
@ -822,56 +822,56 @@ CO_t *CO_new(CO_config_t *config, uint32_t *heapMemoryUsed) {
|
|||
co->CANtx = &COO_CANmodule_txArray[0];
|
||||
|
||||
co->NMT = &COO_NMT;
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE) != 0
|
||||
co->HBcons = &COO_HBcons;
|
||||
co->HBconsMonitoredNodes = &COO_HBconsMonitoredNodes[0];
|
||||
#endif
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE) != 0
|
||||
co->NGslave = &COO_NGslave;
|
||||
#endif
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE) != 0
|
||||
co->NGmaster = &COO_NGmaster;
|
||||
#endif
|
||||
co->em = &COO_EM;
|
||||
#if (CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)
|
||||
#if ((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) != 0
|
||||
co->em_fifo = &COO_EM_FIFO[0];
|
||||
#endif
|
||||
co->SDOserver = &COO_SDOserver[0];
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE) != 0
|
||||
co->SDOclient = &COO_SDOclient[0];
|
||||
#endif
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE) != 0
|
||||
co->TIME = &COO_TIME;
|
||||
#endif
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE) != 0
|
||||
co->SYNC = &COO_SYNC;
|
||||
#endif
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE) != 0
|
||||
co->RPDO = &COO_RPDO[0];
|
||||
#endif
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE) != 0
|
||||
co->TPDO = &COO_TPDO[0];
|
||||
#endif
|
||||
#if (CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE
|
||||
#if ((CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE) != 0
|
||||
co->LEDs = &COO_LEDs;
|
||||
#endif
|
||||
#if (CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE) != 0
|
||||
co->GFC = &COO_GFC;
|
||||
#endif
|
||||
#if (CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) != 0
|
||||
co->SRDOGuard = &COO_SRDOGuard;
|
||||
co->SRDO = &COO_SRDO[0];
|
||||
#endif
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) != 0
|
||||
co->LSSslave = &COO_LSSslave;
|
||||
#endif
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER) != 0
|
||||
co->LSSmaster = &COO_LSSmaster;
|
||||
#endif
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII) != 0
|
||||
co->gtwa = &COO_gtwa;
|
||||
#endif
|
||||
#if (CO_CONFIG_TRACE) & CO_CONFIG_TRACE_ENABLE
|
||||
#if ((CO_CONFIG_TRACE) & CO_CONFIG_TRACE_ENABLE) != 0
|
||||
co->trace = &COO_trace[0];
|
||||
co->traceTimeBuffers = &COO_traceTimeBuffers[0][0];
|
||||
co->traceValueBuffers = &COO_traceValueBuffers[0][0];
|
||||
|
|
@ -894,7 +894,7 @@ void CO_delete(CO_t *co) {
|
|||
bool_t CO_isLSSslaveEnabled(CO_t *co) {
|
||||
(void) co; /* may be unused */
|
||||
bool_t en = false;
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) != 0
|
||||
if (CO_GET_CNT(LSS_SLV) == 1U) { en = true; }
|
||||
#endif
|
||||
return en;
|
||||
|
|
@ -923,7 +923,7 @@ CO_ReturnError_t CO_CANinit(CO_t *co, void *CANptr, uint16_t bitRate) {
|
|||
|
||||
|
||||
/******************************************************************************/
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) != 0
|
||||
CO_ReturnError_t CO_LSSinit(CO_t *co,
|
||||
CO_LSS_address_t *lssAddress,
|
||||
uint8_t *pendingNodeID,
|
||||
|
|
@ -986,7 +986,7 @@ CO_ReturnError_t CO_CANopenInit(CO_t *co,
|
|||
|
||||
/* Verify CANopen Node-ID */
|
||||
co->nodeIdUnconfigured = false;
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) != 0
|
||||
if ((CO_GET_CNT(LSS_SLV) == 1U) && (nodeId == CO_LSS_NODE_ID_ASSIGNMENT)) {
|
||||
co->nodeIdUnconfigured = true;
|
||||
}
|
||||
|
|
@ -997,7 +997,7 @@ CO_ReturnError_t CO_CANopenInit(CO_t *co,
|
|||
}
|
||||
else { /* MISRA C 2004 14.10 */ }
|
||||
|
||||
#if (CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE
|
||||
#if ((CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE) != 0
|
||||
if (CO_GET_CNT(LEDS) == 1U) {
|
||||
err = CO_LEDs_init(co->LEDs);
|
||||
if (err) { return err; }
|
||||
|
|
@ -1014,24 +1014,24 @@ CO_ReturnError_t CO_CANopenInit(CO_t *co,
|
|||
err = CO_EM_init(co->em,
|
||||
co->CANmodule,
|
||||
OD_GET(H1001, OD_H1001_ERR_REG),
|
||||
#if (CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)
|
||||
#if ((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) != 0
|
||||
co->em_fifo,
|
||||
(CO_GET_CNT(ARR_1003) + 1U),
|
||||
#endif
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) != 0
|
||||
OD_GET(H1014, OD_H1014_COBID_EMERGENCY),
|
||||
CO_GET_CO(TX_IDX_EM_PROD),
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT) != 0
|
||||
OD_GET(H1015, OD_H1015_INHIBIT_TIME_EMCY),
|
||||
#endif
|
||||
#endif
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_HISTORY
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_HISTORY) != 0
|
||||
OD_GET(H1003, OD_H1003_PREDEF_ERR_FIELD),
|
||||
#endif
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_STATUS_BITS
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_STATUS_BITS) != 0
|
||||
OD_statusBits,
|
||||
#endif
|
||||
#if (CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER
|
||||
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) != 0
|
||||
co->CANmodule,
|
||||
CO_GET_CO(RX_IDX_EM_CONS),
|
||||
#endif
|
||||
|
|
@ -1051,7 +1051,7 @@ CO_ReturnError_t CO_CANopenInit(CO_t *co,
|
|||
co->CANmodule,
|
||||
CO_GET_CO(RX_IDX_NMT_SLV),
|
||||
CO_CAN_ID_NMT_SERVICE,
|
||||
#if (CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER
|
||||
#if ((CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER) != 0
|
||||
co->CANmodule,
|
||||
CO_GET_CO(TX_IDX_NMT_MST),
|
||||
CO_CAN_ID_NMT_SERVICE,
|
||||
|
|
@ -1063,7 +1063,7 @@ CO_ReturnError_t CO_CANopenInit(CO_t *co,
|
|||
if (err) { return err; }
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE) != 0
|
||||
if (CO_GET_CNT(HB_CONS) == 1U) {
|
||||
err = CO_HBconsumer_init(co->HBcons,
|
||||
em,
|
||||
|
|
@ -1077,7 +1077,7 @@ CO_ReturnError_t CO_CANopenInit(CO_t *co,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE) != 0
|
||||
err = CO_nodeGuardingSlave_init(co->NGslave,
|
||||
OD_GET(H100C, OD_H100C_GUARD_TIME),
|
||||
OD_GET(H100D, OD_H100D_LIFETIME_FACTOR),
|
||||
|
|
@ -1090,7 +1090,7 @@ CO_ReturnError_t CO_CANopenInit(CO_t *co,
|
|||
errInfo);
|
||||
if (err) { return err; }
|
||||
#endif
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE) != 0
|
||||
err = CO_nodeGuardingMaster_init(co->NGmaster,
|
||||
em,
|
||||
co->CANmodule,
|
||||
|
|
@ -1118,7 +1118,7 @@ CO_ReturnError_t CO_CANopenInit(CO_t *co,
|
|||
}
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE) != 0
|
||||
if (CO_GET_CNT(SDO_CLI) > 0) {
|
||||
OD_entry_t *SDOcliPar = OD_GET(H1280, OD_H1280_SDO_CLIENT_1_PARAM);
|
||||
for (uint16_t i = 0; i < CO_GET_CNT(SDO_CLI); i++) {
|
||||
|
|
@ -1136,13 +1136,13 @@ CO_ReturnError_t CO_CANopenInit(CO_t *co,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE) != 0
|
||||
if (CO_GET_CNT(TIME) == 1U) {
|
||||
err = CO_TIME_init(co->TIME,
|
||||
OD_GET(H1012, OD_H1012_COBID_TIME),
|
||||
co->CANmodule,
|
||||
CO_GET_CO(RX_IDX_TIME),
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_PRODUCER) != 0
|
||||
co->CANmodule,
|
||||
CO_GET_CO(TX_IDX_TIME),
|
||||
#endif
|
||||
|
|
@ -1151,7 +1151,7 @@ CO_ReturnError_t CO_CANopenInit(CO_t *co,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE) != 0
|
||||
if (CO_GET_CNT(SYNC) == 1U) {
|
||||
err = CO_SYNC_init(co->SYNC,
|
||||
em,
|
||||
|
|
@ -1161,7 +1161,7 @@ CO_ReturnError_t CO_CANopenInit(CO_t *co,
|
|||
OD_GET(H1019, OD_H1019_SYNC_CNT_OVERFLOW),
|
||||
co->CANmodule,
|
||||
CO_GET_CO(RX_IDX_SYNC),
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0
|
||||
co->CANmodule,
|
||||
CO_GET_CO(TX_IDX_SYNC),
|
||||
#endif
|
||||
|
|
@ -1170,7 +1170,7 @@ CO_ReturnError_t CO_CANopenInit(CO_t *co,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER) != 0
|
||||
if (CO_GET_CNT(LSS_MST) == 1) {
|
||||
err = CO_LSSmaster_init(co->LSSmaster,
|
||||
CO_LSSmaster_DEFAULT_TIMEOUT,
|
||||
|
|
@ -1184,21 +1184,21 @@ CO_ReturnError_t CO_CANopenInit(CO_t *co,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII) != 0
|
||||
if (CO_GET_CNT(GTWA) == 1) {
|
||||
err = CO_GTWA_init(co->gtwa,
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) != 0
|
||||
&co->SDOclient[0],
|
||||
SDOclientTimeoutTime_ms,
|
||||
SDOclientBlockTransfer,
|
||||
#endif
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT) != 0
|
||||
co->NMT,
|
||||
#endif
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS) != 0
|
||||
co->LSSmaster,
|
||||
#endif
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS) != 0
|
||||
co->LEDs,
|
||||
#endif
|
||||
0);
|
||||
|
|
@ -1249,7 +1249,7 @@ CO_ReturnError_t CO_CANopenInitPDO(CO_t *co,
|
|||
? CO_ERROR_NODE_ID_UNCONFIGURED_LSS : CO_ERROR_ILLEGAL_ARGUMENT;
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE) != 0
|
||||
if (CO_GET_CNT(RPDO) > 0U) {
|
||||
OD_entry_t *RPDOcomm = OD_GET(H1400, OD_H1400_RXPDO_1_PARAM);
|
||||
OD_entry_t *RPDOmap = OD_GET(H1600, OD_H1600_RXPDO_1_MAPPING);
|
||||
|
|
@ -1269,7 +1269,7 @@ CO_ReturnError_t CO_CANopenInitPDO(CO_t *co,
|
|||
err = CO_RPDO_init(&co->RPDO[i],
|
||||
od,
|
||||
em,
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0
|
||||
co->SYNC,
|
||||
#endif
|
||||
preDefinedCanId,
|
||||
|
|
@ -1283,7 +1283,7 @@ CO_ReturnError_t CO_CANopenInitPDO(CO_t *co,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE) != 0
|
||||
if (CO_GET_CNT(TPDO) > 0U) {
|
||||
OD_entry_t *TPDOcomm = OD_GET(H1800, OD_H1800_TXPDO_1_PARAM);
|
||||
OD_entry_t *TPDOmap = OD_GET(H1A00, OD_H1A00_TXPDO_1_MAPPING);
|
||||
|
|
@ -1303,7 +1303,7 @@ CO_ReturnError_t CO_CANopenInitPDO(CO_t *co,
|
|||
err = CO_TPDO_init(&co->TPDO[i],
|
||||
od,
|
||||
em,
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) != 0
|
||||
co->SYNC,
|
||||
#endif
|
||||
preDefinedCanId,
|
||||
|
|
@ -1322,7 +1322,7 @@ CO_ReturnError_t CO_CANopenInitPDO(CO_t *co,
|
|||
|
||||
|
||||
/******************************************************************************/
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE) || ((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE)
|
||||
#if (((CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE) != 0) || (((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) != 0)
|
||||
CO_ReturnError_t CO_CANopenInitSRDO(CO_t *co,
|
||||
CO_EM_t *em,
|
||||
OD_t *od,
|
||||
|
|
@ -1338,7 +1338,7 @@ CO_ReturnError_t CO_CANopenInitSRDO(CO_t *co,
|
|||
}
|
||||
|
||||
|
||||
#if (CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE) != 0
|
||||
if (CO_GET_CNT(GFC) == 1) {
|
||||
CO_ReturnError_t err;
|
||||
err = CO_GFC_init(co->GFC,
|
||||
|
|
@ -1353,7 +1353,7 @@ CO_ReturnError_t CO_CANopenInitSRDO(CO_t *co,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) != 0
|
||||
if (CO_GET_CNT(SRDO) > 0U) {
|
||||
CO_ReturnError_t err;
|
||||
err = CO_SRDO_init_start(co->SRDOGuard,
|
||||
|
|
@ -1414,7 +1414,7 @@ CO_NMT_reset_cmd_t CO_process(CO_t *co,
|
|||
/* CAN module */
|
||||
CO_CANmodule_process(co->CANmodule);
|
||||
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE)
|
||||
if (CO_GET_CNT(LSS_SLV) == 1U) {
|
||||
if (CO_LSSslave_process(co->LSSslave)) {
|
||||
reset = CO_RESET_COMM;
|
||||
|
|
@ -1422,11 +1422,11 @@ CO_NMT_reset_cmd_t CO_process(CO_t *co,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE
|
||||
#if ((CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE) != 0
|
||||
bool_t unc = co->nodeIdUnconfigured;
|
||||
uint16_t CANerrorStatus = co->CANmodule->CANerrorStatus;
|
||||
bool_t LSSslave_configuration = false;
|
||||
#if (CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) != 0
|
||||
if ((CO_GET_CNT(LSS_SLV) == 1U)
|
||||
&& (CO_LSSslave_getState(co->LSSslave) == CO_LSS_STATE_CONFIGURATION)
|
||||
) {
|
||||
|
|
@ -1486,7 +1486,7 @@ CO_NMT_reset_cmd_t CO_process(CO_t *co,
|
|||
timerNext_us);
|
||||
}
|
||||
|
||||
#if (CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE) != 0
|
||||
if (CO_GET_CNT(HB_CONS) == 1U) {
|
||||
CO_HBconsumer_process(co->HBcons,
|
||||
NMTisPreOrOperational,
|
||||
|
|
@ -1495,26 +1495,26 @@ CO_NMT_reset_cmd_t CO_process(CO_t *co,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE) != 0
|
||||
CO_nodeGuardingSlave_process(co->NGslave,
|
||||
NMTstate,
|
||||
(co->NMT->HBproducerTime_us > 0U),
|
||||
timeDifference_us,
|
||||
timerNext_us);
|
||||
#endif
|
||||
#if (CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE) != 0
|
||||
CO_nodeGuardingMaster_process(co->NGmaster,
|
||||
timeDifference_us,
|
||||
timerNext_us);
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE) != 0
|
||||
if (CO_GET_CNT(TIME) == 1U) {
|
||||
CO_TIME_process(co->TIME, NMTisPreOrOperational, timeDifference_us);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII) != 0
|
||||
if (CO_GET_CNT(GTWA) == 1) {
|
||||
CO_GTWA_process(co->gtwa,
|
||||
enableGateway,
|
||||
|
|
@ -1528,7 +1528,7 @@ CO_NMT_reset_cmd_t CO_process(CO_t *co,
|
|||
|
||||
|
||||
/******************************************************************************/
|
||||
#if (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE) != 0
|
||||
bool_t CO_process_SYNC(CO_t *co,
|
||||
uint32_t timeDifference_us,
|
||||
uint32_t *timerNext_us)
|
||||
|
|
@ -1566,7 +1566,7 @@ bool_t CO_process_SYNC(CO_t *co,
|
|||
|
||||
|
||||
/******************************************************************************/
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE) != 0
|
||||
void CO_process_RPDO(CO_t *co,
|
||||
bool_t syncWas,
|
||||
uint32_t timeDifference_us,
|
||||
|
|
@ -1582,7 +1582,7 @@ void CO_process_RPDO(CO_t *co,
|
|||
|
||||
for (uint16_t i = 0; i < CO_GET_CNT(RPDO); i++) {
|
||||
CO_RPDO_process(&co->RPDO[i],
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_TIMERS_ENABLE) != 0
|
||||
timeDifference_us,
|
||||
timerNext_us,
|
||||
#endif
|
||||
|
|
@ -1594,7 +1594,7 @@ void CO_process_RPDO(CO_t *co,
|
|||
|
||||
|
||||
/******************************************************************************/
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE) != 0
|
||||
void CO_process_TPDO(CO_t *co,
|
||||
bool_t syncWas,
|
||||
uint32_t timeDifference_us,
|
||||
|
|
@ -1610,7 +1610,7 @@ void CO_process_TPDO(CO_t *co,
|
|||
|
||||
for (uint16_t i = 0; i < CO_GET_CNT(TPDO); i++) {
|
||||
CO_TPDO_process(&co->TPDO[i],
|
||||
#if (CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_TIMERS_ENABLE) != 0
|
||||
timeDifference_us,
|
||||
timerNext_us,
|
||||
#endif
|
||||
|
|
@ -1622,7 +1622,7 @@ void CO_process_TPDO(CO_t *co,
|
|||
|
||||
|
||||
/******************************************************************************/
|
||||
#if (CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) != 0
|
||||
CO_SRDO_state_t CO_process_SRDO(CO_t *co,
|
||||
uint32_t timeDifference_us,
|
||||
uint32_t *timerNext_us)
|
||||
|
|
|
|||
42
CANopen.h
42
CANopen.h
|
|
@ -300,7 +300,7 @@ typedef struct {
|
|||
uint16_t TX_IDX_NMT_MST; /**< Start index in CANtx. */
|
||||
uint16_t TX_IDX_HB_PROD; /**< Start index in CANtx. */
|
||||
#endif
|
||||
#if ((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_HB_CONS) & CO_CONFIG_HB_CONS_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/** Heartbeat consumer object, initialised by @ref CO_HBconsumer_init() */
|
||||
CO_HBconsumer_t *HBcons;
|
||||
/** Object for monitored nodes, initialised by @ref CO_HBconsumer_init() */
|
||||
|
|
@ -309,7 +309,7 @@ typedef struct {
|
|||
uint16_t RX_IDX_HB_CONS; /**< Start index in CANrx. */
|
||||
#endif
|
||||
#endif
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_SLAVE_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/** Node guarding slave object, initialised by @ref CO_nodeGuardingSlave_init() */
|
||||
CO_nodeGuardingSlave_t *NGslave;
|
||||
#if defined CO_MULTIPLE_OD || defined CO_DOXYGEN
|
||||
|
|
@ -317,7 +317,7 @@ typedef struct {
|
|||
uint16_t TX_IDX_NG_SLV; /**< Start index in CANtx. */
|
||||
#endif
|
||||
#endif
|
||||
#if ((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_NODE_GUARDING) & CO_CONFIG_NODE_GUARDING_MASTER_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/** Node guarding master object, initialised by @ref CO_nodeGuardingMaster_init() */
|
||||
CO_nodeGuardingMaster_t *NGmaster;
|
||||
#if defined CO_MULTIPLE_OD || defined CO_DOXYGEN
|
||||
|
|
@ -331,7 +331,7 @@ typedef struct {
|
|||
uint16_t RX_IDX_EM_CONS; /**< Start index in CANrx. */
|
||||
uint16_t TX_IDX_EM_PROD; /**< Start index in CANtx. */
|
||||
#endif
|
||||
#if ((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) \
|
||||
#if (((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) != 0) \
|
||||
|| defined CO_DOXYGEN
|
||||
/** FIFO for emergency object, initialised by @ref CO_EM_init() */
|
||||
CO_EM_fifo_t *em_fifo;
|
||||
|
|
@ -342,7 +342,7 @@ typedef struct {
|
|||
uint16_t RX_IDX_SDO_SRV; /**< Start index in CANrx. */
|
||||
uint16_t TX_IDX_SDO_SRV; /**< Start index in CANtx. */
|
||||
#endif
|
||||
#if ((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/** SDO client objects, initialised by @ref CO_SDOclient_init() */
|
||||
CO_SDOclient_t *SDOclient;
|
||||
#if defined CO_MULTIPLE_OD || defined CO_DOXYGEN
|
||||
|
|
@ -350,7 +350,7 @@ typedef struct {
|
|||
uint16_t TX_IDX_SDO_CLI; /**< Start index in CANtx. */
|
||||
#endif
|
||||
#endif
|
||||
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/** TIME object, initialised by @ref CO_TIME_init() */
|
||||
CO_TIME_t *TIME;
|
||||
#if defined CO_MULTIPLE_OD || defined CO_DOXYGEN
|
||||
|
|
@ -358,7 +358,7 @@ typedef struct {
|
|||
uint16_t TX_IDX_TIME; /**< Start index in CANtx. */
|
||||
#endif
|
||||
#endif
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/** SYNC object, initialised by @ref CO_SYNC_init() */
|
||||
CO_SYNC_t *SYNC;
|
||||
#if defined CO_MULTIPLE_OD || defined CO_DOXYGEN
|
||||
|
|
@ -366,25 +366,25 @@ typedef struct {
|
|||
uint16_t TX_IDX_SYNC; /**< Start index in CANtx. */
|
||||
#endif
|
||||
#endif
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/** RPDO objects, initialised by @ref CO_RPDO_init() */
|
||||
CO_RPDO_t *RPDO;
|
||||
#if defined CO_MULTIPLE_OD || defined CO_DOXYGEN
|
||||
uint16_t RX_IDX_RPDO; /**< Start index in CANrx. */
|
||||
#endif
|
||||
#endif
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/** TPDO objects, initialised by @ref CO_TPDO_init() */
|
||||
CO_TPDO_t *TPDO;
|
||||
#if defined CO_MULTIPLE_OD || defined CO_DOXYGEN
|
||||
uint16_t TX_IDX_TPDO; /**< Start index in CANtx. */
|
||||
#endif
|
||||
#endif
|
||||
#if ((CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_LEDS) & CO_CONFIG_LEDS_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/** LEDs object, initialised by @ref CO_LEDs_init() */
|
||||
CO_LEDs_t *LEDs;
|
||||
#endif
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/** GFC object, initialised by @ref CO_GFC_init() */
|
||||
CO_GFC_t *GFC;
|
||||
#if defined CO_MULTIPLE_OD || defined CO_DOXYGEN
|
||||
|
|
@ -392,7 +392,7 @@ typedef struct {
|
|||
uint16_t TX_IDX_GFC; /**< Start index in CANtx. */
|
||||
#endif
|
||||
#endif
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/** SRDO guard object, initialised by @ref CO_SRDO_init_start(), single
|
||||
* SRDOGuard object is included inside all SRDO objects */
|
||||
CO_SRDOGuard_t *SRDOGuard;
|
||||
|
|
@ -403,7 +403,7 @@ typedef struct {
|
|||
uint16_t TX_IDX_SRDO; /**< Start index in CANtx. */
|
||||
#endif
|
||||
#endif
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) != 0) || defined CO_DOXYGEN
|
||||
/** LSS slave object, initialised by @ref CO_LSSslave_init(). */
|
||||
CO_LSSslave_t *LSSslave;
|
||||
#if defined CO_MULTIPLE_OD || defined CO_DOXYGEN
|
||||
|
|
@ -411,7 +411,7 @@ typedef struct {
|
|||
uint16_t TX_IDX_LSS_SLV; /**< Start index in CANtx. */
|
||||
#endif
|
||||
#endif
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_LSS) & CO_CONFIG_LSS_MASTER) != 0) || defined CO_DOXYGEN
|
||||
/** LSS master object, initialised by @ref CO_LSSmaster_init(). */
|
||||
CO_LSSmaster_t *LSSmaster;
|
||||
#if defined CO_MULTIPLE_OD || defined CO_DOXYGEN
|
||||
|
|
@ -419,7 +419,7 @@ typedef struct {
|
|||
uint16_t TX_IDX_LSS_MST; /**< Start index in CANtx. */
|
||||
#endif
|
||||
#endif
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII) != 0) || defined CO_DOXYGEN
|
||||
/** Gateway-ascii object, initialised by @ref CO_GTWA_init(). */
|
||||
CO_GTWA_t *gtwa;
|
||||
#if defined CO_MULTIPLE_OD || defined CO_DOXYGEN
|
||||
|
|
@ -486,7 +486,7 @@ bool_t CO_isLSSslaveEnabled(CO_t *co);
|
|||
CO_ReturnError_t CO_CANinit(CO_t *co, void *CANptr, uint16_t bitRate);
|
||||
|
||||
|
||||
#if ((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_LSS) & CO_CONFIG_LSS_SLAVE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Initialize CANopen LSS slave
|
||||
*
|
||||
|
|
@ -596,7 +596,7 @@ CO_ReturnError_t CO_CANopenInitPDO(CO_t *co,
|
|||
*
|
||||
* @return CO_ERROR_NO in case of success.
|
||||
*/
|
||||
#if ((CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE) || ((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE)
|
||||
#if (((CO_CONFIG_GFC) & CO_CONFIG_GFC_ENABLE) != 0) || (((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) != 0)
|
||||
CO_ReturnError_t CO_CANopenInitSRDO(CO_t *co,
|
||||
CO_EM_t *em,
|
||||
OD_t *od,
|
||||
|
|
@ -633,7 +633,7 @@ CO_NMT_reset_cmd_t CO_process(CO_t *co,
|
|||
uint32_t *timerNext_us);
|
||||
|
||||
|
||||
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Process CANopen SYNC objects.
|
||||
*
|
||||
|
|
@ -654,7 +654,7 @@ bool_t CO_process_SYNC(CO_t *co,
|
|||
#endif
|
||||
|
||||
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_RPDO_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Process CANopen RPDO objects.
|
||||
*
|
||||
|
|
@ -676,7 +676,7 @@ void CO_process_RPDO(CO_t *co,
|
|||
#endif
|
||||
|
||||
|
||||
#if ((CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_PDO) & CO_CONFIG_TPDO_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Process CANopen TPDO objects.
|
||||
*
|
||||
|
|
@ -698,7 +698,7 @@ void CO_process_TPDO(CO_t *co,
|
|||
#endif
|
||||
|
||||
|
||||
#if ((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_SRDO) & CO_CONFIG_SRDO_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
/**
|
||||
* Process CANopen SRDO objects.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "storage/CO_storage.h"
|
||||
|
||||
#if (CO_CONFIG_STORAGE) & CO_CONFIG_STORAGE_ENABLE
|
||||
#if ((CO_CONFIG_STORAGE) & CO_CONFIG_STORAGE_ENABLE) != 0
|
||||
|
||||
/*
|
||||
* Custom function for writing OD object "Store parameters"
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#define CO_CONFIG_STORAGE (CO_CONFIG_STORAGE_ENABLE)
|
||||
#endif
|
||||
|
||||
#if ((CO_CONFIG_STORAGE) & CO_CONFIG_STORAGE_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_STORAGE) & CO_CONFIG_STORAGE_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#include "storage/CO_eeprom.h"
|
||||
#include "301/crc16-ccitt.h"
|
||||
|
||||
#if (CO_CONFIG_STORAGE) & CO_CONFIG_STORAGE_ENABLE
|
||||
#if ((CO_CONFIG_STORAGE) & CO_CONFIG_STORAGE_ENABLE) != 0
|
||||
|
||||
/*
|
||||
* Function for writing data on "Store parameters" command - OD object 1010
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "storage/CO_storage.h"
|
||||
|
||||
#if ((CO_CONFIG_STORAGE) & CO_CONFIG_STORAGE_ENABLE) || defined CO_DOXYGEN
|
||||
#if (((CO_CONFIG_STORAGE) & CO_CONFIG_STORAGE_ENABLE) != 0) || defined CO_DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
Loading…
Reference in a new issue