author | Florian Pose <fp@igh-essen.com> |
Thu, 20 Sep 2007 12:58:35 +0000 | |
changeset 749 | c8f1395f818a |
parent 741 | aece53f82df3 |
child 751 | 41a5c537b76d |
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 |
* |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id: fsm_coe.c 920 2007-09-12 10:07:55Z fp $ |
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
void ec_fsm_coe_map_action_next_sync(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
|
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 |
|
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
62 |
void ec_fsm_coe_map_clear_pdos(ec_fsm_coe_map_t *); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
63 |
|
741
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 |
|
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 |
Constructor. |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
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
|
71 |
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
|
72 |
ec_fsm_coe_t *fsm_coe /*< CoE state machine to use */ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
fsm->state = NULL; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
fsm->fsm_coe = fsm_coe; |
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
77 |
INIT_LIST_HEAD(&fsm->pdos); |
741
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 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
Destructor. |
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
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
|
87 |
{ |
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
88 |
ec_fsm_coe_map_clear_pdos(fsm); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
89 |
} |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
90 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
91 |
/*****************************************************************************/ |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
92 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
93 |
/** |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
94 |
*/ |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
95 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
96 |
void ec_fsm_coe_map_clear_pdos( |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
97 |
ec_fsm_coe_map_t *fsm /**< finite state machine */ |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
98 |
) |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
99 |
{ |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
100 |
ec_pdo_t *pdo, *next; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
101 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
102 |
// free all PDOs |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
103 |
list_for_each_entry_safe(pdo, next, &fsm->pdos, list) { |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
104 |
list_del(&pdo->list); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
105 |
ec_pdo_clear(pdo); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
106 |
kfree(pdo); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
107 |
} |
741
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 |
|
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 |
|
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 |
Starts to upload an SDO from a slave. |
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
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
|
117 |
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
|
118 |
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
|
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 |
fsm->slave = slave; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
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
|
123 |
} |
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 |
|
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 |
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
|
129 |
\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
|
130 |
*/ |
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 |
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
|
133 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
fsm->state(fsm); |
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 |
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
|
137 |
&& 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
|
138 |
} |
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 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
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
|
144 |
\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
|
145 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
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
|
148 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
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
|
150 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
/****************************************************************************** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
* CoE dictionary state machine |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
|
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
void ec_fsm_coe_map_state_start(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
|
160 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
// read mapping of first sync manager |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
fsm->sync_index = 0; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
ec_fsm_coe_map_action_next_sync(fsm); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
165 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
168 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
169 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
void ec_fsm_coe_map_action_next_sync( |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
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
|
173 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
ec_slave_t *slave = fsm->slave; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
ec_sdo_entry_t *entry; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
177 |
|
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
178 |
for (; fsm->sync_index < slave->sii_sync_count; fsm->sync_index++) { |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
if (!(fsm->sync_sdo = ec_slave_get_sdo(slave, 0x1C10 + fsm->sync_index))) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
180 |
continue; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
182 |
if (slave->master->debug_level) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
EC_DBG("Reading PDO mapping of sync manager %u of slave %u.\n", |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
fsm->sync_index, slave->ring_position); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
185 |
|
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
186 |
ec_fsm_coe_map_clear_pdos(fsm); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
187 |
|
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
if (!(entry = ec_sdo_get_entry(fsm->sync_sdo, 0))) { |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
EC_ERR("SDO 0x%04X has no subindex 0 on slave %u.\n", |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
fsm->sync_sdo->index, |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
fsm->slave->ring_position); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
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
|
193 |
return; |
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 |
ec_sdo_request_init_read(&fsm->request, entry); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
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
|
198 |
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
|
199 |
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
|
200 |
return; |
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
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
|
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 |
/*****************************************************************************/ |
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 |
*/ |
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 |
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
|
212 |
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
|
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 |
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
|
216 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
EC_ERR("Failed to read number of mapped PDOs from slave %u.\n", |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
fsm->slave->ring_position); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
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
|
221 |
return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
} |
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 |
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
|
225 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
if (fsm->slave->master->debug_level) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
EC_DBG(" %u PDOs mapped.\n", fsm->sync_subindices); |
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 |
// read first PDO |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
fsm->sync_subindex = 1; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
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
|
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 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
|
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
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
|
240 |
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
|
241 |
) |
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 |
ec_sdo_entry_t *entry; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
if (fsm->sync_subindex <= fsm->sync_subindices) { |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
if (!(entry = ec_sdo_get_entry(fsm->sync_sdo, |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
fsm->sync_subindex))) { |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
248 |
EC_ERR("SDO 0x%04X has no subindex %u on slave %u.\n", |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
249 |
fsm->sync_sdo->index, |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
250 |
fsm->sync_subindex, |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
251 |
fsm->slave->ring_position); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
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
|
253 |
return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
ec_sdo_request_init_read(&fsm->request, entry); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
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
|
258 |
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
|
259 |
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
|
260 |
return; |
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 |
|
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
263 |
{ |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
264 |
ec_sync_t *sync = fsm->slave->sii_syncs + fsm->sync_index; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
265 |
ec_pdo_t *pdo; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
266 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
267 |
// exchange sync manager PDO mapping |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
268 |
ec_sync_clear_pdos(sync); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
269 |
list_for_each_entry(pdo, &fsm->pdos, list) { |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
270 |
ec_sync_add_pdo(sync, pdo); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
271 |
} |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
272 |
ec_fsm_coe_map_clear_pdos(fsm); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
273 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
274 |
// next sync manager |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
275 |
fsm->sync_index++; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
276 |
ec_fsm_coe_map_action_next_sync(fsm); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
277 |
} |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
} |
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 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
282 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
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
|
286 |
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
|
287 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
288 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
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
|
290 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
291 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
292 |
EC_ERR("Failed to read mapped PDO index from slave %u.\n", |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
293 |
fsm->slave->ring_position); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
294 |
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
|
295 |
return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
296 |
} |
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 |
ec_sdo_entry_t *entry; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
300 |
|
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
301 |
if (!(fsm->pdo = (ec_pdo_t *) |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
302 |
kmalloc(sizeof(ec_pdo_t), GFP_KERNEL))) { |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
303 |
EC_ERR("Failed to allocate PDO.\n"); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
304 |
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
|
305 |
return; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
306 |
} |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
307 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
308 |
ec_pdo_init(fsm->pdo); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
309 |
fsm->pdo->index = EC_READ_U16(fsm->request.data); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
310 |
fsm->pdo->type = |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
311 |
ec_sync_get_pdo_type(fsm->slave->sii_syncs + fsm->sync_index); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
312 |
|
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
313 |
if (fsm->slave->master->debug_level) |
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
314 |
EC_DBG(" PDO 0x%04X.\n", fsm->pdo->index); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
315 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
316 |
if (!(fsm->pdo_sdo = ec_slave_get_sdo(fsm->slave, fsm->pdo->index))) { |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
EC_ERR("Slave %u has no SDO 0x%04X.\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
|
318 |
fsm->slave->ring_position, fsm->pdo->index); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
319 |
ec_pdo_clear(fsm->pdo); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
320 |
kfree(fsm->pdo); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
321 |
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
|
322 |
return; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
323 |
} |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
324 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
325 |
if (fsm->pdo_sdo->name && strlen(fsm->pdo_sdo->name)) { |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
326 |
if (!(fsm->pdo->name = (char *) |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
327 |
kmalloc(strlen(fsm->pdo_sdo->name) + 1, GFP_KERNEL))) { |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
328 |
EC_ERR("Failed to allocate PDO name.\n"); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
329 |
ec_pdo_clear(fsm->pdo); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
330 |
kfree(fsm->pdo); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
331 |
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
|
332 |
return; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
333 |
} |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
334 |
memcpy(fsm->pdo->name, fsm->pdo_sdo->name, |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
335 |
strlen(fsm->pdo_sdo->name) + 1); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
336 |
} else { |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
337 |
fsm->pdo->name = NULL; |
741
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
340 |
if (!(entry = ec_sdo_get_entry(fsm->pdo_sdo, 0))) { |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
EC_ERR("SDO 0x%04X has no subindex 0 on slave %u.\n", |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
fsm->pdo_sdo->index, |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
fsm->slave->ring_position); |
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
344 |
ec_pdo_clear(fsm->pdo); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
345 |
kfree(fsm->pdo); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
346 |
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
|
347 |
return; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
348 |
} |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
349 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
350 |
list_add_tail(&fsm->pdo->list, &fsm->pdos); |
741
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 |
ec_sdo_request_init_read(&fsm->request, entry); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
fsm->state = 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
|
354 |
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
|
355 |
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
|
356 |
return; |
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 |
|
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 |
/** |
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
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
|
366 |
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
|
367 |
) |
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_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
|
370 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
EC_ERR("Failed to read number of mapped PDO entries from slave %u.\n", |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
373 |
fsm->slave->ring_position); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
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
|
375 |
return; |
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 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
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
|
379 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
if (fsm->slave->master->debug_level) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
EC_DBG(" %u PDO entries mapped.\n", fsm->pdo_subindices); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
382 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
383 |
// read first PDO entry |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
384 |
fsm->pdo_subindex = 1; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
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
|
386 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
387 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
388 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
389 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
390 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
391 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
392 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
393 |
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
|
394 |
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
|
395 |
) |
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 |
ec_sdo_entry_t *entry; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
399 |
if (fsm->pdo_subindex <= fsm->pdo_subindices) { |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
400 |
if (!(entry = ec_sdo_get_entry(fsm->pdo_sdo, |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
fsm->pdo_subindex))) { |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
402 |
EC_ERR("SDO 0x%04X has no subindex %u on slave %u.\n", |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
fsm->pdo_sdo->index, fsm->pdo_subindex, |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
404 |
fsm->slave->ring_position); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
405 |
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
|
406 |
return; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
407 |
} |
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 |
ec_sdo_request_init_read(&fsm->request, entry); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
410 |
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
|
411 |
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
|
412 |
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
|
413 |
return; |
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 |
// next PDO |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
417 |
fsm->sync_subindex++; |
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_action_next_pdo(fsm); |
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 |
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
|
427 |
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
|
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 |
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
|
431 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
432 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
433 |
EC_ERR("Failed to read index of mapped PDO entry from slave %u.\n", |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
434 |
fsm->slave->ring_position); |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
435 |
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
|
436 |
return; |
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 |
uint32_t pdo_entry_info; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
441 |
ec_sdo_t *sdo; |
749
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
442 |
ec_sdo_entry_t *entry; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
443 |
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
|
444 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
445 |
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
|
446 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
447 |
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
|
448 |
kmalloc(sizeof(ec_pdo_entry_t), GFP_KERNEL))) { |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
449 |
EC_ERR("Failed to allocate PDO entry.\n"); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
450 |
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
|
451 |
return; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
452 |
} |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
453 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
454 |
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
|
455 |
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
|
456 |
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
|
457 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
458 |
if (!(sdo = ec_slave_get_sdo(fsm->slave, pdo_entry->index))) { |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
459 |
EC_ERR("Slave %u has no SDO 0x%04X.\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
|
460 |
fsm->slave->ring_position, pdo_entry->index); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
461 |
kfree(pdo_entry); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
462 |
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
|
463 |
return; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
464 |
} |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
465 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
466 |
if (!(entry = ec_sdo_get_entry(sdo, pdo_entry->subindex))) { |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
467 |
EC_ERR("Slave %u has no SDO entry 0x%04X:%u.\n", |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
468 |
fsm->slave->ring_position, pdo_entry->index, |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
469 |
pdo_entry->subindex); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
470 |
kfree(pdo_entry); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
471 |
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
|
472 |
return; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
473 |
} |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
474 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
475 |
if (entry->description && strlen(entry->description)) { |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
476 |
if (!(pdo_entry->name = (char *) |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
477 |
kmalloc(strlen(entry->description) + 1, GFP_KERNEL))) { |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
478 |
EC_ERR("Failed to allocate PDO entry name.\n"); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
479 |
kfree(pdo_entry); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
480 |
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
|
481 |
return; |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
482 |
} |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
483 |
memcpy(pdo_entry->name, entry->description, strlen(entry->description) + 1); |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
484 |
} else { |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
485 |
pdo_entry->name = NULL; |
741
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
486 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
487 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
488 |
if (fsm->slave->master->debug_level) { |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
489 |
EC_DBG(" PDO entry 0x%04X \"%s\" (%u bit).\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
|
490 |
pdo_entry->index, pdo_entry->name ? pdo_entry->name : "???", |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
491 |
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
|
492 |
} |
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
493 |
|
c8f1395f818a
Only exchange sync manager PDOs, if they could completely be read in.
Florian Pose <fp@igh-essen.com>
parents:
741
diff
changeset
|
494 |
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
|
495 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
496 |
// next PDO entry |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
497 |
fsm->pdo_subindex++; |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
498 |
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
|
499 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
500 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
501 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
502 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
503 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
504 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
505 |
State: ERROR. |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
506 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
507 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
508 |
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
|
509 |
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
|
510 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
511 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
512 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
513 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
514 |
/*****************************************************************************/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
515 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
516 |
/** |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
517 |
State: END. |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
518 |
*/ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
519 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
520 |
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
|
521 |
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
|
522 |
) |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
523 |
{ |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
524 |
} |
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
525 |
|
aece53f82df3
Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
526 |
/*****************************************************************************/ |