From 543936d41020d476e647efe4481704d48fa094a1 Mon Sep 17 00:00:00 2001
From: Florian Pose <fp@igh-essen.com>
Date: Mon, 19 Apr 2010 21:56:16 +0200
Subject: [PATCH] Added missing code documentation.

---
 master/debug.c        |  2 ++
 master/device.c       |  2 ++
 master/domain.c       |  8 ++++++--
 master/ethernet.c     |  2 ++
 master/fsm_coe.c      | 27 ++++++++++++++++++++-------
 master/mailbox.h      |  2 ++
 master/master.h       |  4 ++--
 master/slave_config.h |  4 +++-
 master/soe_request.c  | 12 ++++++++++--
 9 files changed, 49 insertions(+), 14 deletions(-)

diff --git a/master/debug.c b/master/debug.c
index a6b9249a..be06296a 100644
--- a/master/debug.c
+++ b/master/debug.c
@@ -50,6 +50,8 @@ int ec_dbgdev_tx(struct sk_buff *, struct net_device *);
 struct net_device_stats *ec_dbgdev_stats(struct net_device *);
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)
+/** Device operations for debug interfaces.
+ */
 static const struct net_device_ops ec_dbg_netdev_ops =
 {
     .ndo_open = ec_dbgdev_open,
diff --git a/master/device.c b/master/device.c
index 25b9a3b0..952a944d 100644
--- a/master/device.c
+++ b/master/device.c
@@ -54,6 +54,8 @@
     } while (0)
 #endif
 
+/** List of intervals for frame statistics [s].
+ */
 static const unsigned int rate_intervals[] = {
     1, 10, 60
 };
diff --git a/master/domain.c b/master/domain.c
index 4476f5ef..da86a817 100644
--- a/master/domain.c
+++ b/master/domain.c
@@ -226,10 +226,13 @@ int ec_domain_finish(
     datagram_count = 0;
     datagram_used[EC_DIR_OUTPUT] = 0;
     datagram_used[EC_DIR_INPUT] = 0;
+
     list_for_each_entry(fmmu_temp, &domain->fmmu_configs, list) {
-       ec_slave_config_t *sc = (ec_slave_config_t *)fmmu_temp->sc; // we have to remove the constness, sorry
-       sc->used_for_fmmu_datagram[fmmu_temp->dir] = 0;
+        // we have to remove the constness, sorry FIXME
+        ec_slave_config_t *sc = (ec_slave_config_t *) fmmu_temp->sc;
+        sc->used_for_fmmu_datagram[fmmu_temp->dir] = 0;
     }
+
     list_for_each_entry(fmmu, &domain->fmmu_configs, list) {
         // Correct logical FMMU address
         fmmu->logical_start_address += base_address;
@@ -241,6 +244,7 @@ int ec_domain_finish(
             datagram_used[fmmu->dir]++;
             sc->used_for_fmmu_datagram[fmmu->dir] = 1;
         }
+
         // If the current FMMU's data do not fit in the current datagram,
         // allocate a new one.
         if (datagram_size + fmmu->data_size > EC_MAX_DATA_SIZE) {
diff --git a/master/ethernet.c b/master/ethernet.c
index b41b1d65..dc46a7ce 100644
--- a/master/ethernet.c
+++ b/master/ethernet.c
@@ -83,6 +83,8 @@ struct net_device_stats *ec_eoedev_stats(struct net_device *);
 /*****************************************************************************/
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
+/** Device operations for EoE interfaces.
+ */
 static const struct net_device_ops ec_eoedev_ops = {
     .ndo_open = ec_eoedev_open,
     .ndo_stop = ec_eoedev_stop,
diff --git a/master/fsm_coe.c b/master/fsm_coe.c
index 84d7f9d9..e14f7ff6 100644
--- a/master/fsm_coe.c
+++ b/master/fsm_coe.c
@@ -45,11 +45,24 @@
  */
 #define EC_FSM_COE_DICT_TIMEOUT 1000
 
-#define EC_COE_DOWN_REQ_HEADER_SIZE      10
-#define EC_COE_DOWN_SEG_REQ_HEADER_SIZE  3
-#define EC_COE_DOWN_SEG_MIN_DATA_SIZE    7
+/** CoE download request header size.
+ */
+#define EC_COE_DOWN_REQ_HEADER_SIZE 10
+
+/** CoE download segment request header size.
+ */
+#define EC_COE_DOWN_SEG_REQ_HEADER_SIZE 3
 
+/** Minimum size of download segment.
+ */
+#define EC_COE_DOWN_SEG_MIN_DATA_SIZE 7
+
+/** Enable debug output for CoE retries.
+ */
 #define DEBUG_RETRIES 0
+
+/** Enable warning output if transfers take too long.
+ */
 #define DEBUG_LONG 0
 
 /*****************************************************************************/
@@ -1256,10 +1269,8 @@ void ec_fsm_coe_down_request(ec_fsm_coe_t *fsm /**< finite state machine */)
 
 /*****************************************************************************/
 
-/**
-   CoE state: DOWN CHECK.
-*/
-
+/** CoE state: DOWN CHECK.
+ */
 void ec_fsm_coe_down_check(ec_fsm_coe_t *fsm /**< finite state machine */)
 {
     ec_datagram_t *datagram = fsm->datagram;
@@ -1309,6 +1320,8 @@ void ec_fsm_coe_down_check(ec_fsm_coe_t *fsm /**< finite state machine */)
 
 /*****************************************************************************/
 
+/** Prepare a download segment request.
+ */
 void ec_fsm_coe_down_prepare_segment_request(
         ec_fsm_coe_t *fsm /**< finite state machine */
         )
diff --git a/master/mailbox.h b/master/mailbox.h
index e22b65b6..67c95a34 100644
--- a/master/mailbox.h
+++ b/master/mailbox.h
@@ -41,6 +41,8 @@
 
 /*****************************************************************************/
 
+/** Size of the mailbox header.
+ */
 #define EC_MBOX_HEADER_SIZE 6
 
 /*****************************************************************************/
diff --git a/master/master.h b/master/master.h
index 00a13e34..1f02fed9 100644
--- a/master/master.h
+++ b/master/master.h
@@ -155,8 +155,8 @@ struct ec_master {
                                       ext_datagram_queue. */
 
     struct list_head external_datagram_queue; /**< External Datagram queue. */
-    size_t send_interval; /* interval between calls to ecrt_master_send */
-    size_t max_queue_size; /** max. size of datagram queue */
+    size_t send_interval; /**< Interval between calls to ecrt_master_send */
+    size_t max_queue_size; /**< Maximum size of datagram queue */
     struct list_head domains; /**< List of domains. */
 
     unsigned int debug_level; /**< Master debug level. */
diff --git a/master/slave_config.h b/master/slave_config.h
index c2a3091c..2c703ab7 100644
--- a/master/slave_config.h
+++ b/master/slave_config.h
@@ -70,7 +70,9 @@ struct ec_slave_config {
                                                    configurations. */
     ec_fmmu_config_t fmmu_configs[EC_MAX_FMMUS]; /**< FMMU configurations. */
     uint8_t used_fmmus; /**< Number of FMMUs used. */
-    unsigned int used_for_fmmu_datagram[EC_DIR_COUNT];
+    unsigned int used_for_fmmu_datagram[EC_DIR_COUNT]; /**< Number of FMMUs
+                                                         used for process data
+                                                         exchange datagrams. */
     uint16_t dc_assign_activate; /**< Vendor-specific AssignActivate word. */
     ec_sync_signal_t dc_sync[EC_SYNC_SIGNAL_COUNT]; /**< DC sync signals. */
 
diff --git a/master/soe_request.c b/master/soe_request.c
index f6f4e72e..d77035a2 100644
--- a/master/soe_request.c
+++ b/master/soe_request.c
@@ -206,7 +206,11 @@ int ec_soe_request_append_data(
 
 /*****************************************************************************/
 
-void ec_soe_request_read(ec_soe_request_t *req)
+/** Request a read operation.
+ */
+void ec_soe_request_read(
+        ec_soe_request_t *req /**< SoE request. */
+       )
 {
     req->dir = EC_DIR_INPUT;
     req->state = EC_INT_REQUEST_QUEUED;
@@ -215,7 +219,11 @@ void ec_soe_request_read(ec_soe_request_t *req)
 
 /*****************************************************************************/
 
-void ec_soe_request_write(ec_soe_request_t *req)
+/** Request a write operation.
+ */
+void ec_soe_request_write(
+        ec_soe_request_t *req /**< SoE request. */
+        )
 {
     req->dir = EC_DIR_OUTPUT;
     req->state = EC_INT_REQUEST_QUEUED;
-- 
GitLab