Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The unified GOAL In order to enable EtherNet/IP layer provides a common interface to all adapted EtherNet/IP stacks by using the same API in single core mode and also via GOALs Core To Core for multiple cores. This document describes the mandatory design rules for creating new commands for the GOAL CLI.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.

Code Block
languagec
#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;
}