1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

node-ethercat: Fix #include after opened namespace

The `ethercat_config.hpp` header was included from `ethercat.hpp`
after opening the `villas::node` namespace. This made all definitions
originating from that header including the transitive definitions
from ethercat's `ecrt.h` part of the `villas::node` namespace.

The especially problematic part was that `ecrt.h` itself has an
`#include <netinet/in.h>` introduced in [1]. This caused the libc
definitions for `sa_familt_t`, `sockaddr_in` and `sockaddr_in6` to be
moved into the `villas::node` namespace, causing build error on recent
`ethercat` versions.

[1]: c2f9baf96a

Signed-off-by: Philipp Jungkamp <philipp.jungkamp@rwth-aachen.de>
This commit is contained in:
Philipp Jungkamp 2024-10-16 21:23:14 +02:00 committed by Steffen Vogel
parent 28d354cb84
commit 802f86090b
2 changed files with 11 additions and 13 deletions

View file

@ -18,22 +18,17 @@
#include <villas/queue_signalled.h>
#include <villas/task.hpp>
namespace villas {
namespace node {
// Include hard-coded Ethercat Bus configuration
#include <villas/nodes/ethercat_config.hpp>
#define DEFAULT_ETHERCAT_QUEUE_LENGTH (DEFAULT_QUEUE_LENGTH * 64)
namespace villas::node {
// Forward declarations
class NodeCompat;
class SuperNode;
// Include hard-coded Ethercat Bus configuration
#include <villas/nodes/ethercat_config.hpp>
extern "C" {
#include <ecrt.h>
}
#define DEFAULT_ETHERCAT_QUEUE_LENGTH (DEFAULT_QUEUE_LENGTH * 64)
// Internal data per ethercat node
struct ethercat {
// Settings
@ -91,5 +86,4 @@ int ethercat_read(NodeCompat *n, struct Sample *const smps[], unsigned cnt);
int ethercat_write(NodeCompat *n, struct Sample *const smps[], unsigned cnt);
} // namespace node
} // namespace villas
} // namespace villas::node

View file

@ -25,6 +25,8 @@
#define ETHERCAT_PID_EL3008 0x0bc03052
#define ETHERCAT_PID_FC1100 0x044c0c62
namespace villas::node {
// TODO: Make PDO entry tables configurable
/* Master 0, Slave 3, "EL4038"
@ -168,3 +170,5 @@ static ec_sync_info_t slave_4_syncs[] = {
{2, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
{3, EC_DIR_INPUT, 8, slave_4_pdos + 0, EC_WD_DISABLE},
{0xff}};
} // namespace villas::node