author | Florian Pose <fp@igh-essen.com> |
Wed, 29 Apr 2009 09:43:04 +0000 | |
changeset 1421 | 043a518831b2 |
parent 1419 | 8fc38c37d86e |
child 1430 | 97ab86a9b1d7 |
permissions | -rw-r--r-- |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
d83d92e1a919
Separated slave state machines.
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:
1318
diff
changeset
|
5 |
* Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
* |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT Master. |
d83d92e1a919
Separated slave state machines.
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:
1318
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:
1318
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:
1318
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:
1318
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:
1318
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:
1318
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:
1318
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:
1318
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:
1318
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:
1318
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:
1318
diff
changeset
|
19 |
* with the IgH EtherCAT Master; if not, write to the Free Software |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
* |
1363
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1347
diff
changeset
|
22 |
* --- |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1347
diff
changeset
|
23 |
* |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1347
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:
1347
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:
1347
diff
changeset
|
26 |
* industrial property and similar rights of Beckhoff Automation GmbH. |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
* |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
|
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
30 |
/** \file |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
31 |
* |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
32 |
* EtherCAT slave configuration state machine. |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
33 |
*/ |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
#include "globals.h" |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
#include "master.h" |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
#include "mailbox.h" |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
#include "slave_config.h" |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
#include "fsm_slave_config.h" |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
void ec_fsm_slave_config_state_start(ec_fsm_slave_config_t *); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
void ec_fsm_slave_config_state_init(ec_fsm_slave_config_t *); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
void ec_fsm_slave_config_state_clear_fmmus(ec_fsm_slave_config_t *); |
1342
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
48 |
void ec_fsm_slave_config_state_clear_sync(ec_fsm_slave_config_t *); |
1407
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
49 |
void ec_fsm_slave_config_state_dc_clear_assign(ec_fsm_slave_config_t *); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
50 |
void ec_fsm_slave_config_state_dc_read_offset(ec_fsm_slave_config_t *); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
51 |
void ec_fsm_slave_config_state_dc_write_offset(ec_fsm_slave_config_t *); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
void ec_fsm_slave_config_state_mbox_sync(ec_fsm_slave_config_t *); |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
53 |
void ec_fsm_slave_config_state_boot_preop(ec_fsm_slave_config_t *); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
void ec_fsm_slave_config_state_sdo_conf(ec_fsm_slave_config_t *); |
888
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
55 |
void ec_fsm_slave_config_state_pdo_sync(ec_fsm_slave_config_t *); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
56 |
void ec_fsm_slave_config_state_pdo_conf(ec_fsm_slave_config_t *); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
void ec_fsm_slave_config_state_fmmu(ec_fsm_slave_config_t *); |
1392
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
58 |
void ec_fsm_slave_config_state_dc_cycle(ec_fsm_slave_config_t *); |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
59 |
void ec_fsm_slave_config_state_dc_start(ec_fsm_slave_config_t *); |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
60 |
void ec_fsm_slave_config_state_dc_assign(ec_fsm_slave_config_t *); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
void ec_fsm_slave_config_state_safeop(ec_fsm_slave_config_t *); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
void ec_fsm_slave_config_state_op(ec_fsm_slave_config_t *); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
|
1318
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
64 |
void ec_fsm_slave_config_enter_init(ec_fsm_slave_config_t *); |
1342
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
65 |
void ec_fsm_slave_config_enter_clear_sync(ec_fsm_slave_config_t *); |
1407
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
66 |
void ec_fsm_slave_config_enter_dc_clear_assign(ec_fsm_slave_config_t *); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
void ec_fsm_slave_config_enter_mbox_sync(ec_fsm_slave_config_t *); |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
68 |
void ec_fsm_slave_config_enter_boot_preop(ec_fsm_slave_config_t *); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
void ec_fsm_slave_config_enter_sdo_conf(ec_fsm_slave_config_t *); |
1180
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
70 |
void ec_fsm_slave_config_enter_pdo_conf(ec_fsm_slave_config_t *); |
888
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
71 |
void ec_fsm_slave_config_enter_pdo_sync(ec_fsm_slave_config_t *); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
void ec_fsm_slave_config_enter_fmmu(ec_fsm_slave_config_t *); |
1407
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
73 |
void ec_fsm_slave_config_enter_dc_cycle(ec_fsm_slave_config_t *); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
void ec_fsm_slave_config_enter_safeop(ec_fsm_slave_config_t *); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
void ec_fsm_slave_config_state_end(ec_fsm_slave_config_t *); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
void ec_fsm_slave_config_state_error(ec_fsm_slave_config_t *); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
|
1318
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
79 |
void ec_fsm_slave_config_reconfigure(ec_fsm_slave_config_t *); |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
80 |
|
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
/** Constructor. |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
*/ |
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
85 |
void ec_fsm_slave_config_init( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
86 |
ec_fsm_slave_config_t *fsm, /**< slave state machine */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
87 |
ec_datagram_t *datagram, /**< datagram structure to use */ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
88 |
ec_fsm_change_t *fsm_change, /**< State change state machine to use. */ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
89 |
ec_fsm_coe_t *fsm_coe, /**< CoE state machine to use. */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
90 |
ec_fsm_pdo_t *fsm_pdo /**< PDO configuration state machine to use. */ |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
) |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
{ |
1318
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
93 |
ec_sdo_request_init(&fsm->request_copy); |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
94 |
|
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
fsm->datagram = datagram; |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
96 |
fsm->fsm_change = fsm_change; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
97 |
fsm->fsm_coe = fsm_coe; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
98 |
fsm->fsm_pdo = fsm_pdo; |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
/** Destructor. |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
*/ |
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
105 |
void ec_fsm_slave_config_clear( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
106 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
107 |
) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
{ |
1318
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
109 |
ec_sdo_request_clear(&fsm->request_copy); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
|
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
114 |
/** Start slave configuration state machine. |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
115 |
*/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
116 |
void ec_fsm_slave_config_start( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
117 |
ec_fsm_slave_config_t *fsm, /**< slave state machine */ |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
ec_slave_t *slave /**< slave to configure */ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
) |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
{ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
fsm->slave = slave; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
fsm->state = ec_fsm_slave_config_state_start; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
/** |
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
128 |
* \return false, if state machine has terminated |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
129 |
*/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
130 |
int ec_fsm_slave_config_running( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
131 |
const ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
132 |
) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
{ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
return fsm->state != ec_fsm_slave_config_state_end |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
&& fsm->state != ec_fsm_slave_config_state_error; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
|
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
140 |
/** Executes the current state of the state machine. |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
141 |
* |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
142 |
* If the state machine's datagram is not sent or received yet, the execution |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
143 |
* of the state machine is delayed to the next cycle. |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
144 |
* |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
145 |
* \return false, if state machine has terminated |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
146 |
*/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
147 |
int ec_fsm_slave_config_exec( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
148 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
149 |
) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
{ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
if (fsm->datagram->state == EC_DATAGRAM_SENT |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
|| fsm->datagram->state == EC_DATAGRAM_QUEUED) { |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
// datagram was not sent or received yet. |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
return ec_fsm_slave_config_running(fsm); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
fsm->state(fsm); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
return ec_fsm_slave_config_running(fsm); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
/** |
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
164 |
* \return true, if the state machine terminated gracefully |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
165 |
*/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
166 |
int ec_fsm_slave_config_success( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
167 |
const ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
168 |
) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
169 |
{ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
return fsm->state == ec_fsm_slave_config_state_end; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
/****************************************************************************** |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
* Slave configuration state machine |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
|
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
177 |
/** Slave configuration state: START. |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
178 |
*/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
179 |
void ec_fsm_slave_config_state_start( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
180 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
181 |
) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
182 |
{ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
if (fsm->slave->master->debug_level) { |
986
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
184 |
EC_DBG("Configuring slave %u...\n", fsm->slave->ring_position); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
185 |
} |
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
186 |
|
1318
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
187 |
ec_fsm_slave_config_enter_init(fsm); |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
188 |
} |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
189 |
|
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
190 |
/*****************************************************************************/ |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
191 |
|
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
192 |
/** Start state change to INIT. |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
193 |
*/ |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
194 |
void ec_fsm_slave_config_enter_init( |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
195 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
196 |
) |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
197 |
{ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
198 |
ec_fsm_change_start(fsm->fsm_change, fsm->slave, EC_SLAVE_STATE_INIT); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
199 |
ec_fsm_change_exec(fsm->fsm_change); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
200 |
fsm->state = ec_fsm_slave_config_state_init; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
|
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
205 |
/** Slave configuration state: INIT. |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
206 |
*/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
207 |
void ec_fsm_slave_config_state_init( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
208 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
209 |
) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
{ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
ec_master_t *master = fsm->slave->master; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
212 |
ec_slave_t *slave = fsm->slave; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
213 |
ec_datagram_t *datagram = fsm->datagram; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
215 |
if (ec_fsm_change_exec(fsm->fsm_change)) return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
216 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
217 |
if (!ec_fsm_change_success(fsm->fsm_change)) { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
218 |
if (!fsm->fsm_change->spontaneous_change) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
slave->error_flag = 1; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
fsm->state = ec_fsm_slave_config_state_error; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
if (master->debug_level) { |
986
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
225 |
EC_DBG("Slave %u is now in INIT.\n", slave->ring_position); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
if (!slave->base_fmmu_count) { // skip FMMU configuration |
1342
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
229 |
ec_fsm_slave_config_enter_clear_sync(fsm); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
if (master->debug_level) |
986
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
234 |
EC_DBG("Clearing FMMU configurations of slave %u...\n", |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
slave->ring_position); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
// clear FMMU configurations |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
ec_datagram_fpwr(datagram, slave->station_address, |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
0x0600, EC_FMMU_PAGE_SIZE * slave->base_fmmu_count); |
1225
4d5b739edcb5
Introduced ec_datagram_zero().
Florian Pose <fp@igh-essen.com>
parents:
1180
diff
changeset
|
240 |
ec_datagram_zero(datagram); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
fsm->retries = EC_FSM_RETRIES; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
fsm->state = ec_fsm_slave_config_state_clear_fmmus; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
|
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
247 |
/** Slave configuration state: CLEAR FMMU. |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
248 |
*/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
249 |
void ec_fsm_slave_config_state_clear_fmmus( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
250 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
251 |
) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
{ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
253 |
ec_datagram_t *datagram = fsm->datagram; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
fsm->state = ec_fsm_slave_config_state_error; |
986
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
260 |
EC_ERR("Failed receive FMMU clearing datagram for slave %u.\n", |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
fsm->slave->ring_position); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
265 |
if (datagram->working_counter != 1) { |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
266 |
fsm->slave->error_flag = 1; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
fsm->state = ec_fsm_slave_config_state_error; |
986
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
268 |
EC_ERR("Failed to clear FMMUs of slave %u: ", |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
fsm->slave->ring_position); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
ec_datagram_print_wc_error(datagram); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
|
1342
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
274 |
ec_fsm_slave_config_enter_clear_sync(fsm); |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
275 |
} |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
276 |
|
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
277 |
/*****************************************************************************/ |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
278 |
|
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
279 |
/** Clear the sync manager configurations. |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
280 |
*/ |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
281 |
void ec_fsm_slave_config_enter_clear_sync( |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
282 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
283 |
) |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
284 |
{ |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
285 |
ec_slave_t *slave = fsm->slave; |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
286 |
ec_datagram_t *datagram = fsm->datagram; |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
287 |
size_t sync_size; |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
288 |
|
1404 | 289 |
if (!slave->sii.sync_count) { // FIXME use base_sync_count? |
290 |
// no sync managers |
|
1407
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
291 |
ec_fsm_slave_config_enter_dc_clear_assign(fsm); |
1342
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
292 |
return; |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
293 |
} |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
294 |
|
1344 | 295 |
if (slave->master->debug_level) |
296 |
EC_DBG("Clearing sync manager configurations of slave %u...\n", |
|
297 |
slave->ring_position); |
|
298 |
||
1342
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
299 |
sync_size = EC_SYNC_PAGE_SIZE * slave->sii.sync_count; |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
300 |
|
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
301 |
// clear sync manager configurations |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
302 |
ec_datagram_fpwr(datagram, slave->station_address, 0x0800, sync_size); |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
303 |
memset(datagram->data, 0x00, sync_size); |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
304 |
fsm->retries = EC_FSM_RETRIES; |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
305 |
fsm->state = ec_fsm_slave_config_state_clear_sync; |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
306 |
} |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
307 |
|
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
308 |
/*****************************************************************************/ |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
309 |
|
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
310 |
/** Slave configuration state: CLEAR SYNC. |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
311 |
*/ |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
312 |
void ec_fsm_slave_config_state_clear_sync( |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
313 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
314 |
) |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
315 |
{ |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
316 |
ec_datagram_t *datagram = fsm->datagram; |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
317 |
|
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
318 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
319 |
return; |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
320 |
|
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
321 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
322 |
fsm->state = ec_fsm_slave_config_state_error; |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
323 |
EC_ERR("Failed receive sync manager clearing datagram" |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
324 |
" for slave %u.\n", fsm->slave->ring_position); |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
325 |
return; |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
326 |
} |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
327 |
|
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
328 |
if (datagram->working_counter != 1) { |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
329 |
fsm->slave->error_flag = 1; |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
330 |
fsm->state = ec_fsm_slave_config_state_error; |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
331 |
EC_ERR("Failed to clear sync manager configurations of slave %u: ", |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
332 |
fsm->slave->ring_position); |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
333 |
ec_datagram_print_wc_error(datagram); |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
334 |
return; |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
335 |
} |
a72b9b370277
Clear sync managers before configuration.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
336 |
|
1407
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
337 |
ec_fsm_slave_config_enter_dc_clear_assign(fsm); |
1406
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
338 |
} |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
339 |
|
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
340 |
/*****************************************************************************/ |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
341 |
|
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
342 |
/** Clear the DC assignment. |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
343 |
*/ |
1407
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
344 |
void ec_fsm_slave_config_enter_dc_clear_assign( |
1406
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
345 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
346 |
) |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
347 |
{ |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
348 |
ec_slave_t *slave = fsm->slave; |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
349 |
ec_datagram_t *datagram = fsm->datagram; |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
350 |
|
1419
8fc38c37d86e
Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents:
1412
diff
changeset
|
351 |
if (!slave->base_dc_supported || !slave->has_dc_system_time) { |
1406
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
352 |
ec_fsm_slave_config_enter_mbox_sync(fsm); |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
353 |
return; |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
354 |
} |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
355 |
|
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
356 |
if (slave->master->debug_level) |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
357 |
EC_DBG("Clearing DC assignment of slave %u...\n", |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
358 |
slave->ring_position); |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
359 |
|
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
360 |
ec_datagram_fpwr(datagram, slave->station_address, 0x0980, 2); |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
361 |
ec_datagram_zero(datagram); |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
362 |
fsm->retries = EC_FSM_RETRIES; |
1407
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
363 |
fsm->state = ec_fsm_slave_config_state_dc_clear_assign; |
1406
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
364 |
} |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
365 |
|
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
366 |
/*****************************************************************************/ |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
367 |
|
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
368 |
/** Slave configuration state: CLEAR DC ASSIGN. |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
369 |
*/ |
1407
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
370 |
void ec_fsm_slave_config_state_dc_clear_assign( |
1406
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
371 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
372 |
) |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
373 |
{ |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
374 |
ec_datagram_t *datagram = fsm->datagram; |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
375 |
|
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
376 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
377 |
return; |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
378 |
|
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
379 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
380 |
fsm->state = ec_fsm_slave_config_state_error; |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
381 |
EC_ERR("Failed receive DC assignment clearing datagram" |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
382 |
" for slave %u.\n", fsm->slave->ring_position); |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
383 |
return; |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
384 |
} |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
385 |
|
1407
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
386 |
if (fsm->slave->master->debug_level && datagram->working_counter != 1) { |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
387 |
// clearing the DC assignment does not succeed on simple slaves |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
388 |
EC_DBG("Failed to clear DC assignment of slave %u: ", |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
389 |
fsm->slave->ring_position); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
390 |
ec_datagram_print_wc_error(datagram); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
391 |
} |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
392 |
|
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
393 |
// read DC system time and system time offset |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
394 |
ec_datagram_fprd(fsm->datagram, fsm->slave->station_address, 0x0910, 24); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
395 |
fsm->retries = EC_FSM_RETRIES; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
396 |
fsm->state = ec_fsm_slave_config_state_dc_read_offset; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
397 |
} |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
398 |
|
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
399 |
/*****************************************************************************/ |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
400 |
|
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
401 |
/** Slave configuration state: DC READ OFFSET. |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
402 |
*/ |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
403 |
void ec_fsm_slave_config_state_dc_read_offset( |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
404 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
405 |
) |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
406 |
{ |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
407 |
ec_datagram_t *datagram = fsm->datagram; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
408 |
ec_slave_t *slave = fsm->slave; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
409 |
u64 system_time, old_offset, new_offset; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
410 |
|
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
411 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
412 |
return; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
413 |
|
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
414 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
415 |
fsm->state = ec_fsm_slave_config_state_error; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
416 |
EC_ERR("Failed to receive DC times datagram for slave %u" |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
417 |
" (datagram state %u).\n", |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
418 |
slave->ring_position, datagram->state); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
419 |
return; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
420 |
} |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
421 |
|
1406
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
422 |
if (datagram->working_counter != 1) { |
1407
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
423 |
slave->error_flag = 1; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
424 |
fsm->state = ec_fsm_slave_config_state_error; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
425 |
EC_ERR("Failed to get DC times of slave %u: ", |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
426 |
slave->ring_position); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
427 |
ec_datagram_print_wc_error(datagram); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
428 |
return; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
429 |
} |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
430 |
|
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
431 |
system_time = EC_READ_U64(datagram->data); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
432 |
old_offset = EC_READ_U64(datagram->data + 16); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
433 |
new_offset = slave->master->app_time - system_time + old_offset; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
434 |
|
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
435 |
if (slave->master->debug_level) |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
436 |
EC_DBG("Slave %u: DC system_time=%llu old_offset=%llu, " |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
437 |
"app_time=%llu, new_offset=%llu\n", |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
438 |
slave->ring_position, system_time, old_offset, |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
439 |
slave->master->app_time, new_offset); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
440 |
|
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
441 |
// set DC system time offset |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
442 |
ec_datagram_fpwr(datagram, slave->station_address, 0x0920, 8); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
443 |
EC_WRITE_U64(datagram->data, new_offset); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
444 |
fsm->retries = EC_FSM_RETRIES; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
445 |
fsm->state = ec_fsm_slave_config_state_dc_write_offset; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
446 |
} |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
447 |
|
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
448 |
/*****************************************************************************/ |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
449 |
|
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
450 |
/** Slave configuration state: DC WRITE OFFSET. |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
451 |
*/ |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
452 |
void ec_fsm_slave_config_state_dc_write_offset( |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
453 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
454 |
) |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
455 |
{ |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
456 |
ec_datagram_t *datagram = fsm->datagram; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
457 |
ec_slave_t *slave = fsm->slave; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
458 |
|
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
459 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
460 |
return; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
461 |
|
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
462 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
463 |
fsm->state = ec_fsm_slave_config_state_error; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
464 |
EC_ERR("Failed to receive DC system time offset datagram for slave %u" |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
465 |
" (datagram state %u).\n", |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
466 |
slave->ring_position, datagram->state); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
467 |
return; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
468 |
} |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
469 |
|
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
470 |
if (datagram->working_counter != 1) { |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
471 |
slave->error_flag = 1; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
472 |
fsm->state = ec_fsm_slave_config_state_error; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
473 |
EC_ERR("Failed to set DC system time offset of slave %u: ", |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
474 |
slave->ring_position); |
1406
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
475 |
ec_datagram_print_wc_error(datagram); |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
476 |
return; |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
477 |
} |
8686c5b3d14b
Clear DC assignment after going to INIT.
Florian Pose <fp@igh-essen.com>
parents:
1404
diff
changeset
|
478 |
|
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
479 |
ec_fsm_slave_config_enter_mbox_sync(fsm); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
480 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
481 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
482 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
483 |
|
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
484 |
/** Check for mailbox sync managers to be configured. |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
485 |
*/ |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
486 |
void ec_fsm_slave_config_enter_mbox_sync( |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
487 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
488 |
) |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
489 |
{ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
490 |
ec_master_t *master = fsm->slave->master; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
491 |
ec_slave_t *slave = fsm->slave; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
492 |
ec_datagram_t *datagram = fsm->datagram; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
493 |
unsigned int i; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
494 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
495 |
// slave is now in INIT |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
496 |
if (slave->current_state == slave->requested_state) { |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
497 |
fsm->state = ec_fsm_slave_config_state_end; // successful |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
498 |
if (master->debug_level) { |
986
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
499 |
EC_DBG("Finished configuration of slave %u.\n", |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
500 |
slave->ring_position); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
501 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
502 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
503 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
504 |
|
834
0791aac03180
Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents:
830
diff
changeset
|
505 |
if (!slave->sii.mailbox_protocols) { |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
506 |
// no mailbox protocols supported |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
507 |
if (master->debug_level) |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
508 |
EC_DBG("Slave %u does not support mailbox communication.\n", |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
509 |
slave->ring_position); |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
510 |
ec_fsm_slave_config_enter_boot_preop(fsm); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
511 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
512 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
513 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
514 |
if (master->debug_level) { |
986
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
515 |
EC_DBG("Configuring mailbox sync managers of slave %u.\n", |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
516 |
slave->ring_position); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
517 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
518 |
|
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
519 |
if (slave->requested_state == EC_SLAVE_STATE_BOOT) { |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
520 |
ec_sync_t sync; |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
521 |
|
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
522 |
ec_datagram_fpwr(datagram, slave->station_address, 0x0800, |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
523 |
EC_SYNC_PAGE_SIZE * 2); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
524 |
memset(datagram->data, 0x00, EC_SYNC_PAGE_SIZE * 2); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
525 |
|
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
526 |
ec_sync_init(&sync, slave); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
527 |
sync.physical_start_address = slave->sii.boot_rx_mailbox_offset; |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
528 |
sync.control_register = 0x26; |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
529 |
sync.enable = 1; |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
530 |
ec_sync_page(&sync, 0, slave->sii.boot_rx_mailbox_size, |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
531 |
EC_DIR_INVALID, // use default direction |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
532 |
datagram->data); |
1338
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
533 |
slave->configured_rx_mailbox_offset = |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
534 |
slave->sii.boot_rx_mailbox_offset; |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
535 |
slave->configured_rx_mailbox_size = |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
536 |
slave->sii.boot_rx_mailbox_size; |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
537 |
|
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
538 |
ec_sync_init(&sync, slave); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
539 |
sync.physical_start_address = slave->sii.boot_tx_mailbox_offset; |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
540 |
sync.control_register = 0x22; |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
541 |
sync.enable = 1; |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
542 |
ec_sync_page(&sync, 1, slave->sii.boot_tx_mailbox_size, |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
543 |
EC_DIR_INVALID, // use default direction |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
544 |
datagram->data + EC_SYNC_PAGE_SIZE); |
1338
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
545 |
slave->configured_tx_mailbox_offset = |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
546 |
slave->sii.boot_tx_mailbox_offset; |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
547 |
slave->configured_tx_mailbox_size = |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
548 |
slave->sii.boot_tx_mailbox_size; |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
549 |
|
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
550 |
} else if (slave->sii.sync_count >= 2) { // mailbox configuration provided |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
551 |
ec_datagram_fpwr(datagram, slave->station_address, 0x0800, |
834
0791aac03180
Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents:
830
diff
changeset
|
552 |
EC_SYNC_PAGE_SIZE * slave->sii.sync_count); |
1225
4d5b739edcb5
Introduced ec_datagram_zero().
Florian Pose <fp@igh-essen.com>
parents:
1180
diff
changeset
|
553 |
ec_datagram_zero(datagram); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
554 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
555 |
for (i = 0; i < 2; i++) { |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
556 |
ec_sync_page(&slave->sii.syncs[i], i, |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
557 |
slave->sii.syncs[i].default_length, |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
558 |
EC_DIR_INVALID, // use default direction |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
559 |
datagram->data + EC_SYNC_PAGE_SIZE * i); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
560 |
} |
1338
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
561 |
|
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
562 |
slave->configured_rx_mailbox_offset = |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
563 |
slave->sii.syncs[0].physical_start_address; |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
564 |
slave->configured_rx_mailbox_size = |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
565 |
slave->sii.syncs[0].default_length; |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
566 |
slave->configured_tx_mailbox_offset = |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
567 |
slave->sii.syncs[1].physical_start_address; |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
568 |
slave->configured_tx_mailbox_size = |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
569 |
slave->sii.syncs[1].default_length; |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
570 |
} else { // no mailbox sync manager configurations provided |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
571 |
ec_sync_t sync; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
572 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
573 |
if (master->debug_level) |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
574 |
EC_DBG("Slave %u does not provide" |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
575 |
" mailbox sync manager configurations.\n", |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
576 |
slave->ring_position); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
577 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
578 |
ec_datagram_fpwr(datagram, slave->station_address, 0x0800, |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
579 |
EC_SYNC_PAGE_SIZE * 2); |
1225
4d5b739edcb5
Introduced ec_datagram_zero().
Florian Pose <fp@igh-essen.com>
parents:
1180
diff
changeset
|
580 |
ec_datagram_zero(datagram); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
581 |
|
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
582 |
ec_sync_init(&sync, slave); |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
583 |
sync.physical_start_address = slave->sii.std_rx_mailbox_offset; |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
584 |
sync.control_register = 0x26; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
585 |
sync.enable = 1; |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
586 |
ec_sync_page(&sync, 0, slave->sii.std_rx_mailbox_size, |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
587 |
EC_DIR_INVALID, // use default direction |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
588 |
datagram->data); |
1338
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
589 |
slave->configured_rx_mailbox_offset = |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
590 |
slave->sii.std_rx_mailbox_offset; |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
591 |
slave->configured_rx_mailbox_size = |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
592 |
slave->sii.std_rx_mailbox_size; |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
593 |
|
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
594 |
ec_sync_init(&sync, slave); |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
595 |
sync.physical_start_address = slave->sii.std_tx_mailbox_offset; |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
596 |
sync.control_register = 0x22; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
597 |
sync.enable = 1; |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
598 |
ec_sync_page(&sync, 1, slave->sii.std_tx_mailbox_size, |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
599 |
EC_DIR_INVALID, // use default direction |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
600 |
datagram->data + EC_SYNC_PAGE_SIZE); |
1338
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
601 |
slave->configured_tx_mailbox_offset = |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
602 |
slave->sii.boot_tx_mailbox_offset; |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
603 |
slave->configured_tx_mailbox_size = |
eb31b5a135da
merge -c1621 branches/1.4-foe: Introduced configured_[tr]x_mailbox(size|offset) members of slave.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
604 |
slave->sii.boot_tx_mailbox_size; |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
605 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
606 |
|
1347
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
607 |
fsm->take_time = 1; |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
608 |
|
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
609 |
fsm->retries = EC_FSM_RETRIES; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
610 |
fsm->state = ec_fsm_slave_config_state_mbox_sync; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
611 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
612 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
613 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
614 |
|
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
615 |
/** Slave configuration state: SYNC. |
1345 | 616 |
* |
617 |
* \todo Timeout for response. |
|
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
618 |
*/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
619 |
void ec_fsm_slave_config_state_mbox_sync( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
620 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
621 |
) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
622 |
{ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
623 |
ec_datagram_t *datagram = fsm->datagram; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
624 |
ec_slave_t *slave = fsm->slave; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
625 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
626 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
627 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
628 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
629 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
630 |
fsm->state = ec_fsm_slave_config_state_error; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
631 |
EC_ERR("Failed to receive sync manager configuration datagram for" |
986
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
632 |
" slave %u (datagram state %u).\n", |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
633 |
slave->ring_position, datagram->state); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
634 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
635 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
636 |
|
1347
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
637 |
if (fsm->take_time) { |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
638 |
fsm->take_time = 0; |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
639 |
fsm->jiffies_start = datagram->jiffies_sent; |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
640 |
} |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
641 |
|
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
642 |
/* Because the sync manager configurations are cleared during the last |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
643 |
* cycle, some slaves do not immediately respond to the mailbox sync |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
644 |
* manager configuration datagram. Therefore, resend the datagram for |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
645 |
* a certain time, if the slave does not respond. |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
646 |
*/ |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
647 |
if (datagram->working_counter == 0) { |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
648 |
unsigned long diff = datagram->jiffies_received - fsm->jiffies_start; |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
649 |
|
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
650 |
if (diff >= HZ) { |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
651 |
slave->error_flag = 1; |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
652 |
fsm->state = ec_fsm_slave_config_state_error; |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
653 |
EC_ERR("Timeout while configuring mailbox sync managers of" |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
654 |
" slave %u.\n", slave->ring_position); |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
655 |
return; |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
656 |
} |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
657 |
else if (slave->master->debug_level) { |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
658 |
EC_DBG("Resending after %u ms...\n", |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
659 |
(unsigned int) diff * 1000 / HZ); |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
660 |
} |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
661 |
|
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
662 |
// send configuration datagram again |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
663 |
fsm->retries = EC_FSM_RETRIES; |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
664 |
return; |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
665 |
} |
41360ffdcb14
Allow the slave to not respond to the mailbox sync manager configuration
Florian Pose <fp@igh-essen.com>
parents:
1345
diff
changeset
|
666 |
else if (datagram->working_counter != 1) { |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
667 |
slave->error_flag = 1; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
668 |
fsm->state = ec_fsm_slave_config_state_error; |
986
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
669 |
EC_ERR("Failed to set sync managers of slave %u: ", |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
670 |
slave->ring_position); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
671 |
ec_datagram_print_wc_error(datagram); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
672 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
673 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
674 |
|
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
675 |
ec_fsm_slave_config_enter_boot_preop(fsm); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
676 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
677 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
678 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
679 |
|
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
680 |
/** Request PREOP state. |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
681 |
*/ |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
682 |
void ec_fsm_slave_config_enter_boot_preop( |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
683 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
684 |
) |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
685 |
{ |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
686 |
fsm->state = ec_fsm_slave_config_state_boot_preop; |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
687 |
|
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
688 |
if (fsm->slave->requested_state != EC_SLAVE_STATE_BOOT) { |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
689 |
ec_fsm_change_start(fsm->fsm_change, fsm->slave, EC_SLAVE_STATE_PREOP); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
690 |
} else { // BOOT |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
691 |
ec_fsm_change_start(fsm->fsm_change, fsm->slave, EC_SLAVE_STATE_BOOT); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
692 |
} |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
693 |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
694 |
ec_fsm_change_exec(fsm->fsm_change); // execute immediately |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
695 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
696 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
697 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
698 |
|
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
699 |
/** Slave configuration state: BOOT/PREOP. |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
700 |
*/ |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
701 |
void ec_fsm_slave_config_state_boot_preop( |
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
702 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
703 |
) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
704 |
{ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
705 |
ec_slave_t *slave = fsm->slave; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
706 |
ec_master_t *master = fsm->slave->master; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
707 |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
708 |
if (ec_fsm_change_exec(fsm->fsm_change)) return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
709 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
710 |
if (!ec_fsm_change_success(fsm->fsm_change)) { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
711 |
if (!fsm->fsm_change->spontaneous_change) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
712 |
slave->error_flag = 1; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
713 |
fsm->state = ec_fsm_slave_config_state_error; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
714 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
715 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
716 |
|
1404 | 717 |
// slave is now in BOOT or PREOP |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
718 |
slave->jiffies_preop = fsm->datagram->jiffies_received; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
719 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
720 |
if (master->debug_level) { |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
721 |
EC_DBG("Slave %u is now in %s.\n", slave->ring_position, |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
722 |
slave->requested_state != EC_SLAVE_STATE_BOOT |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
723 |
? "PREOP" : "BOOT"); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
724 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
725 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
726 |
if (slave->current_state == slave->requested_state) { |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
727 |
fsm->state = ec_fsm_slave_config_state_end; // successful |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
728 |
if (master->debug_level) { |
888
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
729 |
EC_DBG("Finished configuration of slave %u.\n", |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
730 |
slave->ring_position); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
731 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
732 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
733 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
734 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
735 |
if (!slave->config) { |
1374
1ca1178a3f93
Warn if going to SAFEOP without configuration.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
736 |
EC_WARN("Slave %u is not configured.\n", slave->ring_position); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
737 |
ec_fsm_slave_config_enter_safeop(fsm); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
738 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
739 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
740 |
|
888
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
741 |
ec_fsm_slave_config_enter_sdo_conf(fsm); |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
742 |
} |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
743 |
|
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
744 |
/*****************************************************************************/ |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
745 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
746 |
/** Check for SDO configurations to be applied. |
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
747 |
*/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
748 |
void ec_fsm_slave_config_enter_sdo_conf( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
749 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
750 |
) |
888
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
751 |
{ |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
752 |
ec_slave_t *slave = fsm->slave; |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
753 |
|
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
754 |
// No CoE configuration to be applied? |
1392
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
755 |
// FIXME check for config |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
756 |
if (list_empty(&slave->config->sdo_configs)) { // skip SDO configuration |
1180
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
757 |
ec_fsm_slave_config_enter_pdo_conf(fsm); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
758 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
759 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
760 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
761 |
// start SDO configuration |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
762 |
fsm->state = ec_fsm_slave_config_state_sdo_conf; |
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
763 |
fsm->request = list_entry(fsm->slave->config->sdo_configs.next, |
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
764 |
ec_sdo_request_t, list); |
1318
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
765 |
ec_sdo_request_copy(&fsm->request_copy, fsm->request); |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
766 |
ecrt_sdo_request_write(&fsm->request_copy); |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
767 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request_copy); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
768 |
ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
769 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
770 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
771 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
772 |
|
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
773 |
/** Slave configuration state: SDO_CONF. |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
774 |
*/ |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
775 |
void ec_fsm_slave_config_state_sdo_conf( |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
776 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
777 |
) |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
778 |
{ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
779 |
if (ec_fsm_coe_exec(fsm->fsm_coe)) return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
780 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
781 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
782 |
EC_ERR("SDO configuration failed for slave %u.\n", |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
783 |
fsm->slave->ring_position); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
784 |
fsm->slave->error_flag = 1; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
785 |
fsm->state = ec_fsm_slave_config_state_error; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
786 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
787 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
788 |
|
1318
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
789 |
if (!fsm->slave->config) { // config removed in the meantime |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
790 |
ec_fsm_slave_config_reconfigure(fsm); |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
791 |
return; |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
792 |
} |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
793 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
794 |
// Another SDO to configure? |
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
795 |
if (fsm->request->list.next != &fsm->slave->config->sdo_configs) { |
1318
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
796 |
fsm->request = list_entry(fsm->request->list.next, |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
797 |
ec_sdo_request_t, list); |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
798 |
ec_sdo_request_copy(&fsm->request_copy, fsm->request); |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
799 |
ecrt_sdo_request_write(&fsm->request_copy); |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
800 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request_copy); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
801 |
ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
802 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
803 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
804 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
805 |
// All SDOs are now configured. |
1180
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
806 |
ec_fsm_slave_config_enter_pdo_conf(fsm); |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
807 |
} |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
808 |
|
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
809 |
/*****************************************************************************/ |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
810 |
|
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
811 |
/** PDO_CONF entry function. |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
812 |
*/ |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
813 |
void ec_fsm_slave_config_enter_pdo_conf( |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
814 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
815 |
) |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
816 |
{ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
817 |
// Start configuring PDOs |
1180
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
818 |
ec_fsm_pdo_start_configuration(fsm->fsm_pdo, fsm->slave); |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
819 |
fsm->state = ec_fsm_slave_config_state_pdo_conf; |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
820 |
fsm->state(fsm); // execute immediately |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
821 |
} |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
822 |
|
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
823 |
/*****************************************************************************/ |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
824 |
|
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
825 |
/** Slave configuration state: PDO_CONF. |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
826 |
*/ |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
827 |
void ec_fsm_slave_config_state_pdo_conf( |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
828 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
829 |
) |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
830 |
{ |
1407
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
831 |
// TODO check for config here |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
832 |
|
1180
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
833 |
if (ec_fsm_pdo_exec(fsm->fsm_pdo)) |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
834 |
return; |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
835 |
|
1318
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
836 |
if (!fsm->slave->config) { // config removed in the meantime |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
837 |
ec_fsm_slave_config_reconfigure(fsm); |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
838 |
return; |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
839 |
} |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
840 |
|
1180
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
841 |
if (!ec_fsm_pdo_success(fsm->fsm_pdo)) { |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
842 |
EC_WARN("PDO configuration failed on slave %u.\n", |
1180
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
843 |
fsm->slave->ring_position); |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
844 |
} |
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
845 |
|
888
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
846 |
ec_fsm_slave_config_enter_pdo_sync(fsm); |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
847 |
} |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
848 |
|
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
849 |
/*****************************************************************************/ |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
850 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
851 |
/** Check for PDO sync managers to be configured. |
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
852 |
*/ |
888
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
853 |
void ec_fsm_slave_config_enter_pdo_sync( |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
854 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
855 |
) |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
856 |
{ |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
857 |
ec_slave_t *slave = fsm->slave; |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
858 |
ec_datagram_t *datagram = fsm->datagram; |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
859 |
unsigned int i, offset, num_pdo_syncs; |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
860 |
uint8_t sync_index; |
888
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
861 |
const ec_sync_t *sync; |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
862 |
const ec_sync_config_t *sync_config; |
888
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
863 |
uint16_t size; |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
864 |
|
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
865 |
if (slave->sii.mailbox_protocols) { |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
866 |
offset = 2; // slave has mailboxes |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
867 |
} else { |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
868 |
offset = 0; |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
869 |
} |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
870 |
|
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
871 |
if (slave->sii.sync_count <= offset) { |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
872 |
// no PDO sync managers to configure |
1180
846907b8cc4b
Configure Pdos before configuring the Pdo sync managers,
Florian Pose <fp@igh-essen.com>
parents:
1174
diff
changeset
|
873 |
ec_fsm_slave_config_enter_fmmu(fsm); |
888
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
874 |
return; |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
875 |
} |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
876 |
|
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
877 |
num_pdo_syncs = slave->sii.sync_count - offset; |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
878 |
|
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
879 |
// configure sync managers for process data |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
880 |
ec_datagram_fpwr(datagram, slave->station_address, |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
881 |
0x0800 + EC_SYNC_PAGE_SIZE * offset, |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
882 |
EC_SYNC_PAGE_SIZE * num_pdo_syncs); |
1225
4d5b739edcb5
Introduced ec_datagram_zero().
Florian Pose <fp@igh-essen.com>
parents:
1180
diff
changeset
|
883 |
ec_datagram_zero(datagram); |
888
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
884 |
|
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
885 |
for (i = 0; i < num_pdo_syncs; i++) { |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
886 |
sync_index = i + offset; |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
887 |
sync = &slave->sii.syncs[sync_index]; |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
888 |
sync_config = &slave->config->sync_configs[sync_index]; |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
889 |
size = ec_pdo_list_total_size(&sync_config->pdos); |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
890 |
ec_sync_page(sync, sync_index, size, sync_config->dir, |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
891 |
datagram->data + EC_SYNC_PAGE_SIZE * i); |
888
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
892 |
} |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
893 |
|
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
894 |
fsm->retries = EC_FSM_RETRIES; |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
895 |
fsm->state = ec_fsm_slave_config_state_pdo_sync; |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
896 |
} |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
897 |
|
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
898 |
/*****************************************************************************/ |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
899 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
900 |
/** Configure PDO sync managers. |
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
901 |
*/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
902 |
void ec_fsm_slave_config_state_pdo_sync( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
903 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
904 |
) |
888
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
905 |
{ |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
906 |
ec_datagram_t *datagram = fsm->datagram; |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
907 |
ec_slave_t *slave = fsm->slave; |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
908 |
|
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
909 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
910 |
return; |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
911 |
|
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
912 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
913 |
fsm->state = ec_fsm_slave_config_state_error; |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
914 |
EC_ERR("Failed to receive process data sync manager configuration" |
986
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
915 |
" datagram for slave %u (datagram state %u).\n", |
888
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
916 |
slave->ring_position, datagram->state); |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
917 |
return; |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
918 |
} |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
919 |
|
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
920 |
if (datagram->working_counter != 1) { |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
921 |
slave->error_flag = 1; |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
922 |
fsm->state = ec_fsm_slave_config_state_error; |
986
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
923 |
EC_ERR("Failed to set process data sync managers of slave %u: ", |
888
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
924 |
slave->ring_position); |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
925 |
ec_datagram_print_wc_error(datagram); |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
926 |
return; |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
927 |
} |
f0db19108bba
Moved Pdo sync manager configuration before Pdo assignment in slave
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
928 |
|
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
929 |
ec_fsm_slave_config_enter_fmmu(fsm); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
930 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
931 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
932 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
933 |
|
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
934 |
/** Check for FMMUs to be configured. |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
935 |
*/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
936 |
void ec_fsm_slave_config_enter_fmmu( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
937 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
938 |
) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
939 |
{ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
940 |
ec_slave_t *slave = fsm->slave; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
941 |
ec_datagram_t *datagram = fsm->datagram; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
942 |
unsigned int i; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
943 |
const ec_fmmu_config_t *fmmu; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
944 |
const ec_sync_t *sync; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
945 |
|
1407
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
946 |
if (!slave->config) { // config removed in the meantime |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
947 |
ec_fsm_slave_config_reconfigure(fsm); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
948 |
return; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
949 |
} |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
950 |
|
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
951 |
if (slave->base_fmmu_count < slave->config->used_fmmus) { |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
952 |
slave->error_flag = 1; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
953 |
fsm->state = ec_fsm_slave_config_state_error; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
954 |
EC_ERR("Slave %u has less FMMUs (%u) than requested (%u).\n", |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
955 |
slave->ring_position, slave->base_fmmu_count, |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
956 |
slave->config->used_fmmus); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
957 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
958 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
959 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
960 |
if (!slave->base_fmmu_count) { // skip FMMU configuration |
1407
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
961 |
ec_fsm_slave_config_enter_dc_cycle(fsm); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
962 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
963 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
964 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
965 |
// configure FMMUs |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
966 |
ec_datagram_fpwr(datagram, slave->station_address, |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
967 |
0x0600, EC_FMMU_PAGE_SIZE * slave->base_fmmu_count); |
1225
4d5b739edcb5
Introduced ec_datagram_zero().
Florian Pose <fp@igh-essen.com>
parents:
1180
diff
changeset
|
968 |
ec_datagram_zero(datagram); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
969 |
for (i = 0; i < slave->config->used_fmmus; i++) { |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
970 |
fmmu = &slave->config->fmmu_configs[i]; |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1053
diff
changeset
|
971 |
if (!(sync = ec_slave_get_sync(slave, fmmu->sync_index))) { |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
972 |
slave->error_flag = 1; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
973 |
fsm->state = ec_fsm_slave_config_state_error; |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
974 |
EC_ERR("Failed to determine PDO sync manager for FMMU on slave" |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
975 |
" %u!\n", slave->ring_position); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
976 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
977 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
978 |
ec_fmmu_config_page(fmmu, sync, |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
979 |
datagram->data + EC_FMMU_PAGE_SIZE * i); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
980 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
981 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
982 |
fsm->retries = EC_FSM_RETRIES; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
983 |
fsm->state = ec_fsm_slave_config_state_fmmu; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
984 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
985 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
986 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
987 |
|
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
988 |
/** Slave configuration state: FMMU. |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
989 |
*/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
990 |
void ec_fsm_slave_config_state_fmmu( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
991 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
992 |
) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
993 |
{ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
994 |
ec_datagram_t *datagram = fsm->datagram; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
995 |
ec_slave_t *slave = fsm->slave; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
996 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
997 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
998 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
999 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1000 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1001 |
fsm->state = ec_fsm_slave_config_state_error; |
986
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
1002 |
EC_ERR("Failed to receive FMMUs datagram for slave %u" |
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
1003 |
" (datagram state %u).\n", |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1004 |
slave->ring_position, datagram->state); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1005 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1006 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1007 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1008 |
if (datagram->working_counter != 1) { |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1009 |
slave->error_flag = 1; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1010 |
fsm->state = ec_fsm_slave_config_state_error; |
986
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
1011 |
EC_ERR("Failed to set FMMUs of slave %u: ", |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1012 |
slave->ring_position); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1013 |
ec_datagram_print_wc_error(datagram); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1014 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1015 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1016 |
|
1407
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1017 |
ec_fsm_slave_config_enter_dc_cycle(fsm); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1018 |
} |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1019 |
|
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1020 |
/*****************************************************************************/ |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1021 |
|
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1022 |
/** Check for DC to be configured. |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1023 |
*/ |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1024 |
void ec_fsm_slave_config_enter_dc_cycle( |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1025 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1026 |
) |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1027 |
{ |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1028 |
ec_datagram_t *datagram = fsm->datagram; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1029 |
ec_slave_t *slave = fsm->slave; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1030 |
ec_slave_config_t *config = slave->config; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1031 |
|
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1032 |
if (!config) { // config removed in the meantime |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1033 |
ec_fsm_slave_config_reconfigure(fsm); |
1396
9d04cc08f40f
DC sync reference clock to application time. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1392
diff
changeset
|
1034 |
return; |
9d04cc08f40f
DC sync reference clock to application time. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1392
diff
changeset
|
1035 |
} |
1392
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1036 |
|
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1037 |
if (config->dc_assign_activate) { |
1419
8fc38c37d86e
Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents:
1412
diff
changeset
|
1038 |
if (!slave->base_dc_supported || !slave->has_dc_system_time) { |
1407
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1039 |
EC_WARN("Slave %u seems not to support distributed clocks!\n", |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1040 |
slave->ring_position); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1041 |
} |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1042 |
|
1392
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1043 |
// set DC cycle times |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1044 |
ec_datagram_fpwr(datagram, slave->station_address, 0x09A0, 8); |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1045 |
EC_WRITE_U32(datagram->data, config->dc_sync_cycle_times[0]); |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1046 |
EC_WRITE_U32(datagram->data + 4, config->dc_sync_cycle_times[1]); |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1047 |
fsm->retries = EC_FSM_RETRIES; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1048 |
fsm->state = ec_fsm_slave_config_state_dc_cycle; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1049 |
} else { |
1404 | 1050 |
// DC are unused |
1396
9d04cc08f40f
DC sync reference clock to application time. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1392
diff
changeset
|
1051 |
ec_fsm_slave_config_enter_safeop(fsm); |
1392
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1052 |
} |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1053 |
} |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1054 |
|
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1055 |
/*****************************************************************************/ |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1056 |
|
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1057 |
/** Slave configuration state: DC CYCLE. |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1058 |
*/ |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1059 |
void ec_fsm_slave_config_state_dc_cycle( |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1060 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1061 |
) |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1062 |
{ |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1063 |
ec_datagram_t *datagram = fsm->datagram; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1064 |
ec_slave_t *slave = fsm->slave; |
1412 | 1065 |
ec_slave_config_t *config = slave->config; |
1396
9d04cc08f40f
DC sync reference clock to application time. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1392
diff
changeset
|
1066 |
u64 start_time; |
1392
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1067 |
|
1412 | 1068 |
if (!config) { // config removed in the meantime |
1069 |
ec_fsm_slave_config_reconfigure(fsm); |
|
1070 |
return; |
|
1071 |
} |
|
1072 |
||
1392
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1073 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1074 |
return; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1075 |
|
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1076 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1077 |
fsm->state = ec_fsm_slave_config_state_error; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1078 |
EC_ERR("Failed to receive DC cycle times datagram for slave %u" |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1079 |
" (datagram state %u).\n", |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1080 |
slave->ring_position, datagram->state); |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1081 |
return; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1082 |
} |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1083 |
|
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1084 |
if (datagram->working_counter != 1) { |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1085 |
slave->error_flag = 1; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1086 |
fsm->state = ec_fsm_slave_config_state_error; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1087 |
EC_ERR("Failed to set DC cycle times of slave %u: ", |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1088 |
slave->ring_position); |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1089 |
ec_datagram_print_wc_error(datagram); |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1090 |
return; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1091 |
} |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1092 |
|
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1093 |
// set DC start time |
1412 | 1094 |
start_time = slave->master->app_time + |
1095 |
config->dc_sync_shift_times[0] + 100000000ULL; // now + shift + x ns |
|
1396
9d04cc08f40f
DC sync reference clock to application time. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1392
diff
changeset
|
1096 |
if (slave->master->debug_level) |
9d04cc08f40f
DC sync reference clock to application time. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1392
diff
changeset
|
1097 |
EC_DBG("Slave %u: Setting DC cyclic operation start time to %llu.\n", |
9d04cc08f40f
DC sync reference clock to application time. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1392
diff
changeset
|
1098 |
slave->ring_position, start_time); |
9d04cc08f40f
DC sync reference clock to application time. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1392
diff
changeset
|
1099 |
|
1392
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1100 |
ec_datagram_fpwr(datagram, slave->station_address, 0x0990, 8); |
1396
9d04cc08f40f
DC sync reference clock to application time. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1392
diff
changeset
|
1101 |
EC_WRITE_U64(datagram->data, start_time); |
1392
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1102 |
fsm->retries = EC_FSM_RETRIES; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1103 |
fsm->state = ec_fsm_slave_config_state_dc_start; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1104 |
} |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1105 |
|
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1106 |
/*****************************************************************************/ |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1107 |
|
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1108 |
/** Slave configuration state: DC START. |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1109 |
*/ |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1110 |
void ec_fsm_slave_config_state_dc_start( |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1111 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1112 |
) |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1113 |
{ |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1114 |
ec_datagram_t *datagram = fsm->datagram; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1115 |
ec_slave_t *slave = fsm->slave; |
1407
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1116 |
ec_slave_config_t *config = slave->config; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1117 |
|
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1118 |
if (!config) { // config removed in the meantime |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1119 |
ec_fsm_slave_config_reconfigure(fsm); |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1120 |
return; |
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1121 |
} |
1392
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1122 |
|
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1123 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1124 |
return; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1125 |
|
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1126 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1127 |
fsm->state = ec_fsm_slave_config_state_error; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1128 |
EC_ERR("Failed to receive DC start time datagram for slave %u" |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1129 |
" (datagram state %u).\n", |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1130 |
slave->ring_position, datagram->state); |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1131 |
return; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1132 |
} |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1133 |
|
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1134 |
if (datagram->working_counter != 1) { |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1135 |
slave->error_flag = 1; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1136 |
fsm->state = ec_fsm_slave_config_state_error; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1137 |
EC_ERR("Failed to set DC start time of slave %u: ", |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1138 |
slave->ring_position); |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1139 |
ec_datagram_print_wc_error(datagram); |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1140 |
return; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1141 |
} |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1142 |
|
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1143 |
// assign sync unit to EtherCAT or PDI |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1144 |
ec_datagram_fpwr(datagram, slave->station_address, 0x0980, 2); |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1145 |
EC_WRITE_U16(datagram->data, config->dc_assign_activate); |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1146 |
fsm->retries = EC_FSM_RETRIES; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1147 |
fsm->state = ec_fsm_slave_config_state_dc_assign; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1148 |
} |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1149 |
|
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1150 |
/*****************************************************************************/ |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1151 |
|
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1152 |
/** Slave configuration state: DC ASSIGN. |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1153 |
*/ |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1154 |
void ec_fsm_slave_config_state_dc_assign( |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1155 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1156 |
) |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1157 |
{ |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1158 |
ec_datagram_t *datagram = fsm->datagram; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1159 |
ec_slave_t *slave = fsm->slave; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1160 |
|
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1161 |
if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1162 |
return; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1163 |
|
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1164 |
if (datagram->state != EC_DATAGRAM_RECEIVED) { |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1165 |
fsm->state = ec_fsm_slave_config_state_error; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1166 |
EC_ERR("Failed to receive DC activation datagram for slave %u" |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1167 |
" (datagram state %u).\n", |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1168 |
slave->ring_position, datagram->state); |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1169 |
return; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1170 |
} |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1171 |
|
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1172 |
if (datagram->working_counter != 1) { |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1173 |
slave->error_flag = 1; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1174 |
fsm->state = ec_fsm_slave_config_state_error; |
1407
e3974f72d31e
Improved DC configuration.
Florian Pose <fp@igh-essen.com>
parents:
1406
diff
changeset
|
1175 |
EC_ERR("Failed to set DC cyclic operation state of slave %u: ", |
1392
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1176 |
slave->ring_position); |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1177 |
ec_datagram_print_wc_error(datagram); |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1178 |
return; |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1179 |
} |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1374
diff
changeset
|
1180 |
|
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1181 |
ec_fsm_slave_config_enter_safeop(fsm); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1182 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1183 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1184 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1185 |
|
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1186 |
/** Request SAFEOP state. |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1187 |
*/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1188 |
void ec_fsm_slave_config_enter_safeop( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1189 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1190 |
) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1191 |
{ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1192 |
fsm->state = ec_fsm_slave_config_state_safeop; |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
1193 |
ec_fsm_change_start(fsm->fsm_change, fsm->slave, EC_SLAVE_STATE_SAFEOP); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
1194 |
ec_fsm_change_exec(fsm->fsm_change); // execute immediately |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1195 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1196 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1197 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1198 |
|
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1199 |
/** Slave configuration state: SAFEOP. |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1200 |
*/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1201 |
void ec_fsm_slave_config_state_safeop( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1202 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1203 |
) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1204 |
{ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1205 |
ec_master_t *master = fsm->slave->master; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1206 |
ec_slave_t *slave = fsm->slave; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1207 |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
1208 |
if (ec_fsm_change_exec(fsm->fsm_change)) return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
1209 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
1210 |
if (!ec_fsm_change_success(fsm->fsm_change)) { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
1211 |
if (!fsm->fsm_change->spontaneous_change) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1212 |
fsm->slave->error_flag = 1; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1213 |
fsm->state = ec_fsm_slave_config_state_error; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1214 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1215 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1216 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1217 |
// slave is now in SAFEOP |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1218 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1219 |
if (master->debug_level) { |
986
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
1220 |
EC_DBG("Slave %u is now in SAFEOP.\n", slave->ring_position); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1221 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1222 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1223 |
if (fsm->slave->current_state == fsm->slave->requested_state) { |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1224 |
fsm->state = ec_fsm_slave_config_state_end; // successful |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1225 |
if (master->debug_level) { |
986
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
1226 |
EC_DBG("Finished configuration of slave %u.\n", |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1227 |
slave->ring_position); |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1228 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1229 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1230 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1231 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1232 |
// set state to OP |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1233 |
fsm->state = ec_fsm_slave_config_state_op; |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
1234 |
ec_fsm_change_start(fsm->fsm_change, slave, EC_SLAVE_STATE_OP); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
1235 |
ec_fsm_change_exec(fsm->fsm_change); // execute immediately |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1236 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1237 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1238 |
/*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1239 |
|
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1240 |
/** Slave configuration state: OP |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1241 |
*/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1242 |
void ec_fsm_slave_config_state_op( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1243 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1244 |
) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1245 |
{ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1246 |
ec_master_t *master = fsm->slave->master; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1247 |
ec_slave_t *slave = fsm->slave; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1248 |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
1249 |
if (ec_fsm_change_exec(fsm->fsm_change)) return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
1250 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
1251 |
if (!ec_fsm_change_success(fsm->fsm_change)) { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1173
diff
changeset
|
1252 |
if (!fsm->fsm_change->spontaneous_change) |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1253 |
slave->error_flag = 1; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1254 |
fsm->state = ec_fsm_slave_config_state_error; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1255 |
return; |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1256 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1257 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1258 |
// slave is now in OP |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1259 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1260 |
if (master->debug_level) { |
986
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
1261 |
EC_DBG("Slave %u is now in OP.\n", slave->ring_position); |
a486591ba86b
Replaced misleading %i by %u.
Florian Pose <fp@igh-essen.com>
parents:
908
diff
changeset
|
1262 |
EC_DBG("Finished configuration of slave %u.\n", slave->ring_position); |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1263 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1264 |
|
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1265 |
fsm->state = ec_fsm_slave_config_state_end; // successful |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1266 |
} |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1267 |
|
1318
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
1268 |
/*****************************************************************************/ |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
1269 |
|
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
1270 |
/** Reconfigure the slave starting at INIT. |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
1271 |
*/ |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
1272 |
void ec_fsm_slave_config_reconfigure( |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
1273 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
1274 |
) |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
1275 |
{ |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
1276 |
if (fsm->slave->master->debug_level) { |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
1277 |
EC_DBG("Slave configuration for slave %u detached during " |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
1278 |
"configuration. Reconfiguring.", fsm->slave->ring_position); |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
1279 |
} |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
1280 |
|
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
1281 |
ec_fsm_slave_config_enter_init(fsm); // reconfigure |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
1282 |
} |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1277
diff
changeset
|
1283 |
|
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1284 |
/****************************************************************************** |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1285 |
* Common state functions |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1286 |
*****************************************************************************/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1287 |
|
1064
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1288 |
/** State: ERROR. |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1289 |
*/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1290 |
void ec_fsm_slave_config_state_error( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1291 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1292 |
) |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1293 |
{ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1294 |
} |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1295 |
|
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1296 |
/*****************************************************************************/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1297 |
|
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1298 |
/** State: END. |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1299 |
*/ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1300 |
void ec_fsm_slave_config_state_end( |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1301 |
ec_fsm_slave_config_t *fsm /**< slave state machine */ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1302 |
) |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1303 |
{ |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1304 |
} |
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1305 |
|
5f27403587a8
Avoid duplicate reconfiguration.
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
1306 |
/*****************************************************************************/ |