EtherCAT SubDevice2.03.00
 
Loading...
Searching...
No Matches
ecSubDeviceSimple.c

EtherCAT® SubDevice Example Application.

EtherCAT® SubDevice Example Application

Author
Texas Instruments Incorporated

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

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

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.

Neither the name of Texas Instruments Incorporated 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 OWNER 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.

#define SHOW_LOOPCOUNT 0
#define SHOW_ESCSTATUS 0
#define ENABLE_I2CLEDS 1
#define BIT2BYTE(x) (((x) + 7) >> 3)
/*-----------------------------------------------------------------------------------------
------
------ Includes
------
-----------------------------------------------------------------------------------------*/
#include "ecSubDeviceSimple.h"
#include <defines/ecSlvApiDef.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_coeBackupDemo.h>
#include <ESL_eoeDemo.h>
#include <ESL_soeDemo.h>
#include <ESL_eeprom.h>
#include <ESL_version.h>
#include <ESL_esiDemoData.h>
#if !(defined FBTL_REMOTE) && !(defined DPRAM_REMOTE)
#include <CUST_PHY_base.h>
#endif
#include <ecSlvApi.h>
#if !(defined MBXMEM)
#define MBXMEM
#endif
/*-----------------------------------------------------------------------------------------
------
------ local variables and constants
------
-----------------------------------------------------------------------------------------*/
#define I2C_IOEXP_ADDR 0x60 // The I2C address for GPIO expander
// object indices
#define SLS_OBJIDX_DIAGNOSIS 0x2018
#define SLS_OBJIDX_FSOE_DIG_IO_MODULE 0xA000
#define SLS_OBJIDX_FSOE_CONN_STATE 0x0800
#define FSOE_CONN_ST_RESET 100
#define FSOE_CONN_ST_SESSION 101
#define FSOE_CONN_ST_CONNECTION 102
#define FSOE_CONN_ST_PARAMETER 103
#define FSOE_CONN_ST_DATA 104
#define FSOE_CONN_ST_FAILSAFE 105
static void EC_SLV_APP_SS_applicationRun(void *pAppCtxt_p);
/*-----------------------------------------------------------------------------------------
------
------ application specific functions
------
-----------------------------------------------------------------------------------------*/
static uint8_t EC_SLV_APP_writeDiagnosis(
void *pApplicationCtxt_p,
uint16_t index_p,
uint8_t subindex_p,
uint32_t size_p,
uint16_t MBXMEM *pData_p,
uint8_t completeAccess_p)
{
EC_SLV_APP_SS_Application_t *pAppInstance = NULL;
= { DEFTYPE_UNSIGNED8, EC_API_SLV_DIAG_MSG_PARAM_TYPE_DATA, sizeof(uint8_t), (uint8_t *)pData_p };
OSALUNREF_PARM(completeAccess_p);
if ((pApplicationCtxt_p != NULL) && (pData_p != NULL))
{
OSAL_printf(
"%s ==> Idx: 0x%04x:%d | Size: %d | Value: %d\r\n",
__func__,
index_p,
subindex_p,
size_p,
pData_p[0]);
/* @cppcheck_justify{misra-c2012-11.5} generic API requires cast */
/* cppcheck-suppress misra-c2012-11.5 */
pAppInstance = (EC_SLV_APP_SS_Application_t *)pApplicationCtxt_p;
pAppInstance->ptEcSlvApi,
pData_p[0],
1,
&param);
}
return (uint8_t)error;
}
#if !(defined DPRAM_REMOTE) && !(defined FBTL_REMOTE)
static OSAL_FUNC_UNUSED void EC_SLV_APP_SS_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 */
EC_SLV_APP_SS_Application_t *pApplicationInstance = (EC_SLV_APP_SS_Application_t *)pCtxt_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_phyReset(
pApplicationInstance->gpioHandle,
pApplicationInstance->selectedPruInstance,
phyIdx_p,
reset_p);
Exit:
return;
}
#endif
static void EC_SLV_APP_SS_appBoardStatusLed(void *pCallContext_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_SS_Application_t *pApplicationInstance = (EC_SLV_APP_SS_Application_t *)pCallContext_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_SS_populateBoardFunctions(
EC_SLV_APP_SS_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;
}
pApplicationInstance->ptEcSlvApi,
EC_SLV_APP_SS_appBoardStatusLed,
pApplicationInstance);
Exit:
return error;
}
{
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);
#if (!(defined SOC_AM263PX) && !(defined SOC_AM261X))
/* configure Phy Reset Pin */
ESL_BOARD_OS_configureResets(pAppInstance_p->gpioHandle, pAppInstance_p->selectedPruInstance);
#endif
#else
OSALUNREF_PARM(pAppInstance_p);
#endif
#if !(defined SOC_AM263PX)
/* configure LED Pin */
ESL_BOARD_OS_initStatusLED(pAppInstance_p->gpioHandle, pAppInstance_p->selectedPruInstance);
#endif //SOC_AM263PX
ESL_GPIO_apply(pAppInstance_p->gpioHandle);
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;
}
#if !(defined DPRAM_REMOTE) && !(defined FBTL_REMOTE)
ESL_BOARD_OS_registerPhys(pAppInstance_p->ptEcSlvApi, pAppInstance_p->selectedPruInstance);
CUST_PHY_CBregisterLibDetect(CUST_PHY_detect, pAppInstance_p);
#if (!(defined SOC_AM263PX) && !(defined SOC_AM261X))
CUST_PHY_CBregisterReset(EC_SLV_APP_SS_boardPhyReset, pAppInstance_p);
#endif // !SOC_AM263PX && !SOC_AM261X
#endif
Exit:
return;
}
static uint32_t EC_SLAVE_APP_assignmentChangedHandler(
void *pContext_p,
{
uint32_t error = EC_API_eERR_NONE;
OSALUNREF_PARM(pContext_p);
OSAL_printf("**************************************\r\n");
if (pRxPdoAssignMap_p->pdoAssignmentChanged)
{
if (pRxPdoAssignMap_p->pPdoIndexArray != NULL)
{
uint8_t idx;
OSAL_printf("New assignments for SyncManager 2:\r\n");
for (idx = 0; idx <pRxPdoAssignMap_p->pdoCount; idx++)
{
OSAL_printf("PDO: 0x%04x\r\n", pRxPdoAssignMap_p->pPdoIndexArray[idx]);
}
}
}
if (pTxPdoAssignMap_p->pdoAssignmentChanged)
{
if (pTxPdoAssignMap_p->pPdoIndexArray != NULL)
{
uint8_t idx;
OSAL_printf("New assignments for SyncManager 3:\r\n");
for (idx = 0; idx <pTxPdoAssignMap_p->pdoCount; idx++)
{
OSAL_printf("PDO: 0x%04x\r\n", pTxPdoAssignMap_p->pPdoIndexArray[idx]);
}
}
}
OSAL_printf("**************************************\r\n");
if (pRxPdoAssignMap_p->pdoCount == 0u && pTxPdoAssignMap_p->pdoCount == 0u)
{
}
return error;
}
static uint32_t EC_SLAVE_APP_mappingChangedHandler(
void *pContext_p,
uint16_t pdoIndex_p,
uint8_t count_p,
{
uint32_t error = EC_API_eERR_NONE;
OSALUNREF_PARM(pContext_p);
if (pPdoMap_p != NULL)
{
uint8_t idx;
OSAL_printf("**************************************\r\n");
OSAL_printf("New mapping for PDO 0x%04x: \r\n", pdoIndex_p);
for (idx = 0; idx < count_p; idx++)
{
OSAL_printf("0x%04x:%d:0x%02x\r\n", pPdoMap_p[idx].index, pPdoMap_p[idx].subIndex,pPdoMap_p[idx].size );
}
OSAL_printf("**************************************\r\n");
}
if (count_p == 0u)
{
}
return error;
}
static uint32_t EC_SLV_APP_AoE_readRequest(
void *pContext_p,
uint16_t port_p,
uint16_t index_p,
uint8_t subIndex_p,
bool completeAccess_p,
uint32_t *pLength_p,
uint16_t *pData_p)
{
uint32_t adsError = ERR_NOERROR;
EC_API_SLV_SHandle_t *pEcSlvApi = (EC_API_SLV_SHandle_t *)pContext_p;
EC_API_SLV_SCoE_ObjEntry_t *pObjectEntry = NULL;
EC_API_SLV_SCoE_Object_t *pObject = NULL;
uint32_t length = 0;
OSALUNREF_PARM(port_p);
if ((NULL != pLength_p) && (NULL != pData_p))
{
uint32_t dtkError;
if (completeAccess_p == false)
{
dtkError = EC_API_SLV_CoE_getObjectEntry(pEcSlvApi, index_p, subIndex_p, &pObjectEntry);
if (dtkError == EC_API_eERR_NONE)
{
EC_API_SLV_CoE_getObjectEntryLength(pEcSlvApi, pObjectEntry, &length);
if (length <= *pLength_p)
{
*pLength_p = length;
dtkError
= EC_API_SLV_CoE_getObjectEntryData(pEcSlvApi, pObjectEntry, length, pData_p);
if (dtkError != EC_API_eERR_NONE)
{
adsError = ADSERR_DEVICE_ERROR;
}
}
else
{
adsError = ADSERR_DEVICE_INVALIDSIZE;
}
}
else
{
adsError = ADSERR_DEVICE_NOTFOUND;
}
}
else
{
dtkError = EC_API_SLV_CoE_getObject(pEcSlvApi, index_p, &pObject);
if (dtkError == EC_API_eERR_NONE)
{
if (subIndex_p == 0u)
{
EC_API_SLV_CoE_getObjectLength(pEcSlvApi, pObject, &length);
if (length <= *pLength_p)
{
*pLength_p = length;
EC_API_SLV_CoE_getObjectEntryCount(pEcSlvApi, pObject, (uint8_t *)&pData_p[0]);
dtkError
= EC_API_SLV_CoE_getObjectData(pEcSlvApi, pObject, length, &pData_p[1]);
if (dtkError != EC_API_eERR_NONE)
{
adsError = ADSERR_DEVICE_ERROR;
}
}
else
{
adsError = ADSERR_DEVICE_INVALIDSIZE;
}
}
else if (subIndex_p == 1u)
{
EC_API_SLV_CoE_getObjectLength(pEcSlvApi, pObject, &length);
if (length <= *pLength_p)
{
*pLength_p = length;
dtkError = EC_API_SLV_CoE_getObjectData(pEcSlvApi, pObject, length, pData_p);
if (dtkError != EC_API_eERR_NONE)
{
adsError = ADSERR_DEVICE_ERROR;
}
}
else
{
adsError = ADSERR_DEVICE_INVALIDSIZE;
}
}
else
{
adsError = ADSERR_DEVICE_INVALIDPARM;
}
}
else
{
adsError = ADSERR_DEVICE_NOTFOUND;
}
}
}
else
{
adsError = ADSERR_DEVICE_INVALIDPARM;
}
return adsError;
}
static uint32_t EC_SLV_APP_AoE_writeRequest(
void *pContext_p,
uint16_t port_p,
uint16_t index_p,
uint8_t subIndex_p,
bool completeAccess_p,
uint32_t *pLength_p,
uint16_t *pData_p)
{
uint32_t adsError = ERR_NOERROR;
EC_API_SLV_SHandle_t *pEcSlvApi = (EC_API_SLV_SHandle_t *)pContext_p;
EC_API_SLV_SCoE_ObjEntry_t *pObjectEntry = NULL;
EC_API_SLV_SCoE_Object_t *pObject = NULL;
OSALUNREF_PARM(port_p);
if (pData_p != NULL)
{
uint32_t dtkError;
if (completeAccess_p == false)
{
dtkError = EC_API_SLV_CoE_getObjectEntry(pEcSlvApi, index_p, subIndex_p, &pObjectEntry);
if (dtkError == EC_API_eERR_NONE)
{
dtkError
= EC_API_SLV_CoE_setObjectEntryData(pEcSlvApi, pObjectEntry, *pLength_p, pData_p);
if (dtkError != EC_API_eERR_NONE)
{
adsError = ADSERR_DEVICE_ERROR;
}
}
else
{
adsError = ADSERR_DEVICE_NOTFOUND;
}
}
else
{
dtkError = EC_API_SLV_CoE_getObject(pEcSlvApi, index_p, &pObject);
if (dtkError == EC_API_eERR_NONE)
{
if (subIndex_p == 0u)
{
pEcSlvApi,
pObject,
subIndex_p,
*pLength_p,
&pData_p[1]);
if (dtkError != EC_API_eERR_NONE)
{
adsError = ADSERR_DEVICE_ERROR;
}
}
else if (subIndex_p == 1u)
{
dtkError
= EC_API_SLV_CoE_setObjectData(pEcSlvApi, pObject, subIndex_p, *pLength_p, pData_p);
if (dtkError != EC_API_eERR_NONE)
{
adsError = ADSERR_DEVICE_ERROR;
}
}
else
{
adsError = ADSERR_DEVICE_INVALIDPARM;
}
}
else
{
adsError = ADSERR_DEVICE_NOTFOUND;
}
}
}
else
{
adsError = ADSERR_DEVICE_NOMEMORY;
}
return adsError;
}
{
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_SS_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;
}
#ifdef SOC_AM64X
error = EC_API_SLV_ESI_parseFileRam(pAppInstance_p->ptEcSlvApi, (const uint8_t *)ti_am64x_r5f_simple_hex, ti_am64x_r5f_simple_hex_len);
#endif //SOC_AM64X
#ifdef SOC_AM243X
error = EC_API_SLV_ESI_parseFileRam(pAppInstance_p->ptEcSlvApi, (const uint8_t *)ti_am243x_r5f_simple_hex, ti_am243x_r5f_simple_hex_len);
#endif //SOC_AM243X
#ifdef SOC_AM263PX
error = EC_API_SLV_ESI_parseFileRam(pAppInstance_p->ptEcSlvApi, (const uint8_t *)ti_am263px_r5f_simple_hex, ti_am263px_r5f_simple_hex_len);
#endif //SOC_AM263PX
#ifdef SOC_AM261X
error = EC_API_SLV_ESI_parseFileRam(pAppInstance_p->ptEcSlvApi, (const uint8_t *)ti_am261x_r5f_simple_hex, ti_am261x_r5f_simple_hex_len);
#endif //SOC_AM261X
if (error != EC_API_eERR_NONE)
{
OSAL_printf("ESI parser 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;
}
//Backup Parmeter
//Setting NVM offset NOT handled by ESI PARSER
#if !(defined FBTL_REMOTE) || (0 == FBTL_REMOTE)
EC_API_SLV_CoE_setObjectNonVolatileOffset(pAppInstance_p->ptEcSlvApi,0x2003,(BACKUP_PARAMETER_DATA_OFFSET));
#endif
#if !(defined FBTL_REMOTE) || (0 == FBTL_REMOTE)
uint32_t objectSize = 0;
error = EC_API_SLV_CoE_getObjectLengthByIndex(pAppInstance_p->ptEcSlvApi,0x2003,&objectSize);
if (error == EC_API_eERR_NONE)
{
EC_API_SLV_CoE_setObjectNonVolatileOffset(pAppInstance_p->ptEcSlvApi,0x2004,(BACKUP_PARAMETER_DATA_OFFSET + objectSize));
}
else
{
OSAL_printf("Get Object 0x2003 Size 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;
}
#endif
/*PDO Mapping Changes*/
pAppInstance_p->ptEcSlvApi,
EC_SLAVE_APP_assignmentChangedHandler,
pAppInstance_p);
pAppInstance_p->ptEcSlvApi,
EC_SLAVE_APP_mappingChangedHandler,
pAppInstance_p);
/*AoE*/
pAppInstance_p->ptEcSlvApi,
EC_SLV_APP_AoE_readRequest,
pAppInstance_p->ptEcSlvApi);
pAppInstance_p->ptEcSlvApi,
EC_SLV_APP_AoE_writeRequest,
pAppInstance_p->ptEcSlvApi);
/*EoE*/
pAppInstance_p->ptEcSlvApi,
pAppInstance_p);
pAppInstance_p->ptEcSlvApi,
pAppInstance_p);
/*FoE*/
pAppInstance_p->ptEcSlvApi,
pAppInstance_p->ptEcSlvApi);
pAppInstance_p->ptEcSlvApi,
pAppInstance_p->ptEcSlvApi);
pAppInstance_p->ptEcSlvApi,
pAppInstance_p->ptEcSlvApi);
pAppInstance_p->ptEcSlvApi,
pAppInstance_p->ptEcSlvApi);
pAppInstance_p->ptEcSlvApi,
pAppInstance_p->ptEcSlvApi);
pAppInstance_p->ptEcSlvApi,
pAppInstance_p->ptEcSlvApi);
/*CoE - Backup Parameters*/
#if !(defined DPRAM_REMOTE) && !(defined FBTL_REMOTE)
EC_API_SLV_CoE_cbRegisterResetBkpMemHandler(
pAppInstance_p->ptEcSlvApi,
pAppInstance_p->ptEcSlvApi);
EC_API_SLV_CoE_cbRegisterGetBkpParamCrcHandler(
pAppInstance_p->ptEcSlvApi,
pAppInstance_p->ptEcSlvApi);
EC_API_SLV_CoE_cbRegisterGetBkpMemStateHandler(
pAppInstance_p->ptEcSlvApi,
pAppInstance_p->ptEcSlvApi);
EC_API_SLV_CoE_cbRegisterStoreBkpParamHandler(
pAppInstance_p->ptEcSlvApi,
pAppInstance_p->ptEcSlvApi);
EC_API_SLV_CoE_cbRegisterRestoreBkpParamHandler(
pAppInstance_p->ptEcSlvApi,
pAppInstance_p->ptEcSlvApi);
EC_API_SLV_CoE_cbRegisterReadBkpDataHandler(
pAppInstance_p->ptEcSlvApi,
pAppInstance_p->ptEcSlvApi);
EC_API_SLV_CoE_cbRegisterWriteBkpDataHandler(
pAppInstance_p->ptEcSlvApi,
pAppInstance_p->ptEcSlvApi);
#endif
/*Diagnosis support */
#if !(defined DPRAM_REMOTE) && !(defined FBTL_REMOTE) \
&& !(defined OSAL_FREERTOS_JACINTO) /* first omit flash */
pAppInstance_p->ptEcSlvApi,
pAppInstance_p->ptEcSlvApi);
/* @cppcheck_justify{misra-c2012-11.6} void cast required for signature */
/* cppcheck-suppress misra-c2012-11.6 */
pAppInstance_p->ptEcSlvApi,
EC_SLV_APP_EEP_write, EEPROM_MAGIC_KEY);
/* @cppcheck_justify{misra-c2012-11.6} void cast required for signature */
/* cppcheck-suppress misra-c2012-11.6 */
pAppInstance_p->ptEcSlvApi,
EC_SLV_APP_EEP_read, EEPROM_MAGIC_KEY);
#endif
pAppInstance_p->ptEcSlvApi,
EC_SLV_APP_SS_applicationRun,
pAppInstance_p);
error = EC_API_SLV_PDO_get(pAppInstance_p->ptEcSlvApi, 0x1600, &pAppInstance_p->ptRxPdo1600);
if (EC_API_eERR_NONE != error)
{
OSAL_printf("SubDevice 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;
}
error = EC_API_SLV_PDO_get(pAppInstance_p->ptEcSlvApi, 0x1A00, &pAppInstance_p->ptTxPdo1A00);
if (EC_API_eERR_NONE != error)
{
OSAL_printf("SubDevice 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;
}
error = (EC_API_EError_t)EC_API_SLV_init(pAppInstance_p->ptEcSlvApi);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("SubDevice 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;
}
#if !(defined DPRAM_REMOTE) && !(defined FBTL_REMOTE)
#endif
pAppInstance_p->state = EC_API_SLV_eESM_init;
pAppInstance_p->msec = 0;
pAppInstance_p->trigger = 1000; /* 1000 ms */
pAppInstance_p->prev = ESL_OS_clockGet();
error = EC_API_SLV_run(pAppInstance_p->ptEcSlvApi);
if (EC_API_eERR_NONE != error)
{
OSAL_printf("%s:%d:0x%x\r\n", __func__, __LINE__, error);
}
Exit:
return;
}
#if (defined SHOW_ESCSTATUS) && (SHOW_ESCSTATUS == 1)
static void EC_SLV_APP_escStatusAnalysis(EC_SLV_APP_SS_Application_t *pAppInstance_p)
{
static uint16_t lastPortState = 0;
uint16_t portState;
static uint16_t lastCounters[8] = { 0 };
uint16_t counters[8] = { 0 };
uint8_t cntIdx = 0;
uint32_t error;
error = EC_API_SLV_readWordEscRegister(pAppInstance_p->ptEcSlvApi, 0x110, &portState);
if (EC_API_eERR_NONE != error)
{
OSAL_printf("%s:%d:E=0x%x\r\n", __func__, __LINE__, error);
}
if (lastPortState != portState)
{
OSAL_printf("PortState 0x%04x->0x%04x\r\n", lastPortState, portState);
}
lastPortState = portState;
for (cntIdx = 0; cntIdx < 0x0e; cntIdx += 2)
{
pAppInstance_p->ptEcSlvApi,
(0x300 | cntIdx),
&counters[cntIdx >> 1]);
if (EC_API_eERR_NONE != error)
{
OSAL_printf("%s:%d:E=0x%x\r\n", __func__, __LINE__, error);
}
}
if (0 != OSAL_MEMORY_memcmp(counters, lastCounters, sizeof(counters)))
{
for (cntIdx = 0; cntIdx < 8; ++cntIdx)
{
OSAL_printf("Counter 0x%04x: %04x\r\n", 0x300 | (cntIdx * 2), counters[cntIdx]);
}
}
OSAL_MEMORY_memcpy(lastCounters, counters, sizeof(counters));
}
#endif
static void EC_SLV_APP_SS_applicationRun(void *pAppCtxt_p)
{
/* @cppcheck_justify{misra-c2012-11.5} generic API requires cast */
/* cppcheck-suppress misra-c2012-11.5 */
EC_SLV_APP_SS_Application_t *pApplicationInstance = (EC_SLV_APP_SS_Application_t *)pAppCtxt_p;
/* @cppcheck_justify{threadsafety-threadsafety} thread is not reentrant */
/* cppcheck-suppress threadsafety-threadsafety */
static uint8_t lastLed = 0;
/* @cppcheck_justify{threadsafety-threadsafety} thread is not reentrant */
/* cppcheck-suppress threadsafety-threadsafety */
static EC_API_SLV_EEsmState_t lastState = EC_API_SLV_eESM_uninit; /* last known stack state to
notify changes */
EC_API_SLV_EEsmState_t curState = EC_API_SLV_eESM_uninit; /* current stack state */
/* @cppcheck_justify{threadsafety-threadsafety} thread is not reentrant */
/* cppcheck-suppress threadsafety-threadsafety */
static bool gotLEDOffset = false; /* process data offset of LED object acquired? */
/* @cppcheck_justify{threadsafety-threadsafety} thread is not reentrant */
/* cppcheck-suppress threadsafety-threadsafety */
static uint16_t ledPDOffset = 0; /* offset of PD LEDs in process data image */
/* @cppcheck_justify{threadsafety-threadsafety} thread is not reentrant */
/* cppcheck-suppress threadsafety-threadsafety */
static uint32_t pdOutLen = 0; /* length of out process data for buffer exchange */
uint16_t alErrorCode = 0;
uint32_t error;
#if (defined SHOW_LOOPCOUNT) && (SHOW_LOOPCOUNT == 1)
static uint32_t loops = 0;
#endif
if (NULL == pApplicationInstance)
{
OSAL_error(__func__, __LINE__, OSAL_ERR_InvalidState, true, 1, "App Instance = NULL");
}
else
{
#if (defined ENABLE_I2CLEDS) && (ENABLE_I2CLEDS == 1)
/* be sure we own I2C in this thread */
if (NULL == pApplicationInstance->ioexpLedHandle)
{
pApplicationInstance->ioexpLedHandle = ESL_OS_ioexp_leds_init();
}
#endif
error = EC_API_SLV_getState(pApplicationInstance->ptEcSlvApi, &curState, &alErrorCode);
if (EC_API_eERR_NONE != error)
{
OSAL_printf("%s:%d:E=0x%x\r\n", __func__, __LINE__, error);
}
if (curState != lastState)
{
OSAL_printf("State change: 0x%x -> 0x%x\r\n", lastState, curState);
pApplicationInstance->prev = ESL_OS_clockGet();
}
lastState = curState;
if (EC_API_SLV_eESM_op != curState)
{
if (gotLEDOffset)
{
OSAL_printf("Discard LED Offset\r\n");
ledPDOffset = 0;
pdOutLen = 0;
gotLEDOffset = false;
}
}
if (EC_API_SLV_eESM_op == curState)
{
/* @cppcheck_justify{threadsafety-threadsafety} thread is not reentrant */
/* cppcheck-suppress threadsafety-threadsafety */
static volatile uint8_t ledPDData;
if (!gotLEDOffset)
{
error = EC_API_SLV_getOutputProcDataLength(pApplicationInstance->ptEcSlvApi, &pdOutLen);
if (EC_API_eERR_NONE != error)
{
OSAL_printf("%s:%d:E=0x%x\r\n", __func__, __LINE__, error);
}
pdOutLen = BIT2BYTE(pdOutLen);
if (pdOutLen > sizeof(pApplicationInstance->pdBuffer))
{
pdOutLen = sizeof(pApplicationInstance->pdBuffer);
}
pApplicationInstance->ptEcSlvApi,
pApplicationInstance->ptRxPdo1600,
&ledPDOffset);
if (EC_API_eERR_NONE != error)
{
OSAL_printf("%s:%d:E=0x%x\r\n", __func__, __LINE__, error);
}
gotLEDOffset = true;
OSAL_printf("LED Offset = %d\r\n", ledPDOffset);
}
pApplicationInstance->ptEcSlvApi,
pdOutLen,
pApplicationInstance->pdBuffer);
if (EC_API_eERR_NONE != error)
{
OSAL_printf("%s:%d:E=0x%x\r\n", __func__, __LINE__, error);
}
/*Mirror output data into input data*/
pApplicationInstance->ptEcSlvApi,
pApplicationInstance->ptRxPdo1600,
1,
1,
(uint8_t*)(&ledPDData));
if(err != EC_API_eERR_NONE)
{
OSAL_printf("Cannot get leddata 0x%08x\r\n", err);
}
ledPDData = pApplicationInstance->pdBuffer[ledPDOffset];
if (
#if (defined ENABLE_I2CLEDS) && (ENABLE_I2CLEDS == 1)
(NULL != pApplicationInstance->ioexpLedHandle) &&
#endif
(lastLed != ledPDData))
{
lastLed = ledPDData;
#if (defined ENABLE_I2CLEDS) && (ENABLE_I2CLEDS == 1)
ESL_OS_ioexp_leds_write(pApplicationInstance->ioexpLedHandle, lastLed);
#else
OSAL_printf("Update I2C to 0x%x\r\n", lastLed);
#endif
}
#if !(defined FBTL_REMOTE) || (0 == FBTL_REMOTE)
pApplicationInstance->ptEcSlvApi,
pApplicationInstance->ptTxPdo1A00,
1,
sizeof(uint8_t),
(uint8_t *)&ledPDData);
if (err != EC_API_eERR_NONE)
{
OSAL_printf("Fill Description Object Error code: 0x%08x\r\n", err);
}
#endif
}
else
{
clock_t now = ESL_OS_clockGet();
if (pApplicationInstance->prev > now)
{
pApplicationInstance->prev = now;
}
pApplicationInstance->diff = ESL_OS_clockDiff(pApplicationInstance->prev, &now);
if (pApplicationInstance->ioexpLedHandle && pApplicationInstance->diff)
{
#if (defined SHOW_LOOPCOUNT) && (SHOW_LOOPCOUNT == 1)
OSAL_printf("LoopCount 0x%08x\r\n", loops);
#endif
#if (defined ENABLE_I2CLEDS) && (ENABLE_I2CLEDS == 1)
ESL_OS_ioexp_leds_write(pApplicationInstance->ioexpLedHandle, lastLed);
#else
OSAL_printf("Update I2C to 0x%x\r\n", lastLed);
#endif
pApplicationInstance->prev = now;
if (0u == lastLed)
{
lastLed = 1u;
}
else
{
lastLed = (lastLed << 1u);
}
//Write Led data to the process data. It can be seen in OBD in Object 0x2002:2 as well.
pApplicationInstance->ptEcSlvApi,
pApplicationInstance->ptTxPdo1A00,
1,
sizeof(uint8_t),
(uint8_t *)&lastLed);
if (EC_API_eERR_NONE != error)
{
OSAL_printf("%s:%d:E=0x%x\r\n", __func__, __LINE__, error);
}
}
}
#if (defined SHOW_ESCSTATUS) && (SHOW_ESCSTATUS == 1)
EC_SLV_APP_escStatusAnalysis(pApplicationInstance);
#endif
#if (defined SHOW_LOOPCOUNT) && (SHOW_LOOPCOUNT == 1)
loops++;
#endif
}
}
uint32_t EC_SLV_APP_CoE_getBkpParamCrc(void *pContext)
Function to get the backup parameters checksum.
Definition ESL_coeBackupDemo.c:332
void EC_SLV_APP_CoE_restoreBkpParam(void *pContext)
Function to prepare for the backup parameters restore from the NV memory.
Definition ESL_coeBackupDemo.c:504
uint8_t EC_SLV_APP_CoE_getBkpMemState(void *pContext)
Function to get the status of the backup parameters NV memory.
Definition ESL_coeBackupDemo.c:374
void EC_SLV_APP_CoE_storeBkpParam(void *pContext)
Function to write the backup parameters cache into the NV memory.
Definition ESL_coeBackupDemo.c:428
uint32_t EC_SLV_APP_CoE_writeBkpData(void *pContext, uint32_t destOffset, uint16_t *pSrc, uint16_t length, uint8_t writeType)
Function to write the backup parameter data to the NV memory.
Definition ESL_coeBackupDemo.c:591
void EC_SLV_APP_CoE_resetBkpMem(void *pContext)
Function to reset the backup parameter NV memory.
Definition ESL_coeBackupDemo.c:258
void EC_SLV_APP_CoE_readBkpData(void *pContext, uint16_t *pDest, uint32_t srcOffset, uint16_t length)
Function to read the backup parameter data from the NV memory.
Definition ESL_coeBackupDemo.c:545
void EC_SLV_APP_CoE_backupParamInit(void *pContext)
Function to initialize the backup parameters and NV memory. It should be called after powerup.
Definition ESL_coeBackupDemo.c:191
#define EC_API_SLV_DIAG_MSG_PARAM_TYPE_DATA
Diagnosis parameter type data.
Definition ecSlvApiDef_diagnosis.h:44
#define EC_API_SLV_DIAG_CODE_EMCY(Code)
Macro to create emergency code.
Definition ecSlvApiDef_diagnosis.h:50
#define EC_API_SLV_DIAG_MSG_TYPE_ERROR
Diagnosis message type error.
Definition ecSlvApiDef_diagnosis.h:42
uint32_t EC_API_SLV_AoE_cbRegisterWriteRequestHandler(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_AoE_CBWriteRequestHandler_t cbFunc, void *pContext)
Register user application to handle AoE write requests.
Definition ecSlvApi_AoE.c:80
uint32_t EC_API_SLV_AoE_cbRegisterReadRequestHandler(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_AoE_CBReadRequestHandler_t cbFunc, void *pContext)
Register user application to handle AoE read requests.
Definition ecSlvApi_AoE.c:44
uint32_t EC_API_SLV_init(EC_API_SLV_SHandle_t *pHandle)
This is the function to initialize the EtherCAT Slave API.
Definition ecSlvApi.c:1238
uint32_t EC_API_SLV_readWordEscRegister(EC_API_SLV_SHandle_t *pHandle, uint16_t escAddress, uint16_t *pValue)
This is the function reads a byte from ESC Register.
Definition ecSlvApi.c:2133
EC_API_SLV_SHandle_t * EC_API_SLV_new(void)
This is the function to create a new EtherCAT Slave device instance.
Definition ecSlvApi.c:925
uint32_t EC_API_SLV_run(EC_API_SLV_SHandle_t *pHandle)
This is the function to run the EtherCAT Slave API.
Definition ecSlvApi.c:1455
uint32_t EC_API_SLV_getState(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_EEsmState_t *pState, uint16_t *pAlErrorCode)
This is the function to read the EtherCAT Slave state machine.
Definition ecSlvApi.c:1681
uint32_t EC_API_SLV_cbRegisterBoardStatusLed(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_CBBoardStatusLed_t cbFunc, void *pContext)
Register Board Status LED callback.
Definition ecSlvApi_board.c:102
uint32_t EC_API_SLV_CoE_getObjectEntryLength(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_SCoE_ObjEntry_t *pObjEntry, uint32_t *length)
This function returns the object entry length.
Definition ecSlvApi_CoE.c:557
uint32_t EC_API_SLV_CoE_setObjectData(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_SCoE_Object_t *pObject, uint8_t subIndex, uint32_t length, uint16_t *pData)
This function writes Data to the Object Dictionary.
Definition ecSlvApi_CoE.c:427
uint32_t EC_API_SLV_CoE_getObjectEntryData(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_SCoE_ObjEntry_t *pObjEntry, uint32_t length, uint16_t *pData)
This function reads Data from the Object Dictionary.
Definition ecSlvApi_CoE.c:831
uint32_t EC_API_SLV_CoE_getObject(EC_API_SLV_SHandle_t *pHandle, uint16_t index, EC_API_SLV_SCoE_Object_t **ppObject)
This function returns an object of the Object Dictionary.
Definition ecSlvApi_CoE.c:286
uint32_t EC_API_SLV_CoE_setObjectEntryData(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_SCoE_ObjEntry_t *pObjEntry, uint32_t length, uint16_t *pData)
This function writes Data to the Object Dictionary.
Definition ecSlvApi_CoE.c:956
uint32_t EC_API_SLV_CoE_getObjectLength(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_SCoE_Object_t *pObject, uint32_t *length)
This function returns the object length including subIndex 0.
Definition ecSlvApi_CoE.c:525
uint32_t EC_API_SLV_CoE_getObjectLengthByIndex(EC_API_SLV_SHandle_t *pHandle, uint16_t index, uint32_t *length)
This function returns the object length including subIndex 0.
Definition ecSlvApi_CoE.c:5039
uint32_t EC_API_SLV_CoE_getObjectData(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_SCoE_Object_t *pObject, uint32_t length, uint16_t *pData)
This function read the object Data from the Object Dictionary.
Definition ecSlvApi_CoE.c:360
uint32_t EC_API_SLV_CoE_getObjectEntryCount(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_SCoE_Object_t *pObject, uint8_t *pCount)
This function returns the number of entries of an Object.
Definition ecSlvApi_CoE.c:493
uint32_t EC_API_SLV_CoE_getObjectEntry(EC_API_SLV_SHandle_t *pHandle, uint16_t index, uint8_t subIndex, EC_API_SLV_SCoE_ObjEntry_t **ppObjectEntry)
This function returns object entries from the Object Dictionary.
Definition ecSlvApi_CoE.c:662
uint32_t EC_API_SLV_DIAG_newMessage(EC_API_SLV_SHandle_t *pHandle, uint32_t diagCode, uint8_t type, uint16_t textID, uint8_t numParams, EC_API_SLV_SDIAG_parameter_t *pParams)
Send Diagnosis message.
Definition ecSlvApi_diagnosis.c:239
uint32_t EC_API_SLV_DIAG_enable(EC_API_SLV_SHandle_t *pHandle)
Enable history diagnosis object.
Definition ecSlvApi_diagnosis.c:49
uint32_t EC_API_SLV_EEPROM_cbRegisterInit(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_CBEepromInit_t cbFunc, void *pContext)
Initialize flash memory block.
Definition ecSlvApi.c:2575
uint32_t EC_API_SLV_EEPROM_cbRegisterWrite(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_CBEepromWrite_t cbFunc, void *pContext)
Register a function lo store the eeprom content.
Definition ecSlvApi.c:2528
uint32_t EC_API_SLV_EEPROM_cbRegisterRead(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_CBEepromRead_t cbFunc, void *pContext)
Register a function lo load the eeprom content.
Definition ecSlvApi.c:2475
uint32_t EC_API_SLV_EoE_cbRegisterReceiveHandler(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_EoE_CBReceiveHandler_t cbFunc, void *pContext)
This is the function to register EoE receive handlers.
Definition ecSlvApi_EoE.c:50
uint32_t EC_API_SLV_EoE_cbRegisterSettingIndHandler(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_EoE_CBSettingIndHandler_t cbFunc, void *pContext)
This is the function to register EoE Setting Indication handler.
Definition ecSlvApi_EoE.c:89
@ EC_API_eERR_INVALID
Definition ecSlvApiDef_error.h:48
@ EC_API_eERR_ABORT
Definition ecSlvApiDef_error.h:47
@ EC_API_eERR_NONE
Definition ecSlvApiDef_error.h:41
enum EC_API_EError EC_API_EError_t
uint32_t EC_API_SLV_ESI_parseFileRam(EC_API_SLV_SHandle_t *pHandle, const uint8_t *pData_p, uint32_t length_p)
Parse an ESI file from a RAM source.
Definition ecSlvApi_esiParser.c:576
uint32_t EC_API_SLV_FoE_cbRegisterStartBLHandler(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_FoE_CBStartBLHandler_t cbFunc, void *pContext)
This is the function to register FoE bootloader start function.
Definition ecSlvApi_FoE.c:218
uint32_t EC_API_SLV_FoE_cbRegisterOpenFileHandler(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_FoE_CBOpenFileHandler_t cbFunc, void *pContext)
This is the function to register FoE open function.
Definition ecSlvApi_FoE.c:53
uint32_t EC_API_SLV_FoE_cbRegisterCloseFileHandler(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_FoE_CBCloseFileHandler_t cbFunc, void *pContext)
This is the function to register FoE close function.
Definition ecSlvApi_FoE.c:176
uint32_t EC_API_SLV_FoE_cbRegisterStopBLHandler(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_FoE_CBStopBLHandler_t cbFunc, void *pContext)
This is the function to register FoE bootloader stop function.
Definition ecSlvApi_FoE.c:260
uint32_t EC_API_SLV_FoE_cbRegisterWriteFileHandler(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_FoE_CBWriteFileHandler_t cbFunc, void *pContext)
This is the function to register FoE write function.
Definition ecSlvApi_FoE.c:135
uint32_t EC_API_SLV_FoE_cbRegisterReadFileHandler(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_FoE_CBReadFileHandler_t cbFunc, void *pContext)
This is the function to register FoE read function.
Definition ecSlvApi_FoE.c:94
uint32_t EC_API_SLV_PDO_setEntryData(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_Pdo_t *pPdo, uint8_t subIndex, uint32_t length, uint8_t *pData)
Write data to an individual PDO Entry Variable.
Definition ecSlvApi_pdo.c:1421
uint32_t EC_API_SLV_PDO_getOffset(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_Pdo_t *pPdo, uint16_t *pOffset)
This function return the offset of the PDO in the process image in bytes.
Definition ecSlvApi_pdo.c:610
uint32_t EC_API_SLV_PDO_registerMappingChanges(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_PDO_CBMappingChanges_t cbFunc, void *pContext)
Report PDO mapping changes.
Definition ecSlvApi_pdo.c:2949
uint32_t EC_API_SLV_PDO_registerAssignmentChanges(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_PDO_CBAssignmentChanges_t cbFunc, void *pContext)
Report PDO assignment changes.
Definition ecSlvApi_pdo.c:2907
uint32_t EC_API_SLV_PDO_getEntryData(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_Pdo_t *pPdo, uint8_t subIndex, uint32_t length, uint8_t *pData)
Read data from an individual PDO Entry Variable.
Definition ecSlvApi_pdo.c:1560
uint32_t EC_API_SLV_getOutputData(EC_API_SLV_SHandle_t *pHandle, uint32_t length, uint8_t *pOutputData)
Read output process from the EtherCAT Master.
Definition ecSlvApi_pdo.c:2250
uint32_t EC_API_SLV_PDO_get(EC_API_SLV_SHandle_t *pHandle, uint16_t index, EC_API_SLV_Pdo_t **pOutPdo)
Search for PDO and fetch it.
Definition ecSlvApi_pdo.c:552
uint32_t EC_API_SLV_getOutputProcDataLength(EC_API_SLV_SHandle_t *pHandle, uint32_t *pLength)
Read the output process data length.
Definition ecSlvApi_pdo.c:2034
uint32_t EC_API_SLV_cbRegisterUserApplicationRun(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_CBUsrApplicationRun_t cbFunc, void *pContext)
This is the function to register a function which runs application run handler.
Definition ecSlvApi_ssc.c:95
enum EC_API_SLV_EEsmState EC_API_SLV_EEsmState_t
EC_STATE_T EtherCAT State Machine states.
@ EC_API_SLV_eESM_op
Operational State.
Definition ecSlvApi_types.h:75
@ EC_API_SLV_eESM_uninit
Uninitialized State.
Definition ecSlvApi_types.h:70
@ EC_API_SLV_eESM_init
Init State.
Definition ecSlvApi_types.h:71
void EC_SLV_APP_EEP_init(void *pContext)
Initialize EEPROM instance.
Definition ESL_eeprom.c:153
void EC_SLV_APP_EEP_write(void *pContext, void *pEeprom, uint32_t length)
Write EEPROM to memory.
Definition ESL_eeprom.c:193
bool EC_SLV_APP_EEP_read(void *pContext, void *pEeprom, uint32_t *pLength)
Load EEPROM from memory.
Definition ESL_eeprom.c:273
bool EC_SLV_APP_EoE_SS_receiveHandler(void *pContext, uint16_t *pData, uint16_t size)
User defined EoE receive function. Called when an EoE frame is received.
Definition ESL_eoeDemo.c:548
bool EC_SLV_APP_EoE_SS_settingIndHandler(void *pContext, uint16_t *pMac, uint16_t *pIp, uint16_t *pSubNet, uint16_t *pDefaultGateway, uint16_t *pDnsIp)
EoE Settings Indication callback. Called when EoE settings are received.
Definition ESL_eoeDemo.c:453
void EC_SLV_APP_FoE_startBL(void *pContext)
FoE Bootloader start.
Definition ESL_foeDemo.c:651
uint32_t EC_SLV_APP_FoE_fileWrite(void *pContext, uint16_t *pData, uint16_t size)
Write file from device.
Definition ESL_foeDemo.c:363
void EC_SLV_APP_FoE_stopBL(void *pContext)
FoE Bootloader stop.
Definition ESL_foeDemo.c:682
uint32_t EC_SLV_APP_FoE_fileRead(void *pContext, uint16_t *pData, uint16_t size, uint32_t fileOffset)
Read file from device.
Definition ESL_foeDemo.c:289
uint32_t EC_SLV_APP_FoE_fileClose(void *pContext, uint32_t errorCode)
Close file.
Definition ESL_foeDemo.c:435
uint32_t EC_SLV_APP_FoE_fileOpen(void *pContext, const char *pName, uint16_t nameLen, bool isRead, uint32_t password)
Open file from device.
Definition ESL_foeDemo.c:543
void EC_SLV_APP_SS_registerStacklessBoardFunctions(EC_SLV_APP_SS_Application_t *pAppInstance_p)
Register board related functions, which do not use stack handle.
Definition ecSubDeviceSimple.c:3172
void EC_SLV_APP_SS_applicationInit(EC_SLV_APP_SS_Application_t *pAppInstance_p)
Initialize application.
Definition ecSubDeviceSimple.c:3558
void EC_SLV_APP_SS_initBoardFunctions(EC_SLV_APP_SS_Application_t *pAppInstance_p)
Initialize board related functions.
Definition ecSubDeviceSimple.c:3109
#define ABORT_NOERROR
No SDO error.
Definition ecSlvApiDef_CoE.h:158
#define DEFTYPE_UNSIGNED8
UNSIGNED8.
Definition ecSlvApiDef_CoE.h:44
Definition ecSlvApiInternal.h:130
Definition ecSlvApiInternal.h:144
Definition ecSlvApiInternal.h:351
EC_SLV_API_PDO_SEntryMap_t describes the EtherCAT Slave API.
Definition ecSlvApi_types.h:127
uint8_t pdoCount
Number of PDOs assigned to SyncManager.
Definition ecSlvApi_types.h:137
bool pdoAssignmentChanged
Flag to indicate the PDO assignment change to SyncManager.
Definition ecSlvApi_types.h:136
uint16_t * pPdoIndexArray
Array of PDO indexes assigned to SyncManager.
Definition ecSlvApi_types.h:138
Describes the information passed to the PDO assignment change callback.
Definition ecSlvApi_types.h:135
uint8_t pdBuffer[128]
Definition ecSubDeviceSimple.h:98
uint8_t state
Definition ecSubDeviceSimple.h:73
clock_t diff
Definition ecSubDeviceSimple.h:76
EC_API_SLV_Pdo_t * ptRxPdo1600
Definition ecSubDeviceSimple.h:91
void * ioexpLedHandle
Definition ecSubDeviceSimple.h:68
int32_t trigger
Definition ecSubDeviceSimple.h:71
void * gpioHandle
Definition ecSubDeviceSimple.h:66
EC_API_SLV_Pdo_t * ptTxPdo1A00
Definition ecSubDeviceSimple.h:93
uint32_t selectedPruInstance
Definition ecSubDeviceSimple.h:58
EC_API_SLV_SHandle_t * ptEcSlvApi
Definition ecSubDeviceSimple.h:96
int32_t msec
Definition ecSubDeviceSimple.h:70
clock_t prev
Definition ecSubDeviceSimple.h:75
Definition ecSubDeviceSimple.h:57
EC_API_SLV_SDIAG_parameter_t Diagnosis type parameter.
Definition ecSlvApi_types.h:94