author | Florian Pose <fp@igh-essen.com> |
Tue, 24 Feb 2009 08:54:17 +0000 | |
changeset 1357 | b065f49113f4 |
parent 1339 | 3483999e1aba |
child 1363 | 11c0b2caa253 |
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 |
* |
|
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
|
22 |
* Using the EtherCAT technology and brand is permitted in compliance with |
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
|
23 |
* the industrial property and similar rights of Beckhoff Automation GmbH. |
436 | 24 |
* |
25 |
*****************************************************************************/ |
|
26 |
||
27 |
/** |
|
28 |
\file |
|
29 |
EtherCAT CoE state machines. |
|
30 |
*/ |
|
31 |
||
32 |
/*****************************************************************************/ |
|
33 |
||
883
4963e22a267a
Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
34 |
#ifndef __EC_FSM_COE_H__ |
4963e22a267a
Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents:
859
diff
changeset
|
35 |
#define __EC_FSM_COE_H__ |
436 | 36 |
|
37 |
#include "globals.h" |
|
38 |
#include "datagram.h" |
|
39 |
#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
|
40 |
#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
|
41 |
#include "sdo_request.h" |
436 | 42 |
|
43 |
/*****************************************************************************/ |
|
44 |
||
45 |
typedef struct ec_fsm_coe ec_fsm_coe_t; /**< \see ec_fsm_coe */ |
|
46 |
||
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
47 |
/** 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
|
48 |
*/ |
3771f5a0ed90
CoE state machines raising error, if the slave does not support CoE.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
49 |
struct ec_fsm_coe { |
436 | 50 |
ec_slave_t *slave; /**< slave the FSM runs on */ |
51 |
ec_datagram_t *datagram; /**< datagram used in the state machine */ |
|
505
bc443ca0077f
State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents:
436
diff
changeset
|
52 |
unsigned int retries; /**< retries upon datagram timeout */ |
436 | 53 |
|
54 |
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
|
55 |
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
|
56 |
ec_sdo_t *sdo; /**< current SDO */ |
436 | 57 |
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
|
58 |
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
|
59 |
uint32_t complete_size; /**< Used when segmenting. */ |
436 | 60 |
uint8_t toggle; /**< toggle bit for segment commands */ |
61 |
}; |
|
62 |
||
63 |
/*****************************************************************************/ |
|
64 |
||
65 |
void ec_fsm_coe_init(ec_fsm_coe_t *, ec_datagram_t *); |
|
66 |
void ec_fsm_coe_clear(ec_fsm_coe_t *); |
|
67 |
||
68 |
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
|
69 |
void ec_fsm_coe_transfer(ec_fsm_coe_t *, ec_slave_t *, ec_sdo_request_t *); |
436 | 70 |
|
71 |
int ec_fsm_coe_exec(ec_fsm_coe_t *); |
|
72 |
int ec_fsm_coe_success(ec_fsm_coe_t *); |
|
73 |
||
74 |
/*****************************************************************************/ |
|
75 |
||
76 |
#endif |