Import last changes from 2017-03-26, including MDI hack
[revag-nm.git] / vw-nm.h
diff --git a/vw-nm.h b/vw-nm.h
index 8237daee7ffcd642013793f750f8eaba0df11d4c..b9fd981bfdd0bc7c6336195cb42347ec3fa41597 100644 (file)
--- a/vw-nm.h
+++ b/vw-nm.h
@@ -27,41 +27,58 @@ struct NM_Node {
        NM_State state;
 };
 
+
+enum timer_reason {
+       NM_TIMER_NOW,
+       NM_TIMER_NORMAL,
+       NM_TIMER_AWOL,
+       NM_TIMER_LIMPHOME,
+};
+
 struct NM_Main {
        unsigned max_nodes;
        struct NM_Node *nodes;
+
        NM_ID my_id;
        canid_t can_base;
+
        struct timeval tv;
+       enum timer_reason timer_reason;
+
+       /* How many times have we been alone when we reset? */
+       int lonely_resets;
 };
 
 
 
 
-/* This timeout is ~49 ms in:
+/* OSEK/VDX NM: T_Typ
+ *
+ * This timeout is ~50 ms in:
  *  - 0x19 (RCD 310, Bosch)
- *    (sometimes it takes a little longer)
  *
  * and ~45ms in:
  *  - 0x0b Instrument cluster?
  *  - 0x15 MDI
  *  - 0x1A Phone
- *
- * We may reduce it since we're not on a real-time OS.
  */
-#define NM_USECS_MY_TURN 40000
+#define NM_USECS_NORMAL_TURN 50000
 
 
-/* This timeout is 50 ms in:
+/* OSEK/VDX NM: T_Max
+ *
+ * This timeout is 140 ms in:
  *  - 0x19 (RCD 310, Bosch)
  */
-#define NM_USECS_OTHER_TURN 50000
+#define NM_USECS_NODE_AWOL 140000
 
 
-/* This timeout is 500 ms in:
+/* OSEK/VDX NM: T_Error
+ *
+ * This timeout is 500 ms in:
  *  - 0x19 (RCD 310, Bosch)
  */
-#define NM_USECS_LIMP_HOME 500000
+#define NM_USECS_LIMPHOME 500000
 
 
 #endif /* __VW_NM_H__ */