author | Florian Pose <fp@igh-essen.com> |
Fri, 28 Oct 2011 11:31:54 +0200 | |
changeset 2126 | 0383b71b88e4 |
parent 2094 | 83e9160319ec |
child 2589 | 2b9c78543663 |
permissions | -rw-r--r-- |
238
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
1326
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1268
diff
changeset
|
5 |
* Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH |
238
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
* |
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT Master. |
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
* |
1326
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1268
diff
changeset
|
9 |
* The IgH EtherCAT Master is free software; you can redistribute it and/or |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1268
diff
changeset
|
10 |
* modify it under the terms of the GNU General Public License version 2, as |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1268
diff
changeset
|
11 |
* published by the Free Software Foundation. |
238
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
* |
1326
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1268
diff
changeset
|
13 |
* The IgH EtherCAT Master is distributed in the hope that it will be useful, |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1268
diff
changeset
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1268
diff
changeset
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1268
diff
changeset
|
16 |
* Public License for more details. |
238
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
* |
1326
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1268
diff
changeset
|
18 |
* You should have received a copy of the GNU General Public License along |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1268
diff
changeset
|
19 |
* with the IgH EtherCAT Master; if not, write to the Free Software |
238
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
* |
1363
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1335
diff
changeset
|
22 |
* --- |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1335
diff
changeset
|
23 |
* |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1335
diff
changeset
|
24 |
* The license mentioned above concerns the source code only. Using the |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1335
diff
changeset
|
25 |
* EtherCAT technology and brand is only permitted in compliance with the |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1335
diff
changeset
|
26 |
* industrial property and similar rights of Beckhoff Automation GmbH. |
246
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
238
diff
changeset
|
27 |
* |
238
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
*****************************************************************************/ |
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
|
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
/** |
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
\file |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
32 |
EtherCAT master state machine. |
238
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
*/ |
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
|
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
/*****************************************************************************/ |
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
|
883
4963e22a267a
Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents:
872
diff
changeset
|
37 |
#ifndef __EC_FSM_MASTER_H__ |
4963e22a267a
Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents:
872
diff
changeset
|
38 |
#define __EC_FSM_MASTER_H__ |
238
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
|
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
293
diff
changeset
|
40 |
#include "globals.h" |
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
286
diff
changeset
|
41 |
#include "datagram.h" |
2045
ff2a13a4603c
Reduced frame size when sending to mailbox, uses 2 datagrams. Enabled with configure option --enable-mboxframesize
Martin Troxler <ch1010277@ch10pc446>
parents:
2032
diff
changeset
|
42 |
#include "mailbox.h" |
1335
09c6fce1ae45
merge -c1616 branches/1.4-foe: Included FoE patch from Olav Zarges.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
43 |
#include "foe_request.h" |
847
92266462d411
Saparated ec_sdo_t, ec_sdo_entry_t and ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
830
diff
changeset
|
44 |
#include "sdo_request.h" |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
1597
diff
changeset
|
45 |
#include "soe_request.h" |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
46 |
#include "fsm_slave_config.h" |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
47 |
#include "fsm_slave_scan.h" |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1031
diff
changeset
|
48 |
#include "fsm_pdo.h" |
433
100f51f28cf2
Layed out SII state machine.
Florian Pose <fp@igh-essen.com>
parents:
430
diff
changeset
|
49 |
|
238
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
/*****************************************************************************/ |
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
|
872 | 52 |
/** SII write request. |
601
d6d951b766e3
Introduced EEPROM write requests: EEPROM write operations from user
Florian Pose <fp@igh-essen.com>
parents:
553
diff
changeset
|
53 |
*/ |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
54 |
typedef struct { |
979
405cc2d033e0
Renamed some fields in ec_sii_request_t to word addressing.
Florian Pose <fp@igh-essen.com>
parents:
900
diff
changeset
|
55 |
struct list_head list; /**< List head. */ |
405cc2d033e0
Renamed some fields in ec_sii_request_t to word addressing.
Florian Pose <fp@igh-essen.com>
parents:
900
diff
changeset
|
56 |
ec_slave_t *slave; /**< EtherCAT slave. */ |
405cc2d033e0
Renamed some fields in ec_sii_request_t to word addressing.
Florian Pose <fp@igh-essen.com>
parents:
900
diff
changeset
|
57 |
uint16_t offset; /**< SII word offset. */ |
405cc2d033e0
Renamed some fields in ec_sii_request_t to word addressing.
Florian Pose <fp@igh-essen.com>
parents:
900
diff
changeset
|
58 |
size_t nwords; /**< Number of words. */ |
405cc2d033e0
Renamed some fields in ec_sii_request_t to word addressing.
Florian Pose <fp@igh-essen.com>
parents:
900
diff
changeset
|
59 |
const uint16_t *words; /**< Pointer to the data words. */ |
1209 | 60 |
ec_internal_request_state_t state; /**< State of the request. */ |
2030
2bd8ad8bf41f
Sii write wait_event() deadlock fixed: use wait_event_interruptible and refcount ec_master_sii_write_request_t objects with kref
Martin Troxler <ch1010277@ch10pc446>
parents:
2029
diff
changeset
|
61 |
struct kref refcount; |
872 | 62 |
} ec_sii_write_request_t; |
601
d6d951b766e3
Introduced EEPROM write requests: EEPROM write operations from user
Florian Pose <fp@igh-essen.com>
parents:
553
diff
changeset
|
63 |
|
2030
2bd8ad8bf41f
Sii write wait_event() deadlock fixed: use wait_event_interruptible and refcount ec_master_sii_write_request_t objects with kref
Martin Troxler <ch1010277@ch10pc446>
parents:
2029
diff
changeset
|
64 |
void ec_master_sii_write_request_release(struct kref *); |
2bd8ad8bf41f
Sii write wait_event() deadlock fixed: use wait_event_interruptible and refcount ec_master_sii_write_request_t objects with kref
Martin Troxler <ch1010277@ch10pc446>
parents:
2029
diff
changeset
|
65 |
|
601
d6d951b766e3
Introduced EEPROM write requests: EEPROM write operations from user
Florian Pose <fp@igh-essen.com>
parents:
553
diff
changeset
|
66 |
/*****************************************************************************/ |
d6d951b766e3
Introduced EEPROM write requests: EEPROM write operations from user
Florian Pose <fp@igh-essen.com>
parents:
553
diff
changeset
|
67 |
|
1388
3c886ec376f5
Renamed phy_ commands to reg_.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
68 |
/** Register request. |
1200 | 69 |
*/ |
70 |
typedef struct { |
|
71 |
struct list_head list; /**< List head. */ |
|
72 |
ec_slave_t *slave; /**< EtherCAT slave. */ |
|
73 |
ec_direction_t dir; /**< Direction. */ |
|
1388
3c886ec376f5
Renamed phy_ commands to reg_.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
74 |
uint16_t offset; /**< Register address. */ |
1200 | 75 |
size_t length; /**< Number of bytes. */ |
1268 | 76 |
uint8_t *data; /**< Data to write / memory for read data. */ |
1209 | 77 |
ec_internal_request_state_t state; /**< State of the request. */ |
2031
7a025a9e192d
Register read/write wait_event() deadlock fixed: use wait_event_interruptible and refcount ec_reg_request_t objects with kref
Martin Troxler <ch1010277@ch10pc446>
parents:
2030
diff
changeset
|
78 |
struct kref refcount; |
1388
3c886ec376f5
Renamed phy_ commands to reg_.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
79 |
} ec_reg_request_t; |
1200 | 80 |
|
2031
7a025a9e192d
Register read/write wait_event() deadlock fixed: use wait_event_interruptible and refcount ec_reg_request_t objects with kref
Martin Troxler <ch1010277@ch10pc446>
parents:
2030
diff
changeset
|
81 |
void ec_master_reg_request_release(struct kref *); |
2027
ac35f4d38a31
SDO wait_event() deadlock fixed: refcount ec_master_sdo_request_t objects with kref
Martin Troxler <ch1010277@ch10pc446>
parents:
1961
diff
changeset
|
82 |
|
1200 | 83 |
/*****************************************************************************/ |
84 |
||
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
85 |
/** Slave/SDO request record for master's SDO request list. |
849
4b712ec8929d
Removed slave pointer from ec_sdo_request_t class.
Florian Pose <fp@igh-essen.com>
parents:
847
diff
changeset
|
86 |
*/ |
4b712ec8929d
Removed slave pointer from ec_sdo_request_t class.
Florian Pose <fp@igh-essen.com>
parents:
847
diff
changeset
|
87 |
typedef struct { |
4b712ec8929d
Removed slave pointer from ec_sdo_request_t class.
Florian Pose <fp@igh-essen.com>
parents:
847
diff
changeset
|
88 |
struct list_head list; /**< List element. */ |
4b712ec8929d
Removed slave pointer from ec_sdo_request_t class.
Florian Pose <fp@igh-essen.com>
parents:
847
diff
changeset
|
89 |
ec_slave_t *slave; /**< Slave. */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
90 |
ec_sdo_request_t req; /**< SDO request. */ |
2027
ac35f4d38a31
SDO wait_event() deadlock fixed: refcount ec_master_sdo_request_t objects with kref
Martin Troxler <ch1010277@ch10pc446>
parents:
1961
diff
changeset
|
91 |
struct kref refcount; |
849
4b712ec8929d
Removed slave pointer from ec_sdo_request_t class.
Florian Pose <fp@igh-essen.com>
parents:
847
diff
changeset
|
92 |
} ec_master_sdo_request_t; |
4b712ec8929d
Removed slave pointer from ec_sdo_request_t class.
Florian Pose <fp@igh-essen.com>
parents:
847
diff
changeset
|
93 |
|
2029
5ef6507fc77a
FoE wait_event() deadlock fixed: refcount ec_master_foe_request_t objects with kref
Martin Troxler <ch1010277@ch10pc446>
parents:
2027
diff
changeset
|
94 |
void ec_master_sdo_request_release(struct kref *); |
5ef6507fc77a
FoE wait_event() deadlock fixed: refcount ec_master_foe_request_t objects with kref
Martin Troxler <ch1010277@ch10pc446>
parents:
2027
diff
changeset
|
95 |
|
849
4b712ec8929d
Removed slave pointer from ec_sdo_request_t class.
Florian Pose <fp@igh-essen.com>
parents:
847
diff
changeset
|
96 |
/*****************************************************************************/ |
4b712ec8929d
Removed slave pointer from ec_sdo_request_t class.
Florian Pose <fp@igh-essen.com>
parents:
847
diff
changeset
|
97 |
|
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
1597
diff
changeset
|
98 |
/** FoE request. |
1335
09c6fce1ae45
merge -c1616 branches/1.4-foe: Included FoE patch from Olav Zarges.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
99 |
*/ |
09c6fce1ae45
merge -c1616 branches/1.4-foe: Included FoE patch from Olav Zarges.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
100 |
typedef struct { |
09c6fce1ae45
merge -c1616 branches/1.4-foe: Included FoE patch from Olav Zarges.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
101 |
struct list_head list; /**< List head. */ |
09c6fce1ae45
merge -c1616 branches/1.4-foe: Included FoE patch from Olav Zarges.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
102 |
ec_slave_t *slave; /**< EtherCAT slave. */ |
09c6fce1ae45
merge -c1616 branches/1.4-foe: Included FoE patch from Olav Zarges.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
103 |
ec_foe_request_t req; /**< FoE request. */ |
2029
5ef6507fc77a
FoE wait_event() deadlock fixed: refcount ec_master_foe_request_t objects with kref
Martin Troxler <ch1010277@ch10pc446>
parents:
2027
diff
changeset
|
104 |
struct kref refcount; |
1335
09c6fce1ae45
merge -c1616 branches/1.4-foe: Included FoE patch from Olav Zarges.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
105 |
} ec_master_foe_request_t; |
09c6fce1ae45
merge -c1616 branches/1.4-foe: Included FoE patch from Olav Zarges.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
106 |
|
2029
5ef6507fc77a
FoE wait_event() deadlock fixed: refcount ec_master_foe_request_t objects with kref
Martin Troxler <ch1010277@ch10pc446>
parents:
2027
diff
changeset
|
107 |
void ec_master_foe_request_release(struct kref *); |
5ef6507fc77a
FoE wait_event() deadlock fixed: refcount ec_master_foe_request_t objects with kref
Martin Troxler <ch1010277@ch10pc446>
parents:
2027
diff
changeset
|
108 |
|
1335
09c6fce1ae45
merge -c1616 branches/1.4-foe: Included FoE patch from Olav Zarges.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
109 |
/*****************************************************************************/ |
09c6fce1ae45
merge -c1616 branches/1.4-foe: Included FoE patch from Olav Zarges.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
110 |
|
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
1597
diff
changeset
|
111 |
/** SoE request. |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
1597
diff
changeset
|
112 |
*/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
1597
diff
changeset
|
113 |
typedef struct { |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
1597
diff
changeset
|
114 |
struct list_head list; /**< List head. */ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
1597
diff
changeset
|
115 |
ec_slave_t *slave; /**< EtherCAT slave. */ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
1597
diff
changeset
|
116 |
ec_soe_request_t req; /**< SoE request. */ |
2032
57c618557912
SoE request wait_event() deadlock fixed: use wait_event_interruptible and refcount ec_master_soe_request_t objects with kref
Martin Troxler <ch1010277@ch10pc446>
parents:
2031
diff
changeset
|
117 |
struct kref refcount; |
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
1597
diff
changeset
|
118 |
} ec_master_soe_request_t; |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
1597
diff
changeset
|
119 |
|
2032
57c618557912
SoE request wait_event() deadlock fixed: use wait_event_interruptible and refcount ec_master_soe_request_t objects with kref
Martin Troxler <ch1010277@ch10pc446>
parents:
2031
diff
changeset
|
120 |
void ec_master_soe_request_release(struct kref *); |
57c618557912
SoE request wait_event() deadlock fixed: use wait_event_interruptible and refcount ec_master_soe_request_t objects with kref
Martin Troxler <ch1010277@ch10pc446>
parents:
2031
diff
changeset
|
121 |
|
1831
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
1597
diff
changeset
|
122 |
/*****************************************************************************/ |
1875b9fea0ba
Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents:
1597
diff
changeset
|
123 |
|
528
f789bdd78b54
Layed out slave state machines in own files fsm_slave.[ch]; renamed fsm.[ch] to fsm_master.[ch]
Florian Pose <fp@igh-essen.com>
parents:
505
diff
changeset
|
124 |
typedef struct ec_fsm_master ec_fsm_master_t; /**< \see ec_fsm_master */ |
238
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
|
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
126 |
/** Finite state machine of an EtherCAT master. |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
127 |
*/ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
128 |
struct ec_fsm_master { |
238
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
ec_master_t *master; /**< master the FSM runs on */ |
528
f789bdd78b54
Layed out slave state machines in own files fsm_slave.[ch]; renamed fsm.[ch] to fsm_master.[ch]
Florian Pose <fp@igh-essen.com>
parents:
505
diff
changeset
|
130 |
ec_datagram_t *datagram; /**< datagram used in the state machine */ |
2094
83e9160319ec
Minor: Fixed line wraps and spacing.
Florian Pose <fp@igh-essen.com>
parents:
2045
diff
changeset
|
131 |
ec_mailbox_t *mbox; /**< mailbox used in the state machine */ |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
489
diff
changeset
|
132 |
unsigned int retries; /**< retries on datagram timeout. */ |
238
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
|
528
f789bdd78b54
Layed out slave state machines in own files fsm_slave.[ch]; renamed fsm.[ch] to fsm_master.[ch]
Florian Pose <fp@igh-essen.com>
parents:
505
diff
changeset
|
134 |
void (*state)(ec_fsm_master_t *); /**< master state function */ |
650
c68995623e94
Introduced idle flag in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
645
diff
changeset
|
135 |
int idle; /**< state machine is in idle phase */ |
652 | 136 |
unsigned long scan_jiffies; /**< beginning of slave scanning */ |
1400
3c4923051e43
Clear slave list on link down.
Florian Pose <fp@igh-essen.com>
parents:
1388
diff
changeset
|
137 |
uint8_t link_state; /**< Last main device link state. */ |
528
f789bdd78b54
Layed out slave state machines in own files fsm_slave.[ch]; renamed fsm.[ch] to fsm_master.[ch]
Florian Pose <fp@igh-essen.com>
parents:
505
diff
changeset
|
138 |
unsigned int slaves_responding; /**< number of responding slaves */ |
1961 | 139 |
unsigned int rescan_required; /**< A bus rescan is required. */ |
528
f789bdd78b54
Layed out slave state machines in own files fsm_slave.[ch]; renamed fsm.[ch] to fsm_master.[ch]
Florian Pose <fp@igh-essen.com>
parents:
505
diff
changeset
|
140 |
ec_slave_state_t slave_states; /**< states of responding slaves */ |
f789bdd78b54
Layed out slave state machines in own files fsm_slave.[ch]; renamed fsm.[ch] to fsm_master.[ch]
Florian Pose <fp@igh-essen.com>
parents:
505
diff
changeset
|
141 |
ec_slave_t *slave; /**< current slave */ |
872 | 142 |
ec_sii_write_request_t *sii_request; /**< SII write request */ |
143 |
off_t sii_index; /**< index to SII write request data */ |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
144 |
ec_sdo_request_t *sdo_request; /**< SDO request to process. */ |
1388
3c886ec376f5
Renamed phy_ commands to reg_.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
145 |
ec_reg_request_t *reg_request; /**< Register request to process. */ |
238
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
|
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1031
diff
changeset
|
147 |
ec_fsm_coe_t fsm_coe; /**< CoE state machine */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
148 |
ec_fsm_pdo_t fsm_pdo; /**< PDO configuration state machine. */ |
1174
235f34ca50e2
Major Pdo configuration change: Read mapping of unknown Pdos during
Florian Pose <fp@igh-essen.com>
parents:
1031
diff
changeset
|
149 |
ec_fsm_change_t fsm_change; /**< State change state machine */ |
830
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
150 |
ec_fsm_slave_config_t fsm_slave_config; /**< slave state machine */ |
d83d92e1a919
Separated slave state machines.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
151 |
ec_fsm_slave_scan_t fsm_slave_scan; /**< slave state machine */ |
433
100f51f28cf2
Layed out SII state machine.
Florian Pose <fp@igh-essen.com>
parents:
430
diff
changeset
|
152 |
ec_fsm_sii_t fsm_sii; /**< SII state machine */ |
238
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
}; |
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
|
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
/*****************************************************************************/ |
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
|
528
f789bdd78b54
Layed out slave state machines in own files fsm_slave.[ch]; renamed fsm.[ch] to fsm_master.[ch]
Florian Pose <fp@igh-essen.com>
parents:
505
diff
changeset
|
157 |
void ec_fsm_master_init(ec_fsm_master_t *, ec_master_t *, ec_datagram_t *); |
f789bdd78b54
Layed out slave state machines in own files fsm_slave.[ch]; renamed fsm.[ch] to fsm_master.[ch]
Florian Pose <fp@igh-essen.com>
parents:
505
diff
changeset
|
158 |
void ec_fsm_master_clear(ec_fsm_master_t *); |
446 | 159 |
|
1583
017fa8fd9ac1
Each slave got its own SDO state machine (faster handling of external SDO requests)
Martin Troxler <martin.troxler@komaxgroup.com>
parents:
1400
diff
changeset
|
160 |
int ec_fsm_master_exec(ec_fsm_master_t *); |
650
c68995623e94
Introduced idle flag in master state machine.
Florian Pose <fp@igh-essen.com>
parents:
645
diff
changeset
|
161 |
int ec_fsm_master_idle(const ec_fsm_master_t *); |
456
dea14706efc2
Explicit use of slave configuration FSM in ecrt_master_activate() and ecrt_master_release().
Florian Pose <fp@igh-essen.com>
parents:
446
diff
changeset
|
162 |
|
238
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
/*****************************************************************************/ |
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
|
b4960499098f
Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
165 |
#endif |