EtherCAT Slave
 
Loading...
Searching...
No Matches
ecSlvCiA402.c

CiA402 Application implementation.

CiA402 Application implementation.

Author
KUNBUS GmbH

Copyright (c) 2023 KUNBUS GmbH.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer./
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

/*-----------------------------------------------------------------------------------------
------
------ Includes
------
-----------------------------------------------------------------------------------------*/
#include <ecSlvApi.h>
#include <ecSlvApiDef.h>
#include "ecSlvCiA402.h"
#include "ESL_cia402Obd.h"
#include "ESL_cia402Demo.h"
#include "project.h"
#include <ESL_os.h>
#include <ESL_BOARD_config.h>
#include <ESL_vendor.h>
#include <ESL_gpioHelper.h>
#include <ESL_foeDemo.h>
#include <ESL_soeDemo.h>
#include <ESL_eeprom.h>
#include <ESL_version.h>
#include <ecSlvApi.h>
#if !(defined MBXMEM)
#define MBXMEM
#endif
/*-----------------------------------------------------------------------------------------
------
------ local variables and constants
------
-----------------------------------------------------------------------------------------*/
#define I2C_IOEXP_ADDR 0x60 // The I2C address for GPIO expander
#define RXPDOMAP_INDEX (0x1600u)
#define TXPDOMAP_INDEX (0x1A00u)
#define COE_SM_ERROR_MAX_COUNT (0xFFFFu)
#define AXIS_ONE 0
#define AXIS_TWO 1
#define AXIS_THREE 2
#if !(defined BIT2BYTE)
#define BIT2BYTE(x) (((x)+7) >> 3)
#endif
static void EC_SLV_APP_CIA_applicationRun(void* appCtxt);
static EC_API_EError_t EC_SLV_APP_populateCiA402Functions(EC_SLV_APP_CIA_Application_t* pApplicationInstance_p);
static EC_API_EError_t EC_SLV_APP_populateTxPDO(EC_SLV_APP_CIA_Application_t* pApplicationInstance_p, EC_API_SLV_Pdo_t* pPdo_p, uint8_t axis_p);
#if (defined GPIO_TEST_PINS) && (1==GPIO_TEST_PINS)
#if (defined GPIO_TEST_PROFILE_SEL) && (defined GPIO_TEST_PROFILE_2) && (GPIO_TEST_PROFILE_2 == GPIO_TEST_PROFILE_SEL)
static void EC_SLV_APP_measurement(void* pMsrmtCtxt_p, uint32_t measureChannel_p, bool channelOn_p);
#endif
#endif
/*-----------------------------------------------------------------------------------------
------
------ application specific functions
------
-----------------------------------------------------------------------------------------*/
static EC_API_EError_t EC_SLV_APP_CIA_populateSlaveInfo(EC_SLV_APP_CIA_Application_t* pApplicationInstance_p)
{
if (!pApplicationInstance_p)
{
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
ptSlave = pApplicationInstance_p->ptEcSlvApi;
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = (EC_API_EError_t)EC_API_SLV_setVendorId (ptSlave, ECAT_VENDORID);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = (EC_API_EError_t)EC_API_SLV_setRevisionNumber(ptSlave, EC_REVISION);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = (EC_API_EError_t)EC_API_SLV_setSerialNumber (ptSlave, 0x00000000);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = (EC_API_EError_t)EC_API_SLV_setProductCode (ptSlave, ECAT_PRODUCTCODE_CIA402);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = (EC_API_EError_t)EC_API_SLV_setProductName (ptSlave, ECAT_PRODUCTNAME_CIA402);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = (EC_API_EError_t)EC_API_SLV_setGroupType (ptSlave, "EtherCAT Toolkit");
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = (EC_API_EError_t)EC_API_SLV_setHwVersion (ptSlave, "R01");
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = ESL_setSWVersion(ptSlave);
if (error != EC_API_eERR_NONE)
{
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
/* Former Project.h */
error = (EC_API_EError_t)EC_API_SLV_setPDOSize(ptSlave, EC_MAX_PD_LEN, EC_MAX_PD_LEN);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = (EC_API_EError_t)EC_API_SLV_setPDICfg(ptSlave, ESC_EE_PDI_CONTROL, ESC_EE_PDI_CONFIG);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
EC_BOOTSTRAP_MBXOUT_START, EC_BOOTSTRAP_MBXOUT_DEF_LENGTH,
EC_BOOTSTRAP_MBXIN_START, EC_BOOTSTRAP_MBXIN_DEF_LENGTH);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
EC_MBXOUT_START, EC_MBXOUT_DEF_LENGTH,
EC_MBXIN_START, EC_MBXIN_DEF_LENGTH);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
0, EC_MBXOUT_START, EC_MBXOUT_DEF_LENGTH,
EC_MBXOUT_CONTROLREG, EC_MBXOUT_ENABLE);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
1, EC_MBXIN_START, EC_MBXIN_DEF_LENGTH,
EC_MBXIN_CONTROLREG, EC_MBXIN_ENABLE);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
2, EC_OUTPUT_START, EC_OUTPUT_DEF_LENGTH,
EC_OUTPUT_CONTROLREG, EC_OUTPUT_ENABLE);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
3, EC_INPUT_START, EC_INPUT_DEF_LENGTH,
EC_INPUT_CONTROLREG, EC_INPUT_ENABLE);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = (EC_API_EError_t)EC_API_SLV_setSyncManErrLimit(ptSlave, COE_SM_ERROR_MAX_COUNT);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
Exit:
return error;
}
static EC_API_EError_t EC_SLV_APP_populateCiA402Functions(EC_SLV_APP_CIA_Application_t* pApplicationInstance_p)
{
if (!pApplicationInstance_p)
{
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
ptSlave = pApplicationInstance_p->ptEcSlvApi;
EC_API_SLV_CiA402_setAxisNumber (ptSlave, AXES_NUMBER);
error = (EC_API_EError_t)EC_SLV_APP_cia402ObjectDictionary(pApplicationInstance_p);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d CiA402 Object Dictionary error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
Exit:
return error;
}
static EC_API_EError_t EC_SLV_APP_populateRxPDO(EC_SLV_APP_CIA_Application_t* pApplicationInstance_p, EC_API_SLV_Pdo_t* pPdo_p, uint8_t axis_p)
{
EC_API_SLV_SHandle_t* ptSlave = NULL;
uint16_t rxIndex = RXPDOMAP_INDEX + axis_p;
EC_API_SLV_SCoE_ObjEntry_t* pObjEntry = NULL;
uint16_t curOffset = 0;
uint8_t subIndex = 0;
if (!pApplicationInstance_p)
{
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
ptSlave = pApplicationInstance_p->ptEcSlvApi;
error = (EC_API_EError_t)EC_API_SLV_PDO_create(ptSlave, "RxPDO", rxIndex, &pPdo_p);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Create PDO 0x%04x error code: 0x%08x\r\n", __func__, __LINE__, rxIndex, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = (EC_API_EError_t)EC_API_SLV_CoE_getObjectEntry(ptSlave, pApplicationInstance_p->CiA402_axisData[axis_p].controlWordIndex.objectIndex, 0, &pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
pApplicationInstance_p->CiA402_axisData[axis_p].controlWordIndex.pdoObject = pPdo_p;
pApplicationInstance_p->CiA402_axisData[axis_p].controlWordIndex.pdoObjectOffset = curOffset;
error = (EC_API_EError_t)EC_API_SLV_PDO_createEntry(ptSlave, pPdo_p, "SubIndex 001", pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
curOffset += BIT2BYTE(EC_API_SLV_PDO_getEntryDataLength(pPdo_p, subIndex));
subIndex++;
error = (EC_API_EError_t)EC_API_SLV_CoE_getObjectEntry(ptSlave, pApplicationInstance_p->CiA402_axisData[axis_p].modesOfOperationIndex.objectIndex, 0, &pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
pApplicationInstance_p->CiA402_axisData[axis_p].modesOfOperationIndex.pdoObject = pPdo_p;
pApplicationInstance_p->CiA402_axisData[axis_p].modesOfOperationIndex.pdoObjectOffset = curOffset;
error = (EC_API_EError_t)EC_API_SLV_PDO_createEntry(ptSlave, pPdo_p, "SubIndex 002", pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
curOffset += BIT2BYTE(EC_API_SLV_PDO_getEntryDataLength(pPdo_p, subIndex));
subIndex++;
error = (EC_API_EError_t)EC_API_SLV_CoE_getObjectEntry(ptSlave, pApplicationInstance_p->CiA402_axisData[axis_p].targetPositionIndex.objectIndex, 0, &pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
pApplicationInstance_p->CiA402_axisData[axis_p].targetPositionIndex.pdoObject = pPdo_p;
pApplicationInstance_p->CiA402_axisData[axis_p].targetPositionIndex.pdoObjectOffset = curOffset;
error = (EC_API_EError_t)EC_API_SLV_PDO_createEntry(ptSlave, pPdo_p, "SubIndex 003", pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
curOffset += BIT2BYTE(EC_API_SLV_PDO_getEntryDataLength(pPdo_p, subIndex));
subIndex++;
error = (EC_API_EError_t)EC_API_SLV_CoE_getObjectEntry(ptSlave, pApplicationInstance_p->CiA402_axisData[axis_p].targetVelocityIndex.objectIndex, 0, &pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
pApplicationInstance_p->CiA402_axisData[axis_p].targetVelocityIndex.pdoObject = pPdo_p;
pApplicationInstance_p->CiA402_axisData[axis_p].targetVelocityIndex.pdoObjectOffset = curOffset;
error = (EC_API_EError_t)EC_API_SLV_PDO_createEntry(ptSlave, pPdo_p, "SubIndex 004", pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
curOffset += BIT2BYTE(EC_API_SLV_PDO_getEntryDataLength(pPdo_p, subIndex));
subIndex++;
error = (EC_API_EError_t)EC_API_SLV_CoE_getObjectEntry(ptSlave, pApplicationInstance_p->CiA402_axisData[axis_p].targetTorqueIndex.objectIndex, 0, &pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
pApplicationInstance_p->CiA402_axisData[axis_p].targetTorqueIndex.pdoObject = pPdo_p;
pApplicationInstance_p->CiA402_axisData[axis_p].targetTorqueIndex.pdoObjectOffset = curOffset;
error = (EC_API_EError_t)EC_API_SLV_PDO_createEntry(ptSlave, pPdo_p, "SubIndex 005", pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
curOffset += BIT2BYTE(EC_API_SLV_PDO_getEntryDataLength(pPdo_p, subIndex));
subIndex++;
pApplicationInstance_p->realPdoInLen = curOffset;
Exit:
return error;
}
static EC_API_EError_t EC_SLV_APP_populateTxPDO(EC_SLV_APP_CIA_Application_t* pApplicationInstance_p, EC_API_SLV_Pdo_t* pPdo_p, uint8_t axis_p)
{
EC_API_SLV_SHandle_t* ptSlave = NULL;
uint16_t txIndex = TXPDOMAP_INDEX + axis_p;
EC_API_SLV_SCoE_ObjEntry_t* pObjEntry = NULL;
uint16_t curOffset = 0;
uint8_t subIndex = 0;
if (!pApplicationInstance_p)
{
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
ptSlave = pApplicationInstance_p->ptEcSlvApi;
error = (EC_API_EError_t)EC_API_SLV_PDO_create(ptSlave, "TxPDO", txIndex, &pPdo_p);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("Create PDO for axis %d error code: 0x%08x\r\n", axis_p);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = (EC_API_EError_t)EC_API_SLV_CoE_getObjectEntry(ptSlave, pApplicationInstance_p->CiA402_axisData[axis_p].statusWordIndex.objectIndex, 0, &pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
pApplicationInstance_p->CiA402_axisData[axis_p].statusWordIndex.pdoObject = pPdo_p;
pApplicationInstance_p->CiA402_axisData[axis_p].statusWordIndex.pdoObjectOffset = curOffset;
error = (EC_API_EError_t)EC_API_SLV_PDO_createEntry(ptSlave, pPdo_p, "SubIndex 001", pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
curOffset += BIT2BYTE(EC_API_SLV_PDO_getEntryDataLength(pPdo_p, subIndex));
subIndex++;
error = (EC_API_EError_t)EC_API_SLV_CoE_getObjectEntry(ptSlave, pApplicationInstance_p->CiA402_axisData[axis_p].modesOfOperationDisplayIndex.objectIndex, 0, &pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
pApplicationInstance_p->CiA402_axisData[axis_p].modesOfOperationDisplayIndex.pdoObject = pPdo_p;
pApplicationInstance_p->CiA402_axisData[axis_p].modesOfOperationDisplayIndex.pdoObjectOffset = curOffset;
error = (EC_API_EError_t)EC_API_SLV_PDO_createEntry(ptSlave, pPdo_p, "SubIndex 002", pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("PDO 0x1A00 Entry 2 Error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
curOffset += BIT2BYTE(EC_API_SLV_PDO_getEntryDataLength(pPdo_p, subIndex));
subIndex++;
error = (EC_API_EError_t)EC_API_SLV_CoE_getObjectEntry(ptSlave, pApplicationInstance_p->CiA402_axisData[axis_p].positionActualValueIndex.objectIndex, 0, &pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
pApplicationInstance_p->CiA402_axisData[axis_p].positionActualValueIndex.pdoObject = pPdo_p;
pApplicationInstance_p->CiA402_axisData[axis_p].positionActualValueIndex.pdoObjectOffset = curOffset;
error = (EC_API_EError_t)EC_API_SLV_PDO_createEntry(ptSlave, pPdo_p, "SubIndex 003", pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("PDO 0x1A00 Entry 2 Error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
curOffset += BIT2BYTE(EC_API_SLV_PDO_getEntryDataLength(pPdo_p, subIndex));
subIndex++;
error = (EC_API_EError_t)EC_API_SLV_CoE_getObjectEntry(ptSlave, pApplicationInstance_p->CiA402_axisData[axis_p].velocityActualValueIndex.objectIndex, 0, &pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
pApplicationInstance_p->CiA402_axisData[axis_p].velocityActualValueIndex.pdoObject = pPdo_p;
pApplicationInstance_p->CiA402_axisData[axis_p].velocityActualValueIndex.pdoObjectOffset = curOffset;
error = (EC_API_EError_t)EC_API_SLV_PDO_createEntry(ptSlave, pPdo_p, "SubIndex 004", pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("PDO 0x1A00 Entry 2 Error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
curOffset += BIT2BYTE(EC_API_SLV_PDO_getEntryDataLength(pPdo_p, subIndex));
subIndex++;
error = (EC_API_EError_t)EC_API_SLV_CoE_getObjectEntry(ptSlave, pApplicationInstance_p->CiA402_axisData[axis_p].torqueActualValueIndex.objectIndex, 0, &pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
pApplicationInstance_p->CiA402_axisData[axis_p].torqueActualValueIndex.pdoObject = pPdo_p;
pApplicationInstance_p->CiA402_axisData[axis_p].torqueActualValueIndex.pdoObjectOffset = curOffset;
error = (EC_API_EError_t)EC_API_SLV_PDO_createEntry(ptSlave, pPdo_p, "SubIndex 005", pObjEntry);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("PDO 0x1A00 Entry 2 Error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
curOffset += BIT2BYTE(EC_API_SLV_PDO_getEntryDataLength(pPdo_p, subIndex));
subIndex++;
pApplicationInstance_p->realPdoOutLen = curOffset;
Exit:
return error;
}
#if (defined GPIO_TEST_PINS) && (1==GPIO_TEST_PINS)
#if (defined GPIO_TEST_PROFILE_SEL) && (defined GPIO_TEST_PROFILE_2) && (GPIO_TEST_PROFILE_2 == GPIO_TEST_PROFILE_SEL)
void EC_SLV_APP_measurement(void* pMsrmtCtxt_p, uint32_t measureChannel_p, bool channelOn_p)
{
EC_SLV_APP_Application_t* pApplicationInstance = (EC_SLV_APP_Application_t*)pMsrmtCtxt_p;
if(NULL != pApplicationInstance)
{
volatile CSL_GpioBank_registersRegs * pGpioRegBank = NULL;
uint32_t pinMask = 0;
switch (measureChannel_p)
{
case 0: pGpioRegBank = ESL_TESTPIN_STATE_REG_BANK; pinMask = ESL_TESTPIN_0_MASK; break;
case 1: pGpioRegBank = ESL_TESTPIN_STATE_REG_BANK; pinMask = ESL_TESTPIN_1_MASK; break;
case 2: pGpioRegBank = ESL_TESTPIN_STATE_REG_BANK; pinMask = ESL_TESTPIN_2_MASK; break;
default:
break;
}
if (channelOn_p)
{
ESL_GPIO_testPins_set(pGpioRegBank, pinMask);
}
else
{
ESL_GPIO_testPins_clear(pGpioRegBank, pinMask);
}
}
}
#endif
#endif
#if !(defined DPRAM_REMOTE) && !(defined FBTL_REMOTE)
static OSAL_FUNC_UNUSED void EC_SLV_APP_CIA_boardPhyReset(void* pCtxt_p, uint8_t phyIdx_p, bool reset_p)
{
/* @cppcheck_justify{misra-c2012-11.5} generic API requires cast */
/* cppcheck-suppress misra-c2012-11.5 */
ESL_BOARD_OS_phyReset(pApplicationInstance->gpioHandle, pApplicationInstance->selectedPruInstance, phyIdx_p, reset_p);
}
#endif
static void EC_SLV_APP_CIA_appBoardStatusLed(void* pCallContext_p, void* pLedContext_p, bool runLed_p, bool errLed_p)
{
/* @cppcheck_justify{misra-c2012-11.5} generic API requires cast */
/* cppcheck-suppress misra-c2012-11.5 */
EC_SLV_APP_CIA_Application_t* pApplicationInstance = (EC_SLV_APP_CIA_Application_t*)pCallContext_p;
OSALUNREF_PARM(pLedContext_p);
if (NULL == pApplicationInstance)
{
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
ESL_BOARD_OS_statusLED(pApplicationInstance->gpioHandle, pApplicationInstance->selectedPruInstance, runLed_p, errLed_p);
Exit:
return;
}
static EC_API_EError_t EC_SLV_APP_CIA_populateBoardFunctions(EC_SLV_APP_CIA_Application_t* pApplicationInstance)
{
if (!pApplicationInstance)
{
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
EC_API_SLV_cbRegisterBoardStatusLed(pApplicationInstance->ptEcSlvApi, pApplicationInstance
,EC_SLV_APP_CIA_appBoardStatusLed
,&pApplicationInstance->selectedPruInstance);
Exit:
return error;
}
void EC_SLV_APP_CIA_initBoardFunctions(EC_SLV_APP_CIA_Application_t *pAppInstance_p)
{
if (!pAppInstance_p)
{
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
/* open gpio instance */
pAppInstance_p->gpioHandle = ESL_GPIO_init();
#if !(defined DPRAM_REMOTE) && !(defined FBTL_REMOTE)
/* Configure manual MDIO mode workaround if configured in SysConfig or similar
* This is to enable the TI workaround for errata i2329. The activation is
* detected and provisioned in this call.
*/
ESL_OS_manualMdioConfig(pAppInstance_p->ptEcSlvApi);
/* configure Phy Reset Pin */
ESL_BOARD_OS_configureResets(pAppInstance_p->gpioHandle, pAppInstance_p->selectedPruInstance);
#else
OSALUNREF_PARM(pAppInstance_p);
#endif
/* configure LED Pin */
ESL_BOARD_OS_initStatusLED(pAppInstance_p->gpioHandle, pAppInstance_p->selectedPruInstance);
ESL_GPIO_apply(pAppInstance_p->gpioHandle);
#if !(defined DPRAM_REMOTE) && !(defined FBTL_REMOTE)
/* set Phy Reset Pin */
EC_SLV_APP_CIA_boardPhyReset(pAppInstance_p, EC_API_SLV_ePHY_IN, true);
EC_SLV_APP_CIA_boardPhyReset(pAppInstance_p, EC_API_SLV_ePHY_OUT, true);
#endif
Exit:
return;
}
void EC_SLV_APP_CIA_registerStacklessBoardFunctions(EC_SLV_APP_CIA_Application_t *pAppInstance_p)
{
if (!pAppInstance_p)
{
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
#if !(defined DPRAM_REMOTE) && !(defined FBTL_REMOTE)
ESL_BOARD_OS_registerPhys(pAppInstance_p->selectedPruInstance);
EC_API_SLV_cbRegisterPhyReset(EC_SLV_APP_CIA_boardPhyReset, pAppInstance_p);
#endif
Exit:
return;
}
{
if (!pAppInstance_p)
{
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
// Initialize SDK
pAppInstance_p->ptEcSlvApi = EC_API_SLV_new();
if (!pAppInstance_p->ptEcSlvApi)
{
OSAL_error(__func__, __LINE__, OSAL_CONTAINER_NOMEMORY, true, 0);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = EC_SLV_APP_CIA_populateBoardFunctions(pAppInstance_p);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("Populate board functions Error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = EC_SLV_APP_CIA_populateSlaveInfo(pAppInstance_p);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("Create Slave Info Error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = EC_SLV_APP_populateCiA402Functions(pAppInstance_p);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("Create slave information error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
//RxPDO: Master to Slave COM
error = EC_SLV_APP_populateRxPDO(pAppInstance_p, pAppInstance_p->ptRxPdo1600, AXIS_ONE);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("Create RxPDO error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = EC_SLV_APP_populateRxPDO(pAppInstance_p, pAppInstance_p->ptRxPdo1601, AXIS_TWO);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("Create RxPDO error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = EC_SLV_APP_populateRxPDO(pAppInstance_p, pAppInstance_p->ptRxPdo1602, AXIS_THREE);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("Create RxPDO error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
//TxPDO: Slave to Master COM
error = EC_SLV_APP_populateTxPDO(pAppInstance_p, pAppInstance_p->ptTxPdo1A00, AXIS_ONE);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("Create TxPDO error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = EC_SLV_APP_populateTxPDO(pAppInstance_p, pAppInstance_p->ptTxPdo1A01, AXIS_TWO);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("Create TxPDO error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
error = EC_SLV_APP_populateTxPDO(pAppInstance_p, pAppInstance_p->ptTxPdo1A02, AXIS_THREE);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("Create TxPDO error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
#if !(defined DPRAM_REMOTE) && !(defined FBTL_REMOTE)
EC_API_SLV_cbRegisterFlashInit (pAppInstance_p->ptEcSlvApi, pAppInstance_p->ptEcSlvApi, EC_SLV_APP_EEP_initFlash);
/* @cppcheck_justify{misra-c2012-11.6} generic API requires cast */
/* cppcheck-suppress misra-c2012-11.6 */
EC_API_SLV_EEPROM_cbRegisterWrite (pAppInstance_p->ptEcSlvApi, OSPIFLASH_APP_STARTMAGIC, EC_SLV_APP_EEP_writeEeprom);
/* @cppcheck_justify{misra-c2012-11.6} generic API requires cast */
/* cppcheck-suppress misra-c2012-11.6 */
EC_API_SLV_EEPROM_cbRegisterLoad (pAppInstance_p->ptEcSlvApi, OSPIFLASH_APP_STARTMAGIC, EC_SLV_APP_EEP_loadEeprom);
EC_API_SLV_cbRegisterUserApplicationRun (pAppInstance_p->ptEcSlvApi, pAppInstance_p->ptEcSlvApi, EC_SLV_APP_CIA_applicationRun, pAppInstance_p);
#endif
#if (defined GPIO_TEST_PINS) && (1==GPIO_TEST_PINS)
#if (defined GPIO_TEST_PROFILE_SEL) && (defined GPIO_TEST_PROFILE_2) && (GPIO_TEST_PROFILE_2 == GPIO_TEST_PROFILE_SEL)
EC_API_SLV_cbRegisterMeasurement(pAppInstance_p->ptEcSlvApi, pAppInstance_p, EC_SLV_APP_measurement);
#endif
#endif
error = (EC_API_EError_t)EC_API_SLV_init(pAppInstance_p->ptEcSlvApi);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("Slave Init Error Code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
EC_API_SLV_run(pAppInstance_p->ptEcSlvApi);
Exit:
return;
}
void EC_SLV_APP_CIA_applicationRun(void* appCtxt)
{
OSALUNREF_PARM(appCtxt);
#if (defined GPIO_TEST_PINS) && (1==GPIO_TEST_PINS)
#if (defined GPIO_TEST_PROFILE_SEL) && (defined GPIO_TEST_PROFILE_1) && (defined GPIO_TEST_PROFILE_2) && ((GPIO_TEST_PROFILE_1 == GPIO_TEST_PROFILE_SEL) || (GPIO_TEST_PROFILE_2 == GPIO_TEST_PROFILE_SEL))
/* @cppcheck_justify{threadsafety-threadsafety} not reentrant called */
/* cppcheck-suppress threadsafety-threadsafety */
static bool bToggle = false;
if (bToggle)
{
ESL_GPIO_testPins_set(ESL_TESTPIN_STATE_REG_BANK, ESL_TESTPIN_3_MASK);
}
else
{
ESL_GPIO_testPins_clear(ESL_TESTPIN_STATE_REG_BANK, ESL_TESTPIN_3_MASK);
}
bToggle = !bToggle;
#endif
#endif
}
uint16_t EC_SLV_APP_CIA_startInputHandler(void *ctxt, uint16_t *intMask)
Get cycle time information.
Definition ESL_cia402Demo.c:520
void EC_SLV_APP_cia402Application(void *ctxt)
CiA402 Application function.
Definition ESL_cia402Demo.c:964
void EC_SLV_APP_cia402LocalError(void *ctxt, uint16_t errorCode)
Local Error function handler.
Definition ESL_cia402Demo.c:1243
void EC_SLV_APP_CIA_applicationInit(EC_SLV_APP_CIA_Application_t *pAppInstance_p)
Initialize slave application example.
Definition ecSlvCiA402.c:952
void EC_SLV_APP_setObdValues(void *ctxt)
Set default values for CiA 402 object dictionary.
Definition ESL_cia402Demo.c:463
uint32_t EC_SLV_APP_cia402ObjectDictionary(void *pContext_p)
Generate CiA402 Objects.
Definition ESL_cia402Obd.c:84
uint32_t EC_API_SLV_init(EC_API_SLV_SHandle_t *pEcSlaveApi_p)
This is the function to initialize the EtherCAT Slave API.
Definition ecSlvApiStub.c:739
EC_API_SLV_SHandle_t * EC_API_SLV_new(void)
This is the function to create a new EtherCAT Slave device instance.
Definition ecSlvApiStub.c:584
uint32_t EC_API_SLV_run(EC_API_SLV_SHandle_t *pEcSlaveApi_p)
This is the function to run the EtherCAT Slave API.
Definition ecSlvApiStub.c:858
void EC_API_SLV_cbRegisterPhyReset(CUST_PHY_CBreset_t cbFunc_p, void *pContext_p)
This is the function to register Phy Reset Function.
Definition ecSlvApi_BoardStub.c:80
void EC_API_SLV_cbRegisterBoardStatusLed(EC_API_SLV_SHandle_t *pEcSlaveApi_p, void *pContext_p, EC_API_SLV_CBBoardStatusLed_t cbFunc_p, void *pLedContext_p)
Register Board Status LED callback.
Definition ecSlvApi_BoardStub.c:294
uint32_t EC_API_SLV_setProductCode(EC_API_SLV_SHandle_t *pEcSlaveApi_p, uint32_t productCode_p)
Set device product code. Used by the EEPROM and Object Dictionary.
Definition ecSlvApi_ParamStub.c:139
uint32_t EC_API_SLV_setVendorId(EC_API_SLV_SHandle_t *pEcSlaveApi_p, uint32_t vendorId_p)
Set device vendor ID. Used by the EEPROM and Object Dictionary.
Definition ecSlvApi_ParamStub.c:87
uint32_t EC_API_SLV_setSerialNumber(EC_API_SLV_SHandle_t *pEcSlaveApi_p, uint32_t serialNumber_p)
Set default serial number.
Definition ecSlvApi_ParamStub.c:242
uint32_t EC_API_SLV_setGroupType(EC_API_SLV_SHandle_t *pEcSlaveApi_p, char *pGroupType_p)
Set device group type.
Definition ecSlvApi_ParamStub.c:344
uint32_t EC_API_SLV_setStandardMailbox(EC_API_SLV_SHandle_t *pEcSlaveApi_p, uint16_t rxOffset_p, uint16_t rxSize_p, uint16_t txOffset_p, uint16_t txSize_p)
Set Standard Mailbox Configuration.
Definition ecSlvApi_ParamStub.c:651
uint32_t EC_API_SLV_setBootStrapMailbox(EC_API_SLV_SHandle_t *pEcSlaveApi_p, uint16_t rxOffset_p, uint16_t rxSize_p, uint16_t txOffset_p, uint16_t txSize_p)
Set Bootstrap Mailbox Configuration.
Definition ecSlvApi_ParamStub.c:598
uint32_t EC_API_SLV_setSyncManConfig(EC_API_SLV_SHandle_t *pEcSlaveApi_p, uint8_t syncManIdx_p, uint16_t offset_p, uint16_t size_p, uint8_t control_p, uint8_t enable_p)
Set SyncManager Configuration.
Definition ecSlvApi_ParamStub.c:699
uint32_t EC_API_SLV_setHwVersion(EC_API_SLV_SHandle_t *pEcSlaveApi_p, char *pHardwareVersion_p)
Set device hardware version.
Definition ecSlvApi_ParamStub.c:395
uint32_t EC_API_SLV_setSyncManErrLimit(EC_API_SLV_SHandle_t *pEcSlaveApi_p, uint16_t smErrorLimit_p)
Set SyncManager sequence error counter limit.
Definition ecSlvApi_ParamStub.c:743
uint32_t EC_API_SLV_setPDOSize(EC_API_SLV_SHandle_t *pEcSlaveApi_p, uint32_t maxPdOutSize_p, uint32_t maxPdInSize_p)
Set ProcessData Size Limits.
Definition ecSlvApi_ParamStub.c:496
uint32_t EC_API_SLV_setProductName(EC_API_SLV_SHandle_t *pEcSlaveApi_p, char *pProductName_p)
Set device product name.
Definition ecSlvApi_ParamStub.c:293
uint32_t EC_API_SLV_setPDICfg(EC_API_SLV_SHandle_t *pEcSlaveApi_p, uint16_t pdiControl_p, uint16_t pdiConfig_p)
Set PDI Configuration.
Definition ecSlvApi_ParamStub.c:545
uint32_t EC_API_SLV_setDeviceType(EC_API_SLV_SHandle_t *pEcSlaveApi_p, EC_API_SLV_EDevType_t devType_p)
Define EtherCAT Device Type. Identifies the slave as a standard slave, an EtherCAT servo drive suppor...
Definition ecSlvApiStub.c:1676
uint32_t EC_API_SLV_setRevisionNumber(EC_API_SLV_SHandle_t *pEcSlaveApi_p, uint32_t revisionNumber_p)
Set device revision number. Used by the EEPROM and Object Dictionary.
Definition ecSlvApi_ParamStub.c:191
void EC_API_SLV_CiA402_registerLocalError(EC_API_SLV_SHandle_t *pEcSlaveApi_p, void *pContext_p, EC_API_SLV_CiA402_CBUsrApplLocalError_t cbFunc_p)
Register a local error function, triggered if CiA402 state machine changes into an error state.
Definition ecSlvApi_CiA402Stub.c:284
void EC_API_SLV_CiA402_registerSetDictValues(EC_API_SLV_SHandle_t *pEcSlaveApi_p, void *pContext_p, EC_API_SLV_CiA402_CBUsrApplSetDictValues_t cbFunc_p)
Register a function which sets the default values of the CiA402 related objects.
Definition ecSlvApi_CiA402Stub.c:136
void EC_API_SLV_CiA402_registerApplication(EC_API_SLV_SHandle_t *pEcSlaveApi_p, void *pContext_p, EC_API_SLV_CiA402_CBUsrApplApplication_t cbFunc_p)
CiA402 Servo Drive application.
Definition ecSlvApi_CiA402Stub.c:236
void EC_API_SLV_CiA402_setAxisNumber(EC_API_SLV_SHandle_t *pEcSlaveApi_p, uint8_t axisNo_p)
Set number of servo axis. A Cia402 Device might support multiple axes.
Definition ecSlvApi_CiA402Stub.c:331
@ EC_API_eERR_INVALID
Definition ecSlvApi_Error.h:52
@ EC_API_eERR_NONE
Definition ecSlvApi_Error.h:45
enum EC_API_EError EC_API_EError_t
void EC_API_SLV_cbRegisterUserApplicationRun(EC_API_SLV_SHandle_t *pEcSlaveApi_p, void *pContext_p, EC_API_SLV_CBUsrApplicationRun_t cbFunc_p, void *pApplCtxt_p)
This is the function to register a function which runs application run handler.
Definition ecSlvApi_ESMStub.c:125
void EC_API_SLV_cbRegisterStartInputHandler(EC_API_SLV_SHandle_t *pEcSlaveApi_p, void *pContext_p, EC_API_SLV_CBStartInputHandler_t cbFunc_p)
This is the function to register a function which starts the input handler.
Definition ecSlvApi_ESMStub.c:273
uint32_t EC_API_SLV_CoE_getObjectEntry(EC_API_SLV_SHandle_t *pEcSlaveApi_p, uint16_t index_p, uint8_t subIndex_p, EC_API_SLV_SCoE_ObjEntry_t **ppObjectEntry_p)
This function returns object entries from the Object Dictionary.
Definition ecSlvApi_CoEStub.c:420
uint32_t EC_API_SLV_PDO_createEntry(EC_API_SLV_SHandle_t *pEcSlaveApi_p, EC_API_SLV_Pdo_t *pPdo_p, char *pName_p, EC_API_SLV_SCoE_ObjEntry_t *pObjectEntry_p)
This function maps an object entry from the Object Dictionary as a PDO.
Definition ecSlvApi_ProcDataStub.c:268
uint32_t EC_API_SLV_PDO_create(EC_API_SLV_SHandle_t *pEcSlaveApi_p, char *pName_p, uint16_t mapIndex_p, EC_API_SLV_Pdo_t **pOutPdo_p)
Creates an empty PDO.
Definition ecSlvApi_ProcDataStub.c:67
uint32_t EC_API_SLV_PDO_getEntryDataLength(EC_API_SLV_Pdo_t *pPdo_p, uint8_t subIndex_p)
Read PDO entry data length.
Definition ecSlvApi_ProcDataStub.c:1089
void EC_API_SLV_cbRegisterMeasurement(EC_API_SLV_SHandle_t *pEcSlaveApi_p, void *pContext_p, EC_API_SLV_CBMsrmt_t cbFunc_p)
Initialize flash memory block.
Definition ecSlvApiStub.c:1911
void EC_API_SLV_cbRegisterFlashInit(EC_API_SLV_SHandle_t *pEcSlaveApi_p, void *pContext_p, EC_API_SLV_CBInitFlash_t cbFunc_p)
Initialize flash memory block.
Definition ecSlvApiStub.c:1865
void EC_API_SLV_EEPROM_cbRegisterLoad(EC_API_SLV_SHandle_t *pEcSlaveApi_p, void *pContext_p, EC_API_SLV_CBEepromLoad_t cbFunc_p)
Register a function lo load the eeprom content.
Definition ecSlvApiStub.c:1770
void EC_API_SLV_EEPROM_cbRegisterWrite(EC_API_SLV_SHandle_t *pEcSlaveApi_p, void *pContext_p, EC_API_SLV_CBEepromWrite_t cbFunc_p)
Register a function lo store the eeprom content.
Definition ecSlvApiStub.c:1819
@ EC_API_SLV_eDT_SERVO_DRIVE
The device supports CiA402 for a servo drive.
Definition ecSlvApi.h:85
struct EC_API_SLV_CoE_ObjEntry EC_API_SLV_SCoE_ObjEntry_t
TSdoEntry describes an OBD Object Entry.
Definition ecSlvApi.h:130
@ EC_API_SLV_ePHY_IN
Phy index for IN Phy.
Definition ecSlvApi.h:111
@ EC_API_SLV_ePHY_OUT
Phy index for OUT Phy.
Definition ecSlvApi.h:112
struct EC_API_SLV_Pdo EC_API_SLV_Pdo_t
TPdo is used to describe the RxPDOs and TxPDOs.
Definition ecSlvApi.h:127
struct EC_API_SLV_Handle EC_API_SLV_SHandle_t
EC_API_SLV_SHandle_t describes the EtherCAT Slave API.
Definition ecSlvApi.h:136
uint16_t realPdoOutLen
Definition ecSlvCiA402.h:207
EC_API_SLV_Pdo_t * ptRxPdo1600
Definition ecSlvCiA402.h:195
EC_API_SLV_Pdo_t * ptRxPdo1601
Definition ecSlvCiA402.h:196
void * gpioHandle
Definition ecSlvCiA402.h:174
EC_API_SLV_Pdo_t * ptTxPdo1A01
Definition ecSlvCiA402.h:199
uint16_t realPdoInLen
Definition ecSlvCiA402.h:208
EC_API_SLV_Pdo_t * ptTxPdo1A02
Definition ecSlvCiA402.h:200
uint32_t selectedPruInstance
Definition ecSlvCiA402.h:159
EC_API_SLV_Pdo_t * ptTxPdo1A00
Definition ecSlvCiA402.h:198
EC_API_SLV_SHandle_t * ptEcSlvApi
Definition ecSlvCiA402.h:211
EC_API_SLV_Pdo_t * ptRxPdo1602
Definition ecSlvCiA402.h:197
EC_SLV_APP_sCIA_axisData_t CiA402_axisData[AXES_NUMBER]
Definition ecSlvCiA402.h:209
Definition ecSlvCiA402.h:158
Definition ecSlvESI.h:55
EC_SLV_APP_sCIA_object_t statusWordIndex
Definition ecSlvCiA402.h:82
EC_SLV_APP_sCIA_object_t targetTorqueIndex
Definition ecSlvCiA402.h:104
EC_SLV_APP_sCIA_object_t targetVelocityIndex
Definition ecSlvCiA402.h:114
EC_SLV_APP_sCIA_object_t modesOfOperationDisplayIndex
Definition ecSlvCiA402.h:89
EC_SLV_APP_sCIA_object_t targetPositionIndex
Definition ecSlvCiA402.h:109
EC_SLV_APP_sCIA_object_t modesOfOperationIndex
Definition ecSlvCiA402.h:88
EC_SLV_APP_sCIA_object_t velocityActualValueIndex
Definition ecSlvCiA402.h:99
EC_SLV_APP_sCIA_object_t controlWordIndex
Definition ecSlvCiA402.h:81
EC_SLV_APP_sCIA_object_t torqueActualValueIndex
Definition ecSlvCiA402.h:107
EC_SLV_APP_sCIA_object_t positionActualValueIndex
Definition ecSlvCiA402.h:92
EC_API_SLV_Pdo_t * pdoObject
Definition ecSlvCiA402.h:64
uint16_t pdoObjectOffset
Definition ecSlvCiA402.h:65
uint16_t objectIndex
Definition ecSlvCiA402.h:61