libethercat - an embeddable realtime EtherCAT-master library
Communicate with EtherCAT slaves attached to a Network interface.
Loading...
Searching...
No Matches
eoe.h
Go to the documentation of this file.
1
13/*
14 * This file is part of libethercat.
15 *
16 * libethercat is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License as published by the Free Software Foundation; either
19 * version 3 of the License, or (at your option) any later version.
20 *
21 * libethercat is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with libethercat (LICENSE.LGPL-V3); if not, write
28 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
29 * Floor, Boston, MA 02110-1301, USA.
30 *
31 * Please note that the use of the EtherCAT technology, the EtherCAT
32 * brand name and the EtherCAT logo is only permitted if the property
33 * rights of Beckhoff Automation GmbH are observed. For further
34 * information please contact Beckhoff Automation GmbH & Co. KG,
35 * Hülshorstweg 20, D-33415 Verl, Germany (www.beckhoff.com) or the
36 * EtherCAT Technology Group, Ostendstraße 196, D-90482 Nuremberg,
37 * Germany (ETG, www.ethercat.org).
38 *
39 */
40
41#ifndef LIBETHERCAT_EOE_H
42#define LIBETHERCAT_EOE_H
43
44#include <libosal/types.h>
45#include <libosal/semaphore.h>
46
47#include "libethercat/common.h"
48
56#define LEC_EOE_MAC_LEN (6u)
57#define LEC_EOE_IP_ADDRESS_LEN (4u)
58#define LEC_EOE_SUBNET_LEN (4u)
59#define LEC_EOE_GATEWAY_LEN (4u)
60#define LEC_EOE_DNS_LEN (4u)
61#define LEC_EOE_DNS_NAME_LEN (128u)
62
63typedef struct ec_eoe_slave_config {
64 int use_eoe;
65
66 osal_uint8_t mac[LEC_EOE_MAC_LEN];
67 osal_uint8_t ip_address[LEC_EOE_IP_ADDRESS_LEN];
68 osal_uint8_t subnet[LEC_EOE_SUBNET_LEN];
69 osal_uint8_t gateway[LEC_EOE_GATEWAY_LEN];
70 osal_uint8_t dns[LEC_EOE_DNS_LEN];
71 osal_char_t dns_name[LEC_EOE_DNS_NAME_LEN];
73
74typedef struct ec_eoe {
76 pool_t response_pool;
77
81
82 osal_mutex_t lock;
83 osal_semaphore_t send_sync;
84} ec_eoe_t;
85
86#ifdef __cplusplus
87extern "C" {
88#endif
89
91
98void ec_eoe_init(ec_t *pec, osal_uint16_t slave);
99
101
108void ec_eoe_deinit(ec_t *pec, osal_uint16_t slave);
109
111
120void ec_eoe_enqueue(ec_t *pec, osal_uint16_t slave, pool_entry_t *p_entry);
121
123
141int ec_eoe_set_ip_parameter(ec_t *pec, osal_uint16_t slave, osal_uint8_t *mac,
142 osal_uint8_t *ip_address, osal_uint8_t *subnet, osal_uint8_t *gateway,
143 osal_uint8_t *dns, osal_char_t *dns_name);
144
145// send ethernet frame, fragmented if needed
159int ec_eoe_send_frame(ec_t *pec, osal_uint16_t slave, osal_uint8_t *frame,
160 osal_size_t frame_len);
161
162// setup tun interface
171
172// Destroy tun interface
178
179#ifdef __cplusplus
180}
181#endif
182
183#endif // LIBETHERCAT_EOE_H
184
ethercat master common stuff
osal_uint8_t subnet[LEC_EOE_SUBNET_LEN]
Subnet to configure (optional, maybe NULL).
Definition eoe.h:68
int ec_eoe_setup_tun(ec_t *pec)
osal_uint8_t ip_address[LEC_EOE_IP_ADDRESS_LEN]
IP address to configure (optional, maybe NULL).
Definition eoe.h:67
pool_t recv_pool
Mailbox message with EoE fragments received.
Definition eoe.h:75
osal_uint8_t mac[LEC_EOE_MAC_LEN]
MAC address to configure (mandatory)
Definition eoe.h:66
void ec_eoe_destroy_tun(ec_t *pec)
osal_uint8_t dns[LEC_EOE_DNS_LEN]
DNS to configure (optional, maybe NULL).
Definition eoe.h:70
osal_uint8_t gateway[LEC_EOE_GATEWAY_LEN]
Gateway to configure (optional, maybe NULL).
Definition eoe.h:69
void ec_eoe_init(ec_t *pec, osal_uint16_t slave)
initialize EoE structure
int ec_eoe_send_frame(ec_t *pec, osal_uint16_t slave, osal_uint8_t *frame, osal_size_t frame_len)
pool_entry_t free_frames[128]
Static Ethernet frames for Pool, do not use directly.
Definition eoe.h:78
pool_t eth_frames_recv_pool
Pool where to store Ethernet frames nobody cared so far.
Definition eoe.h:80
pool_t eth_frames_free_pool
Pool with Ethernet frames currently unused.
Definition eoe.h:79
void ec_eoe_enqueue(ec_t *pec, osal_uint16_t slave, pool_entry_t *p_entry)
Enqueue EoE message received from slave.
int ec_eoe_set_ip_parameter(ec_t *pec, osal_uint16_t slave, osal_uint8_t *mac, osal_uint8_t *ip_address, osal_uint8_t *subnet, osal_uint8_t *gateway, osal_uint8_t *dns, osal_char_t *dns_name)
Set IP parameters to slave with EoE support.
int use_eoe
Using EoE on actual slave.
Definition eoe.h:64
void ec_eoe_deinit(ec_t *pec, osal_uint16_t slave)
deinitialize EoE structure
osal_char_t dns_name[LEC_EOE_DNS_NAME_LEN]
DNS name to configure (optional, maybe NULL).
Definition eoe.h:71
Definition eoe.h:63
Definition eoe.h:74
ethercat master structure
Definition ec.h:188
Pool queue entry.
Definition pool.h:67
the datagram pool itself
Definition pool.h:81