Hi list,
the patch below adds some #ifdef's which I added in order to use the
master stack with DROPS/TUDOS [1].
DROPS stands for Dresden Realtime OPerating System. It is a
microkernel-based OS and thus runs
the complete EtherCAT stack, the network driver and the application in
unprivileged user mode.
This brings some great advantages with respect to robustness and
dependability.
The patch is only needed due to the fact, that there are no character
devices under DROPS.
Best regards,
Andre
[1] http://wiki.tudos.org
diff -r fb82e4f66c12 contrib/ethercat-devel-r1824/master/master.c
--- a/contrib/ethercat-devel-r1824/master/master.c Wed Nov 25 09:27:37 2009 +0100
+++ b/contrib/ethercat-devel-r1824/master/master.c Wed Nov 25 11:23:03 2009 +0100
@@ -228,6 +228,7 @@ int ec_master_init(ec_master_t *master,
}
ec_master_find_dc_ref_clock(master);
+#ifndef DROPS
// init character device
ret = ec_cdev_init(&master->cdev, master, device_number);
if (ret)
@@ -255,11 +256,14 @@ int ec_master_init(ec_master_t *master,
ret = PTR_ERR(master->class_device);
goto out_clear_cdev;
}
+#endif // DROPS
return 0;
+#ifndef DROPS
out_clear_cdev:
ec_cdev_clear(&master->cdev);
+#endif
out_clear_sync:
ec_datagram_clear(&master->sync_datagram);
out_clear_ref_sync:
@@ -289,7 +293,9 @@ void ec_master_clear(
class_device_unregister(master->class_device);
#endif
+#ifndef DROPS
ec_cdev_clear(&master->cdev);
+#endif
#ifdef EC_EOE
ec_master_clear_eoe_handlers(master);
@@ -1386,6 +1392,7 @@ const ec_domain_t *ec_master_find_domain
/*****************************************************************************/
+#ifdef EC_EOE
/** Get the number of EoE handlers.
*
* \return Number of EoE handlers.
@@ -1427,6 +1434,7 @@ const ec_eoe_t *ec_master_get_eoe_handle
return NULL;
}
+#endif
/*****************************************************************************/
diff -r fb82e4f66c12 contrib/ethercat-devel-r1824/master/module.c
--- a/contrib/ethercat-devel-r1824/master/module.c Wed Nov 25 09:27:37 2009 +0100
+++ b/contrib/ethercat-devel-r1824/master/module.c Wed Nov 25 11:23:03 2009 +0100
@@ -54,7 +54,11 @@ static int ec_mac_parse(uint8_t *, const
/*****************************************************************************/
+#ifndef DROPS
static char *main_devices[MAX_MASTERS]; /**< Main devices parameter. */
+#else
+static char *main_devices[MAX_MASTERS] = { "ff:ff:ff:ff:ff:ff" }; /**< Main devices parameter. */
+#endif
static unsigned int master_count; /**< Number of masters. */
static char *backup_devices[MAX_MASTERS]; /**< Backup devices parameter. */
static unsigned int backup_count; /**< Number of backup devices. */
@@ -79,12 +83,14 @@ MODULE_LICENSE("GPL");
MODULE_LICENSE("GPL");
MODULE_VERSION(EC_MASTER_VERSION);
+#ifndef DROPS
module_param_array(main_devices, charp, &master_count, S_IRUGO);
MODULE_PARM_DESC(main_devices, "MAC addresses of main devices");
module_param_array(backup_devices, charp, &backup_count, S_IRUGO);
MODULE_PARM_DESC(backup_devices, "MAC addresses of backup devices");
module_param_named(debug_level, debug_level, uint, S_IRUGO);
MODULE_PARM_DESC(debug_level, "Debug level");
+#endif
/** \endcond */
@@ -103,6 +109,7 @@ int __init ec_init_module(void)
init_MUTEX(&master_sem);
+#ifndef DROPS
if (master_count) {
if (alloc_chrdev_region(&device_number, 0, master_count, "EtherCAT")) {
EC_ERR("Failed to obtain device number(s)!\n");
@@ -117,6 +124,7 @@ int __init ec_init_module(void)
ret = PTR_ERR(class);
goto out_cdev;
}
+#endif
// zero MAC addresses
memset(macs, 0x00, sizeof(uint8_t) * MAX_MASTERS * 2 * ETH_ALEN);
@@ -164,8 +172,10 @@ out_class:
out_class:
class_destroy(class);
out_cdev:
+#ifndef DROPS
if (master_count)
unregister_chrdev_region(device_number, master_count);
+#endif
out_return:
return ret;
}
_______________________________________________
etherlab-dev mailing list
[email protected]
http://lists.etherlab.org/mailman/listinfo/etherlab-dev