diff --git a/master/Makefile.am b/master/Makefile.am index 65371f72..1a0ef30a 100644 --- a/master/Makefile.am +++ b/master/Makefile.am @@ -60,6 +60,7 @@ noinst_HEADERS = \ reg_request.c reg_request.h \ rtdm-ioctl.c \ rtdm.c rtdm.h \ + rtdm_details.h \ rtdm_xenomai_v3.c \ sdo.c sdo.h \ sdo_entry.c sdo_entry.h \ diff --git a/master/rtdm.c b/master/rtdm.c index eac71eea..e5e73e09 100644 --- a/master/rtdm.c +++ b/master/rtdm.c @@ -33,6 +33,7 @@ #include "master.h" #include "ioctl.h" #include "rtdm.h" +#include "rtdm_details.h" /** Set to 1 to enable device operations debugging. */ @@ -40,15 +41,6 @@ /****************************************************************************/ -/** Context structure for an open RTDM file handle. - */ -typedef struct { - rtdm_user_info_t *user_fd; /**< RTDM user data. */ - ec_ioctl_context_t ioctl_ctx; /**< Context structure. */ -} ec_rtdm_context_t; - -/****************************************************************************/ - int ec_rtdm_open(struct rtdm_dev_context *, rtdm_user_info_t *, int); int ec_rtdm_close(struct rtdm_dev_context *, rtdm_user_info_t *); int ec_rtdm_ioctl(struct rtdm_dev_context *, rtdm_user_info_t *, diff --git a/master/rtdm_details.h b/master/rtdm_details.h new file mode 100644 index 00000000..8b8c0f3c --- /dev/null +++ b/master/rtdm_details.h @@ -0,0 +1,57 @@ +/***************************************************************************** + * + * Copyright (C) 2024 Bjarne von Horn + * + * This file is part of the IgH EtherCAT master. + * + * The IgH EtherCAT master is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as published + * by the Free Software Foundation; version 2 of the License. + * + * The IgH EtherCAT master is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with the IgH EtherCAT master. If not, see . + * + * The license mentioned above concerns the source code only. Using the + * EtherCAT technology and brand is only permitted in compliance with the + * industrial property and similar rights of Beckhoff Automation GmbH. + * + ****************************************************************************/ + + +#ifndef __EC_RTDM_DETAILS_H__ +#define __EC_RTDM_DETAILS_H__ + +#include "../config.h" + +#include + +#ifdef EC_RTDM_XENOMAI_V3 + +#include +#define EC_RTDM_USERFD_T struct rtdm_fd + +#else // EC_RTDM_XENOMAI_V3 + +#include + +#define EC_RTDM_USERFD_T rtdm_user_info_t + +#endif + +/****************************************************************************/ + +/** Context structure for an open RTDM file handle. + */ +typedef struct ec_rtdm_context { + EC_RTDM_USERFD_T *user_fd; /**< RTDM user data. */ + ec_ioctl_context_t ioctl_ctx; /**< Context structure. */ +} ec_rtdm_context_t; + +/****************************************************************************/ + +#endif // __EC_RTDM_DETAILS_H__ diff --git a/master/rtdm_xenomai_v3.c b/master/rtdm_xenomai_v3.c index 0bc90862..4a58950a 100644 --- a/master/rtdm_xenomai_v3.c +++ b/master/rtdm_xenomai_v3.c @@ -37,16 +37,12 @@ #include "master.h" #include "ioctl.h" #include "rtdm.h" +#include "rtdm_details.h" /** Set to 1 to enable device operations debugging. */ #define DEBUG_RTDM 0 -struct ec_rtdm_context { - struct rtdm_fd *user_fd; - ec_ioctl_context_t ioctl_ctx; /**< Context structure. */ -}; - static int ec_rtdm_open(struct rtdm_fd *fd, int oflags) { struct ec_rtdm_context *ctx = rtdm_fd_to_private(fd);