Documented fsm_foe members and removed unused variables.
authorFlorian Pose <fp@igh-essen.com>
Fri, 16 Apr 2010 07:57:16 +0200
changeset 1901 2a1106b1d863
parent 1900 25f848e2fbf4
child 1902 d1a44889bc4f
Documented fsm_foe members and removed unused variables.
TODO
master/fsm_foe.c
master/fsm_foe.h
--- a/TODO	Thu Apr 15 23:04:26 2010 +0200
+++ b/TODO	Fri Apr 16 07:57:16 2010 +0200
@@ -15,7 +15,6 @@
     - Add native drivers from 2.6.24 up to 2.6.31.
 * Finish library implementation.
 * Rescan command.
-* Document ec_fsm_foe members.
 * Change SDO index at runtime for SDO request.
 * Output skipped datagrams again.
 * Output warning on unmatched slave configuration.
--- a/master/fsm_foe.c	Thu Apr 15 23:04:26 2010 +0200
+++ b/master/fsm_foe.c	Fri Apr 16 07:57:16 2010 +0200
@@ -104,37 +104,29 @@
 
 /*****************************************************************************/
 
-/**
-   Constructor.
-*/
-
+/** Constructor.
+ */
 void ec_fsm_foe_init(ec_fsm_foe_t *fsm, /**< finite state machine */
                      ec_datagram_t *datagram /**< datagram */
                      )
 {
     fsm->state     = NULL;
     fsm->datagram  = datagram;
-    fsm->rx_errors = 0;
-    fsm->tx_errors = 0;
-}
-
-/*****************************************************************************/
-
-/**
-   Destructor.
-*/
-
+}
+
+/*****************************************************************************/
+
+/** Destructor.
+ */
 void ec_fsm_foe_clear(ec_fsm_foe_t *fsm /**< finite state machine */)
 {
 }
 
 /*****************************************************************************/
 
-/**
-   Executes the current state of the state machine.
-   \return false, if state machine has terminated
-*/
-
+/** Executes the current state of the state machine.
+ * \return false, if state machine has terminated
+ */
 int ec_fsm_foe_exec(ec_fsm_foe_t *fsm /**< finite state machine */)
 {
     fsm->state(fsm);
@@ -144,11 +136,9 @@
 
 /*****************************************************************************/
 
-/**
-   Returns, if the state machine terminated with success.
-   \return non-zero if successful.
-*/
-
+/** Returns, if the state machine terminated with success.
+ * \return non-zero if successful.
+ */
 int ec_fsm_foe_success(ec_fsm_foe_t *fsm /**< Finite state machine */)
 {
     return fsm->state == ec_fsm_foe_end;
@@ -176,10 +166,8 @@
 
 /*****************************************************************************/
 
-/**
-   State: ERROR.
-*/
-
+/** State: ERROR.
+ */
 void ec_fsm_foe_error(ec_fsm_foe_t *fsm /**< finite state machine */)
 {
 #ifdef DEBUG_FOE
@@ -189,10 +177,8 @@
 
 /*****************************************************************************/
 
-/**
-   State: END.
-*/
-
+/** State: END.
+ */
 void ec_fsm_foe_end(ec_fsm_foe_t *fsm /**< finite state machine */)
 {
 #ifdef DEBUG_FOE
@@ -201,10 +187,9 @@
 }
 
 /*****************************************************************************/
-/**
-   Sends a file or the next fragment.
-*/
-
+
+/** Sends a file or the next fragment.
+ */
 int ec_foe_prepare_data_send(ec_fsm_foe_t *fsm)
 {
     size_t remaining_size, current_size;
@@ -238,10 +223,9 @@
 }
 
 /*****************************************************************************/
-/**
-   Prepare a write request (WRQ) with filename
-*/
-
+
+/** Prepare a write request (WRQ) with filename
+ */
 int ec_foe_prepare_wrq_send(ec_fsm_foe_t *fsm)
 {
     size_t current_size;
@@ -532,10 +516,9 @@
 }
 
 /*****************************************************************************/
-/**
-   Prepare a read request (RRQ) with filename
-*/
-
+
+/** Prepare a read request (RRQ) with filename
+ */
 int ec_foe_prepare_rrq_send(ec_fsm_foe_t *fsm)
 {
     size_t current_size;
@@ -560,7 +543,6 @@
     return 0;
 }
 
-
 /*****************************************************************************/
 
 /** Prepare to send an acknowledge.
@@ -653,8 +635,6 @@
     ec_slave_t *slave = fsm->slave;
 
     fsm->rx_buffer_offset = 0;
-    fsm->rx_current_size = 0;
-    fsm->rx_packet_no = 0;
     fsm->rx_expected_packet_no = 1;
     fsm->rx_last_packet = 0;
 
@@ -914,7 +894,6 @@
         uint32_t errorcode /**< FoE error code. */
         )
 {
-    fsm->tx_errors++;
     fsm->request->result = errorcode;
     fsm->state = ec_fsm_foe_error;
 }
@@ -928,7 +907,6 @@
         uint32_t errorcode /**< FoE error code. */
         )
 {
-    fsm->rx_errors++;
     fsm->request->result = errorcode;
     fsm->state = ec_fsm_foe_error;
 }
--- a/master/fsm_foe.h	Thu Apr 15 23:04:26 2010 +0200
+++ b/master/fsm_foe.h	Fri Apr 16 07:57:16 2010 +0200
@@ -60,31 +60,22 @@
     ec_foe_request_t *request; /**< FoE request */
     uint8_t toggle; /**< toggle bit for segment commands */
 
-    /** \cond */
+    uint8_t *tx_buffer; /**< Buffer with data to transmit. */
+    uint32_t tx_buffer_size; /**< Size of data to transmit. */
+    uint32_t tx_buffer_offset; /**< Offset of data to tranmit next. */
+    uint32_t tx_last_packet; /**< Current packet is last one to send. */
+    uint32_t tx_packet_no; /**< FoE packet number. */
+    uint32_t tx_current_size; /**< Size of current packet to send. */
+    uint8_t *tx_filename; /**< Name of file to transmit. */
+    uint32_t tx_filename_len; /**< Lenth of transmit file name. */
 
-    uint32_t tx_errors;
-    uint8_t *tx_buffer;
-    uint32_t tx_buffer_size;
-    uint32_t tx_buffer_offset;
-    uint32_t tx_last_packet;
-    uint32_t tx_packet_no;
-    uint32_t tx_current_size;
-    uint8_t *tx_filename;
-    uint32_t tx_filename_len;
-
-
-    uint32_t rx_errors;
-    uint8_t *rx_buffer;
-    uint32_t rx_buffer_size;
-    uint32_t rx_buffer_offset;
-    uint32_t rx_current_size;
-    uint32_t rx_packet_no;
-    uint32_t rx_expected_packet_no;
-    uint32_t rx_last_packet;
-    uint8_t *rx_filename;
-    uint32_t rx_filename_len;
-
-    /** \endcond */
+    uint8_t *rx_buffer; /**< Buffer for received data. */
+    uint32_t rx_buffer_size; /**< Size of receive buffer. */
+    uint32_t rx_buffer_offset; /**< Offset in receive buffer. */
+    uint32_t rx_expected_packet_no; /**< Expected receive packet number. */
+    uint32_t rx_last_packet; /**< Current packet is the last to receive. */
+    uint8_t *rx_filename; /**< Name of the file to receive. */
+    uint32_t rx_filename_len; /**< Length of the receive file name. */
 };
 
 /*****************************************************************************/