diff --git a/examples/rtai/rtai_sample.c b/examples/rtai/rtai_sample.c index 0ae577f4506d32c2e2771749620fd77c014738f9..295bc96d2773e5921756cfce7f06e94c6622a68a 100644 --- a/examples/rtai/rtai_sample.c +++ b/examples/rtai/rtai_sample.c @@ -45,6 +45,12 @@ /*****************************************************************************/ +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>"); +MODULE_DESCRIPTION("EtherCAT RTAI sample module"); + +/*****************************************************************************/ + // comment this for synchronous IO #define ASYNC @@ -268,10 +274,6 @@ void __exit cleanup_mod(void) /*****************************************************************************/ -MODULE_LICENSE("GPL"); -MODULE_AUTHOR ("Florian Pose <fp@igh-essen.com>"); -MODULE_DESCRIPTION ("EtherCAT RTAI sample module"); - module_init(init_mod); module_exit(cleanup_mod); diff --git a/master/fsm.c b/master/fsm.c index c3535ac2d7df01c905bde0add2f6288f8e20599d..89a96bf8376754adc2573c19342b48d1389d15b3 100644 --- a/master/fsm.c +++ b/master/fsm.c @@ -44,6 +44,10 @@ /*****************************************************************************/ +/** + Size of memory to allocate while reading categories. +*/ + #define EC_CAT_MEM 0x100 /*****************************************************************************/ diff --git a/master/globals.h b/master/globals.h index dc380120a44b7674032adc453b6b85fb265df853..b4b0f4babe38e70a6a68580959ea8758815f7e32 100644 --- a/master/globals.h +++ b/master/globals.h @@ -90,20 +90,65 @@ /*****************************************************************************/ +/** + Convenience macro for printing EtherCAT-specific information to syslog. + This will print the message in \a fmt with a prefixed "EtherCAT: ". + \param fmt format string (like in printf()) + \param args arguments (optional) +*/ + #define EC_INFO(fmt, args...) \ printk(KERN_INFO "EtherCAT: " fmt, ##args) + +/** + Convenience macro for printing EtherCAT-specific errors to syslog. + This will print the message in \a fmt with a prefixed "EtherCAT ERROR: ". + \param fmt format string (like in printf()) + \param args arguments (optional) +*/ + #define EC_ERR(fmt, args...) \ printk(KERN_ERR "EtherCAT ERROR: " fmt, ##args) + +/** + Convenience macro for printing EtherCAT-specific warnings to syslog. + This will print the message in \a fmt with a prefixed "EtherCAT WARNING: ". + \param fmt format string (like in printf()) + \param args arguments (optional) +*/ + #define EC_WARN(fmt, args...) \ printk(KERN_WARNING "EtherCAT WARNING: " fmt, ##args) + +/** + Convenience macro for printing EtherCAT debug messages to syslog. + This will print the message in \a fmt with a prefixed "EtherCAT DEBUG: ". + \param fmt format string (like in printf()) + \param args arguments (optional) +*/ + #define EC_DBG(fmt, args...) \ printk(KERN_DEBUG "EtherCAT DEBUG: " fmt, ##args) +/** + Helper macro for EC_STR(), literates a macro argument. + \param X argument to literate. +*/ + #define EC_LIT(X) #X + +/** + Converts a macro argument to a string. + \param X argument to stringify. +*/ + #define EC_STR(X) EC_LIT(X) /** - Convenience macro for defining SysFS attributes. + Convenience macro for defining read-only SysFS attributes. + This results in creating a static variable called attr_\a NAME. The SysFS + file will be world-readable. + \param NAME name of the attribute to create. */ #define EC_SYSFS_READ_ATTR(NAME) \ @@ -111,6 +156,13 @@ .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO \ } +/** + Convenience macro for defining read-write SysFS attributes. + This results in creating a static variable called attr_\a NAME. The SysFS + file will be word-readable plus owner-writable. + \param NAME name of the attribute to create. +*/ + #define EC_SYSFS_READ_WRITE_ATTR(NAME) \ static struct attribute attr_##NAME = { \ .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO | S_IWUSR \ diff --git a/master/master.c b/master/master.c index 2534cebeaf511632745ea107a5ec8fee12d77fa9..a21b7d46b826922f5afbe4a2a5af74faebfc50a4 100644 --- a/master/master.c +++ b/master/master.c @@ -58,7 +58,6 @@ void ec_master_freerun(void *); void ec_master_eoe_run(unsigned long); ssize_t ec_show_master_attribute(struct kobject *, struct attribute *, char *); -void ec_master_process_watch_command(ec_master_t *); /*****************************************************************************/