EtherCAT Slave1.12.02
ESL_cia402Obd.c

Interface for creating CiA 402 Object Dictionary - "AXES_NUMBER" axes.

Author
KUNBUS GmbH
Date
2022-04-01
#include "ESL_cia402Obd.h"
#include "ESL_cia402Demo.h"
#include "ecSlvCiA402.h"
#include <ecSlvApi.h>
#include <ecSlvApi_Error.h>
#include <ecSlvApiDef.h>
uint32_t EC_SLV_APP_cia402ObjectDictionary(void* pContext_p)
{
EC_SLV_APP_Sapplication_t* pApplicationInstance = (EC_SLV_APP_Sapplication_t*)pContext_p;
EC_API_SLV_SHandle_t* pEcApiSlv = NULL;
uint32_t error = EC_API_eERR_INVALID;
uint8_t axis;
EC_API_SLV_SCoE_Object_t* pObj607B = NULL;
EC_API_SLV_SCoE_Object_t* pObj607D = NULL;
EC_API_SLV_SCoE_Object_t* pObj608F = NULL;
EC_API_SLV_SCoE_Object_t* pObj6090 = NULL;
EC_API_SLV_SCoE_Object_t* pObj6091 = NULL;
EC_API_SLV_SCoE_Object_t* pObj6092 = NULL;
EC_API_SLV_SCoE_Object_t* pObj6096 = NULL;
EC_API_SLV_SCoE_Object_t* pObj6099 = NULL;
EC_API_SLV_SCoE_Object_t* pObj60C2 = NULL;
if (!pApplicationInstance)
{
goto Exit;
}
pEcApiSlv = pApplicationInstance->ptEcSlvApi;
for(axis = 0; axis < AXES_NUMBER; ++axis)
{
//Object 0x6007: Abort connection
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_ABORT_CONNECTION_OPTION_CODE_INDEX(axis), "Abort connection option code", DEFTYPE_INTEGER16, 16, ACCESS_READWRITE, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6040: Controlword
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, pApplicationInstance->CiA402_axisData[axis].controlWordIndex.objectIndex, "Controlword", DEFTYPE_UNSIGNED16, 16, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6041: Statusword
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, pApplicationInstance->CiA402_axisData[axis].statusWordIndex.objectIndex, "Statusword", DEFTYPE_UNSIGNED16, 16, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x605A: Quickstop option code
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, pApplicationInstance->CiA402_axisData[axis].quickStopIndex.objectIndex, "Quick stop option code", DEFTYPE_INTEGER16, 16, ACCESS_READWRITE, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x605B: Shutdown option code
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, pApplicationInstance->CiA402_axisData[axis].shutdownIndex.objectIndex, "Shutdown option code", DEFTYPE_INTEGER16, 16, ACCESS_READWRITE, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x605C: Disable operation option code
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, pApplicationInstance->CiA402_axisData[axis].disableOperationIndex.objectIndex, "Disable operation option code", DEFTYPE_INTEGER16, 16, ACCESS_READWRITE, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x605D: Halt option code
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_HALT_OPTION_CODE_INDEX(axis), "Halt option code", DEFTYPE_INTEGER16, 16, ACCESS_READWRITE, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x605E: Fault reaction option code
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, pApplicationInstance->CiA402_axisData[axis].faultReactionIndex.objectIndex, "Fault reaction option code", DEFTYPE_INTEGER16, 16, ACCESS_READWRITE, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6060: Mode of operation
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, pApplicationInstance->CiA402_axisData[axis].modesOfOperationIndex.objectIndex, "Modes of operation", DEFTYPE_INTEGER8, 8, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6061: Modes of operation display
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, pApplicationInstance->CiA402_axisData[axis].modesOfOperationDisplayIndex.objectIndex, "Modes of operation display", DEFTYPE_INTEGER8, 8, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6062: Position demand value
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_POSITION_DEMAND_VALUE_INDEX(axis), "Position demand value", DEFTYPE_INTEGER32, 32, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6063: Position actual internal value
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_POSITION_ACTUAL_INTERNAL_VALUE_INDEX(axis), "Position actual internal value", DEFTYPE_INTEGER32, 32, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6064: Position actual value
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, pApplicationInstance->CiA402_axisData[axis].positionActualValueIndex.objectIndex, "Position actual value", DEFTYPE_INTEGER32, 32, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6065: Following error window
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_FOLLOWING_ERROR_WINDOW_INDEX(axis), "Following error window", DEFTYPE_UNSIGNED32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6066: Following error timeout
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_FOLLOWING_ERROR_TIMEOUT_INDEX(axis), "Following error time out", DEFTYPE_UNSIGNED16, 16, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6067: Position window
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_POSITION_WINDOW_INDEX(axis), "Position window", DEFTYPE_UNSIGNED32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6068: Position window time
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_POSITION_WINDOW_TIME_INDEX(axis), "Position window time", DEFTYPE_UNSIGNED16, 16, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6069: Velocity sensor actual value
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_VELOCITY_SENSOR_ACTUAL_VALUE_INDEX(axis), "Velocity sensor actual value", DEFTYPE_INTEGER32, 32, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x606B: Velocity demand value
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_VELOCITY_DEMAND_VALUE_INDEX(axis), "Velocity demand value", DEFTYPE_INTEGER32, 32, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x606C: Velocity actual value
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, pApplicationInstance->CiA402_axisData[axis].velocityActualValueIndex.objectIndex, "Velocity actual value", DEFTYPE_INTEGER32, 32, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x606D: Velocity window
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_VELOCITY_WINDOW_INDEX(axis), "Velocity window", DEFTYPE_UNSIGNED16, 16, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x606E: Velocity window time
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_VELOCITY_WINDOW_TIME_INDEX(axis), "Velocity window time", DEFTYPE_UNSIGNED16, 16, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x606F: Velocity threshold
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_VELOCITY_THRESHOLD_INDEX(axis), "Velocity threshold", DEFTYPE_UNSIGNED16, 16, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6070: Velocity threshold time
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_VELOCITY_THRESHOLD_TIME_INDEX(axis), "Velocity threshold time", DEFTYPE_UNSIGNED16, 16, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6071: Target torque
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, pApplicationInstance->CiA402_axisData[axis].targetTorqueIndex.objectIndex, "Target torque", DEFTYPE_INTEGER16, 16, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6072: Max torque
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_MAX_TORQUE_INDEX(axis), "Max torque", DEFTYPE_UNSIGNED16, 16, ACCESS_READWRITE, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6074: Torque demand
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_TORQUE_DEMAND_INDEX(axis), "Torque demand", DEFTYPE_INTEGER16, 16, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6077: Torque actual value
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, pApplicationInstance->CiA402_axisData[axis].torqueActualValueIndex.objectIndex, "Torque actual value", DEFTYPE_INTEGER16, 16, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6078: Current actual value
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_CURRENT_ACTUAL_VALUE_INDEX(axis), "Current actual value", DEFTYPE_INTEGER16, 16, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x607A: Target position
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, pApplicationInstance->CiA402_axisData[axis].targetPositionIndex.objectIndex, "Target position", DEFTYPE_INTEGER32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x607B: Position range limit
error = EC_API_SLV_CoE_odAddRecord(pEcApiSlv, OBD_POSITION_RANGE_LIMIT_INDEX(axis), "Position range limit", NULL, NULL, NULL, NULL, &pObj607B);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
if(pObj607B)
{
error = EC_API_SLV_CoE_configRecordSubIndex(pEcApiSlv, pObj607B, 1, "Min position range limit", DEFTYPE_INTEGER32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
error = EC_API_SLV_CoE_configRecordSubIndex(pEcApiSlv, pObj607B, 2, "Max position range limit", DEFTYPE_INTEGER32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
}
//Object 0x607C: Home offset
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_HOME_OFFSET_INDEX(axis), "Home offset", DEFTYPE_INTEGER32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x607D: Software position limit
error = EC_API_SLV_CoE_odAddRecord(pEcApiSlv, pApplicationInstance->CiA402_axisData[axis].swPositionLimitIndex.objectIndex, "Software position limit", NULL, NULL, NULL, NULL, &pObj607D);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
if(pObj607D)
{
error = EC_API_SLV_CoE_configRecordSubIndex(pEcApiSlv, pObj607D, 1, "Min position limit", DEFTYPE_INTEGER32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
error = EC_API_SLV_CoE_configRecordSubIndex(pEcApiSlv, pObj607D, 2, "Max position limit", DEFTYPE_INTEGER32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
}
//Object 0x607E: Polarity
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_POLARITY_INDEX(axis), "Polarity", DEFTYPE_UNSIGNED8, 8, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6080: Max motor speed
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_MAX_MOTOR_SPEED_INDEX(axis), "Max motor speed", DEFTYPE_UNSIGNED32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6081: Profile velocity
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_PROFILE_VELOCITY_INDEX(axis), "Profile velocity", DEFTYPE_UNSIGNED32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6083: Profile acceleration
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_PROFILE_ACCELERATION_INDEX(axis), "Profile acceleration", DEFTYPE_UNSIGNED32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6084: Profile deceleration
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_PROFILE_DECELERATION_INDEX(axis), "Profile deceleration", DEFTYPE_UNSIGNED32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6085: Quickstop deceleration
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_QUISTOP_DECELERATION_INDEX(axis), "Quick stop deceleration", DEFTYPE_UNSIGNED32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6086: Motion profile type
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_MOTION_PROFILE_TYPE_INDEX(axis), "Motion profile type", DEFTYPE_INTEGER16, 16, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x608F: Position encoder resolution
error = EC_API_SLV_CoE_odAddRecord(pEcApiSlv, OBD_POSITION_ENCODER_RESOLUTION_INDEX(axis), "Position encoder resolution", NULL, NULL, NULL, NULL, &pObj608F);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
if(pObj608F)
{
error = EC_API_SLV_CoE_configRecordSubIndex(pEcApiSlv, pObj608F, 1, "Encoder increments", DEFTYPE_UNSIGNED32, 32, ACCESS_READ);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
error = EC_API_SLV_CoE_configRecordSubIndex(pEcApiSlv, pObj608F, 2, "Motor revolutions", DEFTYPE_UNSIGNED32, 32, ACCESS_READ);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
}
//Object 0x6090: Velocity encoder resolution
error = EC_API_SLV_CoE_odAddRecord(pEcApiSlv, OBD_VELOCITY_ENCONDER_RESOLUTION_INDEX(axis), "Velocity encoder resolution", NULL, NULL, NULL, NULL, &pObj6090);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
if(pObj6090)
{
error = EC_API_SLV_CoE_configRecordSubIndex(pEcApiSlv, pObj6090, 1, "Encoder increments", DEFTYPE_UNSIGNED32, 32, ACCESS_READ);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
error = EC_API_SLV_CoE_configRecordSubIndex(pEcApiSlv, pObj6090, 2, "Motor revolutions", DEFTYPE_UNSIGNED32, 32, ACCESS_READ);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
}
//Object 0x6091: Gear ratio
error = EC_API_SLV_CoE_odAddRecord(pEcApiSlv, OBD_GEAR_RATIO_INDEX(axis), "Gear ratio", NULL, NULL, NULL, NULL, &pObj6091);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
if(pObj6091)
{
error = EC_API_SLV_CoE_configRecordSubIndex(pEcApiSlv, pObj6091, 1, "Motor shaft revolutions", DEFTYPE_UNSIGNED32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
error = EC_API_SLV_CoE_configRecordSubIndex(pEcApiSlv, pObj6091, 2, "Driving shaft revolutions", DEFTYPE_UNSIGNED32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
}
//Object 0x6092: Feed constant
error = EC_API_SLV_CoE_odAddRecord(pEcApiSlv, OBD_FEED_CONSTANT_INDEX(axis), "Feed constant", NULL, NULL, NULL, NULL, &pObj6092);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
if(pObj6092)
{
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
error = EC_API_SLV_CoE_configRecordSubIndex(pEcApiSlv, pObj6092, 2, "Shaft revolutions", DEFTYPE_UNSIGNED32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
}
//Object 0x6096: Velocity factor
error = EC_API_SLV_CoE_odAddRecord(pEcApiSlv, OBD_VELOCITY_FACTOR_INDEX(axis), "Velocity factor", NULL, NULL, NULL, NULL, &pObj6096);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
if(pObj6096)
{
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
}
//Object 0x6098: Homing method
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_HOMING_METHOD_INDEX(axis), "Homing method", DEFTYPE_INTEGER8, 8, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6099: Homing speeds
error = EC_API_SLV_CoE_odAddRecord(pEcApiSlv, OBD_HOMING_SPEEDS_INDEX(axis), "Homing speeds", NULL, NULL, NULL, NULL, &pObj6099);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
if(pObj6099)
{
error = EC_API_SLV_CoE_configRecordSubIndex(pEcApiSlv, pObj6099, 1, "Switch seek velocity", DEFTYPE_UNSIGNED32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
error = EC_API_SLV_CoE_configRecordSubIndex(pEcApiSlv, pObj6099, 2, "Homing speed", DEFTYPE_UNSIGNED32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
}
//Object 0x609A: Homing acceleration
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_HOMING_ACCELERATION_INDEX(axis), "Homing acceleration", DEFTYPE_UNSIGNED32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60B0: Position offset
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_POSITION_OFFSET_INDEX(axis), "Position offset", DEFTYPE_INTEGER32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60B1: Velocity offset
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_VELOCITY_OFFSET_INDEX(axis), "Velocity offset", DEFTYPE_INTEGER32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60B2: Torque offset
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_TORQUE_OFFSET_INDEX(axis), "Torque offset", DEFTYPE_INTEGER16, 16, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60B8: Touch probe function
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_TOUCH_PROBE_FUNCTION_INDEX(axis), "Touch probe function", DEFTYPE_UNSIGNED16, 16, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60B9: Touch probe status
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_TOUCH_PROBE_STATUS_INDEX(axis), "Touch probe status", DEFTYPE_UNSIGNED16, 16, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60BA: Touch probe 1 positive edge
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_TOUCH_PROBE_1_POS_EDGE_INDEX(axis), "Touch probe 1 positive edge", DEFTYPE_INTEGER32, 32, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60BB: Touch probe 1 negative edge
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_TOUCH_PROBE_1_NEG_EDGE_INDEX(axis), "Touch probe 1 negative edge", DEFTYPE_INTEGER32, 32, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60BC: Touch probe 2 positive edge
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_TOUCH_PROBE_2_POS_EDGE_INDEX(axis), "Touch probe 2 positive edge", DEFTYPE_INTEGER32, 32, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60BD: Touch probe 2 negative edge
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_TOUCH_PROBE_2_NEG_EDGE_INDEX(axis), "Touch probe 2 negative edge", DEFTYPE_INTEGER32, 32, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60C2: Interpolation time period
error = EC_API_SLV_CoE_odAddRecord(pEcApiSlv, OBD_INTERPOLATION_TIME_PERIOD_INDEX(axis), "Interpolation time period", NULL, NULL, NULL, NULL, &pObj60C2);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
if(pObj60C2)
{
error = EC_API_SLV_CoE_configRecordSubIndex(pEcApiSlv, pObj60C2, 1, "Interpolation time period value", DEFTYPE_UNSIGNED8, 8, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
error = EC_API_SLV_CoE_configRecordSubIndex(pEcApiSlv, pObj60C2, 2, "Interpolation time index", DEFTYPE_INTEGER8, 8, ACCESS_READ);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
}
//Object 0x60C5: Max acceleration
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_MAX_ACCELERATION_INDEX(axis), "Max acceleration", DEFTYPE_UNSIGNED32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60C6: Max deceleration
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_MAX_DECELERATION_INDEX(axis), "Max deceleration", DEFTYPE_UNSIGNED32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60D0: Touch probe source
error = EC_API_SLV_CoE_odAddArray(pEcApiSlv, OBD_TOUCH_PROBE_SOURCE(axis), "Touch probe source", 2, DEFTYPE_INTEGER16, 16, ACCESS_READ, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60D5: Touch probe 1 positive edge counter
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_TOUCH_PROBE_1_POS_EDGE_CNT_INDEX(axis), "Touch probe 1 positive edge counter", DEFTYPE_UNSIGNED16, 16, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60D6: Touch probe 1 negative edge counter
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_TOUCH_PROBE_1_NEG_EDGE_CNT_INDEX(axis), "Touch probe 1 negative edge counter", DEFTYPE_UNSIGNED16, 16, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60D7: Touch probe 2 positive edge counter
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_TOUCH_PROBE_2_POS_EDGE_CNT_INDEX(axis), "Touch probe 2 positive edge counter", DEFTYPE_UNSIGNED16, 16, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60D8: Touch probe 2 negative edge counter
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_TOUCH_PROBE_2_NEG_EDGE_CNT_INDEX(axis), "Touch probe 2 negative edge counter", DEFTYPE_UNSIGNED16, 16, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60E0: Positive torque limit value
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_POSITIVE_TORQUE_LIMIT_VALUE_INDEX(axis), "Positive torque limit value", DEFTYPE_UNSIGNED16, 16, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60E1: Negative torque limit value
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_NEGATIVE_TORQUE_LIMIT_VALUE_INDEX(axis), "Negative torque limit value", DEFTYPE_UNSIGNED16, 16, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60F4: Following error actual value
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, OBD_FOLLOWING_ERROR_ACTUAL_VALUE_INDEX(axis), "Following error actual value", DEFTYPE_INTEGER32, 32, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x60FF: Target velocity
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, pApplicationInstance->CiA402_axisData[axis].targetVelocityIndex.objectIndex, "Target velocity", DEFTYPE_INTEGER32, 32, ACCESS_READWRITE | OBJACCESS_RXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
//Object 0x6502: Support drive modes
error = EC_API_SLV_CoE_odAddVariable(pEcApiSlv, pApplicationInstance->CiA402_axisData[axis].supportedDriveModesIndex.objectIndex, "Supported drive modes", DEFTYPE_UNSIGNED32, 32, ACCESS_READ | OBJACCESS_TXPDOMAPPING, NULL, NULL, NULL, NULL);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("%s:%d Error code: 0x%08x\r\n", __func__, __LINE__, error);
goto Exit;
}
}
Exit:
return error;
}
void EC_SLV_APP_cia402_initAxisObjects(void* pContext_p)
{
uint8_t axisIter = 0;
if (!pApp_p)
{
goto Exit;
}
for (axisIter = 0; axisIter < AXES_NUMBER; ++axisIter)
{
}
Exit:
return;
}
#define EC_SLV_APP_CoE_MAPSDO(error, axisObjectEntry) \
(error) = EC_API_SLV_CoE_getObject(pApp_p->ptEcSlvApi, (axisObjectEntry).objectIndex, &((axisObjectEntry).pSdo)); \
if (EC_API_eERR_NONE != (error)){ \
OSAL_printf("Cannot get object at index <0x%x>\r\n", (axisObjectEntry).objectIndex); goto Exit; }
uint32_t EC_SLV_APP_CiA_fetchAxisObjects(void* pContext_p)
{
uint8_t axisIter = 0;
uint32_t err = EC_API_eERR_INVALID;
if (!pApp_p)
{
goto Exit;
}
for ( axisIter = 0; axisIter < AXES_NUMBER; ++axisIter)
{
EC_SLV_APP_CoE_MAPSDO(err, pApp_p->CiA402_axisData[axisIter].controlWordIndex);
EC_SLV_APP_CoE_MAPSDO(err, pApp_p->CiA402_axisData[axisIter].statusWordIndex);
EC_SLV_APP_CoE_MAPSDO(err, pApp_p->CiA402_axisData[axisIter].quickStopIndex);
EC_SLV_APP_CoE_MAPSDO(err, pApp_p->CiA402_axisData[axisIter].shutdownIndex);
EC_SLV_APP_CoE_MAPSDO(err, pApp_p->CiA402_axisData[axisIter].disableOperationIndex);
EC_SLV_APP_CoE_MAPSDO(err, pApp_p->CiA402_axisData[axisIter].faultReactionIndex);
EC_SLV_APP_CoE_MAPSDO(err, pApp_p->CiA402_axisData[axisIter].modesOfOperationIndex);
EC_SLV_APP_CoE_MAPSDO(err, pApp_p->CiA402_axisData[axisIter].modesOfOperationDisplayIndex);
EC_SLV_APP_CoE_MAPSDO(err, pApp_p->CiA402_axisData[axisIter].positionActualValueIndex);
EC_SLV_APP_CoE_MAPSDO(err, pApp_p->CiA402_axisData[axisIter].velocityActualValueIndex);
EC_SLV_APP_CoE_MAPSDO(err, pApp_p->CiA402_axisData[axisIter].targetTorqueIndex);
EC_SLV_APP_CoE_MAPSDO(err, pApp_p->CiA402_axisData[axisIter].torqueActualValueIndex);
EC_SLV_APP_CoE_MAPSDO(err, pApp_p->CiA402_axisData[axisIter].targetPositionIndex);
EC_SLV_APP_CoE_MAPSDO(err, pApp_p->CiA402_axisData[axisIter].swPositionLimitIndex);
EC_SLV_APP_CoE_MAPSDO(err, pApp_p->CiA402_axisData[axisIter].targetVelocityIndex);
EC_SLV_APP_CoE_MAPSDO(err, pApp_p->CiA402_axisData[axisIter].supportedDriveModesIndex);
if (EC_API_eERR_NONE != (err))
{
OSAL_printf("Cannot get objectEntry at index <0x%x> subindex <0x%x> \r\n",
goto Exit;
}
if (EC_API_eERR_NONE != (err))
{
OSAL_printf("Cannot get objectEntry at index <0x%x> subindex <0x%x> \r\n",
goto Exit;
}
sizeof(pApp_p->CiA402_axisData[axisIter].posLimitMin),
(uint16_t *) &pApp_p->CiA402_axisData[axisIter].posLimitMin);
sizeof(pApp_p->CiA402_axisData[axisIter].posLimitMax),
(uint16_t *) &pApp_p->CiA402_axisData[axisIter].posLimitMax);
}
Exit:
return err;
}
#define EC_SLV_APP_CoE_GETPDOOFFSETS(axisObjectEntry) \
if ((axisObjectEntry).pdoObject) { (axisObjectEntry).pdoOffset = EC_API_SLV_PDO_getOffset((axisObjectEntry).pdoObject) + (axisObjectEntry).pdoObjectOffset; }
uint32_t EC_SLV_APP_CiA_fetchPDOffsets(void* pContext_p)
{
uint8_t axisIter = 0;
uint32_t err = EC_API_eERR_INVALID;
if (!pApp_p)
{
goto Exit;
}
for ( axisIter = 0; axisIter < AXES_NUMBER; ++axisIter)
{
EC_SLV_APP_CoE_GETPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].controlWordIndex);
EC_SLV_APP_CoE_GETPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].statusWordIndex);
EC_SLV_APP_CoE_GETPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].quickStopIndex);
EC_SLV_APP_CoE_GETPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].shutdownIndex);
EC_SLV_APP_CoE_GETPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].disableOperationIndex);
EC_SLV_APP_CoE_GETPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].faultReactionIndex);
EC_SLV_APP_CoE_GETPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].modesOfOperationIndex);
EC_SLV_APP_CoE_GETPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].modesOfOperationDisplayIndex);
EC_SLV_APP_CoE_GETPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].positionActualValueIndex);
EC_SLV_APP_CoE_GETPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].velocityActualValueIndex);
EC_SLV_APP_CoE_GETPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].targetTorqueIndex);
EC_SLV_APP_CoE_GETPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].torqueActualValueIndex);
EC_SLV_APP_CoE_GETPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].targetPositionIndex);
EC_SLV_APP_CoE_GETPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].swPositionLimitIndex);
EC_SLV_APP_CoE_GETPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].targetVelocityIndex);
EC_SLV_APP_CoE_GETPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].supportedDriveModesIndex);
}
Exit:
return err;
}
#define EC_SLV_APP_CoE_CLEARPDOOFFSETS(axisObjectEntry) \
(axisObjectEntry).pdoObjectOffset = 0; (axisObjectEntry).pdoOffset = 0;
uint32_t EC_SLV_APP_CiA_dropPDOffsets(void* pContext_p)
{
uint8_t axisIter = 0;
uint32_t err = EC_API_eERR_INVALID;
if (!pApp_p)
{
goto Exit;
}
for ( axisIter = 0; axisIter < AXES_NUMBER; ++axisIter)
{
EC_SLV_APP_CoE_CLEARPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].controlWordIndex);
EC_SLV_APP_CoE_CLEARPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].statusWordIndex);
EC_SLV_APP_CoE_CLEARPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].quickStopIndex);
EC_SLV_APP_CoE_CLEARPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].shutdownIndex);
EC_SLV_APP_CoE_CLEARPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].disableOperationIndex);
EC_SLV_APP_CoE_CLEARPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].faultReactionIndex);
EC_SLV_APP_CoE_CLEARPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].modesOfOperationIndex);
EC_SLV_APP_CoE_CLEARPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].modesOfOperationDisplayIndex);
EC_SLV_APP_CoE_CLEARPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].positionActualValueIndex);
EC_SLV_APP_CoE_CLEARPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].velocityActualValueIndex);
EC_SLV_APP_CoE_CLEARPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].targetTorqueIndex);
EC_SLV_APP_CoE_CLEARPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].torqueActualValueIndex);
EC_SLV_APP_CoE_CLEARPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].targetPositionIndex);
EC_SLV_APP_CoE_CLEARPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].swPositionLimitIndex);
EC_SLV_APP_CoE_CLEARPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].targetVelocityIndex);
EC_SLV_APP_CoE_CLEARPDOOFFSETS(pApp_p->CiA402_axisData[axisIter].supportedDriveModesIndex);
}
Exit:
return err;
}
#define OBD_MAX_MOTOR_SPEED_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:396
#define OBD_TOUCH_PROBE_2_POS_EDGE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:421
#define OBD_CONTROLWORD_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:355
#define OBD_TORQUE_OFFSET_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:415
#define OBD_PROFILE_DECELERATION_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:399
#define OBD_VELOCITY_DEMAND_VALUE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:376
#define OBD_NEGATIVE_TORQUE_LIMIT_VALUE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:435
#define OBD_MODES_OF_OPERATION_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:364
#define OBD_STATUSWORD_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:356
#define OBD_FOLLOWING_ERROR_WINDOW_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:370
#define OBD_POSITION_WINDOW_TIME_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:373
#define OBD_TOUCH_PROBE_2_NEG_EDGE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:422
#define OBD_POLARITY_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:393
#define OBD_TARGET_VELOCITY_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:438
#define OBD_FOLLOWING_ERROR_ACTUAL_VALUE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:437
#define OBD_VELOCITY_SENSOR_ACTUAL_VALUE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:375
#define OBD_VELOCITY_WINDOW_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:378
#define OBD_TARGET_TORQUE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:383
#define OBD_POSITION_OFFSET_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:413
#define OBD_MOTION_PROFILE_TYPE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:401
#define OBD_VELOCITY_WINDOW_TIME_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:379
#define OBD_GEAR_RATIO_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:405
#define OBD_HOMING_SPEEDS_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:410
#define OBD_TORQUE_DEMAND_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:385
#define OBD_VELOCITY_OFFSET_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:414
#define OBD_FAULT_REACTION_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:362
#define OBD_HOMING_ACCELERATION_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:411
#define OBD_POSITION_DEMAND_VALUE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:367
#define OBD_HALT_OPTION_CODE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:361
#define OBD_VELOCITY_THRESHOLD_TIME_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:381
#define OBD_MAX_TORQUE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:384
#define OBD_PROFILE_VELOCITY_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:397
#define OBD_TOUCH_PROBE_2_POS_EDGE_CNT_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:431
#define OBD_VELOCITY_FACTOR_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:407
#define OBD_POSITION_WINDOW_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:372
#define OBD_TOUCH_PROBE_1_POS_EDGE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:419
#define OBD_POSITION_RANGE_LIMIT_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:390
#define OBD_INTERPOLATION_TIME_PERIOD_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:424
#define OBD_CURRENT_ACTUAL_VALUE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:387
#define OBD_TARGET_POSITION_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:388
uint32_t EC_SLV_APP_getCiA402ObjectEntryValue(void *pAppCtxt_p, EC_API_SLV_SCoE_ObjEntry_t *pObjectEntry_p, uint16_t length_p, uint16_t *pValue_p)
Read CiA402 Object entry.
Definition: ESL_cia402Demo.c:296
#define OBD_MODES_OF_OPERATION_DISPLAY_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:365
#define OBD_TOUCH_PROBE_FUNCTION_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:417
#define OBD_HOMING_METHOD_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:409
#define OBD_POSITION_ACTUAL_VALUE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:369
#define OBD_POSITION_ENCODER_RESOLUTION_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:403
#define OBD_DISABLE_OPERATION_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:360
#define OBD_FEED_CONSTANT_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:406
#define OBD_VELOCITY_THRESHOLD_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:380
#define OBD_TOUCH_PROBE_1_POS_EDGE_CNT_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:429
#define OBD_POSITIVE_TORQUE_LIMIT_VALUE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:434
#define OBD_VELOCITY_ENCONDER_RESOLUTION_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:404
#define OBD_POSITION_ACTUAL_INTERNAL_VALUE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:368
#define OBD_SW_POSITION_LIMIT_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:392
#define OBD_TOUCH_PROBE_2_NEG_EDGE_CNT_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:432
#define OBD_SUPPORTED_DRIVE_MODES_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:440
#define OBD_VELOCITY_ACTUAL_VALUE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:377
#define OBD_MAX_DECELERATION_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:426
#define OBD_TORQUE_ACTUAL_VALUE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:386
#define OBD_TOUCH_PROBE_1_NEG_EDGE_CNT_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:430
#define OBD_TOUCH_PROBE_SOURCE(x)
Definition: ecSlvApiDef_CiA402.h:428
#define OBD_ABORT_CONNECTION_OPTION_CODE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:353
#define OBD_QUICKSTOP_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:358
#define OBD_MAX_ACCELERATION_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:425
#define OBD_SHUTDOWN_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:359
#define OBD_HOME_OFFSET_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:391
#define OBD_FOLLOWING_ERROR_TIMEOUT_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:371
#define OBD_QUISTOP_DECELERATION_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:400
#define OBD_TOUCH_PROBE_1_NEG_EDGE_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:420
#define OBD_TOUCH_PROBE_STATUS_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:418
uint32_t EC_SLV_APP_cia402ObjectDictionary(void *pContext_p)
Generate CiA402 Objects.
Definition: ESL_cia402Obd.c:82
#define OBD_PROFILE_ACCELERATION_INDEX(x)
Definition: ecSlvApiDef_CiA402.h:398
@ EC_API_eERR_INVALID
Definition: ecSlvApi_Error.h:73
@ EC_API_eERR_NONE
Definition: ecSlvApi_Error.h:66
uint32_t EC_API_SLV_CoE_odAddArray(EC_API_SLV_SHandle_t *pEcSlaveApi_p, uint16_t index_p, char *pName_p, uint8_t arrayLen_p, uint16_t type_p, uint16_t bitLen_p, uint16_t flags_p, EC_API_SLV_CBObjRead_t cbRead_p, void *pReadCtxt_p, EC_API_SLV_CBObjWrite_t cbWrite_p, void *pWriteCtxt_p)
Definition: ecSlvApi_CoEStub.c:766
uint32_t EC_API_SLV_CoE_configRecordSubIndex(EC_API_SLV_SHandle_t *pEcSlaveApi_p, EC_API_SLV_SCoE_Object_t *pObject_p, uint8_t subIndex_p, char *pName_p, uint16_t type_p, uint16_t bitLen_p, uint16_t flags_p)
This function creates a subIndex for the Record Object.
Definition: ecSlvApi_CoEStub.c:867
uint32_t EC_API_SLV_CoE_odAddVariable(EC_API_SLV_SHandle_t *pEcSlaveApi_p, uint16_t index_p, char *pName_p, uint16_t type_p, uint16_t bitLen_p, uint16_t flags_p, EC_API_SLV_CBObjRead_t cbRead_p, void *pReadCtxt_p, EC_API_SLV_CBObjWrite_t cbWrite_p, void *pWriteCtxt_p)
This function creates a Base Data Type Object for the Object Dictionary.
Definition: ecSlvApi_CoEStub.c:711
uint32_t EC_API_SLV_CoE_getObjectEntryByObject(EC_API_SLV_SHandle_t *pEcSlaveApi_p, EC_API_SLV_SCoE_Object_t *pObject_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:461
uint32_t EC_API_SLV_CoE_odAddRecord(EC_API_SLV_SHandle_t *pEcSlaveApi_p, uint16_t index_p, char *pName_p, EC_API_SLV_CBObjRead_t cbRead_p, void *pReadCtxt_p, EC_API_SLV_CBObjWrite_t cbWrite_p, void *pWriteCtxt_p, EC_API_SLV_SCoE_Object_t **pOutSdo_p)
This function creates a Record Object.
Definition: ecSlvApi_CoEStub.c:818
@ EC_API_SLV_eERR_NO_ERROR
No error.
Definition: ecSlvApi.h:116
struct EC_API_SLV_SHandle EC_API_SLV_SHandle_t
EC_API_SLV_SHandle_t describes the EtherCAT Slave API.
Definition: ecSlvApi.h:157
struct EC_API_SLV_SCoE_Object EC_API_SLV_SCoE_Object_t
TSdo describes an Object Dictionary Object.
Definition: ecSlvApi.h:154
#define ACCESS_READWRITE
Read/write in all states.
Definition: ecSlvApiDef_CoE.h:169
#define ACCESS_READ
Read only in all states.
Definition: ecSlvApiDef_CoE.h:170
#define OBJACCESS_TXPDOMAPPING
Mappable in TxPDOs.
Definition: ecSlvApiDef_CoE.h:180
#define OBJACCESS_RXPDOMAPPING
Mappable in RxPDOs.
Definition: ecSlvApiDef_CoE.h:179
#define DEFTYPE_INTEGER8
INTEGER8.
Definition: ecSlvApiDef_CoE.h:66
#define DEFTYPE_UNSIGNED16
UNSIGNED16.
Definition: ecSlvApiDef_CoE.h:70
#define DEFTYPE_INTEGER16
INTEGER16.
Definition: ecSlvApiDef_CoE.h:67
#define DEFTYPE_UNSIGNED32
UNSIGNED32.
Definition: ecSlvApiDef_CoE.h:71
#define DEFTYPE_UNSIGNED8
UNSIGNED8.
Definition: ecSlvApiDef_CoE.h:69
#define DEFTYPE_INTEGER32
INTEGER32.
Definition: ecSlvApiDef_CoE.h:68
EC_API_SLV_SHandle_t * ptEcSlvApi
Definition: ecSlvSimple.h:97
EC_SLV_APP_sCIA_axisData_t CiA402_axisData[AXES_NUMBER]
Definition: ecSlvCiA402.h:206
Definition: ecSlvSimple.h:56
EC_SLV_APP_sCIA_object_t statusWordIndex
Definition: ecSlvCiA402.h:80
uint32_t posLimitMin
Definition: ecSlvCiA402.h:151
EC_SLV_APP_sCIA_object_t targetTorqueIndex
Definition: ecSlvCiA402.h:102
EC_SLV_APP_sCIA_object_t targetVelocityIndex
Definition: ecSlvCiA402.h:112
EC_SLV_APP_sCIA_object_t faultReactionIndex
Definition: ecSlvCiA402.h:85
EC_SLV_APP_sCIA_object_t modesOfOperationDisplayIndex
Definition: ecSlvCiA402.h:87
EC_SLV_APP_sCIA_object_t targetPositionIndex
Definition: ecSlvCiA402.h:107
EC_SLV_APP_sCIA_object_t modesOfOperationIndex
Definition: ecSlvCiA402.h:86
EC_SLV_APP_sCIA_object_t velocityActualValueIndex
Definition: ecSlvCiA402.h:97
EC_SLV_APP_sCIA_object_t quickStopIndex
Definition: ecSlvCiA402.h:81
uint32_t posLimitMax
Definition: ecSlvCiA402.h:150
EC_SLV_APP_sCIA_objectEntry_t positionLimitMin
Definition: ecSlvCiA402.h:148
EC_SLV_APP_sCIA_object_t disableOperationIndex
Definition: ecSlvCiA402.h:83
EC_SLV_APP_sCIA_object_t controlWordIndex
Definition: ecSlvCiA402.h:79
EC_SLV_APP_sCIA_object_t supportedDriveModesIndex
Definition: ecSlvCiA402.h:145
EC_SLV_APP_sCIA_object_t torqueActualValueIndex
Definition: ecSlvCiA402.h:105
EC_SLV_APP_sCIA_object_t positionActualValueIndex
Definition: ecSlvCiA402.h:90
EC_SLV_APP_sCIA_objectEntry_t positionLimitMax
Definition: ecSlvCiA402.h:147
EC_SLV_APP_sCIA_object_t shutdownIndex
Definition: ecSlvCiA402.h:82
EC_SLV_APP_sCIA_object_t swPositionLimitIndex
Definition: ecSlvCiA402.h:110
EC_API_SLV_SCoE_Object_t * pSdo
Definition: ecSlvCiA402.h:60
uint16_t objectIndex
Definition: ecSlvCiA402.h:59
EC_API_SLV_SCoE_ObjEntry_t * pObjetEntry
Definition: ecSlvCiA402.h:73
EC_API_SLV_SCoE_Object_t * pSdo
Definition: ecSlvCiA402.h:71
uint16_t objectIndex
Definition: ecSlvCiA402.h:69
uint8_t objectSubIndex
Definition: ecSlvCiA402.h:70