rt_dev_* has been abandonned in Xenomai3, on user side we use the regular POSIX I/O calls exposed by libcobalt stable-1.5
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Mon, 30 Jul 2018 11:18:45 +0200
branchstable-1.5
changeset 2703 045624f7f4c3
parent 2702 c67a3647891d
child 2704 a1bb4998a953
rt_dev_* has been abandonned in Xenomai3, on user side we use the regular POSIX I/O calls exposed by libcobalt
lib/common.c
lib/ioctl.h
lib/master.c
--- a/lib/common.c	Sun Jul 22 23:17:59 2018 +0200
+++ b/lib/common.c	Mon Jul 30 11:18:45 2018 +0200
@@ -87,18 +87,10 @@
     master->first_config = NULL;
 
     snprintf(path, MAX_PATH_LEN - 1,
-#ifdef USE_RTDM
-            "EtherCAT%u",
-#else
             "/dev/EtherCAT%u",
-#endif
             master_index);
 
-#ifdef USE_RTDM
-    master->fd = rt_dev_open(path, O_RDWR);
-#else
     master->fd = open(path, O_RDWR);
-#endif
     if (EC_IOCTL_IS_ERROR(master->fd)) {
         fprintf(stderr, "Failed to open %s: %s\n", path,
                 strerror(EC_IOCTL_ERRNO(master->fd)));
--- a/lib/ioctl.h	Sun Jul 22 23:17:59 2018 +0200
+++ b/lib/ioctl.h	Mon Jul 30 11:18:45 2018 +0200
@@ -33,11 +33,7 @@
 
 /*****************************************************************************/
 
-#ifdef USE_RTDM
-#include <rtdm/rtdm.h>
-#else
 #include <sys/ioctl.h>
-#endif
 
 /*****************************************************************************/
 
@@ -45,17 +41,9 @@
 
 /*****************************************************************************/
 
-#ifdef USE_RTDM
-
-#define ioctl rt_dev_ioctl
-
-/* rt_dev_ioctl() returns negative error code */
-#define EC_IOCTL_IS_ERROR(X) ((X) < 0)
-#define EC_IOCTL_ERRNO(X) (-(X))
-
-#else
-
-#define ioctl ioctl
+/* FIXME : historical code inherited from difference 
+           between RTDM ioctl an normal ioctl 
+           -> should ioctl.h be removed ? */
 
 /* libc's ioctl() always returns -1 on error and sets errno */
 #define EC_IOCTL_IS_ERROR(X) ((X) == -1)
@@ -63,8 +51,6 @@
 
 #include <errno.h>
 
-#endif
-
 /*****************************************************************************/
 
 #endif /* __EC_LIB_IOCTL_H__ */
--- a/lib/master.c	Sun Jul 22 23:17:59 2018 +0200
+++ b/lib/master.c	Mon Jul 30 11:18:45 2018 +0200
@@ -88,11 +88,7 @@
     ec_master_clear_config(master);
 
     if (master->fd != -1) {
-#if USE_RTDM
-        rt_dev_close(master->fd);
-#else
         close(master->fd);
-#endif
     }
 }