author | Florian Pose <fp@igh-essen.com> |
Fri, 27 Jun 2008 08:58:04 +0000 | |
changeset 1065 | d1d2aa556344 |
parent 1056 | 7b656881e771 |
child 1082 | ff06c58e269c |
permissions | -rw-r--r-- |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
* Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
* |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT Master. |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
* |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
* The IgH EtherCAT Master is free software; you can redistribute it |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
* and/or modify it under the terms of the GNU General Public License |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
* as published by the Free Software Foundation; either version 2 of the |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
* License, or (at your option) any later version. |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
* |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
* The IgH EtherCAT Master is distributed in the hope that it will be |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
* GNU General Public License for more details. |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
* |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
* You should have received a copy of the GNU General Public License |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
* along with the IgH EtherCAT Master; if not, write to the Free Software |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
* |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
* The right to use EtherCAT Technology is granted and comes free of |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
* charge under condition of compatibility of product made by |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
* Licensee. People intending to distribute/sell products based on the |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
* code, have to sign an agreement to guarantee that products using |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
* software based on IgH EtherCAT master stay compatible with the actual |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
* EtherCAT specification (which are released themselves as an open |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
* standard) as the (only) precondition to have the right to use EtherCAT |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
* Technology, IP and trade marks. |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
* |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
*****************************************************************************/ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
34 |
/** \file |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
35 |
* EtherCAT Pdo assignment state machine. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
36 |
*/ |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
|
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
/*****************************************************************************/ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
|
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
#include "globals.h" |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
#include "master.h" |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
#include "mailbox.h" |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
43 |
#include "slave_config.h" |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
44 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
45 |
#include "fsm_pdo_assign.h" |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
46 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
47 |
/*****************************************************************************/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
48 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
49 |
void ec_fsm_pdo_assign_state_start(ec_fsm_pdo_assign_t *); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
50 |
void ec_fsm_pdo_assign_state_zero_count(ec_fsm_pdo_assign_t *); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
51 |
void ec_fsm_pdo_assign_state_add_pdo(ec_fsm_pdo_assign_t *); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
52 |
void ec_fsm_pdo_assign_state_pdo_count(ec_fsm_pdo_assign_t *); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
53 |
void ec_fsm_pdo_assign_state_end(ec_fsm_pdo_assign_t *); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
54 |
void ec_fsm_pdo_assign_state_error(ec_fsm_pdo_assign_t *); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
55 |
|
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
56 |
void ec_fsm_pdo_assign_next_sync(ec_fsm_pdo_assign_t *); |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
|
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
/*****************************************************************************/ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
60 |
/** Constructor. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
61 |
*/ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
62 |
void ec_fsm_pdo_assign_init( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
63 |
ec_fsm_pdo_assign_t *fsm, /**< Pdo assignment state machine. */ |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
ec_fsm_coe_t *fsm_coe /**< CoE state machine to use */ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
) |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
{ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
fsm->fsm_coe = fsm_coe; |
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
835
diff
changeset
|
68 |
ec_sdo_request_init(&fsm->request); |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
} |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
|
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
/*****************************************************************************/ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
73 |
/** Destructor. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
74 |
*/ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
75 |
void ec_fsm_pdo_assign_clear( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
76 |
ec_fsm_pdo_assign_t *fsm /**< Pdo assignment state machine. */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
77 |
) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
78 |
{ |
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
835
diff
changeset
|
79 |
ec_sdo_request_clear(&fsm->request); |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
80 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
81 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
82 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
83 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
84 |
/** Start Pdo assignment state machine. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
85 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
86 |
void ec_fsm_pdo_assign_start( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
87 |
ec_fsm_pdo_assign_t *fsm, /**< Pdo assignment state machine. */ |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
ec_slave_t *slave /**< slave to configure */ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
) |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
{ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
fsm->slave = slave; |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
92 |
fsm->state = ec_fsm_pdo_assign_state_start; |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
} |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
|
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
/*****************************************************************************/ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
97 |
/** Get running state. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
98 |
* |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
* \return false, if state machine has terminated |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
*/ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
101 |
int ec_fsm_pdo_assign_running( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
102 |
const ec_fsm_pdo_assign_t *fsm /**< Pdo assignment state machine. */ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
103 |
) |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
104 |
{ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
105 |
return fsm->state != ec_fsm_pdo_assign_state_end |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
106 |
&& fsm->state != ec_fsm_pdo_assign_state_error; |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
} |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
|
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
/*****************************************************************************/ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
111 |
/** Executes the current state of the state machine. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
112 |
* |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
* If the state machine's datagram is not sent or received yet, the execution |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
* of the state machine is delayed to the next cycle. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
115 |
* |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
* \return false, if state machine has terminated |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
*/ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
118 |
int ec_fsm_pdo_assign_exec( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
119 |
ec_fsm_pdo_assign_t *fsm /**< Pdo assignment state machine. */ |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
) |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
{ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
fsm->state(fsm); |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
123 |
return ec_fsm_pdo_assign_running(fsm); |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
} |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
|
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
/*****************************************************************************/ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
128 |
/** Get execution result. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
129 |
* |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
* \return true, if the state machine terminated gracefully |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
*/ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
132 |
int ec_fsm_pdo_assign_success( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
133 |
const ec_fsm_pdo_assign_t *fsm /**< Pdo assignment state machine. */ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
134 |
) |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
135 |
{ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
136 |
return fsm->state == ec_fsm_pdo_assign_state_end; |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
} |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
|
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
/****************************************************************************** |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
140 |
* State functions. |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
*****************************************************************************/ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
143 |
/** Start Pdo assignment. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
144 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
145 |
void ec_fsm_pdo_assign_state_start( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
146 |
ec_fsm_pdo_assign_t *fsm /**< Pdo assignment state machine. */ |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
) |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
{ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
149 |
if (!fsm->slave->config) { |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
150 |
fsm->state = ec_fsm_pdo_assign_state_end; |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
151 |
return; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
152 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
153 |
|
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
154 |
fsm->sync_index = 0xff; // next is zero |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
155 |
fsm->num_configured_syncs = 0; |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
156 |
ec_fsm_pdo_assign_next_sync(fsm); |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
157 |
} |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
158 |
|
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
159 |
/*****************************************************************************/ |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
160 |
|
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
161 |
/** Process Pdo assignment of next sync manager. |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
162 |
*/ |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
163 |
void ec_fsm_pdo_assign_next_sync( |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
164 |
ec_fsm_pdo_assign_t *fsm /**< Pdo assignment state machine. */ |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
165 |
) |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
166 |
{ |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
167 |
fsm->sync_index++; |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
168 |
|
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
169 |
for (; fsm->sync_index < EC_MAX_SYNCS; fsm->sync_index++) { |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
170 |
fsm->pdos = &fsm->slave->config->sync_configs[fsm->sync_index].pdos; |
821
c6536d28db56
Fixed warning about missing sync managers during Pdo mapping.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
171 |
|
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
172 |
if (!(fsm->sync = ec_slave_get_sync(fsm->slave, fsm->sync_index))) { |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
173 |
if (!list_empty(&fsm->pdos->list)) { |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
174 |
EC_ERR("Slave %u does not provide a configuration for sync " |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
175 |
"manager %u!\n", fsm->slave->ring_position, |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
176 |
fsm->sync_index); |
1056
7b656881e771
Configuration error, if sync manager configuration configuration with
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
177 |
fsm->state = ec_fsm_pdo_assign_state_error; |
821
c6536d28db56
Fixed warning about missing sync managers during Pdo mapping.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
178 |
return; |
c6536d28db56
Fixed warning about missing sync managers during Pdo mapping.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
179 |
} |
660
582a90a34303
Configure alternative PDO mapping only on slaves that have PDO sync
Florian Pose <fp@igh-essen.com>
parents:
635
diff
changeset
|
180 |
continue; |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
} |
660
582a90a34303
Configure alternative PDO mapping only on slaves that have PDO sync
Florian Pose <fp@igh-essen.com>
parents:
635
diff
changeset
|
182 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
183 |
// check if assignment has to be altered |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
184 |
if (ec_pdo_list_equal(&fsm->sync->pdos, fsm->pdos)) |
821
c6536d28db56
Fixed warning about missing sync managers during Pdo mapping.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
185 |
continue; |
c6536d28db56
Fixed warning about missing sync managers during Pdo mapping.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
186 |
|
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
187 |
if (fsm->slave->master->debug_level) { |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
188 |
EC_DBG("Pdo assignment of SM%u differs in slave %u:\n", |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
189 |
fsm->sync_index, fsm->slave->ring_position); |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
190 |
EC_DBG("Currently assigned Pdos: "); |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
191 |
ec_pdo_list_print(&fsm->sync->pdos); |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
192 |
printk("\n"); |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
193 |
EC_DBG("Pdos to assign: "); |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
194 |
ec_pdo_list_print(fsm->pdos); |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
195 |
printk("\n"); |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
196 |
} |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
197 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
198 |
// Pdo assignment has to be changed. Does the slave support this? |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
199 |
if (!(fsm->slave->sii.mailbox_protocols & EC_MBOX_COE) |
835
23fd8b510803
Evaluate CoE details from general category; moved current consumption
Florian Pose <fp@igh-essen.com>
parents:
827
diff
changeset
|
200 |
|| (fsm->slave->sii.has_general |
23fd8b510803
Evaluate CoE details from general category; moved current consumption
Florian Pose <fp@igh-essen.com>
parents:
827
diff
changeset
|
201 |
&& !fsm->slave->sii.coe_details.enable_pdo_assign)) { |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
202 |
EC_ERR("Slave %u does not support assigning Pdos!\n", |
835
23fd8b510803
Evaluate CoE details from general category; moved current consumption
Florian Pose <fp@igh-essen.com>
parents:
827
diff
changeset
|
203 |
fsm->slave->ring_position); |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
204 |
fsm->state = ec_fsm_pdo_assign_state_error; |
835
23fd8b510803
Evaluate CoE details from general category; moved current consumption
Florian Pose <fp@igh-essen.com>
parents:
827
diff
changeset
|
205 |
return; |
23fd8b510803
Evaluate CoE details from general category; moved current consumption
Florian Pose <fp@igh-essen.com>
parents:
827
diff
changeset
|
206 |
} |
23fd8b510803
Evaluate CoE details from general category; moved current consumption
Florian Pose <fp@igh-essen.com>
parents:
827
diff
changeset
|
207 |
|
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
208 |
fsm->num_configured_syncs++; |
890
1115793a76ed
Debug messaged on configuring assignment and mapping.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
209 |
|
821
c6536d28db56
Fixed warning about missing sync managers during Pdo mapping.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
210 |
if (fsm->slave->master->debug_level) { |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
211 |
EC_DBG("Changing Pdo assignment for SM%u of slave %u.\n", |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
212 |
fsm->sync_index, fsm->slave->ring_position); |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
213 |
} |
821
c6536d28db56
Fixed warning about missing sync managers during Pdo mapping.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
214 |
|
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
835
diff
changeset
|
215 |
if (ec_sdo_request_alloc(&fsm->request, 2)) { |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
216 |
fsm->state = ec_fsm_pdo_assign_state_error; |
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
835
diff
changeset
|
217 |
return; |
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
835
diff
changeset
|
218 |
} |
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
835
diff
changeset
|
219 |
|
821
c6536d28db56
Fixed warning about missing sync managers during Pdo mapping.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
220 |
// set mapped Pdo count to zero |
875
c5df898a3618
Fixed access to data pointers in Pdo config and Pdo mapping FSM's.
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
221 |
EC_WRITE_U8(fsm->request.data, 0); // zero Pdos mapped |
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
835
diff
changeset
|
222 |
fsm->request.data_size = 1; |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
223 |
ec_sdo_request_address(&fsm->request, 0x1C10 + fsm->sync_index, 0); |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
224 |
ecrt_sdo_request_write(&fsm->request); |
801
6b1e2b0ed8bc
Cleaned up Pdo mapping and configuration state machines.
Florian Pose <fp@igh-essen.com>
parents:
792
diff
changeset
|
225 |
if (fsm->slave->master->debug_level) |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
226 |
EC_DBG("Setting Pdo count to zero for SM%u.\n", fsm->sync_index); |
821
c6536d28db56
Fixed warning about missing sync managers during Pdo mapping.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
227 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
228 |
fsm->state = ec_fsm_pdo_assign_state_zero_count; |
859
233e32f428e1
Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
229 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request); |
821
c6536d28db56
Fixed warning about missing sync managers during Pdo mapping.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
230 |
ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately |
c6536d28db56
Fixed warning about missing sync managers during Pdo mapping.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
231 |
return; |
c6536d28db56
Fixed warning about missing sync managers during Pdo mapping.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
232 |
} |
c6536d28db56
Fixed warning about missing sync managers during Pdo mapping.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
233 |
|
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
234 |
if (fsm->slave->master->debug_level && !fsm->num_configured_syncs) |
890
1115793a76ed
Debug messaged on configuring assignment and mapping.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
235 |
EC_DBG("Pdo assignments of slave %u are already configured" |
1115793a76ed
Debug messaged on configuring assignment and mapping.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
236 |
" correctly.\n", fsm->slave->ring_position); |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
237 |
fsm->state = ec_fsm_pdo_assign_state_end; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
238 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
239 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
240 |
/*****************************************************************************/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
241 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
242 |
/** Assign next Pdo. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
243 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
244 |
ec_pdo_t *ec_fsm_pdo_assign_next_pdo( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
245 |
const ec_fsm_pdo_assign_t *fsm, /**< Pdo assignment state machine. */ |
814 | 246 |
const struct list_head *list /**< current Pdo list item */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
247 |
) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
248 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
249 |
list = list->next; |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
250 |
if (list == &fsm->pdos->list) |
814 | 251 |
return NULL; // no next Pdo |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
252 |
return list_entry(list, ec_pdo_t, list); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
253 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
254 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
255 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
256 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
257 |
/** Assign a Pdo. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
258 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
259 |
void ec_fsm_pdo_assign_add_pdo( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
260 |
ec_fsm_pdo_assign_t *fsm /**< Pdo assignment state machine. */ |
801
6b1e2b0ed8bc
Cleaned up Pdo mapping and configuration state machines.
Florian Pose <fp@igh-essen.com>
parents:
792
diff
changeset
|
261 |
) |
6b1e2b0ed8bc
Cleaned up Pdo mapping and configuration state machines.
Florian Pose <fp@igh-essen.com>
parents:
792
diff
changeset
|
262 |
{ |
875
c5df898a3618
Fixed access to data pointers in Pdo config and Pdo mapping FSM's.
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
263 |
EC_WRITE_U16(fsm->request.data, fsm->pdo->index); |
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
835
diff
changeset
|
264 |
fsm->request.data_size = 2; |
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
835
diff
changeset
|
265 |
ec_sdo_request_address(&fsm->request, |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
266 |
0x1C10 + fsm->sync_index, fsm->pdo_count); |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
267 |
ecrt_sdo_request_write(&fsm->request); |
801
6b1e2b0ed8bc
Cleaned up Pdo mapping and configuration state machines.
Florian Pose <fp@igh-essen.com>
parents:
792
diff
changeset
|
268 |
if (fsm->slave->master->debug_level) |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
269 |
EC_DBG("Assigning Pdo 0x%04X at position %u.\n", |
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
835
diff
changeset
|
270 |
fsm->pdo->index, fsm->pdo_count); |
801
6b1e2b0ed8bc
Cleaned up Pdo mapping and configuration state machines.
Florian Pose <fp@igh-essen.com>
parents:
792
diff
changeset
|
271 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
272 |
fsm->state = ec_fsm_pdo_assign_state_add_pdo; |
859
233e32f428e1
Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
273 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request); |
801
6b1e2b0ed8bc
Cleaned up Pdo mapping and configuration state machines.
Florian Pose <fp@igh-essen.com>
parents:
792
diff
changeset
|
274 |
ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately |
6b1e2b0ed8bc
Cleaned up Pdo mapping and configuration state machines.
Florian Pose <fp@igh-essen.com>
parents:
792
diff
changeset
|
275 |
} |
6b1e2b0ed8bc
Cleaned up Pdo mapping and configuration state machines.
Florian Pose <fp@igh-essen.com>
parents:
792
diff
changeset
|
276 |
|
6b1e2b0ed8bc
Cleaned up Pdo mapping and configuration state machines.
Florian Pose <fp@igh-essen.com>
parents:
792
diff
changeset
|
277 |
/*****************************************************************************/ |
6b1e2b0ed8bc
Cleaned up Pdo mapping and configuration state machines.
Florian Pose <fp@igh-essen.com>
parents:
792
diff
changeset
|
278 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
279 |
/** Set the number of assigned Pdos to zero. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
280 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
281 |
void ec_fsm_pdo_assign_state_zero_count( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
282 |
ec_fsm_pdo_assign_t *fsm /**< Pdo assignment state machine. */ |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
) |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
{ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
if (ec_fsm_coe_exec(fsm->fsm_coe)) return; |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
|
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
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:
875
diff
changeset
|
288 |
EC_ERR("Failed to clear Pdo assignment of slave %u.\n", |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
fsm->slave->ring_position); |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
290 |
fsm->state = ec_fsm_pdo_assign_state_error; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
291 |
return; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
292 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
293 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
294 |
// assign all Pdos belonging to the current sync manager |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
295 |
|
814 | 296 |
// find first Pdo |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
297 |
if (!(fsm->pdo = ec_fsm_pdo_assign_next_pdo(fsm, &fsm->pdos->list))) { |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
if (fsm->slave->master->debug_level) |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
299 |
EC_DBG("No Pdos to assign for SM%u of slave %u.\n", |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
300 |
fsm->sync_index, fsm->slave->ring_position); |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
301 |
ec_fsm_pdo_assign_next_sync(fsm); |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
302 |
return; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
303 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
304 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
305 |
// assign first Pdo |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
fsm->pdo_count = 1; |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
307 |
ec_fsm_pdo_assign_add_pdo(fsm); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
308 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
309 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
310 |
/*****************************************************************************/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
311 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
312 |
/** Add a Pdo to the sync managers Pdo assignment. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
313 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
314 |
void ec_fsm_pdo_assign_state_add_pdo( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
315 |
ec_fsm_pdo_assign_t *fsm /**< Pdo assignment state machine. */ |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
) |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
{ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
if (ec_fsm_coe_exec(fsm->fsm_coe)) return; |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
|
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
320 |
if (!ec_fsm_coe_success(fsm->fsm_coe)) { |
814 | 321 |
EC_ERR("Failed to map Pdo 0x%04X for SM%u of slave %u.\n", |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
322 |
fsm->pdo->index, fsm->sync_index, fsm->slave->ring_position); |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
323 |
fsm->state = ec_fsm_pdo_assign_state_error; |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
324 |
return; |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
} |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
|
814 | 327 |
// find next Pdo |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
328 |
if (!(fsm->pdo = ec_fsm_pdo_assign_next_pdo(fsm, &fsm->pdo->list))) { |
814 | 329 |
// no more Pdos to map. write Pdo count |
875
c5df898a3618
Fixed access to data pointers in Pdo config and Pdo mapping FSM's.
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
330 |
EC_WRITE_U8(fsm->request.data, fsm->pdo_count); |
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
835
diff
changeset
|
331 |
fsm->request.data_size = 1; |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
332 |
ec_sdo_request_address(&fsm->request, 0x1C10 + fsm->sync_index, 0); |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
333 |
ecrt_sdo_request_write(&fsm->request); |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
334 |
if (fsm->slave->master->debug_level) |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
335 |
EC_DBG("Setting number of assigned Pdos to %u.\n", |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
336 |
fsm->pdo_count); |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
337 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
338 |
fsm->state = ec_fsm_pdo_assign_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
|
339 |
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request); |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
340 |
ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
return; |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
} |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
344 |
// add next Pdo to assignment |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
345 |
fsm->pdo_count++; |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
346 |
ec_fsm_pdo_assign_add_pdo(fsm); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
347 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
348 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
349 |
/*****************************************************************************/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
350 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
351 |
/** Set the number of assigned Pdos. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
352 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
353 |
void ec_fsm_pdo_assign_state_pdo_count( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
354 |
ec_fsm_pdo_assign_t *fsm /**< Pdo assignment state machine. */ |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
) |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
{ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
357 |
if (ec_fsm_coe_exec(fsm->fsm_coe)) return; |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
358 |
|
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
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:
875
diff
changeset
|
360 |
EC_ERR("Failed to set number of assigned Pdos for slave %u.\n", |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
fsm->slave->ring_position); |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
362 |
fsm->state = ec_fsm_pdo_assign_state_error; |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
return; |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
} |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
|
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
if (fsm->slave->master->debug_level) |
890
1115793a76ed
Debug messaged on configuring assignment and mapping.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
367 |
EC_DBG("Successfully configured Pdo assignment for SM%u of" |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
368 |
" slave %u.\n", fsm->sync_index, fsm->slave->ring_position); |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
369 |
|
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
370 |
// assignment for this sync manager finished |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1050
diff
changeset
|
371 |
ec_fsm_pdo_assign_next_sync(fsm); |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
} |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
373 |
|
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
/****************************************************************************** |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
375 |
* Common state functions |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
376 |
*****************************************************************************/ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
378 |
/** State: ERROR. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
379 |
*/ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
380 |
void ec_fsm_pdo_assign_state_error( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
381 |
ec_fsm_pdo_assign_t *fsm /**< Pdo assignment state machine. */ |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
382 |
) |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
383 |
{ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
384 |
} |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
|
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
386 |
/*****************************************************************************/ |
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
387 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
388 |
/** State: END. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
389 |
*/ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
390 |
void ec_fsm_pdo_assign_state_end( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
391 |
ec_fsm_pdo_assign_t *fsm /**< Pdo assignment state machine. */ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
392 |
) |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
393 |
{ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
394 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
395 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
875
diff
changeset
|
396 |
/*****************************************************************************/ |