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

EtherCAT® SubDevice Example Application with CiA402 Profile.

EtherCAT® SubDevice Example Application with CiA402 Profile.

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 TIESC_HW 0
#define PRU_200MHZ 1
/* this one shall the only one to be using it ! */
#include "project.h"
#include "ecSubDeviceCiA402.h"
#if (defined FBTL_REMOTE) && (FBTL_REMOTE==1)
#if (defined FBTLIMPL_LINEUART) && (1==FBTLIMPL_LINEUART)
#include "sysLib_lineUart.h"
#else
#include <sysLib_sharedMemory.h>
#endif
#endif
/* OS */
#include <osal.h>
/* ESL */
#include <ESL_os.h>
#include <ESL_BOARD_config.h>
#include <ESL_BOARD_OS_config.h>
#include <ESL_cia402Obd.h>
#include <ESL_version.h>
#if (defined SOC_AM263PX)
#include <ESL_BOARD_pinmux.h>
#endif //SOC_AM263PX
/* stack */
#include <ecSlvApi.h>
#if (defined SOC_AM263PX) || (defined SOC_AM261X)
#define FrameProc ECAT_FrameProcAPP
// FREERTOS contained FW #include <source/networking/ethercat_slave/icss_fwhal/ecat_frame_handler_bin.h>
#include <industrial_comms/ethercat_subdevice/icss_fwhal/firmware/m_v2.3/ecat_frame_handler_bin.h>
#define HostProc ECAT_HostProcAPP
// FREERTOS contained FW #include <source/networking/ethercat_slave/icss_fwhal/ecat_host_interface_bin.h>
#include <industrial_comms/ethercat_subdevice/icss_fwhal/firmware/m_v2.3/ecat_host_interface_bin.h>
#else
#define FrameProc ECAT_FrameProcAPP
// FREERTOS contained FW #include <source/networking/ethercat_slave/icss_fwhal/ecat_frame_handler_bin.h>
#include <industrial_comms/ethercat_subdevice/icss_fwhal/firmware/g_v1.3/ecat_frame_handler_bin.h>
#define HostProc ECAT_HostProcAPP
// FREERTOS contained FW #include <source/networking/ethercat_slave/icss_fwhal/ecat_host_interface_bin.h>
#include <industrial_comms/ethercat_subdevice/icss_fwhal/firmware/g_v1.3/ecat_host_interface_bin.h>
#if (defined INCLUDE_MDIO_MANUAL_MODE_WORKAROUND)
#define PRUFirmware PRUMDIOFirmwareECATAPP
#include <industrial_comms/ethercat_subdevice/icss_fwhal/firmware/g_v1.3/mdio_fw_bin.h>
#endif
#endif
#define TIESC_HW 0
#define PRU_200MHZ 1
#define THREAD_IDLE_TIMEOUT (10U) /* 10msec idle timeout */
#if defined(SDK_VARIANT_PREMIUM)
#define MAX_MAINLOOP_TASK_BLOCK_TIME_IN_MS (2U) /* Run loop task at 2ms interval when there is no task notification */
#define ENABLE_LOOP_TASK_SYNC_TO_EVENTS (1U) /* Run loop task in sync to mailbox events */
#define LOOP_TASK_NOTIFICATION_INDEX (0U) /* Loop task notification index. Depends on configUSE_TASK_NOTIFICATIONS */
#if (ENABLE_LOOP_TASK_SYNC_TO_EVENTS == 1)
const TickType_t loopTaskMaxBlockTime = pdMS_TO_TICKS(MAX_MAINLOOP_TASK_BLOCK_TIME_IN_MS);
static TaskHandle_t loopTaskHandle_g = NULL;
static void EC_SLV_APP_loopTaskNotify(TaskHandle_t pTaskHandle);
#endif //(ENABLE_LOOP_TASK_SYNC_TO_EVENTS == 1)
#endif //(SDK_VARIANT_PREMIUM)
#if defined(SDK_VARIANT_PREMIUM) && (ENABLE_LOOP_TASK_SYNC_TO_EVENTS == 1)
static void EC_SLV_APP_loopTaskNotify(TaskHandle_t pTaskHandle)
{
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
if (pTaskHandle)
{
if (HwiP_inISR())
{
vTaskNotifyGiveIndexedFromISR(pTaskHandle, LOOP_TASK_NOTIFICATION_INDEX, &xHigherPriorityTaskWoken);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
else
{
xTaskNotifyGiveIndexed(pTaskHandle, LOOP_TASK_NOTIFICATION_INDEX);
}
}
}
#endif //(SDK_VARIANT_PREMIUM) && (ENABLE_LOOP_TASK_SYNC_TO_EVENTS == 1)
static void EC_SLV_APP_Pinmux_config(void)
{
#if !(defined DPRAM_REMOTE) && !(defined FBTL_REMOTE)
#if (defined SOC_AM263PX)
//TODO: Put this into a function
Pinmux_config(gPruicssPinMuxCfg, PINMUX_DOMAIN_ID_MAIN);
#define MSS_CTRL_ICSSM_PRU_GPIO_OUT_CTRL_VALUE (0x0001077F)
#define MSS_CTRL_ICSSM_PRU1_GPIO_OUT_CTRL_VALUE (0x0001037F)
// Set bits for input pins in ICSSM_PRU0_GPIO_OUT_CTRL and ICSSM_PRU1_GPIO_OUT_CTRL registers
HW_WR_REG32(CSL_MSS_CTRL_U_BASE + CSL_MSS_CTRL_ICSSM_PRU0_GPIO_OUT_CTRL, MSS_CTRL_ICSSM_PRU_GPIO_OUT_CTRL_VALUE);
HW_WR_REG32(CSL_MSS_CTRL_U_BASE + CSL_MSS_CTRL_ICSSM_PRU1_GPIO_OUT_CTRL, MSS_CTRL_ICSSM_PRU1_GPIO_OUT_CTRL_VALUE);
uint32_t pinNum[CONFIG_GPIO_NUM_INSTANCES] = {CONFIG_ICSSM_MUX_SEL_PIN, CONFIG_ICSSM_MUX_EN_PIN, CONFIG_MUX_ENABLE_PIN, CONFIG_USER_LED_PIN};
uint32_t pinDir[CONFIG_GPIO_NUM_INSTANCES] = {CONFIG_ICSSM_MUX_SEL_DIR, CONFIG_ICSSM_MUX_EN_DIR, CONFIG_MUX_ENABLE_DIR, CONFIG_USER_LED_DIR};
for(uint32_t index = 0; index < CONFIG_GPIO_NUM_INSTANCES-1; index++)
{
/* Address translate */
uint32_t gGpioBaseAddr = (uint32_t) AddrTranslateP_getLocalAddr(CONFIG_ICSSM_MUX_SEL_BASE_ADDR);
/* Setup GPIO for ICSSM MDIO Mux selection */
GPIO_setDirMode(gGpioBaseAddr, pinNum[index], pinDir[index]);
GPIO_pinWriteHigh(gGpioBaseAddr, pinNum[index]);
}
OSAL_SCHED_sleep(300);
#endif //SOC_AM263PX
#endif
}
static uint32_t EC_SLV_APP_CIA_remoteInit(EC_SLV_APP_CIA_Application_t *applicationInstance);
static void EC_SLV_APP_CIA_loopTask(void *pArg_p)
{
/* @cppcheck_justify{misra-c2012-11.5} generic API requires cast */
/* cppcheck-suppress misra-c2012-11.5 */
uint32_t error = EC_API_eERR_NONE;
char* pProductName = NULL;
uint32_t vendorId = 0;
uint32_t productCode = 0;
#if !defined(ENABLE_LOOP_TASK_SYNC_TO_EVENTS) || (ENABLE_LOOP_TASK_SYNC_TO_EVENTS == 0)
uint16_t alErrorCode = 0;
#endif
uint8_t axisNo = 0;
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_SLV_APP_CIA_initBoardFunctions(pApplicationInstance);
EC_SLV_APP_CIA_registerStacklessBoardFunctions(pApplicationInstance);
#if !(defined FBTL_REMOTE) && !(defined DPRAM_REMOTE)
/* inject firmware */
error = EC_API_SLV_stackInsertPruFirmware((uint32_t*)ECAT_FrameProcAPP, sizeof(ECAT_FrameProcAPP),
(uint32_t*)ECAT_HostProcAPP, sizeof(ECAT_HostProcAPP));
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
OSAL_error(__func__, __LINE__, OSAL_STACK_INIT_ERROR, true, 0);
}
#if (defined INCLUDE_MDIO_MANUAL_MODE_WORKAROUND)
error = EC_API_SLV_stackInsertMdioManualFirmware((uint32_t*)PRUMDIOFirmwareECATAPP, sizeof(PRUMDIOFirmwareECATAPP));
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
OSAL_error(__func__, __LINE__, OSAL_STACK_INIT_ERROR, true, 0);
}
#endif
#endif
error = EC_API_SLV_stackInit(); // EtherCAT stack init
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
OSAL_error(__func__, __LINE__, OSAL_STACK_INIT_ERROR, true, 0);
}
EC_SLV_APP_cia402_initAxisObjects(pApplicationInstance);
EC_SLV_APP_CIA_applicationInit(pApplicationInstance);
for(axisNo = 0; axisNo < AXES_NUMBER; axisNo++)
{
error = EC_API_SLV_CiA402_enableStateMachineForAxis(pApplicationInstance->ptEcSlvApi,axisNo,true); // Enable CiA402 SM run for all axis.
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
}
}
EC_API_SLV_getVendorId(pApplicationInstance->ptEcSlvApi, &vendorId);
EC_API_SLV_getProductCode(pApplicationInstance->ptEcSlvApi, &productCode);
error = EC_API_SLV_getProductName(pApplicationInstance->ptEcSlvApi, &pProductName);
OSAL_printf("%s - %xh / %xh\r\n", pProductName, vendorId, productCode);
#if defined(SDK_VARIANT_PREMIUM)
// Read ID from the DIP switches and set as an Explicit Device ID (In CTT test case TF-1201, 0x0005 is used as an Explicit Device ID)
EC_API_SLV_setExplicitDeviceId(pApplicationInstance->ptEcSlvApi,0x0005);
uint16_t explicitDeviceID = 0;
EC_API_SLV_getExplicitDeviceId(pApplicationInstance->ptEcSlvApi,&explicitDeviceID);
OSAL_printf("Explicit Device ID : 0x%4x\r\n",explicitDeviceID);
#endif //(SDK_VARIANT_PREMIUM)
/* spit out versions */
ESL_dumpVersions(pApplicationInstance->ptEcSlvApi);
#if defined(SDK_VARIANT_PREMIUM) && (ENABLE_LOOP_TASK_SYNC_TO_EVENTS == 1)
loopTaskHandle_g = xTaskGetCurrentTaskHandle();
if(loopTaskHandle_g == NULL)
{
OSAL_error(__func__, __LINE__, EC_API_eERR_NULLPTR, true, 1, "Failed to get task handle\r\n");
}
error = EC_API_SLV_cbRegisterDirectTaskNotifyFunction(pApplicationInstance->ptEcSlvApi, EC_SLV_APP_loopTaskNotify, loopTaskHandle_g);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
OSAL_error(__func__, __LINE__, error, true, 1, "Task notify callback function register error\r\n");
}
#endif //(SDK_VARIANT_PREMIUM) && (ENABLE_LOOP_TASK_SYNC_TO_EVENTS == 1)
error = EC_SLV_APP_CiA_fetchAxisObjects(pApplicationInstance);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
OSAL_error(__func__, __LINE__, OSAL_STACK_INIT_ERROR, true, 0);
}
for(;;)
{
#if (defined GPIO_TEST_PINS) && (1==GPIO_TEST_PINS)
#if (defined GPIO_TEST_PROFILE_SEL) && (defined GPIO_TEST_PROFILE_1) && (GPIO_TEST_PROFILE_1 == GPIO_TEST_PROFILE_SEL)
ESL_GPIO_testPins_set(ESL_TESTPIN_STATE_REG_BANK, ESL_TESTPIN_0_MASK/*|ESL_TESTPIN_1_MASK*/);
#endif
#endif
#if (defined GPIO_TEST_PINS) && (1==GPIO_TEST_PINS)
#if (defined GPIO_TEST_PROFILE_SEL) && (defined GPIO_TEST_PROFILE_1) && (GPIO_TEST_PROFILE_1 == GPIO_TEST_PROFILE_SEL)
ESL_GPIO_testPins_clear(ESL_TESTPIN_STATE_REG_BANK, ESL_TESTPIN_0_MASK);
#endif
#endif
#if defined(SDK_VARIANT_PREMIUM) && (ENABLE_LOOP_TASK_SYNC_TO_EVENTS == 1)
ulTaskNotifyTakeIndexed(LOOP_TASK_NOTIFICATION_INDEX, pdTRUE, loopTaskMaxBlockTime);
#else
EC_API_SLV_getState(pApplicationInstance->ptEcSlvApi, &state, &alErrorCode);
if (EC_API_SLV_eESM_init < state)
{
OSAL_SCHED_yield();
}
else
{
/* for carve up give some air */
OSAL_SCHED_sleep(THREAD_IDLE_TIMEOUT);
}
#endif
}
Exit:
ESL_OS_taskLeave();
return;
}
static void EC_SLV_APP_CIA_mainTask(void *pArg_p)
{
/* @cppcheck_justify{misra-c2012-11.5} generic API requires cast */
/* cppcheck-suppress misra-c2012-11.5 */
uint32_t retVal = OSAL_ERR_NoError;
if (!applicationInstance)
{
OSAL_error(__func__, __LINE__, OSAL_ERR_InvalidParm, true, 1, "Application instance missing!!!\r\n");
goto Exit;
}
retVal = ESL_OS_boardInit(applicationInstance->selectedPruInstance);
if (OSAL_ERR_NoError != retVal)
{
OSAL_error(__func__, __LINE__, retVal, true, 1, "OS Board init error\r\n");
}
retVal = ESL_OS_printfMutexInit();
if (OSAL_ERR_NoError != retVal)
{
// @cppcheck_justify{misra-c2012-15.1} use goto Exit for single point of return
//cppcheck-suppress misra-c2012-15.1
goto Exit;
}
OSAL_registerPrintOut(NULL, ESL_OS_printf);
retVal = EC_SLV_APP_CIA_remoteInit(applicationInstance);
if(!((OSAL_CONTAINER_LOCALIMPLEMENTATION == retVal) || (OSAL_ERR_NoError == retVal)))
{
OSAL_error(__func__, __LINE__, OSAL_ERR_InvalidParm, true, 1, "Fatal error remote API init!!!\r\n");
/* @cppcheck_justify{misra-c2012-15.1} assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
EC_SLV_APP_Pinmux_config();
retVal = EC_API_SLV_load(NULL /* &applErrHandler*/, applicationInstance->selectedPruInstance);
if (EC_API_eERR_NONE == retVal)
{
EC_API_SLV_prepareTasks(KBECSLV_PRIO_PDI, KBECSLV_PRIO_LED, KBECSLV_PRIO_SYNC0, KBECSLV_PRIO_SYNC1,
KBECSLV_STACKSIZE_PDI, KBECSLV_STACKSIZE_LED, KBECSLV_STACKSIZE_SYNC0,
KBECSLV_STACKSIZE_SYNC1);
applicationInstance->loopThreadHandle = OSAL_SCHED_startTask(EC_SLV_APP_CIA_loopTask
,applicationInstance
#if !(defined FBTL_REMOTE) || (0==FBTL_REMOTE)
,OSAL_TASK_Prio_Normal
#else
,OSAL_TASK_Prio_Idle
#endif
,(uint8_t*)EC_SLV_APP_applLoopTaskStack_g
,APPLLOOP_TASK_SIZE_BYTE
,0
,"Appl_LoopTask");
if ( NULL == applicationInstance->loopThreadHandle)
{
OSAL_printf("Error return start Loop Task\r\n");
OSAL_error(__func__, __LINE__, OSAL_STACK_INIT_ERROR, true, 0);
}
OSAL_SCHED_joinTask(applicationInstance->loopThreadHandle);
/* No default tasks (run forever) here, so introduce a wait cycle */
for (;;)
{
OSAL_SCHED_sleep(1000);
}
}
else
{
for (;;)
{
for (;;)
{
OSAL_printf("long jmp restart\r\n");
OSAL_SCHED_sleep(1000);
}
}
}
// not reachable
//ESL_OS_boardDeinit();
//EC_API_SLV_unLoad();
//return 0;
Exit:
return;
}
int main(int argc, char *argv[])
{
/* @cppcheck_justify{threadsafety-threadsafety} no called reentrant */
/* cppcheck-suppress threadsafety-threadsafety */
static uint32_t selectedPruInstance = UINT32_MAX;
/* @cppcheck_justify{threadsafety-threadsafety} no called reentrant */
/* cppcheck-suppress threadsafety-threadsafety */
static EC_SLV_APP_CIA_Application_t applicationInstance = {0};
uint32_t error = OSAL_ERR_NoError;
ESL_OS_init();
#if !(defined FBTL_REMOTE)
selectedPruInstance = ESL_DEFAULT_PRUICSS;
#endif
if (1 < argc)
{
char *inst = argv[1];
selectedPruInstance = strtoul(inst, NULL, 0);
}
/* Init osal */
OSAL_init();
applicationInstance.selectedPruInstance = selectedPruInstance;
TaskP_Params_init(&applicationInstance.mainThreadParam);
applicationInstance.mainThreadParam.name = "mainThread";
applicationInstance.mainThreadParam.stackSize = MAIN_TASK_SIZE_BYTE; /* FreeRTOS wants Stacksize in Units, when called direct, using TaskP it's bytes */
applicationInstance.mainThreadParam.stack = (uint8_t*)EC_SLV_APP_mainTaskStack_g;
applicationInstance.mainThreadParam.priority = (TaskP_PRIORITY_HIGHEST-1);
applicationInstance.mainThreadParam.taskMain = (TaskP_FxnMain)EC_SLV_APP_CIA_mainTask;
applicationInstance.mainThreadParam.args = (void*)&applicationInstance;
error = TaskP_construct(&applicationInstance.mainThreadHandle
,&applicationInstance.mainThreadParam);
if (SystemP_SUCCESS != error)
{
OSAL_printf("Error setting create thread of %s (%ld)\r\n", applicationInstance.mainThreadParam.name, error);
OSAL_error(__func__, __LINE__, OSAL_STACK_INIT_ERROR, true, 0);
}
OSAL_startOs();
OSAL_error(__func__, __LINE__, OSAL_ERR_InvalidParm, true, 1, "Not reachable by design!!!\r\n");
// not reachable
//EC_API_SLV_unLoad();
return error;
}
static uint32_t EC_SLV_APP_CIA_remoteInit(EC_SLV_APP_CIA_Application_t *applicationInstance)
{
uint32_t retVal = OSAL_CONTAINER_LOCALIMPLEMENTATION;
if (!applicationInstance)
{
/* @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 FBTL_REMOTE) && (FBTL_REMOTE==1)
#if (defined FBTLIMPL_LINEUART) && (FBTLIMPL_LINEUART==1)
retVal = SYSLIB_createLibInstanceLine( FBTL_LINE_UART_NAME,
FBTL_MAX_ASYNC_LEN, FBTL_MAX_ASYNC_LEN,
FBTL_MAX_PD_LEN, FBTL_MAX_PD_LEN
#if (defined FBTLTRACECALLS) && (FBTLTRACECALLS==1)
,true
#else
,false
#endif
,&(applicationInstance->remoteHandle)
);
#else
retVal = SYSLIB_createLibInstanceShm(FBTLSHARED_MEM_NAME, FBTLSHARED_MEM_SIZE, false,
FBTL_MAX_ASYNC_LEN, FBTL_MAX_ASYNC_LEN, FBTL_MAX_PD_LEN, FBTL_MAX_PD_LEN
#if (defined FBTLTRACECALLS) && (FBTLTRACECALLS==1)
,true
#else
,false
#endif
,&(applicationInstance->remoteHandle)
);
#endif
#else
OSALUNREF_PARM(applicationInstance);
retVal = OSAL_CONTAINER_LOCALIMPLEMENTATION;
#endif
if(OSAL_CONTAINER_LOCALIMPLEMENTATION == retVal)
{
OSAL_printf("\r\nLocal Implementation\r\n");
}
#if (defined FBTL_REMOTE) && (FBTL_REMOTE==1)
else if(EC_API_eERR_NONE == retVal)
{
retVal = EC_API_SLV_FBTL_configuration(applicationInstance->remoteHandle);
if(EC_API_eERR_NONE != retVal)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, retVal);
OSAL_error(__func__, __LINE__, OSAL_STACK_INIT_ERROR, 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;
}
}
#endif
else
{
/* nothing to do */
;
}
Exit:
if((OSAL_ERR_NoError != retVal) && (OSAL_CONTAINER_LOCALIMPLEMENTATION != retVal))
{
OSAL_printf("%s:%d::> err ret = 0x%x\r\n", __func__, __LINE__, retVal);
}
return retVal;
}
uint32_t EC_API_SLV_mainLoopCyclic(void)
Trigger stack mainloop.
Definition ecSlvApi.c:2343
uint32_t EC_API_SLV_stackInit(void)
This is the function to initialize Stack backend.
Definition ecSlvApi.c:784
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_getVendorId(EC_API_SLV_SHandle_t *pHandle, uint32_t *pVendorId)
Get device vendor ID.
Definition ecSlvApi_param.c:878
uint32_t EC_API_SLV_getProductName(EC_API_SLV_SHandle_t *pHandle, char **ppProductName)
Get serial number.
Definition ecSlvApi_param.c:1079
uint32_t EC_API_SLV_getProductCode(EC_API_SLV_SHandle_t *pHandle, uint32_t *pProductCode)
Get device product code.
Definition ecSlvApi_param.c:928
uint32_t EC_API_SLV_CiA402_enableStateMachineForAxis(EC_API_SLV_SHandle_t *pHandle, uint8_t axisNo, bool enable)
Activate CiA402 state machine for an axis.
Definition ecSlvApi_CiA402.c:311
@ EC_API_eERR_NULLPTR
Definition ecSlvApiDef_error.h:54
@ EC_API_eERR_NONE
Definition ecSlvApiDef_error.h:41
uint32_t EC_API_SLV_stackInsertPruFirmware(uint32_t *pFirmwareIn, uint32_t lenFirmwareIn, uint32_t *pFirmwareOut, uint32_t lenFirmwareOut)
Insert fieldbus custom PRU firmware.
Definition ecSlvApi.c:824
uint32_t EC_API_SLV_stackInsertMdioManualFirmware(uint32_t *pFirmware, uint32_t lenFirmware)
Insert PRU firmware for manual MDIO workaround.
Definition ecSlvApi.c:869
enum EC_API_SLV_EEsmState EC_API_SLV_EEsmState_t
EC_STATE_T EtherCAT State Machine states.
@ 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_CIA_applicationInit(EC_SLV_APP_CIA_Application_t *pAppInstance_p)
Initialize subdevice application example.
Definition ecSubDeviceCiA402.c:959
void ESL_dumpVersions(EC_API_SLV_SHandle_t *pEcSubDevice)
Dump stack version info.
Definition ESL_version.c:73
uint32_t EC_API_SLV_load(OSAL_ERR_CBHandler_t cbErrHandler, uint32_t pruSelect)
Initialize stack environment (OSAL and HWAL) after load.
Definition ecSlvApi.c:634
uint32_t EC_API_SLV_prepareTasks(OSAL_TASK_Priority_t pdiTaskPrio, OSAL_TASK_Priority_t statusLEDTaskPrio, OSAL_TASK_Priority_t sync0TaskPrio, OSAL_TASK_Priority_t sync1TaskPrio, uint32_t pdiTaskStackSize, uint32_t statusLEDTaskStackSize, uint32_t sync0TaskStackSize, uint32_t sync1TaskStackSize)
Prepare internal task priorities.
Definition ecSlvApi.c:747
TaskP_Object mainThreadHandle
Definition ecSubDeviceCiA402.h:169
void * loopThreadHandle
Definition ecSubDeviceCiA402.h:171
TaskP_Params mainThreadParam
Definition ecSubDeviceCiA402.h:170
uint32_t selectedPruInstance
Definition ecSubDeviceCiA402.h:166
EC_API_SLV_SHandle_t * ptEcSlvApi
Definition ecSubDeviceCiA402.h:207
void * remoteHandle
Definition ecSubDeviceCiA402.h:175
Definition ecSubDeviceCiA402.h:165