diff --git a/TODO b/TODO index 118e1336b6b4dd766b1d460e85c571801b807c1d..7e016225d3e23a40dcf5681d6d6cc2329b0a4cfb 100644 --- a/TODO +++ b/TODO @@ -15,7 +15,6 @@ Version 1.5.0: - 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. diff --git a/master/fsm_foe.c b/master/fsm_foe.c index e655d1c281c4ae7f958703c7d4a1659f928977c9..417fabba715b6066f40412cdcf6948f7be8a01f7 100644 --- a/master/fsm_foe.c +++ b/master/fsm_foe.c @@ -104,37 +104,29 @@ void ec_fsm_foe_read_start(ec_fsm_foe_t *); /*****************************************************************************/ -/** - 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 @@ int ec_fsm_foe_exec(ec_fsm_foe_t *fsm /**< finite state machine */) /*****************************************************************************/ -/** - 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 @@ void ec_fsm_foe_transfer( /*****************************************************************************/ -/** - State: ERROR. -*/ - +/** State: ERROR. + */ void ec_fsm_foe_error(ec_fsm_foe_t *fsm /**< finite state machine */) { #ifdef DEBUG_FOE @@ -189,10 +177,8 @@ void ec_fsm_foe_error(ec_fsm_foe_t *fsm /**< finite state machine */) /*****************************************************************************/ -/** - State: END. -*/ - +/** State: END. + */ void ec_fsm_foe_end(ec_fsm_foe_t *fsm /**< finite state machine */) { #ifdef DEBUG_FOE @@ -201,10 +187,9 @@ void ec_fsm_foe_end(ec_fsm_foe_t *fsm /**< finite state machine */) } /*****************************************************************************/ -/** - 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 @@ int ec_foe_prepare_data_send(ec_fsm_foe_t *fsm) } /*****************************************************************************/ -/** - 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 @@ void ec_fsm_foe_state_data_sent( } /*****************************************************************************/ -/** - 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 @@ int ec_foe_prepare_rrq_send(ec_fsm_foe_t *fsm) return 0; } - /*****************************************************************************/ /** Prepare to send an acknowledge. @@ -653,8 +635,6 @@ void ec_fsm_foe_read_start( 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 @@ void ec_foe_set_tx_error( uint32_t errorcode /**< FoE error code. */ ) { - fsm->tx_errors++; fsm->request->result = errorcode; fsm->state = ec_fsm_foe_error; } @@ -928,7 +907,6 @@ void ec_foe_set_rx_error( uint32_t errorcode /**< FoE error code. */ ) { - fsm->rx_errors++; fsm->request->result = errorcode; fsm->state = ec_fsm_foe_error; } diff --git a/master/fsm_foe.h b/master/fsm_foe.h index 2940b2d806a2adba9f986847ce5d4c3f74986a02..3ead621f5e39c687776f7d64decddb590eee3863 100644 --- a/master/fsm_foe.h +++ b/master/fsm_foe.h @@ -60,31 +60,22 @@ struct ec_fsm_foe { ec_foe_request_t *request; /**< FoE request */ uint8_t toggle; /**< toggle bit for segment commands */ - /** \cond */ - - 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 *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. */ + + 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. */ }; /*****************************************************************************/