author | Florian Pose <fp@igh-essen.com> |
Thu, 19 Feb 2015 15:19:29 +0100 | |
changeset 2598 | 19ff84bbbcb3 |
parent 2415 | af21f0bdc7c9 |
permissions | -rw-r--r-- |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
1326
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1225
diff
changeset
|
5 |
* Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
* |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT Master. |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
* |
1326
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1225
diff
changeset
|
9 |
* The IgH EtherCAT Master is free software; you can redistribute it and/or |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1225
diff
changeset
|
10 |
* modify it under the terms of the GNU General Public License version 2, as |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1225
diff
changeset
|
11 |
* published by the Free Software Foundation. |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1225
diff
changeset
|
12 |
* |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1225
diff
changeset
|
13 |
* The IgH EtherCAT Master is distributed in the hope that it will be useful, |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1225
diff
changeset
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1225
diff
changeset
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1225
diff
changeset
|
16 |
* Public License for more details. |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1225
diff
changeset
|
17 |
* |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1225
diff
changeset
|
18 |
* You should have received a copy of the GNU General Public License along |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1225
diff
changeset
|
19 |
* with the IgH EtherCAT Master; if not, write to the Free Software |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
* |
1363
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
22 |
* --- |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
23 |
* |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
24 |
* The license mentioned above concerns the source code only. Using the |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
25 |
* EtherCAT technology and brand is only permitted in compliance with the |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
26 |
* industrial property and similar rights of Beckhoff Automation GmbH. |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
* |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
*****************************************************************************/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
/** |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
\file |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
EtherCAT state change FSM. |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
*/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
/*****************************************************************************/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
#include "globals.h" |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
#include "master.h" |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
#include "fsm_change.h" |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
/*****************************************************************************/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
|
1445
45c5f5560274
Introduced EC_AL_STATE_CHANGE_TIMEOUT and set it to 2 s.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
43 |
/** Timeout while waiting for AL state change [s]. |
45c5f5560274
Introduced EC_AL_STATE_CHANGE_TIMEOUT and set it to 2 s.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
44 |
*/ |
1967
c41b4f4af645
Increased AL state change timeout to 5 s.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
45 |
#define EC_AL_STATE_CHANGE_TIMEOUT 5 |
1445
45c5f5560274
Introduced EC_AL_STATE_CHANGE_TIMEOUT and set it to 2 s.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
46 |
|
45c5f5560274
Introduced EC_AL_STATE_CHANGE_TIMEOUT and set it to 2 s.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
47 |
/*****************************************************************************/ |
45c5f5560274
Introduced EC_AL_STATE_CHANGE_TIMEOUT and set it to 2 s.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
48 |
|
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
49 |
void ec_fsm_change_state_start(ec_fsm_change_t *); |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
50 |
void ec_fsm_change_state_check(ec_fsm_change_t *); |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
51 |
void ec_fsm_change_state_status(ec_fsm_change_t *); |
2176
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
52 |
void ec_fsm_change_state_start_code(ec_fsm_change_t *); |
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
53 |
void ec_fsm_change_state_code(ec_fsm_change_t *); |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
54 |
void ec_fsm_change_state_ack(ec_fsm_change_t *); |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
55 |
void ec_fsm_change_state_check_ack(ec_fsm_change_t *); |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
56 |
void ec_fsm_change_state_end(ec_fsm_change_t *); |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
57 |
void ec_fsm_change_state_error(ec_fsm_change_t *); |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
/*****************************************************************************/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
/** |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
Constructor. |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
*/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
void ec_fsm_change_init(ec_fsm_change_t *fsm, /**< finite state machine */ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
ec_datagram_t *datagram /**< datagram */ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
) |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
{ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
fsm->state = NULL; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
fsm->datagram = datagram; |
738
880c6153101f
Improved handling for spontaneous AL state changes.
Florian Pose <fp@igh-essen.com>
parents:
713
diff
changeset
|
71 |
fsm->spontaneous_change = 0; |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
/*****************************************************************************/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
/** |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
Destructor. |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
*/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
void ec_fsm_change_clear(ec_fsm_change_t *fsm /**< finite state machine */) |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
{ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
/*****************************************************************************/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
/** |
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
87 |
Starts the change state machine. |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
88 |
*/ |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
89 |
|
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
90 |
void ec_fsm_change_start(ec_fsm_change_t *fsm, /**< finite state machine */ |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
91 |
ec_slave_t *slave, /**< EtherCAT slave */ |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
92 |
ec_slave_state_t state /**< requested state */ |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
93 |
) |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
94 |
{ |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
95 |
fsm->mode = EC_FSM_CHANGE_MODE_FULL; |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
fsm->slave = slave; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
fsm->requested_state = state; |
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
98 |
fsm->state = ec_fsm_change_state_start; |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
99 |
} |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
100 |
|
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
101 |
/*****************************************************************************/ |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
102 |
|
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
103 |
/** |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
104 |
Starts the change state machine to only acknowlegde a slave's state. |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
105 |
*/ |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
106 |
|
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
107 |
void ec_fsm_change_ack(ec_fsm_change_t *fsm, /**< finite state machine */ |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
108 |
ec_slave_t *slave /**< EtherCAT slave */ |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
109 |
) |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
110 |
{ |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
111 |
fsm->mode = EC_FSM_CHANGE_MODE_ACK_ONLY; |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
112 |
fsm->slave = slave; |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
113 |
fsm->requested_state = EC_SLAVE_STATE_UNKNOWN; |
2176
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
114 |
fsm->state = ec_fsm_change_state_start_code; |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
/*****************************************************************************/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
/** |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
Executes the current state of the state machine. |
435
779a18d12e6c
Removed state machine running() methods.
Florian Pose <fp@igh-essen.com>
parents:
434
diff
changeset
|
121 |
\return false, if the state machine has terminated |
779a18d12e6c
Removed state machine running() methods.
Florian Pose <fp@igh-essen.com>
parents:
434
diff
changeset
|
122 |
*/ |
779a18d12e6c
Removed state machine running() methods.
Florian Pose <fp@igh-essen.com>
parents:
434
diff
changeset
|
123 |
|
779a18d12e6c
Removed state machine running() methods.
Florian Pose <fp@igh-essen.com>
parents:
434
diff
changeset
|
124 |
int ec_fsm_change_exec(ec_fsm_change_t *fsm /**< finite state machine */) |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
{ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
fsm->state(fsm); |
435
779a18d12e6c
Removed state machine running() methods.
Florian Pose <fp@igh-essen.com>
parents:
434
diff
changeset
|
127 |
|
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
128 |
return fsm->state != ec_fsm_change_state_end |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
129 |
&& fsm->state != ec_fsm_change_state_error; |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
/*****************************************************************************/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
/** |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
Returns, if the state machine terminated with success. |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
\return non-zero if successful. |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
*/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
int ec_fsm_change_success(ec_fsm_change_t *fsm /**< Finite state machine */) |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
{ |
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
141 |
return fsm->state == ec_fsm_change_state_end; |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
/****************************************************************************** |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
* state change state machine |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
*****************************************************************************/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
/** |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
Change state: START. |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
*/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
|
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
152 |
void ec_fsm_change_state_start(ec_fsm_change_t *fsm |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
153 |
/**< finite state machine */) |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
{ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
ec_datagram_t *datagram = fsm->datagram; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
ec_slave_t *slave = fsm->slave; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
fsm->take_time = 1; |
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
159 |
fsm->old_state = fsm->slave->current_state; |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
// write new state to slave |
815
002fe9ec778f
Implemented missing datagram types.
Florian Pose <fp@igh-essen.com>
parents:
813
diff
changeset
|
162 |
ec_datagram_fpwr(datagram, slave->station_address, 0x0120, 2); |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
EC_WRITE_U16(datagram->data, fsm->requested_state); |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
164 |
fsm->retries = EC_FSM_RETRIES; |
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
165 |
fsm->state = ec_fsm_change_state_check; |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
168 |
/*****************************************************************************/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
169 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
/** |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
Change state: CHECK. |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
*/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
|
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
174 |
void ec_fsm_change_state_check(ec_fsm_change_t *fsm |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
175 |
/**< finite state machine */) |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
{ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
177 |
ec_datagram_t *datagram = fsm->datagram; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
178 |
ec_slave_t *slave = fsm->slave; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
|
637
d5d04c868e0e
Removed ecrt_master_run(), removed datagram queueing from state
Florian Pose <fp@igh-essen.com>
parents:
594
diff
changeset
|
180 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
d5d04c868e0e
Removed ecrt_master_run(), removed datagram queueing from state
Florian Pose <fp@igh-essen.com>
parents:
594
diff
changeset
|
181 |
return; |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
182 |
|
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
184 |
fsm->state = ec_fsm_change_state_error; |
1921 | 185 |
EC_SLAVE_ERR(slave, "Failed to receive state datagram: "); |
1822
74e6ac2369f4
Introduced ec_datagram_print_state() method and used it at all places where
Florian Pose <fp@igh-essen.com>
parents:
1445
diff
changeset
|
186 |
ec_datagram_print_state(datagram); |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
return; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
if (fsm->take_time) { |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
fsm->take_time = 0; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
fsm->jiffies_start = datagram->jiffies_sent; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
194 |
|
713
ae41cadd25b6
Better handling of unexpected working counters; introduced
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
195 |
if (datagram->working_counter == 0) { |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
if (datagram->jiffies_received - fsm->jiffies_start >= 3 * HZ) { |
438
64edce89fe9b
Output state names instead of codes in change FSM.
Florian Pose <fp@igh-essen.com>
parents:
435
diff
changeset
|
197 |
char state_str[EC_STATE_STRING_SIZE]; |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
198 |
ec_state_string(fsm->requested_state, state_str, 0); |
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
199 |
fsm->state = ec_fsm_change_state_error; |
1921 | 200 |
EC_SLAVE_ERR(slave, "Failed to set state %s: ", state_str); |
713
ae41cadd25b6
Better handling of unexpected working counters; introduced
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
201 |
ec_datagram_print_wc_error(datagram); |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
return; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
205 |
// repeat writing new state to slave |
815
002fe9ec778f
Implemented missing datagram types.
Florian Pose <fp@igh-essen.com>
parents:
813
diff
changeset
|
206 |
ec_datagram_fpwr(datagram, slave->station_address, 0x0120, 2); |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
EC_WRITE_U16(datagram->data, fsm->requested_state); |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
208 |
fsm->retries = EC_FSM_RETRIES; |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
return; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
|
713
ae41cadd25b6
Better handling of unexpected working counters; introduced
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
212 |
if (unlikely(datagram->working_counter > 1)) { |
ae41cadd25b6
Better handling of unexpected working counters; introduced
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
213 |
char state_str[EC_STATE_STRING_SIZE]; |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
214 |
ec_state_string(fsm->requested_state, state_str, 0); |
713
ae41cadd25b6
Better handling of unexpected working counters; introduced
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
215 |
fsm->state = ec_fsm_change_state_error; |
1921 | 216 |
EC_SLAVE_ERR(slave, "Failed to set state %s: ", state_str); |
713
ae41cadd25b6
Better handling of unexpected working counters; introduced
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
217 |
ec_datagram_print_wc_error(datagram); |
ae41cadd25b6
Better handling of unexpected working counters; introduced
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
218 |
return; |
ae41cadd25b6
Better handling of unexpected working counters; introduced
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
219 |
} |
ae41cadd25b6
Better handling of unexpected working counters; introduced
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
220 |
|
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
fsm->take_time = 1; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
// read AL status from slave |
815
002fe9ec778f
Implemented missing datagram types.
Florian Pose <fp@igh-essen.com>
parents:
813
diff
changeset
|
224 |
ec_datagram_fprd(datagram, slave->station_address, 0x0130, 2); |
1225
4d5b739edcb5
Introduced ec_datagram_zero().
Florian Pose <fp@igh-essen.com>
parents:
986
diff
changeset
|
225 |
ec_datagram_zero(datagram); |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
226 |
fsm->retries = EC_FSM_RETRIES; |
738
880c6153101f
Improved handling for spontaneous AL state changes.
Florian Pose <fp@igh-essen.com>
parents:
713
diff
changeset
|
227 |
fsm->spontaneous_change = 0; |
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
228 |
fsm->state = ec_fsm_change_state_status; |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
229 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
/*****************************************************************************/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
/** |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
Change state: STATUS. |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
*/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
|
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
237 |
void ec_fsm_change_state_status(ec_fsm_change_t *fsm |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
238 |
/**< finite state machine */) |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
{ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
ec_datagram_t *datagram = fsm->datagram; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
ec_slave_t *slave = fsm->slave; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
|
637
d5d04c868e0e
Removed ecrt_master_run(), removed datagram queueing from state
Florian Pose <fp@igh-essen.com>
parents:
594
diff
changeset
|
243 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
d5d04c868e0e
Removed ecrt_master_run(), removed datagram queueing from state
Florian Pose <fp@igh-essen.com>
parents:
594
diff
changeset
|
244 |
return; |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
245 |
|
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
246 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
247 |
fsm->state = ec_fsm_change_state_error; |
1921 | 248 |
EC_SLAVE_ERR(slave, "Failed to receive state checking datagram: "); |
1822
74e6ac2369f4
Introduced ec_datagram_print_state() method and used it at all places where
Florian Pose <fp@igh-essen.com>
parents:
1445
diff
changeset
|
249 |
ec_datagram_print_state(datagram); |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
250 |
return; |
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
251 |
} |
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
252 |
|
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
253 |
if (datagram->working_counter != 1) { |
469
a9c7991dca6b
Fixed state change FSM again.
Florian Pose <fp@igh-essen.com>
parents:
454
diff
changeset
|
254 |
char req_state[EC_STATE_STRING_SIZE]; |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
255 |
ec_state_string(fsm->requested_state, req_state, 0); |
469
a9c7991dca6b
Fixed state change FSM again.
Florian Pose <fp@igh-essen.com>
parents:
454
diff
changeset
|
256 |
fsm->state = ec_fsm_change_state_error; |
1921 | 257 |
EC_SLAVE_ERR(slave, "Failed to check state %s: ", req_state); |
713
ae41cadd25b6
Better handling of unexpected working counters; introduced
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
258 |
ec_datagram_print_wc_error(datagram); |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
return; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
260 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
if (fsm->take_time) { |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
fsm->take_time = 0; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
fsm->jiffies_start = datagram->jiffies_sent; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
265 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
266 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
slave->current_state = EC_READ_U8(datagram->data); |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
268 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
if (slave->current_state == fsm->requested_state) { |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
// state has been set successfully |
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
271 |
fsm->state = ec_fsm_change_state_end; |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
272 |
return; |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
273 |
} |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
274 |
|
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
275 |
if (slave->current_state != fsm->old_state) { // state changed |
438
64edce89fe9b
Output state names instead of codes in change FSM.
Florian Pose <fp@igh-essen.com>
parents:
435
diff
changeset
|
276 |
char req_state[EC_STATE_STRING_SIZE], cur_state[EC_STATE_STRING_SIZE]; |
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
277 |
|
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
278 |
ec_state_string(slave->current_state, cur_state, 0); |
469
a9c7991dca6b
Fixed state change FSM again.
Florian Pose <fp@igh-essen.com>
parents:
454
diff
changeset
|
279 |
|
a9c7991dca6b
Fixed state change FSM again.
Florian Pose <fp@igh-essen.com>
parents:
454
diff
changeset
|
280 |
if ((slave->current_state & 0x0F) != (fsm->old_state & 0x0F)) { |
a9c7991dca6b
Fixed state change FSM again.
Florian Pose <fp@igh-essen.com>
parents:
454
diff
changeset
|
281 |
// Slave spontaneously changed its state just before the new state |
a9c7991dca6b
Fixed state change FSM again.
Florian Pose <fp@igh-essen.com>
parents:
454
diff
changeset
|
282 |
// was written. Accept current state as old state and wait for |
a9c7991dca6b
Fixed state change FSM again.
Florian Pose <fp@igh-essen.com>
parents:
454
diff
changeset
|
283 |
// state change |
738
880c6153101f
Improved handling for spontaneous AL state changes.
Florian Pose <fp@igh-essen.com>
parents:
713
diff
changeset
|
284 |
fsm->spontaneous_change = 1; |
469
a9c7991dca6b
Fixed state change FSM again.
Florian Pose <fp@igh-essen.com>
parents:
454
diff
changeset
|
285 |
fsm->old_state = slave->current_state; |
1921 | 286 |
EC_SLAVE_WARN(slave, "Changed to %s in the meantime.\n", |
287 |
cur_state); |
|
738
880c6153101f
Improved handling for spontaneous AL state changes.
Florian Pose <fp@igh-essen.com>
parents:
713
diff
changeset
|
288 |
goto check_again; |
469
a9c7991dca6b
Fixed state change FSM again.
Florian Pose <fp@igh-essen.com>
parents:
454
diff
changeset
|
289 |
} |
a9c7991dca6b
Fixed state change FSM again.
Florian Pose <fp@igh-essen.com>
parents:
454
diff
changeset
|
290 |
|
a9c7991dca6b
Fixed state change FSM again.
Florian Pose <fp@igh-essen.com>
parents:
454
diff
changeset
|
291 |
// state change error |
a9c7991dca6b
Fixed state change FSM again.
Florian Pose <fp@igh-essen.com>
parents:
454
diff
changeset
|
292 |
|
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
293 |
slave->error_flag = 1; |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
294 |
ec_state_string(fsm->requested_state, req_state, 0); |
469
a9c7991dca6b
Fixed state change FSM again.
Florian Pose <fp@igh-essen.com>
parents:
454
diff
changeset
|
295 |
|
1921 | 296 |
EC_SLAVE_ERR(slave, "Failed to set %s state, slave refused state" |
297 |
" change (%s).\n", req_state, cur_state); |
|
2176
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
298 |
|
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
299 |
ec_fsm_change_state_start_code(fsm); |
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
300 |
return; |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
301 |
} |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
302 |
|
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
303 |
// still old state |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
|
1445
45c5f5560274
Introduced EC_AL_STATE_CHANGE_TIMEOUT and set it to 2 s.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
305 |
if (datagram->jiffies_received - fsm->jiffies_start >= |
45c5f5560274
Introduced EC_AL_STATE_CHANGE_TIMEOUT and set it to 2 s.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
306 |
EC_AL_STATE_CHANGE_TIMEOUT * HZ) { |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
307 |
// timeout while checking |
438
64edce89fe9b
Output state names instead of codes in change FSM.
Florian Pose <fp@igh-essen.com>
parents:
435
diff
changeset
|
308 |
char state_str[EC_STATE_STRING_SIZE]; |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
309 |
ec_state_string(fsm->requested_state, state_str, 0); |
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
310 |
fsm->state = ec_fsm_change_state_error; |
1921 | 311 |
EC_SLAVE_ERR(slave, "Timeout while setting state %s.\n", state_str); |
738
880c6153101f
Improved handling for spontaneous AL state changes.
Florian Pose <fp@igh-essen.com>
parents:
713
diff
changeset
|
312 |
return; |
880c6153101f
Improved handling for spontaneous AL state changes.
Florian Pose <fp@igh-essen.com>
parents:
713
diff
changeset
|
313 |
} |
880c6153101f
Improved handling for spontaneous AL state changes.
Florian Pose <fp@igh-essen.com>
parents:
713
diff
changeset
|
314 |
|
880c6153101f
Improved handling for spontaneous AL state changes.
Florian Pose <fp@igh-essen.com>
parents:
713
diff
changeset
|
315 |
check_again: |
469
a9c7991dca6b
Fixed state change FSM again.
Florian Pose <fp@igh-essen.com>
parents:
454
diff
changeset
|
316 |
// no timeout yet. check again |
815
002fe9ec778f
Implemented missing datagram types.
Florian Pose <fp@igh-essen.com>
parents:
813
diff
changeset
|
317 |
ec_datagram_fprd(datagram, slave->station_address, 0x0130, 2); |
1225
4d5b739edcb5
Introduced ec_datagram_zero().
Florian Pose <fp@igh-essen.com>
parents:
986
diff
changeset
|
318 |
ec_datagram_zero(datagram); |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
319 |
fsm->retries = EC_FSM_RETRIES; |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
320 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
/*****************************************************************************/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
323 |
|
2176
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
324 |
/** Enter reading AL status code. |
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
325 |
*/ |
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
326 |
void ec_fsm_change_state_start_code( |
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
327 |
ec_fsm_change_t *fsm /**< finite state machine */ |
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
328 |
) |
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
329 |
{ |
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
330 |
ec_slave_t *slave = fsm->slave; |
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
331 |
ec_datagram_t *datagram = fsm->datagram; |
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
332 |
|
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
333 |
// fetch AL status error code |
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
334 |
ec_datagram_fprd(datagram, slave->station_address, 0x0134, 2); |
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
335 |
ec_datagram_zero(datagram); |
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
336 |
fsm->retries = EC_FSM_RETRIES; |
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
337 |
fsm->state = ec_fsm_change_state_code; |
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
338 |
} |
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
339 |
|
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
340 |
/*****************************************************************************/ |
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
341 |
|
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
/** |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
Application layer status messages. |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
344 |
*/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
345 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
346 |
const ec_code_msg_t al_status_messages[] = { |
1886
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
347 |
{0x0000, "No error"}, |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
{0x0001, "Unspecified error"}, |
1886
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
349 |
{0x0002, "No Memory"}, |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
350 |
{0x0011, "Invalid requested state change"}, |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
{0x0012, "Unknown requested state"}, |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
{0x0013, "Bootstrap not supported"}, |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
{0x0014, "No valid firmware"}, |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
{0x0015, "Invalid mailbox configuration"}, |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
{0x0016, "Invalid mailbox configuration"}, |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
{0x0017, "Invalid sync manager configuration"}, |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
357 |
{0x0018, "No valid inputs available"}, |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
358 |
{0x0019, "No valid outputs"}, |
1886
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
359 |
{0x001A, "Synchronization error"}, |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
360 |
{0x001B, "Sync manager watchdog"}, |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
{0x001C, "Invalid sync manager types"}, |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
362 |
{0x001D, "Invalid output configuration"}, |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
{0x001E, "Invalid input configuration"}, |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
{0x001F, "Invalid watchdog configuration"}, |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
{0x0020, "Slave needs cold start"}, |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
{0x0021, "Slave needs INIT"}, |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
367 |
{0x0022, "Slave needs PREOP"}, |
813
bfc3f1ab52de
Fixed typo SAVEOP -> SAFEOP.
Florian Pose <fp@igh-essen.com>
parents:
798
diff
changeset
|
368 |
{0x0023, "Slave needs SAFEOP"}, |
1886
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
369 |
{0x0024, "Invalid Input Mapping"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
370 |
{0x0025, "Invalid Output Mapping"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
371 |
{0x0026, "Inconsistent Settings"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
372 |
{0x0027, "Freerun not supported"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
373 |
{0x0028, "Synchronization not supported"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
374 |
{0x0029, "Freerun needs 3 Buffer Mode"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
375 |
{0x002A, "Background Watchdog"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
376 |
{0x002B, "No Valid Inputs and Outputs"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
377 |
{0x002C, "Fatal Sync Error"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
378 |
{0x002D, "No Sync Error"}, |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
379 |
{0x0030, "Invalid DC SYNCH configuration"}, |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
{0x0031, "Invalid DC latch configuration"}, |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
{0x0032, "PLL error"}, |
1886
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
382 |
{0x0033, "DC Sync IO Error"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
383 |
{0x0034, "DC Sync Timeout Error"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
384 |
{0x0035, "DC Invalid Sync Cycle Time"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
385 |
{0x0036, "DC Sync0 Cycle Time"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
386 |
{0x0037, "DC Sync1 Cycle Time"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
387 |
{0x0041, "MBX_AOE"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
388 |
{0x0042, "MBX_EOE"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
389 |
{0x0043, "MBX_COE"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
390 |
{0x0044, "MBX_FOE"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
391 |
{0x0045, "MBX_SOE"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
392 |
{0x004F, "MBX_VOE"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
393 |
{0x0050, "EEPROM No Access"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
394 |
{0x0051, "EEPROM Error"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
395 |
{0x0060, "Slave Restarted Locally"}, |
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
396 |
{0xffff} |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
397 |
}; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
|
1886
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
399 |
|
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
400 |
/*****************************************************************************/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
402 |
/** |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
Change state: CODE. |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
404 |
*/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
405 |
|
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
406 |
void ec_fsm_change_state_code(ec_fsm_change_t *fsm |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
407 |
/**< finite state machine */) |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
408 |
{ |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
409 |
ec_datagram_t *datagram = fsm->datagram; |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
410 |
uint32_t code; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
411 |
const ec_code_msg_t *al_msg; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
412 |
|
637
d5d04c868e0e
Removed ecrt_master_run(), removed datagram queueing from state
Florian Pose <fp@igh-essen.com>
parents:
594
diff
changeset
|
413 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
d5d04c868e0e
Removed ecrt_master_run(), removed datagram queueing from state
Florian Pose <fp@igh-essen.com>
parents:
594
diff
changeset
|
414 |
return; |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
415 |
|
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
416 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
417 |
fsm->state = ec_fsm_change_state_error; |
1921 | 418 |
EC_SLAVE_ERR(fsm->slave, "Failed to receive" |
419 |
" AL status code datagram: "); |
|
1822
74e6ac2369f4
Introduced ec_datagram_print_state() method and used it at all places where
Florian Pose <fp@igh-essen.com>
parents:
1445
diff
changeset
|
420 |
ec_datagram_print_state(datagram); |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
421 |
return; |
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
422 |
} |
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
423 |
|
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
424 |
if (datagram->working_counter != 1) { |
1921 | 425 |
EC_SLAVE_WARN(fsm->slave, "Reception of AL status code" |
426 |
" datagram failed: "); |
|
713
ae41cadd25b6
Better handling of unexpected working counters; introduced
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
427 |
ec_datagram_print_wc_error(datagram); |
798
5a58606726f3
Output AL status code zero.
Florian Pose <fp@igh-essen.com>
parents:
738
diff
changeset
|
428 |
} else { |
5a58606726f3
Output AL status code zero.
Florian Pose <fp@igh-essen.com>
parents:
738
diff
changeset
|
429 |
code = EC_READ_U16(datagram->data); |
1886
a9fcecb8415c
Included futher AL status code messages.
Florian Pose <fp@igh-essen.com>
parents:
1822
diff
changeset
|
430 |
for (al_msg = al_status_messages; al_msg->code != 0xffff; al_msg++) { |
2412
7ac02fa34e8b
Fixed AL status code lookup.
Florian Pose <fp@igh-essen.com>
parents:
2176
diff
changeset
|
431 |
if (al_msg->code != code) { |
7ac02fa34e8b
Fixed AL status code lookup.
Florian Pose <fp@igh-essen.com>
parents:
2176
diff
changeset
|
432 |
continue; |
7ac02fa34e8b
Fixed AL status code lookup.
Florian Pose <fp@igh-essen.com>
parents:
2176
diff
changeset
|
433 |
} |
7ac02fa34e8b
Fixed AL status code lookup.
Florian Pose <fp@igh-essen.com>
parents:
2176
diff
changeset
|
434 |
|
1921 | 435 |
EC_SLAVE_ERR(fsm->slave, "AL status message 0x%04X: \"%s\".\n", |
798
5a58606726f3
Output AL status code zero.
Florian Pose <fp@igh-essen.com>
parents:
738
diff
changeset
|
436 |
al_msg->code, al_msg->message); |
5a58606726f3
Output AL status code zero.
Florian Pose <fp@igh-essen.com>
parents:
738
diff
changeset
|
437 |
break; |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
438 |
} |
2412
7ac02fa34e8b
Fixed AL status code lookup.
Florian Pose <fp@igh-essen.com>
parents:
2176
diff
changeset
|
439 |
if (al_msg->code == 0xffff) { /* not found in our list. */ |
1921 | 440 |
EC_SLAVE_ERR(fsm->slave, "Unknown AL status code 0x%04X.\n", |
441 |
code); |
|
2412
7ac02fa34e8b
Fixed AL status code lookup.
Florian Pose <fp@igh-essen.com>
parents:
2176
diff
changeset
|
442 |
} |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
443 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
444 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
445 |
// acknowledge "old" slave state |
2176
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
446 |
ec_datagram_fpwr(datagram, fsm->slave->station_address, 0x0120, 2); |
ad4f7514ba71
Read AL status code before acknowledging spontaneous state change.
Florian Pose <fp@igh-essen.com>
parents:
1967
diff
changeset
|
447 |
EC_WRITE_U16(datagram->data, fsm->slave->current_state); |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
448 |
fsm->retries = EC_FSM_RETRIES; |
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
449 |
fsm->state = ec_fsm_change_state_ack; |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
450 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
451 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
452 |
/*****************************************************************************/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
453 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
454 |
/** |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
455 |
Change state: ACK. |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
456 |
*/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
457 |
|
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
458 |
void ec_fsm_change_state_ack(ec_fsm_change_t *fsm /**< finite state machine */) |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
459 |
{ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
460 |
ec_datagram_t *datagram = fsm->datagram; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
461 |
ec_slave_t *slave = fsm->slave; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
462 |
|
637
d5d04c868e0e
Removed ecrt_master_run(), removed datagram queueing from state
Florian Pose <fp@igh-essen.com>
parents:
594
diff
changeset
|
463 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
d5d04c868e0e
Removed ecrt_master_run(), removed datagram queueing from state
Florian Pose <fp@igh-essen.com>
parents:
594
diff
changeset
|
464 |
return; |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
465 |
|
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
466 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
467 |
fsm->state = ec_fsm_change_state_error; |
1921 | 468 |
EC_SLAVE_ERR(slave, "Failed to receive state ack datagram: "); |
1822
74e6ac2369f4
Introduced ec_datagram_print_state() method and used it at all places where
Florian Pose <fp@igh-essen.com>
parents:
1445
diff
changeset
|
469 |
ec_datagram_print_state(datagram); |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
470 |
return; |
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
471 |
} |
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
472 |
|
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
473 |
if (datagram->working_counter != 1) { |
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
474 |
fsm->state = ec_fsm_change_state_error; |
1921 | 475 |
EC_SLAVE_ERR(slave, "Reception of state ack datagram failed: "); |
713
ae41cadd25b6
Better handling of unexpected working counters; introduced
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
476 |
ec_datagram_print_wc_error(datagram); |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
477 |
return; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
478 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
479 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
480 |
fsm->take_time = 1; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
481 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
482 |
// read new AL status |
815
002fe9ec778f
Implemented missing datagram types.
Florian Pose <fp@igh-essen.com>
parents:
813
diff
changeset
|
483 |
ec_datagram_fprd(datagram, slave->station_address, 0x0130, 2); |
1225
4d5b739edcb5
Introduced ec_datagram_zero().
Florian Pose <fp@igh-essen.com>
parents:
986
diff
changeset
|
484 |
ec_datagram_zero(datagram); |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
485 |
fsm->retries = EC_FSM_RETRIES; |
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
486 |
fsm->state = ec_fsm_change_state_check_ack; |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
487 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
488 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
489 |
/*****************************************************************************/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
490 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
491 |
/** |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
492 |
Change state: CHECK ACK. |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
493 |
*/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
494 |
|
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
495 |
void ec_fsm_change_state_check_ack(ec_fsm_change_t *fsm |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
496 |
/**< finite state machine */) |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
497 |
{ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
498 |
ec_datagram_t *datagram = fsm->datagram; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
499 |
ec_slave_t *slave = fsm->slave; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
500 |
|
637
d5d04c868e0e
Removed ecrt_master_run(), removed datagram queueing from state
Florian Pose <fp@igh-essen.com>
parents:
594
diff
changeset
|
501 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
d5d04c868e0e
Removed ecrt_master_run(), removed datagram queueing from state
Florian Pose <fp@igh-essen.com>
parents:
594
diff
changeset
|
502 |
return; |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
503 |
|
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
504 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
505 |
fsm->state = ec_fsm_change_state_error; |
1921 | 506 |
EC_SLAVE_ERR(slave, "Failed to receive state ack check datagram: "); |
1822
74e6ac2369f4
Introduced ec_datagram_print_state() method and used it at all places where
Florian Pose <fp@igh-essen.com>
parents:
1445
diff
changeset
|
507 |
ec_datagram_print_state(datagram); |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
508 |
return; |
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
509 |
} |
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
510 |
|
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
511 |
if (datagram->working_counter != 1) { |
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
512 |
fsm->state = ec_fsm_change_state_error; |
1921 | 513 |
EC_SLAVE_ERR(slave, "Reception of state ack check datagram failed: "); |
713
ae41cadd25b6
Better handling of unexpected working counters; introduced
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
514 |
ec_datagram_print_wc_error(datagram); |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
515 |
return; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
516 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
517 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
518 |
if (fsm->take_time) { |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
519 |
fsm->take_time = 0; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
520 |
fsm->jiffies_start = datagram->jiffies_sent; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
521 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
522 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
523 |
slave->current_state = EC_READ_U8(datagram->data); |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
524 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
525 |
if (!(slave->current_state & EC_SLAVE_STATE_ACK_ERR)) { |
438
64edce89fe9b
Output state names instead of codes in change FSM.
Florian Pose <fp@igh-essen.com>
parents:
435
diff
changeset
|
526 |
char state_str[EC_STATE_STRING_SIZE]; |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
527 |
ec_state_string(slave->current_state, state_str, 0); |
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
528 |
if (fsm->mode == EC_FSM_CHANGE_MODE_FULL) { |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
529 |
fsm->state = ec_fsm_change_state_error; |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
530 |
} |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
531 |
else { // EC_FSM_CHANGE_MODE_ACK_ONLY |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
532 |
fsm->state = ec_fsm_change_state_end; |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
533 |
} |
1921 | 534 |
EC_SLAVE_INFO(slave, "Acknowledged state %s.\n", state_str); |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
535 |
return; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
536 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
537 |
|
1445
45c5f5560274
Introduced EC_AL_STATE_CHANGE_TIMEOUT and set it to 2 s.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
538 |
if (datagram->jiffies_received - fsm->jiffies_start >= |
45c5f5560274
Introduced EC_AL_STATE_CHANGE_TIMEOUT and set it to 2 s.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
539 |
EC_AL_STATE_CHANGE_TIMEOUT * HZ) { |
443 | 540 |
// timeout while checking |
438
64edce89fe9b
Output state names instead of codes in change FSM.
Florian Pose <fp@igh-essen.com>
parents:
435
diff
changeset
|
541 |
char state_str[EC_STATE_STRING_SIZE]; |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
542 |
ec_state_string(slave->current_state, state_str, 0); |
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
543 |
fsm->state = ec_fsm_change_state_error; |
1921 | 544 |
EC_SLAVE_ERR(slave, "Timeout while acknowledging state %s.\n", |
545 |
state_str); |
|
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
546 |
return; |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
547 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
548 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
549 |
// reread new AL status |
815
002fe9ec778f
Implemented missing datagram types.
Florian Pose <fp@igh-essen.com>
parents:
813
diff
changeset
|
550 |
ec_datagram_fprd(datagram, slave->station_address, 0x0130, 2); |
1225
4d5b739edcb5
Introduced ec_datagram_zero().
Florian Pose <fp@igh-essen.com>
parents:
986
diff
changeset
|
551 |
ec_datagram_zero(datagram); |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
469
diff
changeset
|
552 |
fsm->retries = EC_FSM_RETRIES; |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
553 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
554 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
555 |
/*****************************************************************************/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
556 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
557 |
/** |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
558 |
State: ERROR. |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
559 |
*/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
560 |
|
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
561 |
void ec_fsm_change_state_error(ec_fsm_change_t *fsm |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
562 |
/**< finite state machine */) |
434
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
563 |
{ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
564 |
} |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
565 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
566 |
/*****************************************************************************/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
567 |
|
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
568 |
/** |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
569 |
State: END. |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
570 |
*/ |
0180d8277311
Layed out state change state machine.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
571 |
|
454
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
572 |
void ec_fsm_change_state_end(ec_fsm_change_t *fsm |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
573 |
/**< finite state machine */) |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
574 |
{ |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
575 |
} |
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
576 |
|
25cc4a3b9e0a
State acknowledgement in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
443
diff
changeset
|
577 |
/*****************************************************************************/ |