author | Florian Pose <fp@igh-essen.com> |
Mon, 19 Jan 2009 14:46:55 +0000 | |
branch | 1.4-foe |
changeset 1709 | 63e4bc918640 |
parent 1686 | e206f4485f60 |
child 1696 | c9bfe98e00d5 |
permissions | -rw-r--r-- |
436 | 1 |
/****************************************************************************** |
2 |
* |
|
3 |
* $Id$ |
|
4 |
* |
|
1685
399ef727bf62
Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1038
diff
changeset
|
5 |
* Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH |
436 | 6 |
* |
7 |
* This file is part of the IgH EtherCAT Master. |
|
8 |
* |
|
1685
399ef727bf62
Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1038
diff
changeset
|
9 |
* The IgH EtherCAT Master is free software; you can redistribute it and/or |
399ef727bf62
Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1038
diff
changeset
|
10 |
* modify it under the terms of the GNU General Public License version 2, as |
399ef727bf62
Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1038
diff
changeset
|
11 |
* published by the Free Software Foundation. |
436 | 12 |
* |
1685
399ef727bf62
Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1038
diff
changeset
|
13 |
* The IgH EtherCAT Master is distributed in the hope that it will be useful, |
399ef727bf62
Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1038
diff
changeset
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
399ef727bf62
Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1038
diff
changeset
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
399ef727bf62
Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1038
diff
changeset
|
16 |
* Public License for more details. |
436 | 17 |
* |
1685
399ef727bf62
Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1038
diff
changeset
|
18 |
* You should have received a copy of the GNU General Public License along |
399ef727bf62
Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1038
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 |
* |
|
1685
399ef727bf62
Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1038
diff
changeset
|
22 |
* Using the EtherCAT technology and brand is permitted in compliance with |
399ef727bf62
Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1038
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 "../include/ecrt.h" |
|
39 |
#include "datagram.h" |
|
40 |
#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
|
41 |
#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
|
42 |
#include "sdo_request.h" |
436 | 43 |
|
44 |
/*****************************************************************************/ |
|
45 |
||
46 |
typedef struct ec_fsm_coe ec_fsm_coe_t; /**< \see ec_fsm_coe */ |
|
47 |
||
1686
e206f4485f60
Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1685
diff
changeset
|
48 |
/** 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
|
49 |
*/ |
3771f5a0ed90
CoE state machines raising error, if the slave does not support CoE.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
50 |
struct ec_fsm_coe { |
436 | 51 |
ec_slave_t *slave; /**< slave the FSM runs on */ |
52 |
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
|
53 |
unsigned int retries; /**< retries upon datagram timeout */ |
436 | 54 |
|
55 |
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
|
56 |
unsigned long jiffies_start; /**< CoE timestamp. */ |
1686
e206f4485f60
Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1685
diff
changeset
|
57 |
ec_sdo_t *sdo; /**< current SDO */ |
436 | 58 |
uint8_t subindex; /**< current subindex */ |
1686
e206f4485f60
Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1685
diff
changeset
|
59 |
ec_sdo_request_t *request; /**< SDO request */ |
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 |