author | Florian Pose <fp@igh-essen.com> |
Mon, 26 Jan 2009 11:51:53 +0000 | |
changeset 1331 | 7cd33a77f926 |
parent 1327 | 4d179b06dd3c |
child 1363 | 11c0b2caa253 |
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 |
* |
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
|
22 |
* Using the EtherCAT technology and brand is permitted in compliance with |
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
|
23 |
* the 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
|
24 |
* |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
/** \file |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
28 |
* 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
|
29 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
/*****************************************************************************/ |
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 |
#include "globals.h" |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
#include "master.h" |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
#include "mailbox.h" |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
#include "slave_config.h" |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
#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
|
39 |
|
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 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
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
|
43 |
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
|
44 |
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
|
45 |
|
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_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
|
47 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
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
|
49 |
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
|
50 |
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
|
51 |
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
|
52 |
|
1175 | 53 |
void ec_fsm_pdo_entry_conf_action_map(ec_fsm_pdo_entry_t *); |
54 |
||
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
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
|
56 |
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
|
57 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
/** Constructor. |
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 |
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
|
63 |
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
|
64 |
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
|
65 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
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
|
68 |
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
|
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 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
/** Destructor. |
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 |
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
|
76 |
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
|
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 |
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
|
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 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
84 |
/** 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
|
85 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
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
|
87 |
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
|
88 |
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
|
89 |
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
|
90 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
fsm->slave = slave; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
fsm->target_pdo = pdo; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
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
|
96 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
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
|
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 |
|
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 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
|
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_configuration( |
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 |
const ec_pdo_t *pdo /**< PDO with the desired entries. */ |
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->source_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 |
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
|
114 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
|
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 |
/** Get running state. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
* |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
* \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
|
121 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
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
|
123 |
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
|
124 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
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
|
127 |
&& 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
|
128 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
/*****************************************************************************/ |
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 |
/** Executes the current state. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
* |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
* \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
|
135 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
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
|
137 |
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
|
138 |
) |
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 |
fsm->state(fsm); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
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
|
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 |
/*****************************************************************************/ |
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 |
/** Get execution result. |
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 |
* \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
|
149 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
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
|
151 |
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
|
152 |
) |
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 |
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
|
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 |
* Reading state functions. |
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 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
161 |
/** 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
|
162 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
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
|
164 |
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
|
165 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
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
|
168 |
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
|
169 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
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
|
171 |
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
|
172 |
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
|
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 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
177 |
/** 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
|
178 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
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
|
180 |
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
|
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 |
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
|
184 |
return; |
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 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
187 |
EC_ERR("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
|
188 |
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
|
189 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
} |
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 |
if (fsm->request.data_size != sizeof(uint8_t)) { |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
193 |
EC_ERR("Invalid data size %u at 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
|
194 |
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
|
195 |
fsm->request.subindex); |
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_state_error; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
} |
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 |
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
|
201 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
if (fsm->slave->master->debug_level) |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
203 |
EC_DBG("%u PDO entries mapped.\n", fsm->entry_count); |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
204 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
205 |
// 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
|
206 |
fsm->entry_pos = 1; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
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
|
208 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
|
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 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
212 |
/** 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
|
213 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
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
|
215 |
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
|
216 |
) |
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 |
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
|
219 |
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
|
220 |
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
|
221 |
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
|
222 |
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
|
223 |
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
|
224 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
} |
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 |
// finished reading entries. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
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
|
229 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
|
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 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
233 |
/** 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
|
234 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
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
|
236 |
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
|
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 |
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
|
240 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
242 |
EC_ERR("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
|
243 |
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
|
244 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
if (fsm->request.data_size != sizeof(uint32_t)) { |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
248 |
EC_ERR("Invalid data size %u at 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
|
249 |
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
|
250 |
fsm->request.subindex); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
251 |
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
|
252 |
} else { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
253 |
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
|
254 |
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
|
255 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
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
|
257 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
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
|
259 |
kmalloc(sizeof(ec_pdo_entry_t), GFP_KERNEL))) { |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
260 |
EC_ERR("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
|
261 |
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
|
262 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
} |
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 |
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
|
266 |
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
|
267 |
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
|
268 |
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
|
269 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
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
|
271 |
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
|
272 |
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
|
273 |
kfree(pdo_entry); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
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
|
275 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
276 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
} |
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 |
if (fsm->slave->master->debug_level) { |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
280 |
EC_DBG("PDO entry 0x%04X:%02X, %u bit, \"%s\".\n", |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
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
|
282 |
pdo_entry->bit_length, |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
pdo_entry->name ? pdo_entry->name : "???"); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
} |
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 |
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
|
287 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
288 |
// next PDO entry |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
fsm->entry_pos++; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
290 |
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
|
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 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
294 |
/****************************************************************************** |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
295 |
* Configuration state functions. |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
296 |
*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
297 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
298 |
/** Start PDO mapping. |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
300 |
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
|
301 |
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
|
302 |
) |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
303 |
{ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
304 |
// 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
|
305 |
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
|
306 |
|| (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
|
307 |
&& !fsm->slave->sii.coe_details.enable_pdo_configuration)) { |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
308 |
EC_WARN("Slave %u does not support changing the PDO mapping!\n", |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
309 |
fsm->slave->ring_position); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
310 |
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
|
311 |
return; |
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 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
314 |
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
|
315 |
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
|
316 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
319 |
// 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
|
320 |
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
|
321 |
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
|
322 |
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
|
323 |
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
|
324 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
if (fsm->slave->master->debug_level) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
EC_DBG("Setting entry count to zero.\n"); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
327 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
328 |
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
|
329 |
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
|
330 |
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
|
331 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
332 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
333 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
334 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
335 |
/** 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
|
336 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
337 |
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
|
338 |
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
|
339 |
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
|
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 |
list = list->next; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
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
|
344 |
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
|
345 |
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
|
346 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
347 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
349 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
/** 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
|
351 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
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
|
353 |
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
|
354 |
) |
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 |
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
|
357 |
return; |
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 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
360 |
EC_WARN("Failed to clear PDO mapping.\n"); |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
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
|
362 |
return; |
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 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
// find first entry |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
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
|
367 |
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
|
368 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
if (fsm->slave->master->debug_level) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
370 |
EC_DBG("No entries to map.\n"); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
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
|
373 |
return; |
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 |
// add first entry |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
fsm->entry_pos = 1; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
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
|
379 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
|
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 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
383 |
/** 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
|
384 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
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
|
386 |
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
|
387 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
388 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
389 |
uint32_t value; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
390 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
391 |
if (fsm->slave->master->debug_level) |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
392 |
EC_DBG("Mapping PDO entry 0x%04X:%02X (%u bit) at position %u.\n", |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
393 |
fsm->entry->index, fsm->entry->subindex, |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
394 |
fsm->entry->bit_length, fsm->entry_pos); |
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 |
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
|
397 |
| 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
|
398 |
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
|
399 |
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
|
400 |
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
|
401 |
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
|
402 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
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
|
404 |
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
|
405 |
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
|
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 |
/** 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_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
|
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 |
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
|
417 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
418 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
419 |
EC_WARN("Failed to map PDO entry 0x%04X:%02X (%u bit) to " |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
420 |
"position %u.\n", fsm->entry->index, fsm->entry->subindex, |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
421 |
fsm->entry->bit_length, fsm->entry_pos); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
422 |
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
|
423 |
return; |
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 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
426 |
// find next entry |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
427 |
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
|
428 |
fsm, &fsm->entry->list))) { |
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 |
// 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
|
431 |
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
|
432 |
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
|
433 |
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
|
434 |
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
|
435 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
436 |
if (fsm->slave->master->debug_level) |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
437 |
EC_DBG("Setting number of PDO entries to %u.\n", fsm->entry_pos); |
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 |
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
|
440 |
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
|
441 |
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
|
442 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
443 |
} |
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 |
// add next entry |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
446 |
fsm->entry_pos++; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
447 |
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
|
448 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
449 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
450 |
/*****************************************************************************/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
451 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
452 |
/** 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
|
453 |
*/ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
454 |
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
|
455 |
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
|
456 |
) |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
457 |
{ |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
458 |
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
|
459 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
460 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
461 |
EC_ERR("Failed to set number of entries.\n"); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
462 |
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
|
463 |
return; |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
464 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
465 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
466 |
if (fsm->slave->master->debug_level) |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
467 |
EC_DBG("Successfully configured mapping 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
|
468 |
fsm->source_pdo->index); |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
469 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
470 |
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
|
471 |
} |
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 |
* Common state functions |
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 |
|
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
477 |
/** State: ERROR. |
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 |
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
|
480 |
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
|
481 |
) |
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 |
} |
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
484 |
|
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 |
/** State: END. |
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 |
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
|
490 |
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
|
491 |
) |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
492 |
{ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
493 |
} |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
494 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
495 |
/*****************************************************************************/ |