#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
static void EC_SLV_APP_ESIP_applicationRun(void* pAppCtxt_p);
#if !(defined DPRAM_REMOTE) && !(defined FBTL_REMOTE)
static OSAL_FUNC_UNUSED void EC_SLV_APP_ESIP_boardPhyReset(void* pCtxt_p, uint8_t phyIdx_p, bool reset_p)
{
if (NULL == pApplicationInstance)
{
goto Exit;
}
Exit:
return;
}
#endif
static void EC_SLV_APP_ESIP_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_ESIP_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_ESIP_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;
}
static void EC_SLV_APP_ESIP_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;
}
{
}
}
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
EC_API_SLV_EEsmState_t EC_API_SLV_getState(void)
This is the function to read the EtherCAT Slave state machine.
Definition ecSlvApiStub.c:1125
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_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
void EC_API_SLV_CiA402_SM_clearErrorCode(EC_API_SLV_SHandle_t *pEcSlaveApi_p, uint8_t axisNo_p)
Inform the CiA402 state machine whether a state change finished or not.
Definition ecSlvApi_CiA402Stub.c:431
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
@ 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_PDO_setAssignment(EC_API_SLV_SHandle_t *pEcSlaveApi_p, bool assignment_p)
Enable or disable PDO assignments of the SyncManagers. Download of PDO assignment (e....
Definition ecSlvApi_ProcDataStub.c:572
@ EC_API_SLV_eESM_init
Init State.
Definition ecSlvApi.h:71
@ 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
void EC_SLV_APP_ESIP_initBoardFunctions(EC_SLV_APP_Application_t *pAppInstance_p)
Initialize board related functions.
Definition ecSlvESI.c:262
void EC_SLV_APP_ESIP_registerStacklessBoardFunctions(EC_SLV_APP_Application_t *pAppInstance_p)
Register board related functions, which do not use stack handle.
Definition ecSlvESI.c:328
uint8_t state
Definition ecSlvESI.h:79
clock_t diff
Definition ecSlvESI.h:81
void * gpioHandle
Definition ecSlvESI.h:68
int32_t trigger
Definition ecSlvESI.h:77
void * ioexpLedHandle
Definition ecSlvESI.h:70
uint32_t selectedPruInstance
Definition ecSlvESI.h:56
EC_API_SLV_SHandle_t * ptEcSlvApi
Definition ecSlvESI.h:93
int32_t msec
Definition ecSlvESI.h:76
clock_t prev
Definition ecSlvESI.h:81