master/master.c
branchstable-1.5
changeset 2433 3bdd7a747fae
parent 2421 bc2d4bf9cbe5
child 2434 fa52128477f6
--- a/master/master.c	Thu Sep 20 09:20:51 2012 +0200
+++ b/master/master.c	Thu Sep 20 15:28:25 2012 +0200
@@ -2,7 +2,7 @@
  *
  *  $Id$
  *
- *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
+ *  Copyright (C) 2006-2012  Florian Pose, Ingenieurgemeinschaft IgH
  *
  *  This file is part of the IgH EtherCAT Master.
  *
@@ -298,8 +298,24 @@
         goto out_clear_cdev;
     }
 
+#ifdef EC_RTDM
+    // init RTDM device
+    ret = ec_rtdm_dev_init(&master->rtdm_dev, master);
+    if (ret) {
+        goto out_unregister_class_device;
+    }
+#endif
+
     return 0;
 
+#ifdef EC_RTDM
+out_unregister_class_device:
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
+    device_unregister(master->class_device);
+#else
+    class_device_unregister(master->class_device);
+#endif
+#endif
 out_clear_cdev:
     ec_cdev_clear(&master->cdev);
 out_clear_sync_mon:
@@ -327,6 +343,10 @@
         ec_master_t *master /**< EtherCAT master */
         )
 {
+#ifdef EC_RTDM
+    ec_rtdm_dev_clear(&master->rtdm_dev);
+#endif
+
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
     device_unregister(master->class_device);
 #else