26 #define SLSS_ADRESS 0x7E4 |
26 #define SLSS_ADRESS 0x7E4 |
27 #define MLSS_ADRESS 0x7E5 |
27 #define MLSS_ADRESS 0x7E5 |
28 |
28 |
29 #define LSS_MSG_TIMER 0 |
29 #define LSS_MSG_TIMER 0 |
30 #define LSS_SWITCH_DELAY_TIMER 1 |
30 #define LSS_SWITCH_DELAY_TIMER 1 |
|
31 #define LSS_FS_TIMER 2 |
31 |
32 |
32 #define SDELAY_OFF 0 |
33 #define SDELAY_OFF 0 |
33 #define SDELAY_FIRST 1 |
34 #define SDELAY_FIRST 1 |
34 #define SDELAY_SECOND 2 |
35 #define SDELAY_SECOND 2 |
35 |
36 |
66 #define LSS_IDENT_NON_CONF_SLAVE 80 |
67 #define LSS_IDENT_NON_CONF_SLAVE 80 |
67 #define LSS_IDENT_FASTSCAN 81 |
68 #define LSS_IDENT_FASTSCAN 81 |
68 |
69 |
69 /*FastScan State Machine*/ |
70 /*FastScan State Machine*/ |
70 #define LSS_FS_RESET 0 |
71 #define LSS_FS_RESET 0 |
|
72 #define LSS_FS_PROCESSING 1 |
|
73 #define LSS_FS_CONFIRMATION 2 |
71 |
74 |
72 |
75 |
73 typedef void (*LSSCallback_t)(CO_Data* d, UNS8 command); |
76 typedef void (*LSSCallback_t)(CO_Data* d, UNS8 command); |
74 |
77 |
75 typedef void (*lss_StoreConfiguration_t)(UNS8*,UNS8*); |
78 typedef void (*lss_StoreConfiguration_t)(UNS8*,UNS8*); |
103 char *baudRate; /* the new baudrate stored to update the node baudrate when a Activate Bit |
106 char *baudRate; /* the new baudrate stored to update the node baudrate when a Activate Bit |
104 * Timing Parameters is received*/ |
107 * Timing Parameters is received*/ |
105 UNS16 switchDelay; /* the period of the two delay */ |
108 UNS16 switchDelay; /* the period of the two delay */ |
106 UNS8 switchDelayState; /* the state machine for the switchDelay */ |
109 UNS8 switchDelayState; /* the state machine for the switchDelay */ |
107 |
110 |
108 TIMER_HANDLE timers[2]; /* Time counters to implement a timeout in milliseconds. |
111 TIMER_HANDLE timers[3]; /* Time counters to implement a timeout in milliseconds. |
109 * LSS_MSG_TIMER (index 0) is automatically incremented whenever |
112 * LSS_MSG_TIMER (index 0) is automatically incremented whenever |
110 * the lss state is in LSS_TRANS_IN_PROGRESS, and reseted to 0 |
113 * the lss state is in LSS_TRANS_IN_PROGRESS, and reseted to 0 |
111 * when the response LSS have been received. |
114 * when the response LSS have been received. |
112 * LSS_SWITCH_DELAY_TIMER (index 1) is automatically incremented whenever |
115 * LSS_SWITCH_DELAY_TIMER (index 1) is automatically incremented whenever |
113 * the lss switchDelayState is in SDELAY_FIRST or SDELAY_SECOND, and reseted to 0 |
116 * the lss switchDelayState is in SDELAY_FIRST or SDELAY_SECOND, and reseted to 0 |
114 * when the two periods have been expired. |
117 * when the two periods have been expired. |
115 */ |
118 */ |
116 LSSCallback_t Callback; /* The user callback func to be called at LSS transaction end */ |
119 LSSCallback_t Callback; /* The user callback func to be called at LSS transaction end */ |
117 |
120 |
118 UNS32 IDNumber; |
121 UNS8 LSSanswer; /* stores if a message has been received during a timer period */ |
119 UNS8 BitChecked; |
122 |
120 UNS8 LSSSub; |
123 UNS32 IDNumber; /* in the master, the LSS address parameter which it currently tries to identify. |
121 UNS8 LSSNext; |
124 * in the slave, the LSS address parameter which is being checked (LSS-ID[sub]). */ |
122 UNS8 LSSPos; |
125 UNS8 BitChecked; /* bits of the current IDNumber that are currently checked */ |
123 UNS8 FastScan_SM; |
126 UNS8 LSSSub; /* which part of the LSS-ID is currently checked in IDNumber */ |
|
127 UNS8 LSSNext; /* which LSSSub value will be used in the next request */ |
|
128 UNS8 LSSPos; /* in the slave, which part of the LSS-ID is currently processed*/ |
|
129 UNS8 FastScan_SM; /* the state machine for the FastScan protocol */ |
124 }; |
130 }; |
125 |
131 |
126 #ifdef CO_ENABLE_LSS |
132 #ifdef CO_ENABLE_LSS |
127 typedef struct struct_lss_transfer lss_transfer_t; |
133 typedef struct struct_lss_transfer lss_transfer_t; |
128 #else |
134 #else |