#include <ecSlvApiDef.h>
#include <ecSlvESI.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_cia402Demo.h>
#include <ESL_esiParser.h>
#include <ecSlvApi.h>
#if !(defined MBXMEM)
#define MBXMEM
#endif
#ifdef OSAL_LINUX
#define SITARA_ESI_FILE "sitara.xml"
#define FAULHABER_ESI_FILE "Faulhaber_MC5004_012601_06.xml"
#define WEIDMULLER_ESI_FILE "Weidmueller_UR20_FBC.xml"
#define KUNBUS_ESI_FILE "Gateway_Component_EtherCAT_R02.xml"
#define PILZ_ESI_FILE "KUNBUS-PNOZ_m_ES_EtherCAT_V1_1.xml"
#else
#include "Sitara_Slave_Simple_CiA402.h"
#endif
#define I2C_IOEXP_ADDR 0x60 // The I2C address for GPIO expander
static void EC_SLV_APP_applicationRun(void* pAppCtxt_p);
#if !(defined DPRAM_REMOTE) && !(defined FBTL_REMOTE)
static OSAL_FUNC_UNUSED void EC_SLV_APP_boardPhyReset(void* pCtxt_p, uint8_t phyIdx_p, bool reset_p)
{
if (NULL == pApplicationInstance)
{
goto Exit;
}
Exit:
return;
}
#endif
static void EC_SLV_APP_appBoardStatusLed(void* pCallContext_p, void* pLedContext_p, bool runLed_p, bool errLed_p)
{
OSALUNREF_PARM(pLedContext_p);
if (NULL == pApplicationInstance)
{
goto Exit;
}
Exit:
return;
}
{
if (!pApplicationInstance)
{
goto Exit;
}
,EC_SLV_APP_appBoardStatusLed
Exit:
return error;
}
{
if (!pAppInstance_p)
{
goto Exit;
}
#if !(defined DPRAM_REMOTE) && !(defined FBTL_REMOTE)
ESL_OS_manualMdioConfig(pAppInstance_p->
ptEcSlvApi);
#else
OSALUNREF_PARM(pAppInstance_p);
#endif
#if !(defined DPRAM_REMOTE) && !(defined FBTL_REMOTE)
#endif
Exit:
return;
}
{
if (!pAppInstance_p)
{
goto Exit;
}
#if !(defined DPRAM_REMOTE) && !(defined FBTL_REMOTE)
#endif
Exit:
return;
}
uint8_t EC_API_SLV_PendingErrorCb(
uint16_t Index,
uint8_t Subindex,
uint32_t length,
uint16_t* pData,
uint8_t bCompleteAccess
)
{
OSALUNREF_PARM(Subindex);
OSALUNREF_PARM(bCompleteAccess);
OSALUNREF_PARM(pData);
if(Index == 0x2000 && length == 2)
{
}
return 0;
}
{
if (!pAppInstance_p)
{
goto Exit;
}
{
OSAL_error(__func__, __LINE__, OSAL_CONTAINER_NOMEMORY, true, 0);
goto Exit;
}
error = EC_SLV_APP_populateBoardFunctions(pAppInstance_p);
{
OSAL_printf("Populate board functions Error code: 0x%08x\n", error);
goto Exit;
}
#ifdef OSAL_LINUX
#else
error = (
EC_API_EError_t)ESL_ESI_parseFileRam(pAppInstance_p->
ptEcSlvApi, (
const uint8_t *)Sitara_Slave_Simple_CiA402_xml, Sitara_Slave_Simple_CiA402_xml_len);
#endif
{
goto Exit;
}
{
OSAL_printf("Slave Init Error Code: 0x%08x\n", error);
goto Exit;
}
#if (defined ENABLE_I2CLEDS) && (ENABLE_I2CLEDS == 1)
#endif
pAppInstance_p->
msec = 0;
pAppInstance_p->
prev = ESL_OS_clockGet();
Exit:
return;
}
{
if (pAppInstance_p)
{
}
}
static void EC_SLV_APP_applicationRun(void* pAppCtxt_p)
{
static uint8_t lastLed = 0;
pApplicationInstace->
diff = ESL_OS_clockDiff(pApplicationInstace->
prev, NULL);
if (pApplicationInstace->
diff)
{
#if (defined ENABLE_I2CLEDS) && (ENABLE_I2CLEDS == 1)
ESL_OS_ioexp_leds_write(pApplicationInstace->
ioexpLedHandle, ledPDData);
#endif
pApplicationInstace->
prev = ESL_OS_clockGet();
lastLed = lastLed ? lastLed << 1 : 1;
}
{
}
}