author | Florian Pose <fp@igh-essen.com> |
Thu, 28 Feb 2008 11:07:40 +0000 | |
changeset 837 | 133528cfd528 |
parent 831 | ded9519c8d6e |
child 847 | 92266462d411 |
permissions | -rw-r--r-- |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
768
b709149d5bba
Added missing svn properties.
Florian Pose <fp@igh-essen.com>
parents:
767
diff
changeset
|
3 |
* $Id$ |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
* Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
* |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT Master. |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
* |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
* The IgH EtherCAT Master is free software; you can redistribute it |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
* and/or modify it under the terms of the GNU General Public License |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
* as published by the Free Software Foundation; either version 2 of the |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
* License, or (at your option) any later version. |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
* |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
* The IgH EtherCAT Master is distributed in the hope that it will be |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
* GNU General Public License for more details. |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
* |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
* You should have received a copy of the GNU General Public License |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
* along with the IgH EtherCAT Master; if not, write to the Free Software |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
* |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
* The right to use EtherCAT Technology is granted and comes free of |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
* charge under condition of compatibility of product made by |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
* Licensee. People intending to distribute/sell products based on the |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
* code, have to sign an agreement to guarantee that products using |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
* software based on IgH EtherCAT master stay compatible with the actual |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
* EtherCAT specification (which are released themselves as an open |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
* standard) as the (only) precondition to have the right to use EtherCAT |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
* Technology, IP and trade marks. |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
* |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
\file |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
EtherCAT CoE mapping state machines. |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
#include "globals.h" |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
#include "master.h" |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
#include "mailbox.h" |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
#include "canopen.h" |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
#include "fsm_coe_map.h" |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
void ec_fsm_coe_map_state_start(ec_fsm_coe_map_t *); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
void ec_fsm_coe_map_state_pdo_count(ec_fsm_coe_map_t *); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
void ec_fsm_coe_map_state_pdo(ec_fsm_coe_map_t *); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
void ec_fsm_coe_map_state_pdo_entry_count(ec_fsm_coe_map_t *); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
void ec_fsm_coe_map_state_pdo_entry(ec_fsm_coe_map_t *); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
void ec_fsm_coe_map_state_end(ec_fsm_coe_map_t *); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
void ec_fsm_coe_map_state_error(ec_fsm_coe_map_t *); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
|
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
58 |
void ec_fsm_coe_map_action_next_dir(ec_fsm_coe_map_t *); |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
void ec_fsm_coe_map_action_next_pdo(ec_fsm_coe_map_t *); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
void ec_fsm_coe_map_action_next_pdo_entry(ec_fsm_coe_map_t *); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
Constructor. |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
void ec_fsm_coe_map_init( |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
ec_fsm_coe_map_t *fsm, /**< finite state machine */ |
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
751
diff
changeset
|
70 |
ec_fsm_coe_t *fsm_coe /**< CoE state machine to use */ |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
fsm->state = NULL; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
fsm->fsm_coe = fsm_coe; |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
768
diff
changeset
|
75 |
ec_pdo_mapping_init(&fsm->mapping); |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
Destructor. |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
void ec_fsm_coe_map_clear(ec_fsm_coe_map_t *fsm /**< finite state machine */) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
{ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
768
diff
changeset
|
86 |
ec_pdo_mapping_clear(&fsm->mapping); |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
87 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
/** |
814 | 92 |
Starts to upload an Sdo from a slave. |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
void ec_fsm_coe_map_start( |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
ec_fsm_coe_map_t *fsm, /**< finite state machine */ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
ec_slave_t *slave /**< EtherCAT slave */ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
fsm->slave = slave; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
fsm->state = ec_fsm_coe_map_state_start; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
Executes the current state of the state machine. |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
\return false, if state machine has terminated |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
int ec_fsm_coe_map_exec(ec_fsm_coe_map_t *fsm /**< finite state machine */) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
fsm->state(fsm); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
return fsm->state != ec_fsm_coe_map_state_end |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
&& fsm->state != ec_fsm_coe_map_state_error; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
Returns, if the state machine terminated with success. |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
\return non-zero if successful. |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
int ec_fsm_coe_map_success(ec_fsm_coe_map_t *fsm /**< Finite state machine */) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
return fsm->state == ec_fsm_coe_map_state_end; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
/****************************************************************************** |
751 | 132 |
* state functions |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
/** |
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
751
diff
changeset
|
136 |
* Start reading mapping. |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
|
751 | 139 |
void ec_fsm_coe_map_state_start( |
140 |
ec_fsm_coe_map_t *fsm /**< finite state machine */ |
|
141 |
) |
|
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
{ |
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
143 |
// read mapping for first direction |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
144 |
fsm->dir = (ec_direction_t) -1; // next is EC_DIR_OUTPUT |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
145 |
ec_fsm_coe_map_action_next_dir(fsm); |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
146 |
} |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
147 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
148 |
/*****************************************************************************/ |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
149 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
150 |
/** |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
151 |
* Read mapping of next direction manager. |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
152 |
*/ |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
153 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
154 |
void ec_fsm_coe_map_action_next_dir( |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
ec_fsm_coe_map_t *fsm /**< finite state machine */ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
ec_slave_t *slave = fsm->slave; |
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
159 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
160 |
fsm->dir++; |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
161 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
162 |
if (slave->master->debug_level) |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
163 |
EC_DBG("Processing dir %u of slave %u.\n", |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
164 |
fsm->dir, slave->ring_position); |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
165 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
166 |
for (; fsm->dir <= EC_DIR_INPUT; fsm->dir++) { |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
167 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
168 |
if (!(fsm->sync = ec_slave_get_pdo_sync(slave, fsm->dir))) { |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
169 |
if (slave->master->debug_level) |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
170 |
EC_DBG("No sync manager for direction %u!\n", fsm->dir); |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
continue; |
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
172 |
} |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
173 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
174 |
fsm->sync_sdo_index = 0x1C10 + fsm->sync->index; |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
if (slave->master->debug_level) |
814 | 177 |
EC_DBG("Reading Pdo mapping of sync manager %u of slave %u.\n", |
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
178 |
fsm->sync->index, slave->ring_position); |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
768
diff
changeset
|
180 |
ec_pdo_mapping_clear_pdos(&fsm->mapping); |
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
181 |
|
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
182 |
ec_sdo_request_init_read(&fsm->request, slave, fsm->sync_sdo_index, 0); |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
fsm->state = ec_fsm_coe_map_state_pdo_count; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
ec_fsm_coe_upload(fsm->fsm_coe, fsm->slave, &fsm->request); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
185 |
ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
186 |
return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
|
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
189 |
if (slave->master->debug_level) |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
190 |
EC_DBG("Reading of Pdo mapping finished for slave %u.\n", |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
191 |
slave->ring_position); |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
192 |
|
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
fsm->state = ec_fsm_coe_map_state_end; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
194 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
195 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
/** |
814 | 199 |
* Count mapped Pdos. |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
200 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
void ec_fsm_coe_map_state_pdo_count( |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
ec_fsm_coe_map_t *fsm /**< finite state machine */ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
205 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
if (ec_fsm_coe_exec(fsm->fsm_coe)) return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
814 | 209 |
EC_ERR("Failed to read number of mapped Pdos from slave %u.\n", |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
fsm->slave->ring_position); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
fsm->state = ec_fsm_coe_map_state_error; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
212 |
return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
213 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
215 |
fsm->sync_subindices = EC_READ_U8(fsm->request.data); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
if (fsm->slave->master->debug_level) |
814 | 218 |
EC_DBG(" %u Pdos mapped.\n", fsm->sync_subindices); |
219 |
||
220 |
// read first Pdo |
|
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
fsm->sync_subindex = 1; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
ec_fsm_coe_map_action_next_pdo(fsm); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
/** |
814 | 228 |
* Read next Pdo. |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
229 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
void ec_fsm_coe_map_action_next_pdo( |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
ec_fsm_coe_map_t *fsm /**< finite state machine */ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
if (fsm->sync_subindex <= fsm->sync_subindices) { |
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
236 |
ec_sdo_request_init_read(&fsm->request, fsm->slave, |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
237 |
fsm->sync_sdo_index, fsm->sync_subindex); |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
fsm->state = ec_fsm_coe_map_state_pdo; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
ec_fsm_coe_upload(fsm->fsm_coe, fsm->slave, &fsm->request); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
|
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
244 |
// finished reading Pdo mapping/configuration |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
245 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
246 |
if (ec_pdo_mapping_copy(&fsm->sync->mapping, &fsm->mapping)) { |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
247 |
fsm->state = ec_fsm_coe_map_state_error; |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
248 |
return; |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
249 |
} |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
250 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
251 |
fsm->sync->mapping_source = EC_SYNC_MAPPING_COE; |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
252 |
ec_pdo_mapping_clear_pdos(&fsm->mapping); |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
253 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
254 |
// next direction |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
255 |
ec_fsm_coe_map_action_next_dir(fsm); |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
260 |
/** |
814 | 261 |
* Fetch Pdo information. |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
void ec_fsm_coe_map_state_pdo( |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
265 |
ec_fsm_coe_map_t *fsm /**< finite state machine */ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
266 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
268 |
if (ec_fsm_coe_exec(fsm->fsm_coe)) return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
814 | 271 |
EC_ERR("Failed to read mapped Pdo index from slave %u.\n", |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
fsm->slave->ring_position); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
fsm->state = ec_fsm_coe_map_state_error; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
275 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
276 |
|
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
277 |
if (!(fsm->pdo = (ec_pdo_t *) |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
278 |
kmalloc(sizeof(ec_pdo_t), GFP_KERNEL))) { |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
279 |
EC_ERR("Failed to allocate Pdo.\n"); |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
280 |
fsm->state = ec_fsm_coe_map_state_error; |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
281 |
return; |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
282 |
} |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
283 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
284 |
ec_pdo_init(fsm->pdo); |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
285 |
fsm->pdo->index = EC_READ_U16(fsm->request.data); |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
286 |
fsm->pdo->dir = ec_sync_direction(fsm->sync); |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
287 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
288 |
if (fsm->slave->master->debug_level) |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
289 |
EC_DBG(" Pdo 0x%04X.\n", fsm->pdo->index); |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
290 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
291 |
list_add_tail(&fsm->pdo->list, &fsm->mapping.pdos); |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
292 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
293 |
ec_sdo_request_init_read(&fsm->request, fsm->slave, fsm->pdo->index, 0); |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
294 |
fsm->state = ec_fsm_coe_map_state_pdo_entry_count; |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
295 |
ec_fsm_coe_upload(fsm->fsm_coe, fsm->slave, &fsm->request); |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
296 |
ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
297 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
300 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
301 |
/** |
814 | 302 |
* Read number of Pdo entries. |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
303 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
305 |
void ec_fsm_coe_map_state_pdo_entry_count( |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
ec_fsm_coe_map_t *fsm /**< finite state machine */ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
307 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
308 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
309 |
if (ec_fsm_coe_exec(fsm->fsm_coe)) return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
310 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
311 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
814 | 312 |
EC_ERR("Failed to read number of mapped Pdo entries from slave %u.\n", |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
313 |
fsm->slave->ring_position); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
314 |
fsm->state = ec_fsm_coe_map_state_error; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
315 |
return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
fsm->pdo_subindices = EC_READ_U8(fsm->request.data); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
320 |
if (fsm->slave->master->debug_level) |
814 | 321 |
EC_DBG(" %u Pdo entries mapped.\n", fsm->pdo_subindices); |
322 |
||
323 |
// read first Pdo entry |
|
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
324 |
fsm->pdo_subindex = 1; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
ec_fsm_coe_map_action_next_pdo_entry(fsm); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
327 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
328 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
329 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
/** |
814 | 331 |
* Read next Pdo entry. |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
332 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
333 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
334 |
void ec_fsm_coe_map_action_next_pdo_entry( |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
335 |
ec_fsm_coe_map_t *fsm /**< finite state machine */ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
336 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
337 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
338 |
if (fsm->pdo_subindex <= fsm->pdo_subindices) { |
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
339 |
ec_sdo_request_init_read(&fsm->request, fsm->slave, |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
340 |
fsm->pdo->index, fsm->pdo_subindex); |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
fsm->state = ec_fsm_coe_map_state_pdo_entry; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
ec_fsm_coe_upload(fsm->fsm_coe, fsm->slave, &fsm->request); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
344 |
return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
345 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
346 |
|
814 | 347 |
// next Pdo |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
fsm->sync_subindex++; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
349 |
ec_fsm_coe_map_action_next_pdo(fsm); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
/** |
814 | 355 |
* Read Pdo entry information. |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
357 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
358 |
void ec_fsm_coe_map_state_pdo_entry( |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
ec_fsm_coe_map_t *fsm /**< finite state machine */ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
360 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
362 |
if (ec_fsm_coe_exec(fsm->fsm_coe)) return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
814 | 365 |
EC_ERR("Failed to read index of mapped Pdo entry from slave %u.\n", |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
fsm->slave->ring_position); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
367 |
fsm->state = ec_fsm_coe_map_state_error; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
368 |
return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
370 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
uint32_t pdo_entry_info; |
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
373 |
ec_pdo_entry_t *pdo_entry; |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
375 |
pdo_entry_info = EC_READ_U32(fsm->request.data); |
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
376 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
377 |
if (!(pdo_entry = (ec_pdo_entry_t *) |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
378 |
kmalloc(sizeof(ec_pdo_entry_t), GFP_KERNEL))) { |
814 | 379 |
EC_ERR("Failed to allocate Pdo entry.\n"); |
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
380 |
fsm->state = ec_fsm_coe_map_state_error; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
381 |
return; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
382 |
} |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
383 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
768
diff
changeset
|
384 |
ec_pdo_entry_init(pdo_entry); |
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
385 |
pdo_entry->index = pdo_entry_info >> 16; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
386 |
pdo_entry->subindex = (pdo_entry_info >> 8) & 0xFF; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
387 |
pdo_entry->bit_length = pdo_entry_info & 0xFF; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
388 |
|
767 | 389 |
if (!pdo_entry->index && !pdo_entry->subindex) { |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
768
diff
changeset
|
390 |
if (ec_pdo_entry_set_name(pdo_entry, "Gap")) { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
768
diff
changeset
|
391 |
ec_pdo_entry_clear(pdo_entry); |
767 | 392 |
kfree(pdo_entry); |
393 |
fsm->state = ec_fsm_coe_map_state_error; |
|
394 |
return; |
|
395 |
} |
|
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
396 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
397 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
if (fsm->slave->master->debug_level) { |
814 | 399 |
EC_DBG(" Pdo entry 0x%04X \"%s\" (%u bit).\n", pdo_entry->index, |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
768
diff
changeset
|
400 |
pdo_entry->name ? pdo_entry->name : "???", |
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
401 |
pdo_entry->bit_length); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
402 |
} |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
403 |
|
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
404 |
// next Pdo entry |
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
405 |
list_add_tail(&pdo_entry->list, &fsm->pdo->entries); |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
406 |
fsm->pdo_subindex++; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
407 |
ec_fsm_coe_map_action_next_pdo_entry(fsm); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
408 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
409 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
410 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
411 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
412 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
413 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
414 |
State: ERROR. |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
415 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
416 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
417 |
void ec_fsm_coe_map_state_error( |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
418 |
ec_fsm_coe_map_t *fsm /**< finite state machine */ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
419 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
420 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
421 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
422 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
423 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
424 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
425 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
426 |
State: END. |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
427 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
428 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
429 |
void ec_fsm_coe_map_state_end( |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
430 |
ec_fsm_coe_map_t *fsm /**< finite state machine */ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
431 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
432 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
433 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
434 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
435 |
/*****************************************************************************/ |