From accbd1eef897e73d972dda66b069025adfd769fd Mon Sep 17 00:00:00 2001
From: Florian Pose <fp@igh-essen.com>
Date: Mon, 22 May 2006 09:16:12 +0000
Subject: [PATCH] Added some documentation.

---
 examples/rtai/rtai_sample.c | 10 ++++---
 master/fsm.c                |  4 +++
 master/globals.h            | 54 ++++++++++++++++++++++++++++++++++++-
 master/master.c             |  1 -
 4 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/examples/rtai/rtai_sample.c b/examples/rtai/rtai_sample.c
index 0ae577f4..295bc96d 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 c3535ac2..89a96bf8 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 dc380120..b4b0f4ba 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 2534cebe..a21b7d46 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 *);
 
 /*****************************************************************************/
 
-- 
GitLab