Minor changes.
authorFlorian Pose <fp@igh-essen.com>
Tue, 08 Aug 2006 12:07:25 +0000
changeset 339 a3a4ee854bd8
parent 338 469369417422
child 340 5a5f5a14c847
Minor changes.
TODO
master/domain.c
master/ethernet.c
master/ethernet.h
master/fsm.c
master/fsm.h
master/master.c
master/slave.c
--- a/TODO	Sat Aug 05 07:11:59 2006 +0000
+++ b/TODO	Tue Aug 08 12:07:25 2006 +0000
@@ -8,6 +8,12 @@
 
 Important things to do:
 
+* Add Kobjects in constructors.
+
+* Read AL Status Code with AL Control Response.
+
+* Coupling of EoE handlers before configuring slaves.
+
 * SysFS interface
   - Add secondary slave address
   - Add SDO dictionary
--- a/master/domain.c	Sat Aug 05 07:11:59 2006 +0000
+++ b/master/domain.c	Tue Aug 08 12:07:25 2006 +0000
@@ -153,7 +153,7 @@
 /*****************************************************************************/
 
 /**
-   Registeres a data field in a domain.
+   Registeres a PDO entry.
    \return 0 in case of success, else < 0
 */
 
@@ -227,7 +227,7 @@
 /*****************************************************************************/
 
 /**
-   Clears the list of the registered data fields.
+   Clears the list of the data registrations.
 */
 
 void ec_domain_clear_data_regs(ec_domain_t *domain /**< EtherCAT domain */)
--- a/master/ethernet.c	Sat Aug 05 07:11:59 2006 +0000
+++ b/master/ethernet.c	Tue Aug 08 12:07:25 2006 +0000
@@ -303,7 +303,7 @@
    \return 1 if the device is "up", 0 if it is "down"
 */
 
-unsigned int ec_eoe_active(const ec_eoe_t *eoe /**< EoE handler */)
+int ec_eoe_active(const ec_eoe_t *eoe /**< EoE handler */)
 {
     return eoe->slave && eoe->opened;
 }
--- a/master/ethernet.h	Sat Aug 05 07:11:59 2006 +0000
+++ b/master/ethernet.h	Tue Aug 08 12:07:25 2006 +0000
@@ -78,10 +78,13 @@
     struct net_device *dev; /**< net_device for virtual ethernet device */
     struct net_device_stats stats; /**< device statistics */
     unsigned int opened; /**< net_device is opened */
+    cycles_t t_last; /**< time of last rate output */
     struct sk_buff *rx_skb; /**< current rx socket buffer */
     off_t rx_skb_offset; /**< current write pointer in the socket buffer */
     size_t rx_skb_size; /**< size of the allocated socket buffer memory */
     uint8_t rx_expected_fragment; /**< next expected fragment number */
+    uint32_t rx_counter; /**< octets received during last second */
+    uint32_t rx_rate; /**< receive rate (bps) */
     struct list_head tx_queue; /**< queue for frames to send */
     unsigned int tx_queue_active; /**< kernel netif queue started */
     unsigned int tx_queued_frames; /**< number of frames in the queue */
@@ -90,11 +93,8 @@
     uint8_t tx_frame_number; /**< number of the transmitted frame */
     uint8_t tx_fragment_number; /**< number of the fragment */
     size_t tx_offset; /**< number of octets sent */
-    uint32_t rx_counter; /**< octets received during last second */
     uint32_t tx_counter; /**< octets transmitted during last second */
-    uint32_t rx_rate; /**< receive rate (bps) */
     uint32_t tx_rate; /**< transmit rate (bps) */
-    cycles_t t_last; /**< time of last output */
 };
 
 /*****************************************************************************/
@@ -102,6 +102,6 @@
 int ec_eoe_init(ec_eoe_t *);
 void ec_eoe_clear(ec_eoe_t *);
 void ec_eoe_run(ec_eoe_t *);
-unsigned int ec_eoe_active(const ec_eoe_t *);
+int ec_eoe_active(const ec_eoe_t *);
 
 /*****************************************************************************/
--- a/master/fsm.c	Sat Aug 05 07:11:59 2006 +0000
+++ b/master/fsm.c	Tue Aug 08 12:07:25 2006 +0000
@@ -95,7 +95,7 @@
 void ec_fsm_coe_down_start(ec_fsm_t *);
 void ec_fsm_coe_down_request(ec_fsm_t *);
 void ec_fsm_coe_down_check(ec_fsm_t *);
-void ec_fsm_coe_down_fetch(ec_fsm_t *);
+void ec_fsm_coe_down_response(ec_fsm_t *);
 
 void ec_fsm_end(ec_fsm_t *);
 void ec_fsm_error(ec_fsm_t *);
@@ -2097,16 +2097,16 @@
     // Fetch response
     ec_slave_mbox_prepare_fetch(slave, datagram); // can not fail.
     ec_master_queue_datagram(fsm->master, datagram);
-    fsm->coe_state = ec_fsm_coe_down_fetch;
-}
-
-/*****************************************************************************/
-
-/**
-   CoE state: DOWN_FETCH.
-*/
-
-void ec_fsm_coe_down_fetch(ec_fsm_t *fsm /**< finite state machine */)
+    fsm->coe_state = ec_fsm_coe_down_response;
+}
+
+/*****************************************************************************/
+
+/**
+   CoE state: DOWN_RESPONSE.
+*/
+
+void ec_fsm_coe_down_response(ec_fsm_t *fsm /**< finite state machine */)
 {
     ec_datagram_t *datagram = &fsm->datagram;
     ec_slave_t *slave = fsm->slave;
--- a/master/fsm.h	Sat Aug 05 07:11:59 2006 +0000
+++ b/master/fsm.h	Tue Aug 08 12:07:25 2006 +0000
@@ -74,7 +74,7 @@
     cycles_t sii_start; /**< sii start */
 
     void (*change_state)(ec_fsm_t *); /**< slave state change state function */
-    uint8_t change_new; /**< input: new state */
+    ec_slave_state_t change_new; /**< input: new state */
     cycles_t change_start; /**< change start */
 
     void (*coe_state)(ec_fsm_t *); /**< CoE state function */
--- a/master/master.c	Sat Aug 05 07:11:59 2006 +0000
+++ b/master/master.c	Tue Aug 08 12:07:25 2006 +0000
@@ -723,7 +723,7 @@
             break;
     }
 
-    off += sprintf(buffer + off, "\n\nNumber of slaves: %i\n",
+    off += sprintf(buffer + off, "\nSlaves: %i\n",
                    master->slave_count);
 
     off += sprintf(buffer + off, "\nTiming (min/avg/max) [us]:\n");
@@ -755,7 +755,7 @@
                    min, sum / HZ, (sum * 100 / HZ) % 100, max);
 
     if (!list_empty(&master->eoe_handlers))
-        off += sprintf(buffer + off, "\nEoE Statistics (RX/TX) [bps]:\n");
+        off += sprintf(buffer + off, "\nEoE statistics (RX/TX) [bps]:\n");
     list_for_each_entry(eoe, &master->eoe_handlers, list) {
         off += sprintf(buffer + off, "  %s: %u / %u\n",
                        eoe->dev->name, eoe->rx_rate, eoe->tx_rate);
--- a/master/slave.c	Sat Aug 05 07:11:59 2006 +0000
+++ b/master/slave.c	Tue Aug 08 12:07:25 2006 +0000
@@ -521,19 +521,18 @@
     if (slave->sii_name)
         off += sprintf(buffer + off, "%s", slave->sii_name);
 
-    off += sprintf(buffer + off, "\n\nVendor ID: 0x%08X\n",
+    off += sprintf(buffer + off, "\nVendor ID: 0x%08X\n",
                    slave->sii_vendor_id);
     off += sprintf(buffer + off, "Product code: 0x%08X\n\n",
                    slave->sii_product_code);
 
-    off += sprintf(buffer + off, "Ring position: %i\n", slave->ring_position);
+    off += sprintf(buffer + off, "State: ");
+    off += ec_state_string(slave->current_state, buffer + off);
+    off += sprintf(buffer + off, "\nRing position: %i\n",
+                   slave->ring_position);
     off += sprintf(buffer + off, "Advanced position: %i:%i\n\n",
                    slave->coupler_index, slave->coupler_subindex);
 
-    off += sprintf(buffer + off, "State: ");
-    off += ec_state_string(slave->current_state, buffer + off);
-    off += sprintf(buffer + off, "\n\n");
-
     off += sprintf(buffer + off, "Data link status:\n");
     for (i = 0; i < 4; i++) {
         off += sprintf(buffer + off, "  Port %i (", i);
@@ -611,7 +610,7 @@
     if (slave->sii_image)
         off += sprintf(buffer + off, "  Image: %s\n", slave->sii_image);
     if (slave->sii_order)
-        off += sprintf(buffer + off, "  Order#: %s\n", slave->sii_order);
+        off += sprintf(buffer + off, "  Order number: %s\n", slave->sii_order);
 
     if (!list_empty(&slave->sii_syncs))
         off += sprintf(buffer + off, "\nSync-Managers:\n");
@@ -629,13 +628,13 @@
 
     list_for_each_entry(pdo, &slave->sii_pdos, list) {
         off += sprintf(buffer + off,
-                       "  %s \"%s\" (0x%04X), -> Sync-Manager %i\n",
+                       "  %s \"%s\" (0x%04X), Sync-Manager %i\n",
                        pdo->type == EC_RX_PDO ? "RXPDO" : "TXPDO",
                        pdo->name ? pdo->name : "???",
                        pdo->index, pdo->sync_index);
 
         list_for_each_entry(pdo_entry, &pdo->entries, list) {
-            off += sprintf(buffer + off, "    \"%s\" 0x%04X:%X, %i Bit\n",
+            off += sprintf(buffer + off, "    \"%s\" 0x%04X:%X, %i bit\n",
                            pdo_entry->name ? pdo_entry->name : "???",
                            pdo_entry->index, pdo_entry->subindex,
                            pdo_entry->bit_length);