master/slave.h
changeset 2600 1a969896d52e
parent 2597 0e145bb05859
--- a/master/slave.h	Thu Feb 19 15:19:29 2015 +0100
+++ b/master/slave.h	Fri Feb 20 16:06:23 2015 +0100
@@ -113,6 +113,24 @@
 
 /*****************************************************************************/
 
+#ifdef EC_LOOP_CONTROL
+
+/** Slave port state.
+ */
+typedef enum {
+    EC_SLAVE_PORT_DOWN,
+    EC_SLAVE_PORT_WAIT,
+    EC_SLAVE_PORT_UP
+} ec_slave_port_state_t;
+
+/** Wait time in [ms] from detecting a link to opening a port.
+ */
+#define EC_PORT_WAIT_MS 2000
+
+#endif
+
+/*****************************************************************************/
+
 /** Slave port.
  */
 typedef struct {
@@ -123,6 +141,10 @@
                                             measurement. */
     uint32_t delay_to_next_dc; /**< Delay to next slave with DC support behind
                                  this port [ns]. */
+#ifdef EC_LOOP_CONTROL
+    ec_slave_port_state_t state; /**< Port state for loop control. */
+    unsigned long link_detection_jiffies; /**< Time of link detection. */
+#endif
 } ec_slave_port_t;
 
 /*****************************************************************************/
@@ -245,7 +267,8 @@
 void ec_slave_clear_sync_managers(ec_slave_t *);
 
 void ec_slave_request_state(ec_slave_t *, ec_slave_state_t);
-void ec_slave_set_state(ec_slave_t *, ec_slave_state_t);
+void ec_slave_set_dl_status(ec_slave_t *, uint16_t);
+void ec_slave_set_al_status(ec_slave_t *, ec_slave_state_t);
 
 // SII categories
 int ec_slave_fetch_sii_strings(ec_slave_t *, const uint8_t *, size_t);