author | Florian Pose <fp@igh-essen.com> |
Fri, 25 Apr 2008 14:32:56 +0000 | |
changeset 908 | 386b908033be |
parent 903 | d13004440b6d |
child 926 | 6bb33c6ec770 |
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 |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
36 |
EtherCAT Pdo information state machines. |
741
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" |
847
92266462d411
Saparated ec_sdo_t, ec_sdo_entry_t and ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
831
diff
changeset
|
44 |
#include "sdo_request.h" |
741
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 |
{ |
852
ab439cbc7a81
Separated ec_sdo_request_init() and ec_sdo_request_read().
Florian Pose <fp@igh-essen.com>
parents:
849
diff
changeset
|
73 |
fsm->fsm_coe = fsm_coe; |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
fsm->state = NULL; |
852
ab439cbc7a81
Separated ec_sdo_request_init() and ec_sdo_request_read().
Florian Pose <fp@igh-essen.com>
parents:
849
diff
changeset
|
75 |
ec_sdo_request_init(&fsm->request); |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
76 |
ec_pdo_list_init(&fsm->pdos); |
741
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 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
Destructor. |
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
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
|
86 |
{ |
852
ab439cbc7a81
Separated ec_sdo_request_init() and ec_sdo_request_read().
Florian Pose <fp@igh-essen.com>
parents:
849
diff
changeset
|
87 |
ec_sdo_request_clear(&fsm->request); |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
88 |
ec_pdo_list_clear(&fsm->pdos); |
741
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 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
/** |
814 | 94 |
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
|
95 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
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
|
98 |
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
|
99 |
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
|
100 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
fsm->slave = slave; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
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
|
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
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
|
110 |
\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
|
111 |
*/ |
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 |
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
|
114 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
fsm->state(fsm); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
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
|
118 |
&& 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
|
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
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
|
125 |
\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
|
126 |
*/ |
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 |
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
|
129 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
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
|
131 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
/****************************************************************************** |
751 | 134 |
* state functions |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
/** |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
138 |
* Start reading Pdo assignment. |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
|
751 | 141 |
void ec_fsm_coe_map_state_start( |
142 |
ec_fsm_coe_map_t *fsm /**< finite state machine */ |
|
143 |
) |
|
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
{ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
145 |
// read Pdo assignment for first direction |
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
146 |
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
|
147 |
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
|
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 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
152 |
/** |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
153 |
* Read Pdo assignment of next direction manager. |
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
154 |
*/ |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
155 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
156 |
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
|
157 |
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
|
158 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
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
|
161 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
162 |
fsm->dir++; |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
163 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
164 |
if (slave->master->debug_level) |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
165 |
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
|
166 |
fsm->dir, slave->ring_position); |
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 |
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
|
169 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
170 |
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
|
171 |
if (slave->master->debug_level) |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
172 |
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
|
173 |
continue; |
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
174 |
} |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
175 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
176 |
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
|
177 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
178 |
if (slave->master->debug_level) |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
179 |
EC_DBG("Reading Pdo assignment 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
|
180 |
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
|
181 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
182 |
ec_pdo_list_clear_pdos(&fsm->pdos); |
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
183 |
|
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
852
diff
changeset
|
184 |
ec_sdo_request_address(&fsm->request, fsm->sync_sdo_index, 0); |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
185 |
ecrt_sdo_request_read(&fsm->request); |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
186 |
fsm->state = ec_fsm_coe_map_state_pdo_count; |
859
233e32f428e1
Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
187 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request); |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
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
|
189 |
return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
|
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
192 |
if (slave->master->debug_level) |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
193 |
EC_DBG("Reading of Pdo assignment finished for slave %u.\n", |
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
194 |
slave->ring_position); |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
195 |
|
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
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
|
197 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
/*****************************************************************************/ |
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 |
/** |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
202 |
* Count assigned Pdos. |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
*/ |
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 |
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
|
206 |
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
|
207 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
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
|
210 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
903
d13004440b6d
Improved a few debugging outputs.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
212 |
EC_ERR("Failed to read number of assigned 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
|
213 |
fsm->slave->ring_position); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
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
|
215 |
return; |
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
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
|
219 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
if (fsm->slave->master->debug_level) |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
221 |
EC_DBG(" %u Pdos assigned.\n", fsm->sync_subindices); |
814 | 222 |
|
223 |
// read first Pdo |
|
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
fsm->sync_subindex = 1; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
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
|
226 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
/*****************************************************************************/ |
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 |
/** |
814 | 231 |
* Read next Pdo. |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
*/ |
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 |
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
|
235 |
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
|
236 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
if (fsm->sync_subindex <= fsm->sync_subindices) { |
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
852
diff
changeset
|
239 |
ec_sdo_request_address(&fsm->request, fsm->sync_sdo_index, |
849
4b712ec8929d
Removed slave pointer from ec_sdo_request_t class.
Florian Pose <fp@igh-essen.com>
parents:
847
diff
changeset
|
240 |
fsm->sync_subindex); |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
241 |
ecrt_sdo_request_read(&fsm->request); |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
fsm->state = ec_fsm_coe_map_state_pdo; |
859
233e32f428e1
Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
243 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request); |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
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
|
245 |
return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
248 |
// finished reading Pdo assignment/mapping |
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
249 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
250 |
if (ec_pdo_list_copy(&fsm->sync->pdos, &fsm->pdos)) { |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
251 |
fsm->state = ec_fsm_coe_map_state_error; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
252 |
return; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
253 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
254 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
255 |
fsm->sync->assign_source = EC_ASSIGN_COE; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
256 |
ec_pdo_list_clear_pdos(&fsm->pdos); |
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
257 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
258 |
// next direction |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
259 |
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
|
260 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
|
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 |
/** |
814 | 265 |
* Fetch Pdo information. |
741
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 |
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
|
269 |
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
|
270 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
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
|
273 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
275 |
EC_ERR("Failed to read assigned 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
|
276 |
fsm->slave->ring_position); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
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
|
278 |
return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
279 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
280 |
|
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
281 |
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
|
282 |
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
|
283 |
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
|
284 |
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
|
285 |
return; |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
286 |
} |
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 |
ec_pdo_init(fsm->pdo); |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
289 |
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
|
290 |
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
|
291 |
|
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
292 |
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
|
293 |
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
|
294 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
295 |
list_add_tail(&fsm->pdo->list, &fsm->pdos.list); |
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
296 |
|
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
852
diff
changeset
|
297 |
ec_sdo_request_address(&fsm->request, fsm->pdo->index, 0); |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
298 |
ecrt_sdo_request_read(&fsm->request); |
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
299 |
fsm->state = ec_fsm_coe_map_state_pdo_entry_count; |
859
233e32f428e1
Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
300 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request); |
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
301 |
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
|
302 |
} |
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
/** |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
307 |
* Read number of mapped Pdo entries. |
741
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
310 |
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
|
311 |
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
|
312 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
313 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
314 |
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
|
315 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
814 | 317 |
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
|
318 |
fsm->slave->ring_position); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
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
|
320 |
return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
323 |
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
|
324 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
if (fsm->slave->master->debug_level) |
814 | 326 |
EC_DBG(" %u Pdo entries mapped.\n", fsm->pdo_subindices); |
327 |
||
328 |
// 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
|
329 |
fsm->pdo_subindex = 1; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
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
|
331 |
} |
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
335 |
/** |
814 | 336 |
* 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
|
337 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
338 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
339 |
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
|
340 |
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
|
341 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
if (fsm->pdo_subindex <= fsm->pdo_subindices) { |
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
852
diff
changeset
|
344 |
ec_sdo_request_address(&fsm->request, fsm->pdo->index, fsm->pdo_subindex); |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
345 |
ecrt_sdo_request_read(&fsm->request); |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
346 |
fsm->state = ec_fsm_coe_map_state_pdo_entry; |
859
233e32f428e1
Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
347 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request); |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
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
|
349 |
return; |
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 |
|
814 | 352 |
// next Pdo |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
fsm->sync_subindex++; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
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
|
355 |
} |
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
/** |
814 | 360 |
* 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
|
361 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
362 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
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
|
364 |
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
|
365 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
367 |
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
|
368 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
370 |
EC_ERR("Failed to read 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
|
371 |
fsm->slave->ring_position); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
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
|
373 |
return; |
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
376 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
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
|
378 |
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
|
379 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
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
|
381 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
382 |
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
|
383 |
kmalloc(sizeof(ec_pdo_entry_t), GFP_KERNEL))) { |
814 | 384 |
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
|
385 |
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
|
386 |
return; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
387 |
} |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
388 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
768
diff
changeset
|
389 |
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
|
390 |
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
|
391 |
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
|
392 |
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
|
393 |
|
767 | 394 |
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
|
395 |
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
|
396 |
ec_pdo_entry_clear(pdo_entry); |
767 | 397 |
kfree(pdo_entry); |
398 |
fsm->state = ec_fsm_coe_map_state_error; |
|
399 |
return; |
|
400 |
} |
|
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
402 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
if (fsm->slave->master->debug_level) { |
814 | 404 |
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
|
405 |
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
|
406 |
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
|
407 |
} |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
408 |
|
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
409 |
// 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
|
410 |
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
|
411 |
fsm->pdo_subindex++; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
412 |
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
|
413 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
414 |
} |
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
418 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
419 |
State: ERROR. |
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 |
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
|
423 |
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
|
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 |
} |
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
430 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
431 |
State: END. |
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 |
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
|
435 |
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
|
436 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
437 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
438 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
439 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
440 |
/*****************************************************************************/ |