author | Florian Pose <fp@igh-essen.com> |
Sat, 31 Jul 2010 16:13:24 +0200 | |
changeset 1954 | a108f0805a0b |
parent 1921 | d9cf40facbc4 |
child 1964 | 9327c261056f |
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:
1175
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:
1175
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:
1175
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:
1175
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:
1175
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:
1175
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:
1175
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:
1175
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:
1175
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:
1175
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:
1175
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:
1175
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:
1327
diff
changeset
|
22 |
* --- |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
23 |
* |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1327
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:
1327
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:
1327
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 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
/** \file |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
31 |
* EtherCAT PDO mapping 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_entry.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 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
void ec_fsm_pdo_entry_read_state_start(ec_fsm_pdo_entry_t *); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
void ec_fsm_pdo_entry_read_state_count(ec_fsm_pdo_entry_t *); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
void ec_fsm_pdo_entry_read_state_entry(ec_fsm_pdo_entry_t *); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
void ec_fsm_pdo_entry_read_action_next(ec_fsm_pdo_entry_t *); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
void ec_fsm_pdo_entry_conf_state_start(ec_fsm_pdo_entry_t *); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
void ec_fsm_pdo_entry_conf_state_zero_entry_count(ec_fsm_pdo_entry_t *); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
void ec_fsm_pdo_entry_conf_state_map_entry(ec_fsm_pdo_entry_t *); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
void ec_fsm_pdo_entry_conf_state_set_entry_count(ec_fsm_pdo_entry_t *); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
|
1175 | 56 |
void ec_fsm_pdo_entry_conf_action_map(ec_fsm_pdo_entry_t *); |
57 |
||
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
void ec_fsm_pdo_entry_state_end(ec_fsm_pdo_entry_t *); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
void ec_fsm_pdo_entry_state_error(ec_fsm_pdo_entry_t *); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
/** Constructor. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
void ec_fsm_pdo_entry_init( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
66 |
ec_fsm_pdo_entry_t *fsm, /**< PDO mapping state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
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
|
68 |
) |
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 |
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
|
71 |
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
|
72 |
} |
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 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
/** Destructor. |
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 |
void ec_fsm_pdo_entry_clear( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
79 |
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
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
|
83 |
} |
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 |
|
1823
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
87 |
/** Print the current and desired PDO mapping. |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
88 |
*/ |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
89 |
void ec_fsm_pdo_entry_print( |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
90 |
ec_fsm_pdo_entry_t *fsm /**< PDO configuration state machine. */ |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
91 |
) |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
92 |
{ |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
93 |
printk("Currently mapped PDO entries: "); |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
94 |
ec_pdo_print_entries(fsm->cur_pdo); |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
95 |
printk(". Entries to map: "); |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
96 |
ec_pdo_print_entries(fsm->source_pdo); |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
97 |
printk("\n"); |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
98 |
} |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
99 |
|
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
100 |
/*****************************************************************************/ |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
101 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
102 |
/** Start reading a PDO's entries. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
void ec_fsm_pdo_entry_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
|
105 |
ec_fsm_pdo_entry_t *fsm, /**< PDO mapping state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
ec_slave_t *slave, /**< slave to configure */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
107 |
ec_pdo_t *pdo /**< PDO to read entries for. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
fsm->slave = slave; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
fsm->target_pdo = pdo; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
ec_pdo_clear_entries(fsm->target_pdo); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
fsm->state = ec_fsm_pdo_entry_read_state_start; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
|
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 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
120 |
/** Start PDO mapping state machine. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
void ec_fsm_pdo_entry_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
|
123 |
ec_fsm_pdo_entry_t *fsm, /**< PDO mapping state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
ec_slave_t *slave, /**< slave to configure */ |
1823
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
125 |
const ec_pdo_t *pdo, /**< PDO with the desired entries. */ |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
126 |
const ec_pdo_t *cur_pdo /**< Current PDO mapping. */ |
1174
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 |
fsm->slave = slave; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
fsm->source_pdo = pdo; |
1823
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
131 |
fsm->cur_pdo = cur_pdo; |
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
132 |
|
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
133 |
if (fsm->slave->master->debug_level) { |
1921 | 134 |
EC_SLAVE_DBG(slave, 1, "Changing mapping of PDO 0x%04X.\n", |
135 |
pdo->index); |
|
136 |
EC_SLAVE_DBG(slave, 1, ""); ec_fsm_pdo_entry_print(fsm); |
|
1823
2bf892fe8080
Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents:
1543
diff
changeset
|
137 |
} |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
fsm->state = ec_fsm_pdo_entry_conf_state_start; |
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 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
/** Get running state. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
* |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
* \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
|
147 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
int ec_fsm_pdo_entry_running( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
149 |
const ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */ |
1174
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 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
return fsm->state != ec_fsm_pdo_entry_state_end |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
&& fsm->state != ec_fsm_pdo_entry_state_error; |
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 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
/** Executes the current state. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
* |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
* \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
|
161 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
int ec_fsm_pdo_entry_exec( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
163 |
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
165 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
fsm->state(fsm); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
return ec_fsm_pdo_entry_running(fsm); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
168 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
169 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
/** Get execution result. |
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 |
* \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
|
175 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
int ec_fsm_pdo_entry_success( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
177 |
const ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
178 |
) |
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 |
return fsm->state == ec_fsm_pdo_entry_state_end; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
} |
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 |
* Reading state functions. |
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 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
187 |
/** Request reading the number of mapped PDO entries. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
void ec_fsm_pdo_entry_read_state_start( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
190 |
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
) |
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 |
ec_sdo_request_address(&fsm->request, fsm->target_pdo->index, 0); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
194 |
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
|
195 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
fsm->state = ec_fsm_pdo_entry_read_state_count; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
200 |
|
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 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
203 |
/** Read number of mapped PDO entries. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
205 |
void ec_fsm_pdo_entry_read_state_count( |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
ec_fsm_pdo_entry_t *fsm /**< finite state machine */ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
if (ec_fsm_coe_exec(fsm->fsm_coe)) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
return; |
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 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
1921 | 213 |
EC_SLAVE_ERR(fsm->slave, |
214 |
"Failed to read number of mapped PDO entries.\n"); |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
215 |
fsm->state = ec_fsm_pdo_entry_state_error; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
if (fsm->request.data_size != sizeof(uint8_t)) { |
1921 | 220 |
EC_SLAVE_ERR(fsm->slave, "Invalid data size %zu at uploading" |
221 |
" SDO 0x%04X:%02X.\n", |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
fsm->request.data_size, fsm->request.index, |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
fsm->request.subindex); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
fsm->state = ec_fsm_pdo_entry_state_error; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
fsm->entry_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
|
229 |
|
1921 | 230 |
EC_SLAVE_DBG(fsm->slave, 1, "%u PDO entries mapped.\n", fsm->entry_count); |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
231 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
232 |
// read first PDO entry |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
fsm->entry_pos = 1; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
ec_fsm_pdo_entry_read_action_next(fsm); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
|
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 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
239 |
/** Read next PDO entry. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
void ec_fsm_pdo_entry_read_action_next( |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
ec_fsm_pdo_entry_t *fsm /**< finite state machine */ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
if (fsm->entry_pos <= fsm->entry_count) { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
ec_sdo_request_address(&fsm->request, fsm->target_pdo->index, fsm->entry_pos); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
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
|
248 |
fsm->state = ec_fsm_pdo_entry_read_state_entry; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
249 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
250 |
ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
251 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
253 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
// finished reading entries. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
fsm->state = ec_fsm_pdo_entry_state_end; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
} |
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 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
260 |
/** Read PDO entry information. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
void ec_fsm_pdo_entry_read_state_entry( |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
ec_fsm_pdo_entry_t *fsm /**< finite state machine */ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
) |
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 |
if (ec_fsm_coe_exec(fsm->fsm_coe)) return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
268 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
1921 | 269 |
EC_SLAVE_ERR(fsm->slave, "Failed to read mapped PDO entry.\n"); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
fsm->state = ec_fsm_pdo_entry_state_error; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
} |
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 |
if (fsm->request.data_size != sizeof(uint32_t)) { |
1921 | 275 |
EC_SLAVE_ERR(fsm->slave, "Invalid data size %zu at" |
276 |
" uploading SDO 0x%04X:%02X.\n", |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
fsm->request.data_size, fsm->request.index, |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
fsm->request.subindex); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
279 |
fsm->state = ec_fsm_pdo_entry_state_error; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
280 |
} else { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
uint32_t pdo_entry_info; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
282 |
ec_pdo_entry_t *pdo_entry; |
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 |
pdo_entry_info = EC_READ_U32(fsm->request.data); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
if (!(pdo_entry = (ec_pdo_entry_t *) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
kmalloc(sizeof(ec_pdo_entry_t), GFP_KERNEL))) { |
1921 | 288 |
EC_SLAVE_ERR(fsm->slave, "Failed to allocate PDO entry.\n"); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
fsm->state = ec_fsm_pdo_entry_state_error; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
290 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
291 |
} |
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 |
ec_pdo_entry_init(pdo_entry); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
294 |
pdo_entry->index = pdo_entry_info >> 16; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
295 |
pdo_entry->subindex = (pdo_entry_info >> 8) & 0xFF; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
296 |
pdo_entry->bit_length = pdo_entry_info & 0xFF; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
297 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
if (!pdo_entry->index && !pdo_entry->subindex) { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
if (ec_pdo_entry_set_name(pdo_entry, "Gap")) { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
300 |
ec_pdo_entry_clear(pdo_entry); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
301 |
kfree(pdo_entry); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
302 |
fsm->state = ec_fsm_pdo_entry_state_error; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
303 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
305 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
|
1921 | 307 |
EC_SLAVE_DBG(fsm->slave, 1, |
308 |
"PDO entry 0x%04X:%02X, %u bit, \"%s\".\n", |
|
309 |
pdo_entry->index, pdo_entry->subindex, |
|
310 |
pdo_entry->bit_length, |
|
311 |
pdo_entry->name ? pdo_entry->name : "???"); |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
312 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
313 |
list_add_tail(&pdo_entry->list, &fsm->target_pdo->entries); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
314 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
315 |
// next PDO entry |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
fsm->entry_pos++; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
ec_fsm_pdo_entry_read_action_next(fsm); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
320 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
/****************************************************************************** |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
* Configuration state functions. |
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 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
325 |
/** Start PDO mapping. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
327 |
void ec_fsm_pdo_entry_conf_state_start( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
328 |
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
329 |
) |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
330 |
{ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
331 |
// PDO mapping has to be changed. Does the slave support this? |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
332 |
if (!(fsm->slave->sii.mailbox_protocols & EC_MBOX_COE) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
333 |
|| (fsm->slave->sii.has_general |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
334 |
&& !fsm->slave->sii.coe_details.enable_pdo_configuration)) { |
1921 | 335 |
EC_SLAVE_WARN(fsm->slave, "Slave does not support" |
336 |
" changing the PDO mapping!\n"); |
|
337 |
EC_SLAVE_WARN(fsm->slave, ""); ec_fsm_pdo_entry_print(fsm); |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
338 |
fsm->state = ec_fsm_pdo_entry_state_error; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
339 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
340 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
if (ec_sdo_request_alloc(&fsm->request, 4)) { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
fsm->state = ec_fsm_pdo_entry_state_error; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
344 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
345 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
346 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
347 |
// set mapped PDO entry count to zero |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
EC_WRITE_U8(fsm->request.data, 0); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
349 |
fsm->request.data_size = 1; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
ec_sdo_request_address(&fsm->request, fsm->source_pdo->index, 0); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
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
|
352 |
|
1921 | 353 |
EC_SLAVE_DBG(fsm->slave, 1, "Setting entry count to zero.\n"); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
fsm->state = ec_fsm_pdo_entry_conf_state_zero_entry_count; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
357 |
ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
358 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
360 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
362 |
/** Process next PDO entry. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
ec_pdo_entry_t *ec_fsm_pdo_entry_conf_next_entry( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
365 |
const ec_fsm_pdo_entry_t *fsm, /**< PDO mapping state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
const struct list_head *list /**< current entry list item */ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
367 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
368 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
list = list->next; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
370 |
if (list == &fsm->source_pdo->entries) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
return NULL; // no next entry |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
return list_entry(list, ec_pdo_entry_t, list); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
373 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
|
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 |
/** Set the number of mapped entries to zero. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
379 |
void ec_fsm_pdo_entry_conf_state_zero_entry_count( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
380 |
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
) |
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 |
if (ec_fsm_coe_exec(fsm->fsm_coe)) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
384 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
386 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
1921 | 387 |
EC_SLAVE_WARN(fsm->slave, "Failed to clear PDO mapping.\n"); |
388 |
EC_SLAVE_WARN(fsm->slave, ""); ec_fsm_pdo_entry_print(fsm); |
|
1174
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_entry_state_error; |
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 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
393 |
// find first entry |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
394 |
if (!(fsm->entry = ec_fsm_pdo_entry_conf_next_entry( |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
395 |
fsm, &fsm->source_pdo->entries))) { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
396 |
|
1921 | 397 |
EC_SLAVE_DBG(fsm->slave, 1, "No entries to map.\n"); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
399 |
fsm->state = ec_fsm_pdo_entry_state_end; // finished |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
400 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
} |
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 |
// add first entry |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
404 |
fsm->entry_pos = 1; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
405 |
ec_fsm_pdo_entry_conf_action_map(fsm); |
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 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
408 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
409 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
410 |
/** Starts to add a PDO entry. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
411 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
412 |
void ec_fsm_pdo_entry_conf_action_map( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
413 |
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */ |
1174
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 |
uint32_t value; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
417 |
|
1921 | 418 |
EC_SLAVE_DBG(fsm->slave, 1, "Mapping PDO entry 0x%04X:%02X (%u bit)" |
419 |
" at position %u.\n", |
|
420 |
fsm->entry->index, fsm->entry->subindex, |
|
421 |
fsm->entry->bit_length, fsm->entry_pos); |
|
1174
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 |
value = fsm->entry->index << 16 |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
424 |
| fsm->entry->subindex << 8 | fsm->entry->bit_length; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
425 |
EC_WRITE_U32(fsm->request.data, value); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
426 |
fsm->request.data_size = 4; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
427 |
ec_sdo_request_address(&fsm->request, fsm->source_pdo->index, fsm->entry_pos); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
428 |
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
|
429 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
430 |
fsm->state = ec_fsm_pdo_entry_conf_state_map_entry; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
431 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
432 |
ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
433 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
434 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
435 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
436 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
437 |
/** Add a PDO entry. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
438 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
439 |
void ec_fsm_pdo_entry_conf_state_map_entry( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
440 |
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
441 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
442 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
443 |
if (ec_fsm_coe_exec(fsm->fsm_coe)) return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
444 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
445 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
1921 | 446 |
EC_SLAVE_WARN(fsm->slave, "Failed to map PDO entry" |
447 |
" 0x%04X:%02X (%u bit) to position %u.\n", |
|
448 |
fsm->entry->index, fsm->entry->subindex, |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
449 |
fsm->entry->bit_length, fsm->entry_pos); |
1921 | 450 |
EC_SLAVE_WARN(fsm->slave, ""); ec_fsm_pdo_entry_print(fsm); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
451 |
fsm->state = ec_fsm_pdo_entry_state_error; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
452 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
453 |
} |
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 |
// find next entry |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
456 |
if (!(fsm->entry = ec_fsm_pdo_entry_conf_next_entry( |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
457 |
fsm, &fsm->entry->list))) { |
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 |
// No more entries to add. Write entry count. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
460 |
EC_WRITE_U8(fsm->request.data, fsm->entry_pos); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
461 |
fsm->request.data_size = 1; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
462 |
ec_sdo_request_address(&fsm->request, fsm->source_pdo->index, 0); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
463 |
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
|
464 |
|
1921 | 465 |
EC_SLAVE_DBG(fsm->slave, 1, "Setting number of PDO entries to %u.\n", |
466 |
fsm->entry_pos); |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
467 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
468 |
fsm->state = ec_fsm_pdo_entry_conf_state_set_entry_count; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
469 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
470 |
ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
471 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
472 |
} |
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 |
// add next entry |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
475 |
fsm->entry_pos++; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
476 |
ec_fsm_pdo_entry_conf_action_map(fsm); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
477 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
478 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
479 |
/*****************************************************************************/ |
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 |
/** Set the number of entries. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
482 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
483 |
void ec_fsm_pdo_entry_conf_state_set_entry_count( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
484 |
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
485 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
486 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
487 |
if (ec_fsm_coe_exec(fsm->fsm_coe)) return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
488 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
489 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
1921 | 490 |
EC_SLAVE_WARN(fsm->slave, "Failed to set number of entries.\n"); |
491 |
EC_SLAVE_WARN(fsm->slave, ""); ec_fsm_pdo_entry_print(fsm); |
|
492 |
fsm->state = ec_fsm_pdo_entry_state_error; |
|
493 |
return; |
|
494 |
} |
|
495 |
||
496 |
EC_SLAVE_DBG(fsm->slave, 1, "Successfully configured" |
|
497 |
" mapping for PDO 0x%04X.\n", fsm->source_pdo->index); |
|
1174
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 |
fsm->state = ec_fsm_pdo_entry_state_end; // finished |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
500 |
} |
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 |
/****************************************************************************** |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
503 |
* Common state functions |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
504 |
*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
505 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
506 |
/** State: ERROR. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
507 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
508 |
void ec_fsm_pdo_entry_state_error( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
509 |
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */ |
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 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
512 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
513 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
514 |
/*****************************************************************************/ |
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 |
/** State: END. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
517 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
518 |
void ec_fsm_pdo_entry_state_end( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
519 |
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
520 |
) |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
521 |
{ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
522 |
} |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
523 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
524 |
/*****************************************************************************/ |