IgH EtherCAT Master  1.6.9
rtdm_details.h
1/*****************************************************************************
2 *
3 * Copyright (C) 2024 Bjarne von Horn <vh@igh.de>
4 *
5 * This file is part of the IgH EtherCAT master.
6 *
7 * The IgH EtherCAT master is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; version 2 of the License.
10 *
11 * The IgH EtherCAT master is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14 * Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with the IgH EtherCAT master. If not, see <http://www.gnu.org/licenses/>.
18 *
19 ****************************************************************************/
20
21#ifndef __EC_RTDM_DETAILS_H__
22#define __EC_RTDM_DETAILS_H__
23
24#include "../config.h"
25#include "ioctl.h"
26
27#include <linux/kernel.h>
28
29#ifdef EC_RTDM_XENOMAI_V3
30
31#include <rtdm/driver.h>
32#define EC_RTDM_USERFD_T struct rtdm_fd
33
34#else // EC_RTDM_XENOMAI_V3
35
36#include <rtdm/rtdm_driver.h>
37
38#define EC_RTDM_USERFD_T rtdm_user_info_t
39
40#endif // EC_RTDM_XENOMAI_V3
41
42/****************************************************************************/
43
46typedef struct ec_rtdm_context {
47 EC_RTDM_USERFD_T *user_fd;
48 ec_ioctl_context_t ioctl_ctx;
49} ec_rtdm_context_t;
50
51/****************************************************************************/
52
53static inline EC_RTDM_USERFD_T *ec_ioctl_to_rtdm(ec_ioctl_context_t *ctx)
54{
55 return container_of(ctx, ec_rtdm_context_t, ioctl_ctx)->user_fd;
56}
57
58/****************************************************************************/
59
60#endif // __EC_RTDM_DETAILS_H__
EtherCAT master character device IOCTL commands.
Context structure for an open RTDM file handle.
ec_ioctl_context_t ioctl_ctx
Context structure.
EC_RTDM_USERFD_T * user_fd
RTDM user data.