Manual merge #202:
- fix conflicts in CO_SRDO.h and CO_SRDO.c - Add configs for GFC & SRDO for CO_driver.h and not for socketCAN - Fix doxygen for CO_gateway_ascii
This commit is contained in:
commit
9dd36aa649
14 changed files with 71 additions and 31 deletions
|
|
@ -265,6 +265,7 @@ void CO_EM_process(
|
|||
uint16_t emInhTime_100us,
|
||||
uint32_t *timerNext_us)
|
||||
{
|
||||
(void)timerNext_us; /* may be unused */
|
||||
|
||||
CO_EM_t *em = emPr->em;
|
||||
uint8_t errorRegister;
|
||||
|
|
|
|||
|
|
@ -317,6 +317,8 @@ void CO_HBconsumer_process(
|
|||
uint32_t timeDifference_us,
|
||||
uint32_t *timerNext_us)
|
||||
{
|
||||
(void)timerNext_us; /* may be unused */
|
||||
|
||||
uint8_t i;
|
||||
bool_t allMonitoredActiveCurrent = true;
|
||||
uint8_t allMonitoredOperationalCurrent = CO_NMT_OPERATIONAL;
|
||||
|
|
|
|||
|
|
@ -206,6 +206,8 @@ CO_NMT_reset_cmd_t CO_NMT_process(
|
|||
const uint8_t errorBehavior[],
|
||||
uint32_t *timerNext_us)
|
||||
{
|
||||
(void)timerNext_us; /* may be unused */
|
||||
|
||||
uint8_t CANpassive;
|
||||
CO_NMT_internalState_t currentOperatingState = NMT->operatingState;
|
||||
uint32_t HBtime = (uint32_t)HBtime_ms * 1000;
|
||||
|
|
|
|||
|
|
@ -1026,6 +1026,8 @@ void CO_TPDO_process(
|
|||
uint32_t timeDifference_us,
|
||||
uint32_t *timerNext_us)
|
||||
{
|
||||
(void)timerNext_us; /* may be unused */
|
||||
|
||||
/* update timers */
|
||||
TPDO->inhibitTimer = (TPDO->inhibitTimer > timeDifference_us) ? (TPDO->inhibitTimer - timeDifference_us) : 0;
|
||||
TPDO->eventTimer = (TPDO->eventTimer > timeDifference_us) ? (TPDO->eventTimer - timeDifference_us) : 0;
|
||||
|
|
|
|||
|
|
@ -382,6 +382,8 @@ CO_SDOclient_return_t CO_SDOclientDownload(CO_SDOclient_t *SDO_C,
|
|||
size_t *sizeTransferred,
|
||||
uint32_t *timerNext_us)
|
||||
{
|
||||
(void)timerNext_us; /* may be unused */
|
||||
|
||||
CO_SDOclient_return_t ret = CO_SDOcli_waitingServerResponse;
|
||||
CO_SDO_abortCode_t abortCode = CO_SDO_AB_NONE;
|
||||
|
||||
|
|
@ -904,6 +906,8 @@ CO_SDOclient_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C,
|
|||
size_t *sizeTransferred,
|
||||
uint32_t *timerNext_us)
|
||||
{
|
||||
(void)timerNext_us; /* may be unused */
|
||||
|
||||
CO_SDOclient_return_t ret = CO_SDOcli_waitingServerResponse;
|
||||
CO_SDO_abortCode_t abortCode = CO_SDO_AB_NONE;
|
||||
|
||||
|
|
|
|||
|
|
@ -669,6 +669,8 @@ uint32_t CO_SDO_writeOD(CO_SDO_t *SDO, uint16_t length){
|
|||
|
||||
/******************************************************************************/
|
||||
static void CO_SDO_process_done(CO_SDO_t *SDO, uint32_t *timerNext_us) {
|
||||
(void)timerNext_us; /* may be unused */
|
||||
|
||||
#if CO_SDO_RX_DATA_SIZE > 1
|
||||
uint8_t proc = SDO->CANrxProc;
|
||||
uint8_t newProc = proc;
|
||||
|
|
@ -684,7 +686,6 @@ static void CO_SDO_process_done(CO_SDO_t *SDO, uint32_t *timerNext_us) {
|
|||
timerNext_us = 0; /* Set timerNext_us to 0 to inform OS to call CO_SDO_process function again without delay. */
|
||||
#endif
|
||||
#else
|
||||
(void)(timerNext_us);
|
||||
CO_FLAG_CLEAR(SDO->CANrxNew[0]);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -353,6 +353,8 @@ CO_SYNC_status_t CO_SYNC_process(
|
|||
uint32_t ObjDict_synchronousWindowLength,
|
||||
uint32_t *timerNext_us)
|
||||
{
|
||||
(void)timerNext_us; /* may be unused */
|
||||
|
||||
CO_SYNC_status_t ret = CO_SYNC_NONE;
|
||||
uint32_t timerNew;
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,15 @@ extern "C" {
|
|||
#define CO_CONFIG_HB_CONS (0)
|
||||
#endif
|
||||
|
||||
#ifndef CO_CONFIG_GFC
|
||||
#define CO_CONFIG_GFC (0)
|
||||
#endif
|
||||
|
||||
#ifndef CO_CONFIG_SRDO
|
||||
#define CO_CONFIG_SRDO (0)
|
||||
#define CO_CONFIG_SRDO_MINIMUM_DELAY 0
|
||||
#endif
|
||||
|
||||
#ifndef CO_CONFIG_PDO
|
||||
#define CO_CONFIG_PDO (CO_CONFIG_PDO_SYNC_ENABLE)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ void CO_LEDs_process(CO_LEDs_t *LEDs,
|
|||
bool_t firmwareDownload,
|
||||
uint32_t *timerNext_us)
|
||||
{
|
||||
(void)timerNext_us; /* may be unused */
|
||||
|
||||
uint8_t rd = 0;
|
||||
uint8_t gr = 0;
|
||||
bool_t tick = false;
|
||||
|
|
|
|||
11
304/CO_GFC.c
11
304/CO_GFC.c
|
|
@ -67,7 +67,6 @@ CO_ReturnError_t CO_GFC_init(CO_GFC_t *GFC,
|
|||
uint16_t GFC_txIdx,
|
||||
uint16_t CANidTxGFC)
|
||||
{
|
||||
CO_ReturnError_t r;
|
||||
if (GFC == NULL || valid == NULL || GFC_CANdevRx == NULL ||
|
||||
GFC_CANdevTx == NULL) {
|
||||
return CO_ERROR_ILLEGAL_ARGUMENT;
|
||||
|
|
@ -90,12 +89,15 @@ CO_ReturnError_t CO_GFC_init(CO_GFC_t *GFC,
|
|||
0, /* number of data bytes */
|
||||
0); /* synchronous message flag bit */
|
||||
|
||||
if (GFC->CANtxBuff == 0) {
|
||||
if (GFC->CANtxBuff == NULL) {
|
||||
return CO_ERROR_TX_UNCONFIGURED;
|
||||
}
|
||||
#else
|
||||
(void)GFC_txIdx; /* unused */
|
||||
(void)CANidTxGFC; /* unused */
|
||||
#endif
|
||||
#if (CO_CONFIG_GFC) & CO_CONFIG_GFC_CONSUMER
|
||||
r = CO_CANrxBufferInit(
|
||||
const CO_ReturnError_t r = CO_CANrxBufferInit(
|
||||
GFC_CANdevRx, /* CAN device */
|
||||
GFC_rxIdx, /* rx buffer index */
|
||||
CANidRxGFC, /* CAN identifier */
|
||||
|
|
@ -106,6 +108,9 @@ CO_ReturnError_t CO_GFC_init(CO_GFC_t *GFC,
|
|||
if (r != CO_ERROR_NO) {
|
||||
return r;
|
||||
}
|
||||
#else
|
||||
(void)GFC_rxIdx; /* unused */
|
||||
(void)CANidRxGFC; /* unused */
|
||||
#endif
|
||||
|
||||
return CO_ERROR_NO;
|
||||
|
|
|
|||
|
|
@ -494,7 +494,7 @@ CO_ReturnError_t CO_SRDOGuard_init(
|
|||
CO_OD_configure(SDO, idx_SRDOvalid, CO_ODF_SRDOvalid, (void*)SRDOGuard, 0, 0);
|
||||
CO_OD_configure(SDO, idx_SRDOcrc, CO_ODF_SRDOcrc, (void*)SRDOGuard, 0, 0);
|
||||
|
||||
return CO_ERROR_NO;
|
||||
return CO_ERROR_NO;
|
||||
}
|
||||
|
||||
uint8_t CO_SRDOGuard_process(
|
||||
|
|
@ -613,13 +613,15 @@ CO_ReturnError_t CO_SRDO_requestSend(
|
|||
SRDO->timer = 0;
|
||||
return CO_ERROR_NO;
|
||||
}
|
||||
|
||||
|
||||
void CO_SRDO_process(
|
||||
CO_SRDO_t *SRDO,
|
||||
uint8_t commands,
|
||||
uint8_t commands,
|
||||
uint32_t timeDifference_us,
|
||||
uint32_t *timerNext_us)
|
||||
{
|
||||
(void)timerNext_us; /* may be unused */
|
||||
|
||||
if(commands & (1<<1)){
|
||||
uint16_t crcValue = CO_SRDOcalcCrc(SRDO);
|
||||
if (*SRDO->checksum != crcValue)
|
||||
|
|
@ -701,14 +703,12 @@ void CO_SRDO_process(
|
|||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
(void)timerNext_us;
|
||||
#endif
|
||||
if(data_ok){
|
||||
/* Copy data from Object dictionary. */
|
||||
for(i = 0; i<SRDO->dataLength; i++){
|
||||
pSRDOdataByte_normal[i] = *(ppODdataByte_normal[i]);
|
||||
pSRDOdataByte_inverted[i] = *(ppODdataByte_inverted[i]);
|
||||
pSRDOdataByte_inverted[i] = *(ppODdataByte_inverted[i]);
|
||||
}
|
||||
|
||||
CO_CANsend(SRDO->CANdevTx, SRDO->CANtxBuff[0]);
|
||||
|
|
@ -744,7 +744,7 @@ void CO_SRDO_process(
|
|||
uint8_t** ppODdataByte_normal;
|
||||
uint8_t** ppODdataByte_inverted;
|
||||
bool_t data_ok = true;
|
||||
|
||||
|
||||
pSRDOdataByte_normal = &SRDO->CANrxData[0][0];
|
||||
pSRDOdataByte_inverted = &SRDO->CANrxData[1][0];
|
||||
for(i = 0; i<SRDO->dataLength; i++){
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ extern "C" {
|
|||
* @{
|
||||
*
|
||||
* CANopen Safety Related Data Object protocol.
|
||||
*
|
||||
*
|
||||
* The functionality is very similar to that of the PDOs.
|
||||
* The main differences is every message is send and received twice.
|
||||
* The second message must be bitwise inverted. The delay between the two messages and between each message pair is monitored.
|
||||
|
|
@ -151,16 +151,16 @@ typedef struct{
|
|||
|
||||
/**
|
||||
* Initialize SRDOGuard object.
|
||||
*
|
||||
*
|
||||
* Function must be called in the communication reset section.
|
||||
*
|
||||
*
|
||||
* @param SRDOGuard This object will be initialized.
|
||||
* @param SDO SDO object.
|
||||
* @param operatingState Pointer to variable indicating CANopen device NMT internal state.
|
||||
* @param configurationValid Pointer to variable with the SR valid flag
|
||||
* @param idx_SRDOvalid Index in Object Dictionary
|
||||
* @param idx_SRDOcrc Index in Object Dictionary
|
||||
*
|
||||
*
|
||||
* @return #CO_ReturnError_t: CO_ERROR_NO or CO_ERROR_ILLEGAL_ARGUMENT.
|
||||
*/
|
||||
CO_ReturnError_t CO_SRDOGuard_init(
|
||||
|
|
@ -173,7 +173,7 @@ CO_ReturnError_t CO_SRDOGuard_init(
|
|||
|
||||
/**
|
||||
* Process operation and valid state changes.
|
||||
*
|
||||
*
|
||||
* @param SRDOGuard This object.
|
||||
* @return uint8_t command for CO_SRDO_process().
|
||||
* - bit 0 entered operational
|
||||
|
|
@ -184,9 +184,9 @@ uint8_t CO_SRDOGuard_process(
|
|||
|
||||
/**
|
||||
* Initialize SRDO object.
|
||||
*
|
||||
*
|
||||
* Function must be called in the communication reset section.
|
||||
*
|
||||
*
|
||||
* @param SRDO This object will be initialized.
|
||||
* @param SRDOGuard SRDOGuard object.
|
||||
* @param em Emergency object.
|
||||
|
|
@ -197,7 +197,7 @@ uint8_t CO_SRDOGuard_process(
|
|||
* dictionary (index 0x1301+).
|
||||
* @param SRDOMapPar Pointer to _SRDO mapping parameter_ record from Object
|
||||
* dictionary (index 0x1381+).
|
||||
* @param checksum
|
||||
* @param checksum
|
||||
* @param idx_SRDOCommPar Index in Object Dictionary
|
||||
* @param idx_SRDOMapPar Index in Object Dictionary
|
||||
* @param CANdevRx CAN device used for SRDO reception.
|
||||
|
|
@ -206,7 +206,7 @@ uint8_t CO_SRDOGuard_process(
|
|||
* @param CANdevTx CAN device used for SRDO transmission.
|
||||
* @param CANdevTxIdxNormal Index of transmit buffer in the above CAN device.
|
||||
* @param CANdevTxIdxInverted Index of transmit buffer in the above CAN device.
|
||||
*
|
||||
*
|
||||
* @return #CO_ReturnError_t: CO_ERROR_NO or CO_ERROR_ILLEGAL_ARGUMENT.
|
||||
*/
|
||||
CO_ReturnError_t CO_SRDO_init(
|
||||
|
|
@ -247,13 +247,13 @@ void CO_SRDO_initCallbackPre(
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Initialize SRDO callback function.
|
||||
*
|
||||
* Initialize SRDO callback function.
|
||||
*
|
||||
* Function initializes optional callback function, that is called when SRDO enters a safe state.
|
||||
* This happens when a timeout is reached or the data is inconsistent. The safe state itself is not further defined.
|
||||
* One measure, for example, would be to go back to the pre-operational state
|
||||
* Callback is called from CO_SRDO_process().
|
||||
*
|
||||
*
|
||||
* @param SRDO This object.
|
||||
* @param object Pointer to object, which will be passed to pFunctSignalSafe(). Can be NULL
|
||||
* @param pFunctSignalSafe Pointer to the callback function. Not called if NULL.
|
||||
|
|
@ -266,10 +266,10 @@ void CO_SRDO_initCallbackEnterSafeState(
|
|||
|
||||
/**
|
||||
* Send SRDO on event
|
||||
*
|
||||
*
|
||||
* Sends SRDO before the next refresh timer tiggers. The message itself is send in CO_SRDO_process().
|
||||
* After the transmission the timer is reset to the full refresh time.
|
||||
*
|
||||
*
|
||||
* @param SRDO This object.
|
||||
* @return CO_ReturnError_t CO_ERROR_NO if request is granted
|
||||
*/
|
||||
|
|
@ -278,10 +278,10 @@ CO_ReturnError_t CO_SRDO_requestSend(
|
|||
|
||||
/**
|
||||
* Process transmitting/receiving SRDO messages.
|
||||
*
|
||||
*
|
||||
* This function verifies the checksum on demand.
|
||||
* This function also configures the SRDO on operation state change to operational
|
||||
*
|
||||
*
|
||||
* @param SRDO This object.
|
||||
* @param commands result from CO_SRDOGuard_process().
|
||||
* @param timeDifference_us Time difference from previous function call in [microseconds].
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "309/CO_gateway_ascii.h"
|
||||
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII
|
||||
|
||||
/******************************************************************************/
|
||||
CO_ReturnError_t CO_GTWA_init(CO_GTWA_t* gtwa,
|
||||
|
|
@ -578,6 +579,8 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
|
|||
uint32_t timeDifference_us,
|
||||
uint32_t *timerNext_us)
|
||||
{
|
||||
(void)timerNext_us; /* may be unused */
|
||||
|
||||
bool_t err = false; /* syntax or other error, true or false, I/O variable */
|
||||
char closed; /* indication of command delimiter, I/O variable */
|
||||
CO_GTWA_respErrorCode_t respErrorCode = CO_GTWA_respErrorNone;
|
||||
|
|
@ -1959,3 +1962,5 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
#endif /* (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII */
|
||||
|
|
|
|||
|
|
@ -29,18 +29,21 @@
|
|||
#define CO_GATEWAY_ASCII_H
|
||||
|
||||
#include "301/CO_driver.h"
|
||||
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII) || defined CO_DOXYGEN
|
||||
|
||||
#include "301/CO_fifo.h"
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) || defined CO_DOXYGEN
|
||||
#include "301/CO_SDOserver.h"
|
||||
#include "301/CO_SDOclient.h"
|
||||
#endif
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT) || defined CO_DOXYGEN
|
||||
#include "301/CO_NMT_Heartbeat.h"
|
||||
#endif
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS) || defined CO_DOXYGEN
|
||||
#include "305/CO_LSSmaster.h"
|
||||
#endif
|
||||
#if (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS
|
||||
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS) || defined CO_DOXYGEN
|
||||
#include "303/CO_LEDs.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -526,5 +529,7 @@ void CO_GTWA_process(CO_GTWA_t *gtwa,
|
|||
}
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
#endif /* (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII */
|
||||
|
||||
/** @} */
|
||||
#endif /* CO_GATEWAY_ASCII_H */
|
||||
|
|
|
|||
Loading…
Reference in a new issue