Reset timeout on correcting re-login. Comments.
[revag-nm.git] / vw-nm.h
1 #ifndef __VW_NM_H__
2 #define __VW_NM_H__
3
4 #include <sys/time.h>
5
6
7 enum {
8         /* OSEK/VDX NM Level 0 */
9
10         NM_MAIN_OFF      = 0x00,
11         NM_MAIN_ON       = 0x01,
12         NM_MAIN_LOGIN    = 0x02,
13         NM_MAIN_LIMPHOME = 0x04,
14         NM_MAIN_MASK     = 0x0F,
15
16         NM_SLEEP_CANCEL  = 0x00,
17         NM_SLEEP_REQUEST = 0x10,
18         NM_SLEEP_ACK     = 0x20,
19         NM_SLEEP_MASK    = 0xF0,
20 };
21
22 typedef unsigned char NM_ID;
23 typedef unsigned char NM_State;
24
25 struct NM_Node {
26         NM_ID next;
27         NM_State state;
28 };
29
30 struct NM_Main {
31         unsigned max_nodes;
32         struct NM_Node *nodes;
33         NM_ID my_id;
34         canid_t can_base;
35         struct timeval tv;
36 };
37
38
39
40
41 /* This timeout is ~49 ms in:
42  *  - 0x19 (RCD 310, Bosch)
43  *    (sometimes it takes a little longer)
44  *
45  * and ~45ms in:
46  *  - 0x0b Instrument cluster?
47  *  - 0x15 MDI
48  *  - 0x1A Phone
49  *
50  * We may reduce it since we're not on a real-time OS.
51  */
52 #define NM_USECS_MY_TURN 40000
53
54
55 /* This timeout is 50 ms in:
56  *  - 0x19 (RCD 310, Bosch)
57  */
58 #define NM_USECS_OTHER_TURN 50000
59
60
61 /* This timeout is 500 ms in:
62  *  - 0x19 (RCD 310, Bosch)
63  */
64 #define NM_USECS_LIMP_HOME 500000
65
66
67 #endif /* __VW_NM_H__ */