EtherNet/IP on GOAL

In order to enable EtherNet/IP support in GOAL, the goal_eipInit function must be called within the appl_init function. The configuration and creation of a new EtherNet/IP instance is done within the appl_setup function.

#include "goal_includes.h" #include "goal_eip.h" static GOAL_EIP_T *pHdlEip; /**< GOAL Ethernet/ IP handle */ GOAL_STATUS_T appl_init( void ) { GOAL_STATUS_T res; /* result */ res = goal_eipInit(); if (GOAL_RES_ERR(res)) { goal_logErr("Initialization of Ethernet/IP failed"); } return res; } /****************************************************************************/ /** Application Setup * * Setup the application. */ GOAL_STATUS_T appl_setup( void ) { GOAL_STATUS_T res; /* result */ /* for a real device the serial number should be unique per device */ res = goal_eipCfgSerialNumSet(123456789); if (GOAL_RES_ERR(res)) { goal_logErr("failed to set Serial Number"); return res; } goal_logInfo("create new instance"); res = goal_eipNew(&pHdlEip, EIP_INSTANCE_DEFAULT, main_eipCallback); if (GOAL_RES_ERR(res)) { goal_logErr("failed to create a new EtherNet/IP instance"); return res; } res = main_eipApplInit(pHdlEip); if (GOAL_RES_ERR(res)) { goal_logErr("failed to initialize assembly and attribute configuration"); return res; } return GOAL_OK; }