author | Philipp Weyer <pw@igh-essen.com> |
Fri, 18 Aug 2017 12:30:16 +0200 | |
branch | stable-1.5 |
changeset 2680 | e6f324a3d8a0 |
parent 2498 | 9cdd7669dc0b |
permissions | -rw-r--r-- |
436 | 1 |
/****************************************************************************** |
2 |
* |
|
3 |
* $Id$ |
|
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:
1209
diff
changeset
|
5 |
* Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH |
436 | 6 |
* |
7 |
* This file is part of the IgH EtherCAT Master. |
|
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:
1209
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:
1209
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:
1209
diff
changeset
|
11 |
* published by the Free Software Foundation. |
436 | 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:
1209
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:
1209
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:
1209
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:
1209
diff
changeset
|
16 |
* Public License for more details. |
436 | 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:
1209
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:
1209
diff
changeset
|
19 |
* with the IgH EtherCAT Master; if not, write to the Free Software |
436 | 20 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
21 |
* |
|
1363
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1339
diff
changeset
|
22 |
* --- |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1339
diff
changeset
|
23 |
* |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1339
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:
1339
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:
1339
diff
changeset
|
26 |
* industrial property and similar rights of Beckhoff Automation GmbH. |
436 | 27 |
* |
28 |
*****************************************************************************/ |
|
29 |
||
30 |
/** |
|
31 |
\file |
|
32 |
EtherCAT CoE state machines. |
|
33 |
*/ |
|
34 |
||
35 |
/*****************************************************************************/ |
|
36 |
||
883
4963e22a267a
Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
37 |
#ifndef __EC_FSM_COE_H__ |
4963e22a267a
Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
38 |
#define __EC_FSM_COE_H__ |
436 | 39 |
|
40 |
#include "globals.h" |
|
41 |
#include "datagram.h" |
|
42 |
#include "slave.h" |
|
847
92266462d411
Saparated ec_sdo_t, ec_sdo_entry_t and ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
825
diff
changeset
|
43 |
#include "sdo.h" |
92266462d411
Saparated ec_sdo_t, ec_sdo_entry_t and ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
825
diff
changeset
|
44 |
#include "sdo_request.h" |
436 | 45 |
|
46 |
/*****************************************************************************/ |
|
47 |
||
48 |
typedef struct ec_fsm_coe ec_fsm_coe_t; /**< \see ec_fsm_coe */ |
|
49 |
||
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
50 |
/** Finite state machines for the CANopen over EtherCAT protocol. |
825
3771f5a0ed90
CoE state machines raising error, if the slave does not support CoE.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
51 |
*/ |
3771f5a0ed90
CoE state machines raising error, if the slave does not support CoE.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
52 |
struct ec_fsm_coe { |
436 | 53 |
ec_slave_t *slave; /**< slave the FSM runs on */ |
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
436
diff
changeset
|
54 |
unsigned int retries; /**< retries upon datagram timeout */ |
436 | 55 |
|
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
1562
diff
changeset
|
56 |
void (*state)(ec_fsm_coe_t *, ec_datagram_t *); /**< CoE state function */ |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
1562
diff
changeset
|
57 |
ec_datagram_t *datagram; /**< Datagram used in last step. */ |
1038
7ca4103ba170
Use jiffies instead of cycles in CoE state machine.
Florian Pose <fp@igh-essen.com>
parents:
883
diff
changeset
|
58 |
unsigned long jiffies_start; /**< CoE timestamp. */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
59 |
ec_sdo_t *sdo; /**< current SDO */ |
436 | 60 |
uint8_t subindex; /**< current subindex */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
61 |
ec_sdo_request_t *request; /**< SDO request */ |
1339
3483999e1aba
merge -c1622 branches/1.4-foe: Fixed seg_size parameter when processing an CoE Upload Segment Response.
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
62 |
uint32_t complete_size; /**< Used when segmenting. */ |
436 | 63 |
uint8_t toggle; /**< toggle bit for segment commands */ |
1562 | 64 |
uint32_t offset; /**< Data offset during segmented download. */ |
65 |
uint32_t remaining; /**< Remaining bytes during segmented download. */ |
|
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
1562
diff
changeset
|
66 |
size_t segment_size; /**< Current segment size. */ |
436 | 67 |
}; |
68 |
||
69 |
/*****************************************************************************/ |
|
70 |
||
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
1562
diff
changeset
|
71 |
void ec_fsm_coe_init(ec_fsm_coe_t *); |
436 | 72 |
void ec_fsm_coe_clear(ec_fsm_coe_t *); |
73 |
||
74 |
void ec_fsm_coe_dictionary(ec_fsm_coe_t *, ec_slave_t *); |
|
859
233e32f428e1
Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
75 |
void ec_fsm_coe_transfer(ec_fsm_coe_t *, ec_slave_t *, ec_sdo_request_t *); |
436 | 76 |
|
2498
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
1562
diff
changeset
|
77 |
int ec_fsm_coe_exec(ec_fsm_coe_t *, ec_datagram_t *); |
9cdd7669dc0b
Avoided io_sem locking from userspace/rtdm library.
Florian Pose <fp@igh-essen.com>
parents:
1562
diff
changeset
|
78 |
int ec_fsm_coe_success(const ec_fsm_coe_t *); |
436 | 79 |
|
80 |
/*****************************************************************************/ |
|
81 |
||
82 |
#endif |