author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Mon, 10 Sep 2018 22:40:27 +0200 | |
branch | stable-1.5 |
changeset 2705 | c6e3c6d66af0 |
parent 2522 | ec403cf308eb |
permissions | -rw-r--r-- |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
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 |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
* |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT Master. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
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 |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
* |
1363
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
22 |
* --- |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1338
diff
changeset
|
23 |
* |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1338
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:
1338
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:
1338
diff
changeset
|
26 |
* industrial property and similar rights of Beckhoff Automation GmbH. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
* |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
|
2522
ec403cf308eb
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
2498
diff
changeset
|
30 |
/** \file |
ec403cf308eb
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
2498
diff
changeset
|
31 |
* EtherCAT PDO configuration state machine. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
#include "globals.h" |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
#include "master.h" |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
#include "mailbox.h" |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
#include "slave_config.h" |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
#include "fsm_pdo.h" |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
|
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
45 |
void ec_fsm_pdo_read_state_start(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
46 |
void ec_fsm_pdo_read_state_pdo_count(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
47 |
void ec_fsm_pdo_read_state_pdo(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
48 |
void ec_fsm_pdo_read_state_pdo_entries(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
49 |
|
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
50 |
void ec_fsm_pdo_read_action_next_sync(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
51 |
void ec_fsm_pdo_read_action_next_pdo(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
52 |
|
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
53 |
void ec_fsm_pdo_conf_state_start(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
54 |
void ec_fsm_pdo_conf_state_read_mapping(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
55 |
void ec_fsm_pdo_conf_state_mapping(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
56 |
void ec_fsm_pdo_conf_state_zero_pdo_count(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
57 |
void ec_fsm_pdo_conf_state_assign_pdo(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
58 |
void ec_fsm_pdo_conf_state_set_pdo_count(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
59 |
|
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
60 |
void ec_fsm_pdo_conf_action_next_sync(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
61 |
void ec_fsm_pdo_conf_action_pdo_mapping(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
62 |
void ec_fsm_pdo_conf_action_check_mapping(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
63 |
void ec_fsm_pdo_conf_action_next_pdo_mapping(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
64 |
void ec_fsm_pdo_conf_action_check_assignment(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
65 |
void ec_fsm_pdo_conf_action_assign_pdo(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
66 |
|
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
67 |
void ec_fsm_pdo_state_end(ec_fsm_pdo_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
68 |
void ec_fsm_pdo_state_error(ec_fsm_pdo_t *, ec_datagram_t *); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
/** Constructor. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
void ec_fsm_pdo_init( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
75 |
ec_fsm_pdo_t *fsm, /**< PDO configuration state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
ec_fsm_coe_t *fsm_coe /**< CoE state machine to use */ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
fsm->fsm_coe = fsm_coe; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
ec_fsm_pdo_entry_init(&fsm->fsm_pdo_entry, fsm_coe); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
ec_pdo_list_init(&fsm->pdos); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
ec_sdo_request_init(&fsm->request); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
ec_pdo_init(&fsm->slave_pdo); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
87 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
/** Destructor. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
void ec_fsm_pdo_clear( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
91 |
ec_fsm_pdo_t *fsm /**< PDO configuration state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
ec_fsm_pdo_entry_clear(&fsm->fsm_pdo_entry); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
ec_pdo_list_clear(&fsm->pdos); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
ec_sdo_request_clear(&fsm->request); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
ec_pdo_clear(&fsm->slave_pdo); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
|
1823
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
102 |
/** Print the current and desired PDO assignment. |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
103 |
*/ |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
104 |
void ec_fsm_pdo_print( |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
105 |
ec_fsm_pdo_t *fsm /**< PDO configuration state machine. */ |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
106 |
) |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
107 |
{ |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
108 |
printk("Currently assigned PDOs: "); |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
109 |
ec_pdo_list_print(&fsm->sync->pdos); |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
110 |
printk(". PDOs to assign: "); |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
111 |
ec_pdo_list_print(&fsm->pdos); |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
112 |
printk("\n"); |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
113 |
} |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
114 |
|
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
115 |
/*****************************************************************************/ |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
116 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
117 |
/** Start reading the PDO configuration. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
void ec_fsm_pdo_start_reading( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
120 |
ec_fsm_pdo_t *fsm, /**< PDO configuration state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
ec_slave_t *slave /**< slave to configure */ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
fsm->slave = slave; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
fsm->state = ec_fsm_pdo_read_state_start; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
130 |
/** Start writing the PDO configuration. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
void ec_fsm_pdo_start_configuration( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
133 |
ec_fsm_pdo_t *fsm, /**< PDO configuration state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
ec_slave_t *slave /**< slave to configure */ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
fsm->slave = slave; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
fsm->state = ec_fsm_pdo_conf_state_start; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
/** Get running state. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
* |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
* \return false, if state machine has terminated |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
int ec_fsm_pdo_running( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
148 |
const ec_fsm_pdo_t *fsm /**< PDO configuration state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
return fsm->state != ec_fsm_pdo_state_end |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
&& fsm->state != ec_fsm_pdo_state_error; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
/** Executes the current state of the state machine. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
* |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
* If the state machine's datagram is not sent or received yet, the execution |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
* of the state machine is delayed to the next cycle. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
* |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
* \return false, if state machine has terminated |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
int ec_fsm_pdo_exec( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
165 |
ec_fsm_pdo_t *fsm, /**< PDO configuration state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
166 |
ec_datagram_t *datagram /**< Datagram to use. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
167 |
) |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
168 |
{ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
169 |
fsm->state(fsm, datagram); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
170 |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
return ec_fsm_pdo_running(fsm); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
/** Get execution result. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
177 |
* |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
178 |
* \return true, if the state machine terminated gracefully |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
180 |
int ec_fsm_pdo_success( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
181 |
const ec_fsm_pdo_t *fsm /**< PDO configuration state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
182 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
return fsm->state == ec_fsm_pdo_state_end; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
185 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
186 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
/****************************************************************************** |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
* Reading state funtions. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
191 |
/** Start reading PDO assignment. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
void ec_fsm_pdo_read_state_start( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
194 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
195 |
ec_datagram_t *datagram /**< Datagram to use. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
{ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
198 |
// read PDO assignment for first sync manager not reserved for mailbox |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
fsm->sync_index = 1; // next is 2 |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
200 |
ec_fsm_pdo_read_action_next_sync(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
205 |
/** Read PDO assignment of next sync manager. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
void ec_fsm_pdo_read_action_next_sync( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
208 |
ec_fsm_pdo_t *fsm, /**< finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
209 |
ec_datagram_t *datagram /**< Datagram to use. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
212 |
ec_slave_t *slave = fsm->slave; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
213 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
fsm->sync_index++; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
215 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
for (; fsm->sync_index < EC_MAX_SYNC_MANAGERS; fsm->sync_index++) { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
if (!(fsm->sync = ec_slave_get_sync(slave, fsm->sync_index))) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
continue; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
|
1921 | 220 |
EC_SLAVE_DBG(slave, 1, "Reading PDO assignment of SM%u.\n", |
221 |
fsm->sync_index); |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
ec_pdo_list_clear_pdos(&fsm->pdos); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
|
2434
fa52128477f6
Added ecrt_sdo_request_index() method to change index and subindex.
Florian Pose <fp@igh-essen.com>
parents:
2421
diff
changeset
|
225 |
ecrt_sdo_request_index(&fsm->request, 0x1C10 + fsm->sync_index, 0); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
ecrt_sdo_request_read(&fsm->request); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
fsm->state = ec_fsm_pdo_read_state_pdo_count; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request); |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
229 |
ec_fsm_coe_exec(fsm->fsm_coe, datagram); // execute immediately |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
|
1921 | 233 |
EC_SLAVE_DBG(slave, 1, "Reading of PDO configuration finished.\n"); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
|
1472
6ca667095c67
Continue with next sync manager if reading the PDOs failed.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
235 |
ec_pdo_list_clear_pdos(&fsm->pdos); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
fsm->state = ec_fsm_pdo_state_end; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
241 |
/** Count assigned PDOs. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
void ec_fsm_pdo_read_state_pdo_count( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
244 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
245 |
ec_datagram_t *datagram /**< Datagram to use. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
246 |
) |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
247 |
{ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
248 |
if (ec_fsm_coe_exec(fsm->fsm_coe, datagram)) { |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
249 |
return; |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
250 |
} |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
251 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
1921 | 253 |
EC_SLAVE_ERR(fsm->slave, "Failed to read number of assigned PDOs" |
254 |
" for SM%u.\n", fsm->sync_index); |
|
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
255 |
ec_fsm_pdo_read_action_next_sync(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
if (fsm->request.data_size != sizeof(uint8_t)) { |
1921 | 260 |
EC_SLAVE_ERR(fsm->slave, "Invalid data size %zu returned" |
261 |
" when uploading SDO 0x%04X:%02X.\n", fsm->request.data_size, |
|
262 |
fsm->request.index, fsm->request.subindex); |
|
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
263 |
ec_fsm_pdo_read_action_next_sync(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
265 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
266 |
fsm->pdo_count = EC_READ_U8(fsm->request.data); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
|
1921 | 268 |
EC_SLAVE_DBG(fsm->slave, 1, "%u PDOs assigned.\n", fsm->pdo_count); |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
269 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
270 |
// read first PDO |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
fsm->pdo_pos = 1; |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
272 |
ec_fsm_pdo_read_action_next_pdo(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
275 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
276 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
277 |
/** Read next PDO. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
279 |
void ec_fsm_pdo_read_action_next_pdo( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
280 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
281 |
ec_datagram_t *datagram /**< Datagram to use. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
282 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
if (fsm->pdo_pos <= fsm->pdo_count) { |
2434
fa52128477f6
Added ecrt_sdo_request_index() method to change index and subindex.
Florian Pose <fp@igh-essen.com>
parents:
2421
diff
changeset
|
285 |
ecrt_sdo_request_index(&fsm->request, 0x1C10 + fsm->sync_index, |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
fsm->pdo_pos); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
ecrt_sdo_request_read(&fsm->request); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
288 |
fsm->state = ec_fsm_pdo_read_state_pdo; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request); |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
290 |
ec_fsm_coe_exec(fsm->fsm_coe, datagram); // execute immediately |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
291 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
292 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
293 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
294 |
// finished reading PDO configuration |
2421 | 295 |
|
1472
6ca667095c67
Continue with next sync manager if reading the PDOs failed.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
296 |
ec_pdo_list_copy(&fsm->sync->pdos, &fsm->pdos); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
297 |
ec_pdo_list_clear_pdos(&fsm->pdos); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
// next sync manager |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
300 |
ec_fsm_pdo_read_action_next_sync(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
301 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
302 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
303 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
305 |
/** Fetch PDO information. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
307 |
void ec_fsm_pdo_read_state_pdo( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
308 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
309 |
ec_datagram_t *datagram /**< Datagram to use. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
310 |
) |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
311 |
{ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
312 |
if (ec_fsm_coe_exec(fsm->fsm_coe, datagram)) { |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
313 |
return; |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
314 |
} |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
315 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
1921 | 317 |
EC_SLAVE_ERR(fsm->slave, "Failed to read index of" |
318 |
" assigned PDO %u from SM%u.\n", |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
fsm->pdo_pos, fsm->sync_index); |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
320 |
ec_fsm_pdo_read_action_next_sync(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
323 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
324 |
if (fsm->request.data_size != sizeof(uint16_t)) { |
1921 | 325 |
EC_SLAVE_ERR(fsm->slave, "Invalid data size %zu returned" |
326 |
" when uploading SDO 0x%04X:%02X.\n", fsm->request.data_size, |
|
327 |
fsm->request.index, fsm->request.subindex); |
|
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
328 |
ec_fsm_pdo_read_action_next_sync(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
329 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
331 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
332 |
if (!(fsm->pdo = (ec_pdo_t *) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
333 |
kmalloc(sizeof(ec_pdo_t), GFP_KERNEL))) { |
1921 | 334 |
EC_SLAVE_ERR(fsm->slave, "Failed to allocate PDO.\n"); |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
335 |
ec_fsm_pdo_read_action_next_sync(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
336 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
337 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
338 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
339 |
ec_pdo_init(fsm->pdo); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
340 |
fsm->pdo->index = EC_READ_U16(fsm->request.data); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
fsm->pdo->sync_index = fsm->sync_index; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
|
1921 | 343 |
EC_SLAVE_DBG(fsm->slave, 1, "PDO 0x%04X.\n", fsm->pdo->index); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
344 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
345 |
list_add_tail(&fsm->pdo->list, &fsm->pdos.list); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
346 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
347 |
fsm->state = ec_fsm_pdo_read_state_pdo_entries; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
ec_fsm_pdo_entry_start_reading(&fsm->fsm_pdo_entry, fsm->slave, fsm->pdo); |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
349 |
fsm->state(fsm, datagram); // execute immediately |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
354 |
/** Fetch PDO information. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
void ec_fsm_pdo_read_state_pdo_entries( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
357 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
358 |
ec_datagram_t *datagram /**< Datagram to use. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
359 |
) |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
360 |
{ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
361 |
if (ec_fsm_pdo_entry_exec(&fsm->fsm_pdo_entry, datagram)) { |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
362 |
return; |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
363 |
} |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
if (!ec_fsm_pdo_entry_success(&fsm->fsm_pdo_entry)) { |
1921 | 366 |
EC_SLAVE_ERR(fsm->slave, "Failed to read mapped PDO entries" |
367 |
" for PDO 0x%04X.\n", fsm->pdo->index); |
|
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
368 |
ec_fsm_pdo_read_action_next_sync(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
370 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
372 |
// next PDO |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
373 |
fsm->pdo_pos++; |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
374 |
ec_fsm_pdo_read_action_next_pdo(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
375 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
376 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
/****************************************************************************** |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
* Writing state functions. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
379 |
*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
381 |
/** Start PDO configuration. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
382 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
383 |
void ec_fsm_pdo_conf_state_start( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
384 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
385 |
ec_datagram_t *datagram /**< Datagram to use. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
386 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
387 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
388 |
if (!fsm->slave->config) { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
389 |
fsm->state = ec_fsm_pdo_state_end; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
390 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
391 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
392 |
|
1964
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
393 |
fsm->sync_index = 1; // next is 2 |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
394 |
ec_fsm_pdo_conf_action_next_sync(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
395 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
396 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
397 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
399 |
/** Assign next PDO. |
2522
ec403cf308eb
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
2498
diff
changeset
|
400 |
* |
ec403cf308eb
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
2498
diff
changeset
|
401 |
* \return Next PDO, or NULL. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
402 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
ec_pdo_t *ec_fsm_pdo_conf_action_next_pdo( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
404 |
const ec_fsm_pdo_t *fsm, /**< PDO configuration state machine. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
405 |
const struct list_head *list /**< current PDO list item */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
406 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
407 |
{ |
2421 | 408 |
list = list->next; |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
409 |
if (list == &fsm->pdos.list) |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
410 |
return NULL; // no next PDO |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
411 |
return list_entry(list, ec_pdo_t, list); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
412 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
413 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
414 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
415 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
416 |
/** Get the next sync manager for a pdo configuration. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
417 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
418 |
void ec_fsm_pdo_conf_action_next_sync( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
419 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
420 |
ec_datagram_t *datagram /**< Datagram to use. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
421 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
422 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
423 |
fsm->sync_index++; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
424 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
425 |
for (; fsm->sync_index < EC_MAX_SYNC_MANAGERS; fsm->sync_index++) { |
2421 | 426 |
if (!fsm->slave->config) { |
1921 | 427 |
// slave configuration removed in the meantime |
1318
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1193
diff
changeset
|
428 |
fsm->state = ec_fsm_pdo_state_error; |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1193
diff
changeset
|
429 |
return; |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1193
diff
changeset
|
430 |
} |
76b4014391bd
merge -r1583:1593 branches/stable-1.4: Fixed detaching oops.
Florian Pose <fp@igh-essen.com>
parents:
1193
diff
changeset
|
431 |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
432 |
if (ec_pdo_list_copy(&fsm->pdos, |
1921 | 433 |
&fsm->slave->config->sync_configs[fsm->sync_index].pdos)) |
434 |
{ |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
435 |
fsm->state = ec_fsm_pdo_state_error; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
436 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
437 |
} |
2421 | 438 |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
439 |
if (!(fsm->sync = ec_slave_get_sync(fsm->slave, fsm->sync_index))) { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
440 |
if (!list_empty(&fsm->pdos.list)) |
1921 | 441 |
EC_SLAVE_WARN(fsm->slave, "PDOs configured for SM%u," |
442 |
" but slave does not provide the" |
|
443 |
" sync manager information!\n", |
|
444 |
fsm->sync_index); |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
445 |
continue; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
446 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
447 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
448 |
// get first configured PDO |
1964
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
449 |
if (!(fsm->pdo = |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
450 |
ec_fsm_pdo_conf_action_next_pdo(fsm, &fsm->pdos.list))) { |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
451 |
// no pdos configured |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
452 |
ec_fsm_pdo_conf_action_check_assignment(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
453 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
454 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
455 |
|
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
456 |
ec_fsm_pdo_conf_action_pdo_mapping(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
457 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
458 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
459 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
460 |
fsm->state = ec_fsm_pdo_state_end; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
461 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
462 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
463 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
464 |
|
1193 | 465 |
/** Check if the mapping has to be read, otherwise start to configure it. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
466 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
467 |
void ec_fsm_pdo_conf_action_pdo_mapping( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
468 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
469 |
ec_datagram_t *datagram /**< Datagram to use. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
470 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
471 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
472 |
const ec_pdo_t *assigned_pdo; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
473 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
474 |
fsm->slave_pdo.index = fsm->pdo->index; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
475 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
476 |
if ((assigned_pdo = ec_slave_find_pdo(fsm->slave, fsm->pdo->index))) { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
477 |
ec_pdo_copy_entries(&fsm->slave_pdo, assigned_pdo); |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
478 |
} else { // configured PDO is not assigned and thus unknown |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
479 |
ec_pdo_clear_entries(&fsm->slave_pdo); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
480 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
481 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
482 |
if (list_empty(&fsm->slave_pdo.entries)) { |
1921 | 483 |
EC_SLAVE_DBG(fsm->slave, 1, "Reading mapping of PDO 0x%04X.\n", |
484 |
fsm->pdo->index); |
|
2421 | 485 |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
486 |
// pdo mapping is unknown; start loading it |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
487 |
ec_fsm_pdo_entry_start_reading(&fsm->fsm_pdo_entry, fsm->slave, |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
488 |
&fsm->slave_pdo); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
489 |
fsm->state = ec_fsm_pdo_conf_state_read_mapping; |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
490 |
fsm->state(fsm, datagram); // execute immediately |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
491 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
492 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
493 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
494 |
// pdo mapping is known, check if it most be re-configured |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
495 |
ec_fsm_pdo_conf_action_check_mapping(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
496 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
497 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
498 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
499 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
500 |
/** Execute the PDO entry state machine to read the current PDO's mapping. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
501 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
502 |
void ec_fsm_pdo_conf_state_read_mapping( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
503 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
504 |
ec_datagram_t *datagram /**< Datagram to use. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
505 |
) |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
506 |
{ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
507 |
if (ec_fsm_pdo_entry_exec(&fsm->fsm_pdo_entry, datagram)) { |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
508 |
return; |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
509 |
} |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
510 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
511 |
if (!ec_fsm_pdo_entry_success(&fsm->fsm_pdo_entry)) |
1921 | 512 |
EC_SLAVE_WARN(fsm->slave, |
513 |
"Failed to read PDO entries for PDO 0x%04X.\n", |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
514 |
fsm->pdo->index); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
515 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
516 |
// check if the mapping must be re-configured |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
517 |
ec_fsm_pdo_conf_action_check_mapping(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
518 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
519 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
520 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
521 |
|
1193 | 522 |
/** Check if the mapping has to be re-configured. |
523 |
* |
|
524 |
* \todo Display mapping differences. |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
525 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
526 |
void ec_fsm_pdo_conf_action_check_mapping( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
527 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
528 |
ec_datagram_t *datagram /**< Datagram to use. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
529 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
530 |
{ |
1964
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
531 |
// check, if slave supports PDO configuration |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
532 |
if ((fsm->slave->sii.mailbox_protocols & EC_MBOX_COE) |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
533 |
&& fsm->slave->sii.has_general |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
534 |
&& fsm->slave->sii.coe_details.enable_pdo_configuration) { |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
535 |
|
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
536 |
// always write PDO mapping |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
537 |
ec_fsm_pdo_entry_start_configuration(&fsm->fsm_pdo_entry, fsm->slave, |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
538 |
fsm->pdo, &fsm->slave_pdo); |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
539 |
fsm->state = ec_fsm_pdo_conf_state_mapping; |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
540 |
fsm->state(fsm, datagram); // execure immediately |
1964
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
541 |
return; |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
542 |
} |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
543 |
else if (!ec_pdo_equal_entries(fsm->pdo, &fsm->slave_pdo)) { |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
544 |
EC_SLAVE_WARN(fsm->slave, "Slave does not support" |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
545 |
" changing the PDO mapping!\n"); |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
546 |
EC_SLAVE_WARN(fsm->slave, ""); |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
547 |
printk("Currently mapped PDO entries: "); |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
548 |
ec_pdo_print_entries(&fsm->slave_pdo); |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
549 |
printk(". Entries to map: "); |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
550 |
ec_pdo_print_entries(fsm->pdo); |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
551 |
printk("\n"); |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
552 |
} |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
553 |
|
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
554 |
ec_fsm_pdo_conf_action_next_pdo_mapping(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
555 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
556 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
557 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
558 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
559 |
/** Let the PDO entry state machine configure the current PDO's mapping. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
560 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
561 |
void ec_fsm_pdo_conf_state_mapping( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
562 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
563 |
ec_datagram_t *datagram /**< Datagram to use. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
564 |
) |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
565 |
{ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
566 |
if (ec_fsm_pdo_entry_exec(&fsm->fsm_pdo_entry, datagram)) { |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
567 |
return; |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
568 |
} |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
569 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
570 |
if (!ec_fsm_pdo_entry_success(&fsm->fsm_pdo_entry)) |
1921 | 571 |
EC_SLAVE_WARN(fsm->slave, |
572 |
"Failed to configure mapping of PDO 0x%04X.\n", |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
573 |
fsm->pdo->index); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
574 |
|
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
575 |
ec_fsm_pdo_conf_action_next_pdo_mapping(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
576 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
577 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
578 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
579 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
580 |
/** Check mapping of next PDO, otherwise configure assignment. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
581 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
582 |
void ec_fsm_pdo_conf_action_next_pdo_mapping( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
583 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
584 |
ec_datagram_t *datagram /**< Datagram 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
|
585 |
) |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
586 |
{ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
587 |
// get next configured PDO |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
588 |
if (!(fsm->pdo = ec_fsm_pdo_conf_action_next_pdo(fsm, &fsm->pdo->list))) { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
589 |
// no more configured pdos |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
590 |
ec_fsm_pdo_conf_action_check_assignment(fsm, datagram); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
591 |
return; |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
592 |
} |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
593 |
|
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
594 |
ec_fsm_pdo_conf_action_pdo_mapping(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
595 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
596 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
597 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
598 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
599 |
/** Check if the PDO assignment of the current SM has to be re-configured. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
600 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
601 |
void ec_fsm_pdo_conf_action_check_assignment( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
602 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
603 |
ec_datagram_t *datagram /**< Datagram to use. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
604 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
605 |
{ |
1964
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
606 |
if ((fsm->slave->sii.mailbox_protocols & EC_MBOX_COE) |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
607 |
&& fsm->slave->sii.has_general |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
608 |
&& fsm->slave->sii.coe_details.enable_pdo_assign) { |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
609 |
|
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
610 |
// always write PDO assignment |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
611 |
if (fsm->slave->master->debug_level) { |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
612 |
EC_SLAVE_DBG(fsm->slave, 1, "Setting PDO assignment of SM%u:\n", |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
613 |
fsm->sync_index); |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
614 |
EC_SLAVE_DBG(fsm->slave, 1, ""); ec_fsm_pdo_print(fsm); |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
615 |
} |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
616 |
|
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
617 |
if (ec_sdo_request_alloc(&fsm->request, 2)) { |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
618 |
fsm->state = ec_fsm_pdo_state_error; |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
619 |
return; |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
620 |
} |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
621 |
|
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
622 |
// set mapped PDO count to zero |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
623 |
EC_WRITE_U8(fsm->request.data, 0); // zero PDOs mapped |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
624 |
fsm->request.data_size = 1; |
2434
fa52128477f6
Added ecrt_sdo_request_index() method to change index and subindex.
Florian Pose <fp@igh-essen.com>
parents:
2421
diff
changeset
|
625 |
ecrt_sdo_request_index(&fsm->request, 0x1C10 + fsm->sync_index, 0); |
1964
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
626 |
ecrt_sdo_request_write(&fsm->request); |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
627 |
|
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
628 |
EC_SLAVE_DBG(fsm->slave, 1, "Setting number of assigned" |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
629 |
" PDOs to zero.\n"); |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
630 |
|
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
631 |
fsm->state = ec_fsm_pdo_conf_state_zero_pdo_count; |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
632 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request); |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
633 |
ec_fsm_coe_exec(fsm->fsm_coe, datagram); // execute immediately |
1964
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
634 |
return; |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
635 |
} |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
636 |
else if (!ec_pdo_list_equal(&fsm->sync->pdos, &fsm->pdos)) { |
1921 | 637 |
EC_SLAVE_WARN(fsm->slave, "Slave does not support assigning PDOs!\n"); |
638 |
EC_SLAVE_WARN(fsm->slave, ""); ec_fsm_pdo_print(fsm); |
|
1964
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
639 |
} |
9327c261056f
Always write PDO mapping/assignment.
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
640 |
|
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
641 |
ec_fsm_pdo_conf_action_next_sync(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
642 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
643 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
644 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
645 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
646 |
/** Set the number of assigned PDOs to zero. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
647 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
648 |
void ec_fsm_pdo_conf_state_zero_pdo_count( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
649 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
650 |
ec_datagram_t *datagram /**< Datagram to use. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
651 |
) |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
652 |
{ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
653 |
if (ec_fsm_coe_exec(fsm->fsm_coe, datagram)) { |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
654 |
return; |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
655 |
} |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
656 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
657 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
1921 | 658 |
EC_SLAVE_WARN(fsm->slave, "Failed to clear PDO assignment of SM%u.\n", |
659 |
fsm->sync_index); |
|
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
660 |
EC_SLAVE_WARN(fsm->slave, ""); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
661 |
ec_fsm_pdo_print(fsm); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
662 |
ec_fsm_pdo_conf_action_next_sync(fsm, datagram); |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
663 |
return; |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
664 |
} |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
665 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
666 |
// the sync manager's assigned PDOs have been cleared |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
667 |
ec_pdo_list_clear_pdos(&fsm->sync->pdos); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
668 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
669 |
// assign all PDOs belonging to the current sync manager |
2421 | 670 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
671 |
// find first PDO |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
672 |
if (!(fsm->pdo = ec_fsm_pdo_conf_action_next_pdo(fsm, &fsm->pdos.list))) { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
673 |
// check for mapping to be altered |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
674 |
ec_fsm_pdo_conf_action_next_sync(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
675 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
676 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
677 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
678 |
// assign first PDO |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
679 |
fsm->pdo_pos = 1; |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
680 |
ec_fsm_pdo_conf_action_assign_pdo(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
681 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
682 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
683 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
684 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
685 |
/** Assign a PDO. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
686 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
687 |
void ec_fsm_pdo_conf_action_assign_pdo( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
688 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
689 |
ec_datagram_t *datagram /**< Datagram to use. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
690 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
691 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
692 |
EC_WRITE_U16(fsm->request.data, fsm->pdo->index); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
693 |
fsm->request.data_size = 2; |
2434
fa52128477f6
Added ecrt_sdo_request_index() method to change index and subindex.
Florian Pose <fp@igh-essen.com>
parents:
2421
diff
changeset
|
694 |
ecrt_sdo_request_index(&fsm->request, |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
695 |
0x1C10 + fsm->sync_index, fsm->pdo_pos); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
696 |
ecrt_sdo_request_write(&fsm->request); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
697 |
|
1921 | 698 |
EC_SLAVE_DBG(fsm->slave, 1, "Assigning PDO 0x%04X at position %u.\n", |
699 |
fsm->pdo->index, fsm->pdo_pos); |
|
2421 | 700 |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
701 |
fsm->state = ec_fsm_pdo_conf_state_assign_pdo; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
702 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request); |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
703 |
ec_fsm_coe_exec(fsm->fsm_coe, datagram); // execute immediately |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
704 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
705 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
706 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
707 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
708 |
/** Add a PDO to the sync managers PDO assignment. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
709 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
710 |
void ec_fsm_pdo_conf_state_assign_pdo( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
711 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
712 |
ec_datagram_t *datagram /**< Datagram to use. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
713 |
) |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
714 |
{ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
715 |
if (ec_fsm_coe_exec(fsm->fsm_coe, datagram)) { |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
716 |
return; |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
717 |
} |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
718 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
719 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
1921 | 720 |
EC_SLAVE_WARN(fsm->slave, "Failed to assign PDO 0x%04X at position %u" |
721 |
" of SM%u.\n", |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
722 |
fsm->pdo->index, fsm->pdo_pos, fsm->sync_index); |
1921 | 723 |
EC_SLAVE_WARN(fsm->slave, ""); ec_fsm_pdo_print(fsm); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
724 |
fsm->state = ec_fsm_pdo_state_error; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
725 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
726 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
727 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
728 |
// find next PDO |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
729 |
if (!(fsm->pdo = ec_fsm_pdo_conf_action_next_pdo(fsm, &fsm->pdo->list))) { |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
730 |
// no more PDOs to assign, set PDO count |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
731 |
EC_WRITE_U8(fsm->request.data, fsm->pdo_pos); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
732 |
fsm->request.data_size = 1; |
2434
fa52128477f6
Added ecrt_sdo_request_index() method to change index and subindex.
Florian Pose <fp@igh-essen.com>
parents:
2421
diff
changeset
|
733 |
ecrt_sdo_request_index(&fsm->request, 0x1C10 + fsm->sync_index, 0); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
734 |
ecrt_sdo_request_write(&fsm->request); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
735 |
|
1921 | 736 |
EC_SLAVE_DBG(fsm->slave, 1, |
737 |
"Setting number of assigned PDOs to %u.\n", |
|
738 |
fsm->pdo_pos); |
|
2421 | 739 |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
740 |
fsm->state = ec_fsm_pdo_conf_state_set_pdo_count; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
741 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request); |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
742 |
ec_fsm_coe_exec(fsm->fsm_coe, datagram); // execute immediately |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
743 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
744 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
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 |
// add next PDO to assignment |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
747 |
fsm->pdo_pos++; |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
748 |
ec_fsm_pdo_conf_action_assign_pdo(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
749 |
} |
2421 | 750 |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
751 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
752 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
753 |
/** Set the number of assigned PDOs. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
754 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
755 |
void ec_fsm_pdo_conf_state_set_pdo_count( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
756 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
757 |
ec_datagram_t *datagram /**< Datagram to use. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
758 |
) |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
759 |
{ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
760 |
if (ec_fsm_coe_exec(fsm->fsm_coe, datagram)) { |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
761 |
return; |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
762 |
} |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
763 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
764 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
1921 | 765 |
EC_SLAVE_WARN(fsm->slave, "Failed to set number of" |
766 |
" assigned PDOs of SM%u.\n", fsm->sync_index); |
|
767 |
EC_SLAVE_WARN(fsm->slave, ""); ec_fsm_pdo_print(fsm); |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
768 |
fsm->state = ec_fsm_pdo_state_error; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
769 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
770 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
771 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
772 |
// PDOs have been configured |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
773 |
ec_pdo_list_copy(&fsm->sync->pdos, &fsm->pdos); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
774 |
|
1921 | 775 |
EC_SLAVE_DBG(fsm->slave, 1, "Successfully configured" |
776 |
" PDO assignment of SM%u.\n", fsm->sync_index); |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
777 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
778 |
// check if PDO mapping has to be altered |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
779 |
ec_fsm_pdo_conf_action_next_sync(fsm, datagram); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
780 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
781 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
782 |
/****************************************************************************** |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
783 |
* Common state functions |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
784 |
*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
785 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
786 |
/** State: ERROR. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
787 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
788 |
void ec_fsm_pdo_state_error( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
789 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
790 |
ec_datagram_t *datagram /**< Datagram to use. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
791 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
792 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
793 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
794 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
795 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
796 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
797 |
/** State: END. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
798 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
799 |
void ec_fsm_pdo_state_end( |
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
800 |
ec_fsm_pdo_t *fsm, /**< Finite state machine. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
801 |
ec_datagram_t *datagram /**< Datagram to use. */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
802 |
) |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
803 |
{ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
804 |
} |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
805 |
|
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
2434
diff
changeset
|
806 |
/*****************************************************************************/ |