author | Florian Pose <fp@igh-essen.com> |
Fri, 28 Oct 2011 11:31:54 +0200 | |
changeset 2126 | 0383b71b88e4 |
parent 2045 | ff2a13a4603c |
child 2589 | 2b9c78543663 |
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" |
|
2045
ff2a13a4603c
Reduced frame size when sending to mailbox, uses 2 datagrams. Enabled with configure option --enable-mboxframesize
Martin Troxler <ch1010277@ch10pc446>
parents:
1562
diff
changeset
|
42 |
#include "mailbox.h" |
436 | 43 |
#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
|
44 |
#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
|
45 |
#include "sdo_request.h" |
436 | 46 |
|
47 |
/*****************************************************************************/ |
|
48 |
||
49 |
typedef struct ec_fsm_coe ec_fsm_coe_t; /**< \see ec_fsm_coe */ |
|
50 |
||
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
51 |
/** 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
|
52 |
*/ |
3771f5a0ed90
CoE state machines raising error, if the slave does not support CoE.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
53 |
struct ec_fsm_coe { |
436 | 54 |
ec_slave_t *slave; /**< slave the FSM runs on */ |
2045
ff2a13a4603c
Reduced frame size when sending to mailbox, uses 2 datagrams. Enabled with configure option --enable-mboxframesize
Martin Troxler <ch1010277@ch10pc446>
parents:
1562
diff
changeset
|
55 |
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:
436
diff
changeset
|
56 |
unsigned int retries; /**< retries upon datagram timeout */ |
436 | 57 |
|
58 |
void (*state)(ec_fsm_coe_t *); /**< CoE state function */ |
|
1038
7ca4103ba170
Use jiffies instead of cycles in CoE state machine.
Florian Pose <fp@igh-essen.com>
parents:
883
diff
changeset
|
59 |
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
|
60 |
ec_sdo_t *sdo; /**< current SDO */ |
436 | 61 |
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
|
62 |
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
|
63 |
uint32_t complete_size; /**< Used when segmenting. */ |
436 | 64 |
uint8_t toggle; /**< toggle bit for segment commands */ |
1562 | 65 |
uint32_t offset; /**< Data offset during segmented download. */ |
66 |
uint32_t remaining; /**< Remaining bytes during segmented download. */ |
|
436 | 67 |
}; |
68 |
||
69 |
/*****************************************************************************/ |
|
70 |
||
2045
ff2a13a4603c
Reduced frame size when sending to mailbox, uses 2 datagrams. Enabled with configure option --enable-mboxframesize
Martin Troxler <ch1010277@ch10pc446>
parents:
1562
diff
changeset
|
71 |
void ec_fsm_coe_init(ec_fsm_coe_t *, ec_mailbox_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 |
|
77 |
int ec_fsm_coe_exec(ec_fsm_coe_t *); |
|
78 |
int ec_fsm_coe_success(ec_fsm_coe_t *); |
|
79 |
||
80 |
/*****************************************************************************/ |
|
81 |
||
82 |
#endif |