From be4754decaf1793d41ef57c8e93b32fd8d194e53 Mon Sep 17 00:00:00 2001 From: Florian Pose Date: Thu, 1 Feb 2024 16:52:24 +0100 Subject: [PATCH] API proposal for EoE set IP. --- include/ecrt.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/include/ecrt.h b/include/ecrt.h index 9cdd10e1..8c211894 100644 --- a/include/ecrt.h +++ b/include/ecrt.h @@ -47,6 +47,9 @@ * - Added the ecrt_master_scan_progress() method, the * ec_master_scan_progress_t structure and the EC_HAVE_SCAN_PROGRESS * definition to check for its existence. + * - Added the ecrt_slave_config_set_ip() method, the + * ec_slave_config_ip_param_t structure and the EC_HAVE_SET_IP + * definition to check for its existence. * * Changes since version 1.5.2: * @@ -243,6 +246,11 @@ */ #define EC_HAVE_SCAN_PROGRESS +/** Defined, if the method ecrt_slave_config_set_ip() and the + * ec_slave_config_ip_param_t sttucture are available. + */ +#define EC_HAVE_SET_IP + /****************************************************************************/ /** Symbol visibility control macro. @@ -618,6 +626,31 @@ typedef enum { EC_AL_STATE_OP = 8, /**< Operational. */ } ec_al_state_t; +/****************************************************************************/ + +/** Internet protocol (IP) parameters for Ethernet-over-EtherCAT (EoE). + * + * This type is used for the input parameter of ecrt_slave_config_set_ip(). + */ +typedef struct { + uint8_t mac_address_included; + uint8_t ip_address_included; + uint8_t subnet_mask_included; + uint8_t gateway_included; + uint8_t dns_included; + uint8_t name_included; + + unsigned char mac_address[EC_ETH_ALEN]; + uint32_t ip_address; + uint32_t subnet_mask; + uint32_t gateway; + uint32_t dns; + char name[EC_MAX_HOSTNAME_SIZE]; + + // output + uint16_t result; +} ec_slave_config_ip_param_t; + /***************************************************************************** * Global functions ****************************************************************************/ @@ -1792,6 +1825,19 @@ EC_PUBLIC_API int ecrt_slave_config_flag( int32_t value /**< Value to store. */ ); +/** Sets IP parameters vor Ethernet-over-EtherCAT (EoE) operation. + * + * This method has to be called in non-realtime context before + * ecrt_master_activate(). + * + * \retval 0 Success. + * \retval <0 Error code. + */ +EC_PUBLIC_API int ecrt_slave_config_set_ip( + ec_slave_config_t *sc, /**< Slave configuration. */ + const ec_slave_config_ip_param_t *ip, /**< IP parameters. */ + ); + /***************************************************************************** * Domain methods ****************************************************************************/