author | Florian Pose <fp@igh-essen.com> |
Thu, 02 Oct 2008 10:44:43 +0000 | |
changeset 1245 | 9f52fc9562ae |
parent 1244 | 0b70040d3daa |
child 1248 | 3cc16b60a571 |
permissions | -rw-r--r-- |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
125 | 3 |
* $Id$ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
197
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
5 |
* Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
6 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT Master. |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
8 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
9 |
* The IgH EtherCAT Master is free software; you can redistribute it |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
10 |
* and/or modify it under the terms of the GNU General Public License |
246
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
206
diff
changeset
|
11 |
* as published by the Free Software Foundation; either version 2 of the |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
206
diff
changeset
|
12 |
* License, or (at your option) any later version. |
197
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
13 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
14 |
* The IgH EtherCAT Master is distributed in the hope that it will be |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
15 |
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
17 |
* GNU General Public License for more details. |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
18 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
19 |
* You should have received a copy of the GNU General Public License |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
20 |
* along with the IgH EtherCAT Master; if not, write to the Free Software |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
21 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
22 |
* |
246
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
206
diff
changeset
|
23 |
* The right to use EtherCAT Technology is granted and comes free of |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
206
diff
changeset
|
24 |
* charge under condition of compatibility of product made by |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
206
diff
changeset
|
25 |
* Licensee. People intending to distribute/sell products based on the |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
206
diff
changeset
|
26 |
* code, have to sign an agreement to guarantee that products using |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
206
diff
changeset
|
27 |
* software based on IgH EtherCAT master stay compatible with the actual |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
206
diff
changeset
|
28 |
* EtherCAT specification (which are released themselves as an open |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
206
diff
changeset
|
29 |
* standard) as the (only) precondition to have the right to use EtherCAT |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
206
diff
changeset
|
30 |
* Technology, IP and trade marks. |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
206
diff
changeset
|
31 |
* |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
*****************************************************************************/ |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
|
786 | 34 |
/** \file |
35 |
* |
|
1182 | 36 |
* EtherCAT master application interface. |
37 |
* |
|
38 |
* \defgroup ApplicationInterface EtherCAT Application Interface |
|
786 | 39 |
* |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
40 |
* EtherCAT interface for realtime applications. This interface is designed |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
41 |
* for realtime modules that want to use EtherCAT. There are functions to |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
42 |
* request a master, to map process data, to communicate with slaves via CoE |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
43 |
* and to configure and activate the bus. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
44 |
* |
1239
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1226
diff
changeset
|
45 |
* Changes in version 1.5: |
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1226
diff
changeset
|
46 |
* |
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1226
diff
changeset
|
47 |
* - Changed the return value of ecrt_request_master(). |
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1226
diff
changeset
|
48 |
* |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
49 |
* Changes in Version 1.4: |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
50 |
* |
1083
1322dc34cb37
Updated header docs, features and news file.
Florian Pose <fp@igh-essen.com>
parents:
1082
diff
changeset
|
51 |
* - Replaced ec_slave_t with ec_slave_config_t, separating the bus |
1322dc34cb37
Updated header docs, features and news file.
Florian Pose <fp@igh-essen.com>
parents:
1082
diff
changeset
|
52 |
* configuration from the actual slaves. Therefore, renamed |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
53 |
* ecrt_master_get_slave() to ecrt_master_slave_config(). |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
54 |
* - Replaced slave address string with alias and position values. See |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
55 |
* ecrt_master_slave_config(). |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
56 |
* - Removed ecrt_master_get_slave_by_pos(), because it is no longer |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
793
diff
changeset
|
57 |
* necessary due to alias/position addressing. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
58 |
* - Added ec_slave_config_state_t for the new method |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
59 |
* ecrt_slave_config_state(). |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
60 |
* - Process data memory for a domain can now be allocated externally. This |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
61 |
* offers the possibility to use a shared-memory region. Therefore, |
809 | 62 |
* added the domain methods ecrt_domain_size() and |
63 |
* ecrt_domain_external_memory(). |
|
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
64 |
* - Pdo entry registration functions do not return a process data pointer, |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
65 |
* but an offset in the domain's process data. In addition, an optional bit |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
66 |
* position can be requested. This was necessary for the external domain |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
67 |
* memory. An additional advantage is, that the returned offset is |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
68 |
* immediately valid. If the domain's process data is allocated internally, |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
69 |
* the start address can be retrieved with ecrt_domain_data(). |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
70 |
* - Replaced ecrt_slave_pdo_mapping/add/clear() with |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
71 |
* ecrt_slave_config_pdo_assign_add() to add a Pdo to a sync manager's Pdo |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
72 |
* assignment and ecrt_slave_config_pdo_mapping_add() to add a Pdo entry to a |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
73 |
* Pdo's mapping. ecrt_slave_config_pdos() is a convenience function |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
74 |
* for both, that uses the new data types ec_pdo_info_t and |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
75 |
* ec_pdo_entry_info_t. Pdo entries, that are mapped with these functions |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
76 |
* can now immediately be registered, even if the bus is offline. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
77 |
* - Renamed ec_bus_status_t, ec_master_status_t to ec_bus_state_t and |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
78 |
* ec_master_state_t, respectively. Renamed ecrt_master_get_status() to |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
79 |
* ecrt_master_state(), for consistency reasons. |
1083
1322dc34cb37
Updated header docs, features and news file.
Florian Pose <fp@igh-essen.com>
parents:
1082
diff
changeset
|
80 |
* - Added ec_domain_state_t and #ec_wc_state_t for a new output parameter |
832 | 81 |
* of ecrt_domain_state(). The domain state object does now contain |
82 |
* information, if the process data was exchanged completely. |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
83 |
* - Former "Pdo registration" meant Pdo entry registration in fact, therefore |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
84 |
* renamed ec_pdo_reg_t to ec_pdo_entry_reg_t and ecrt_domain_register_pdo() |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
793
diff
changeset
|
85 |
* to ecrt_slave_config_reg_pdo_entry(). |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
86 |
* - Removed ecrt_domain_register_pdo_range(), because it's functionality can |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
87 |
* be reached by specifying an explicit Pdo assignment/mapping and |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
88 |
* registering the mapped Pdo entries. |
864 | 89 |
* - Added an Sdo access interface, working with Sdo requests. These can be |
90 |
* scheduled for reading and writing during realtime operation. |
|
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
91 |
* - Exported ecrt_slave_config_sdo(), the generic Sdo configuration function. |
900
f8b5c6d21705
Removed bus validation; slave configuration during realtime operation;
Florian Pose <fp@igh-essen.com>
parents:
894
diff
changeset
|
92 |
* - Removed the bus_state and bus_tainted flags from ec_master_state_t. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
93 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
94 |
* @{ |
786 | 95 |
*/ |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
96 |
|
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
97 |
/*****************************************************************************/ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
98 |
|
125 | 99 |
#ifndef __ECRT_H__ |
100 |
#define __ECRT_H__ |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
|
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
#include <asm/byteorder.h> |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
|
110 | 104 |
#ifdef __KERNEL__ |
105 |
#include <linux/types.h> |
|
106 |
#else |
|
107 |
#include <stdint.h> |
|
108 |
#endif |
|
109 |
||
779 | 110 |
/****************************************************************************** |
111 |
* Global definitions |
|
112 |
*****************************************************************************/ |
|
113 |
||
864 | 114 |
/** EtherCAT realtime interface major version number. |
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
707
diff
changeset
|
115 |
*/ |
637
d5d04c868e0e
Removed ecrt_master_run(), removed datagram queueing from state
Florian Pose <fp@igh-essen.com>
parents:
635
diff
changeset
|
116 |
#define ECRT_VER_MAJOR 1 |
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
707
diff
changeset
|
117 |
|
864 | 118 |
/** EtherCAT realtime interface minor version number. |
779 | 119 |
*/ |
1209 | 120 |
#define ECRT_VER_MINOR 5 |
779 | 121 |
|
864 | 122 |
/** EtherCAT realtime interface version word generator. |
779 | 123 |
*/ |
124 |
#define ECRT_VERSION(a, b) (((a) << 8) + (b)) |
|
125 |
||
864 | 126 |
/** EtherCAT realtime interface version word. |
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
707
diff
changeset
|
127 |
*/ |
541
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
128 |
#define ECRT_VERSION_MAGIC ECRT_VERSION(ECRT_VER_MAJOR, ECRT_VER_MINOR) |
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
129 |
|
878 | 130 |
/*****************************************************************************/ |
131 |
||
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
132 |
/** End of list marker. |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
133 |
* |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
134 |
* This can be used with ecrt_slave_config_pdos(). |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
135 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
136 |
#define EC_END ~0U |
878 | 137 |
|
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
138 |
/** Maximum number of sync managers per slave. |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
139 |
*/ |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
140 |
#define EC_MAX_SYNC_MANAGERS 16 |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
141 |
|
779 | 142 |
/****************************************************************************** |
143 |
* Data types |
|
144 |
*****************************************************************************/ |
|
541
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
145 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
struct ec_master; |
286
f3352378b4d4
Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents:
276
diff
changeset
|
147 |
typedef struct ec_master ec_master_t; /**< \see ec_master */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
149 |
struct ec_slave_config; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
150 |
typedef struct ec_slave_config ec_slave_config_t; /**< \see ec_slave_config */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
151 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
struct ec_domain; |
286
f3352378b4d4
Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents:
276
diff
changeset
|
153 |
typedef struct ec_domain ec_domain_t; /**< \see ec_domain */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
155 |
struct ec_sdo_request; |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
156 |
typedef struct ec_sdo_request ec_sdo_request_t; /**< \see ec_sdo_request. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
157 |
|
1209 | 158 |
struct ec_voe_handler; |
159 |
typedef struct ec_voe_handler ec_voe_handler_t; /**< \see ec_voe_handler. */ |
|
160 |
||
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
161 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
162 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
163 |
/** Master state. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
164 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
165 |
* This is used for the output parameter of ecrt_master_state(). |
1020
9bf2ddf05e17
Completed ec_master_state_t and documented ec_master_state_t and
Florian Pose <fp@igh-essen.com>
parents:
1010
diff
changeset
|
166 |
* |
9bf2ddf05e17
Completed ec_master_state_t and documented ec_master_state_t and
Florian Pose <fp@igh-essen.com>
parents:
1010
diff
changeset
|
167 |
* \see ecrt_master_state(). |
612
aede068f9a74
Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents:
541
diff
changeset
|
168 |
*/ |
aede068f9a74
Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents:
541
diff
changeset
|
169 |
typedef struct { |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
170 |
unsigned int slaves_responding; /**< Number of slaves in the bus. */ |
1022
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
171 |
unsigned int al_states : 4; /**< Application-layer states of all slaves. |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
172 |
The states are coded in the lower 4 bits. |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
173 |
If a bit is set, it means that at least one |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
174 |
slave in the bus is in the corresponding |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
175 |
state: |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
176 |
- Bit 0: \a INIT |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
177 |
- Bit 1: \a PREOP |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
178 |
- Bit 2: \a SAFEOP |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
179 |
- Bit 3: \a OP */ |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
180 |
unsigned int link_up : 1; /**< \a true, if the network link is up. */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
181 |
} ec_master_state_t; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
182 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
183 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
184 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
185 |
/** Slave configuration state. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
186 |
* |
1020
9bf2ddf05e17
Completed ec_master_state_t and documented ec_master_state_t and
Florian Pose <fp@igh-essen.com>
parents:
1010
diff
changeset
|
187 |
* This is used as an output parameter of ecrt_slave_config_state(). |
9bf2ddf05e17
Completed ec_master_state_t and documented ec_master_state_t and
Florian Pose <fp@igh-essen.com>
parents:
1010
diff
changeset
|
188 |
* |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
189 |
* \see ecrt_slave_config_state(). |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
190 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
191 |
typedef struct { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
192 |
unsigned int online : 1; /**< The slave is online. */ |
1020
9bf2ddf05e17
Completed ec_master_state_t and documented ec_master_state_t and
Florian Pose <fp@igh-essen.com>
parents:
1010
diff
changeset
|
193 |
unsigned int operational : 1; /**< The slave was brought into \a OP state |
9bf2ddf05e17
Completed ec_master_state_t and documented ec_master_state_t and
Florian Pose <fp@igh-essen.com>
parents:
1010
diff
changeset
|
194 |
using the specified configuration. */ |
1022
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
195 |
unsigned int al_state : 4; /**< The application-layer state of the slave. |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
196 |
- 1: \a INIT |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
197 |
- 2: \a PREOP |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
198 |
- 4: \a SAFEOP |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
199 |
- 8: \a OP |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
200 |
|
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
201 |
Note that each state is coded in a different |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
202 |
bit! */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
203 |
} ec_slave_config_state_t; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
204 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
205 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
206 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
207 |
/** Domain working counter interpretation. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
208 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
209 |
* This is used in ec_domain_state_t. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
210 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
211 |
typedef enum { |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
212 |
EC_WC_ZERO = 0, /**< No registered process data were exchanged. */ |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
213 |
EC_WC_INCOMPLETE, /**< Some of the registered process data were |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
214 |
exchanged. */ |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
215 |
EC_WC_COMPLETE /**< All registered process data were exchanged. */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
216 |
} ec_wc_state_t; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
217 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
218 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
219 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
220 |
/** Domain state. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
221 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
222 |
* This is used for the output parameter of ecrt_domain_state(). |
640
16e9ad7d8e12
Added parameters for vendor ID and product code to ecrt_get_slave(); PDO
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
223 |
*/ |
16e9ad7d8e12
Added parameters for vendor ID and product code to ecrt_get_slave(); PDO
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
224 |
typedef struct { |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
225 |
unsigned int working_counter; /**< Value of the last working counter. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
226 |
ec_wc_state_t wc_state; /**< Working counter interpretation. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
227 |
} ec_domain_state_t; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
228 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
229 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
230 |
|
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
231 |
/** Direction type for Pdo assignment functions. |
779 | 232 |
*/ |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
612
diff
changeset
|
233 |
typedef enum { |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
234 |
EC_DIR_INVALID, /**< Invalid direction. Do not use this value. */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
235 |
EC_DIR_OUTPUT, /**< Values written by the master. */ |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
236 |
EC_DIR_INPUT, /**< Values read by the master. */ |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
237 |
EC_DIR_COUNT /**< Number of directions. For internal use only. */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
238 |
} ec_direction_t; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
239 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
240 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
241 |
|
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
242 |
/** Pdo entry configuration information. |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
243 |
* |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
244 |
* This is the data type of the \a entries field in ec_pdo_info_t. |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
245 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
246 |
* \see ecrt_slave_config_pdos(). |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
247 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
248 |
typedef struct { |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
249 |
uint16_t index; /**< Pdo entry index. */ |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
250 |
uint8_t subindex; /**< Pdo entry subindex. */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
251 |
uint8_t bit_length; /**< Size of the Pdo entry in bit. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
252 |
} ec_pdo_entry_info_t; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
253 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
254 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
255 |
|
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
256 |
/** Pdo configuration information. |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
257 |
* |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
258 |
* This is the data type of the \a pdos field in ec_sync_info_t. |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
259 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
260 |
* \see ecrt_slave_config_pdos(). |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
261 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
262 |
typedef struct { |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
263 |
uint16_t index; /**< Pdo index. */ |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
264 |
unsigned int n_entries; /**< Number of Pdo entries in \a entries to map. |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
265 |
Zero means, that the default mapping shall be |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
266 |
used (this can only be done if the slave is |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
267 |
present at bus configuration time). */ |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
268 |
ec_pdo_entry_info_t *entries; /**< Array of Pdo entries to map. Can either |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
269 |
be \a NULL, or must contain at |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
270 |
least \a n_entries values. */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
271 |
} ec_pdo_info_t; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
272 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
273 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
274 |
|
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
275 |
/** Sync manager configuration information. |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
276 |
* |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
277 |
* This can be use to configure multiple sync managers including the Pdo |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
278 |
* assignment and Pdo mapping. It is used as an input parameter type in |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
279 |
* ecrt_slave_config_pdos(). |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
280 |
*/ |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
281 |
typedef struct { |
1083
1322dc34cb37
Updated header docs, features and news file.
Florian Pose <fp@igh-essen.com>
parents:
1082
diff
changeset
|
282 |
uint8_t index; /**< Sync manager index. Must be less |
1322dc34cb37
Updated header docs, features and news file.
Florian Pose <fp@igh-essen.com>
parents:
1082
diff
changeset
|
283 |
than #EC_MAX_SYNC_MANAGERS for a valid sync manager, |
1322dc34cb37
Updated header docs, features and news file.
Florian Pose <fp@igh-essen.com>
parents:
1082
diff
changeset
|
284 |
but can also be \a 0xff to mark the end of the list. */ |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
285 |
ec_direction_t dir; /**< Sync manager direction. */ |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
286 |
unsigned int n_pdos; /**< Number of Pdos in \a pdos. */ |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
287 |
ec_pdo_info_t *pdos; /**< Array with Pdos to assign. This must contain |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
288 |
at least \a n_pdos Pdos. */ |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
289 |
} ec_sync_info_t; |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
290 |
|
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
291 |
/*****************************************************************************/ |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
292 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
293 |
/** List record type for Pdo entry mass-registration. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
294 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
295 |
* This type is used for the array parameter of the |
923
a6b51990e7e6
Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents:
916
diff
changeset
|
296 |
* ecrt_domain_reg_pdo_entry_list() |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
297 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
298 |
typedef struct { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
299 |
uint16_t alias; /**< Slave alias address. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
300 |
uint16_t position; /**< Slave position. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
301 |
uint32_t vendor_id; /**< Slave vendor ID. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
302 |
uint32_t product_code; /**< Slave product code. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
303 |
uint16_t index; /**< Pdo entry index. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
304 |
uint8_t subindex; /**< Pdo entry subindex. */ |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
305 |
unsigned int *offset; /**< Pointer to a variable to store the Pdo entry's |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
306 |
(byte-)offset in the process data. */ |
1092 | 307 |
unsigned int *bit_position; /**< Pointer to a variable to store a bit |
308 |
position (0-7) within the \a offset. Can be |
|
309 |
NULL, in which case an error is raised if the |
|
310 |
Pdo entry does not byte-align. */ |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
311 |
} ec_pdo_entry_reg_t; |
416
4f007cd2a79d
ecrt_domain_register_pdo_range() implemented.
Florian Pose <fp@igh-essen.com>
parents:
325
diff
changeset
|
312 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
313 |
/*****************************************************************************/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
314 |
|
1209 | 315 |
/** Request state. |
316 |
* |
|
317 |
* This is used as return type for ecrt_sdo_request_state() and |
|
318 |
* ecrt_voe_handler_state(). |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
319 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
320 |
typedef enum { |
1209 | 321 |
EC_REQUEST_UNUSED, /**< Not requested. */ |
322 |
EC_REQUEST_BUSY, /**< Request is being processed. */ |
|
323 |
EC_REQUEST_SUCCESS, /**< Request was processed successfully. */ |
|
324 |
EC_REQUEST_ERROR, /**< Request processing failed. */ |
|
325 |
} ec_request_state_t; |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
326 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
327 |
/****************************************************************************** |
779 | 328 |
* Global functions |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
329 |
*****************************************************************************/ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
331 |
/** Returns the version magic of the realtime interface. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
332 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
333 |
* \return Value of ECRT_VERSION_MAGIC() at EtherCAT master compile time. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
334 |
*/ |
541
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
335 |
unsigned int ecrt_version_magic(void); |
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
336 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
337 |
/** Requests an EtherCAT master for realtime operation. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
338 |
* |
1092 | 339 |
* Before an application can access an EtherCAT master, it has to reserve one |
340 |
* for exclusive use. |
|
341 |
* |
|
342 |
* This function has to be the first function an application has to call to |
|
343 |
* use EtherCAT. The function takes the index of the master as its argument. |
|
344 |
* The first master has index 0, the n-th master has index n - 1. The number |
|
345 |
* of masters has to be specified when loading the master module. |
|
346 |
* |
|
1239
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1226
diff
changeset
|
347 |
* \attention In kernel context, the returned pointer has to be checked for |
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1226
diff
changeset
|
348 |
* errors using the IS_ERR() macro. |
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1226
diff
changeset
|
349 |
* |
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1226
diff
changeset
|
350 |
* \return If \a IS_ERR() returns zero, the result is a pointer to the |
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1226
diff
changeset
|
351 |
* reserved master, otherwise, the result is an error code. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
352 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
353 |
ec_master_t *ecrt_request_master( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
354 |
unsigned int master_index /**< Index of the master to request. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
355 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
356 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
357 |
/** Releases a requested EtherCAT master. |
1092 | 358 |
* |
359 |
* After use, a master it has to be released to make it available for other |
|
360 |
* applications. |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
361 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
362 |
void ecrt_release_master( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
363 |
ec_master_t *master /**< EtherCAT master */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
364 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
365 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
366 |
/****************************************************************************** |
779 | 367 |
* Master methods |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
368 |
*****************************************************************************/ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
|
1244
0b70040d3daa
No kernel handles in userspace; Domain creation.
Florian Pose <fp@igh-essen.com>
parents:
1239
diff
changeset
|
370 |
#ifdef __KERNEL__ |
0b70040d3daa
No kernel handles in userspace; Domain creation.
Florian Pose <fp@igh-essen.com>
parents:
1239
diff
changeset
|
371 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
372 |
/** Sets the locking callbacks. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
373 |
* |
1092 | 374 |
* For concurrent master access, the application has to provide a locking |
375 |
* mechanism (see section FIXME in the docs). The method takes two function |
|
376 |
* pointers and a data value as its parameters. The arbitrary \a cb_data value |
|
377 |
* will be passed as argument on every callback. Asynchronous master access |
|
378 |
* (like EoE processing) is only possible if the callbacks have been set. |
|
379 |
* |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
380 |
* The request_cb function must return zero, to allow another instance |
1092 | 381 |
* (an EoE process for example) to access the master. Non-zero means, |
382 |
* that access is currently forbidden. |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
383 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
384 |
void ecrt_master_callbacks( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
385 |
ec_master_t *master, /**< EtherCAT master */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
386 |
int (*request_cb)(void *), /**< Lock request function. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
387 |
void (*release_cb)(void *), /**< Lock release function. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
388 |
void *cb_data /**< Arbitrary user data. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
389 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
390 |
|
1244
0b70040d3daa
No kernel handles in userspace; Domain creation.
Florian Pose <fp@igh-essen.com>
parents:
1239
diff
changeset
|
391 |
#endif /* __KERNEL__ */ |
0b70040d3daa
No kernel handles in userspace; Domain creation.
Florian Pose <fp@igh-essen.com>
parents:
1239
diff
changeset
|
392 |
|
1092 | 393 |
/** Creates a new process data domain. |
394 |
* |
|
395 |
* For process data exchange, at least one process data domain is needed. |
|
396 |
* This method creates a new process data domain and returns a pointer to the |
|
397 |
* new domain object. This object can be used for registering Pdos and |
|
398 |
* exchanging them in cyclic operation. |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
399 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
400 |
* \return Pointer to the new domain on success, else NULL. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
401 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
402 |
ec_domain_t *ecrt_master_create_domain( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
403 |
ec_master_t *master /**< EtherCAT master. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
404 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
405 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
406 |
/** Obtains a slave configuration. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
407 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
408 |
* Creates a slave configuration object for the given \a alias and \a position |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
409 |
* tuple and returns it. If a configuration with the same \a alias and \a |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
410 |
* position already exists, it will be re-used. In the latter case, the given |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
411 |
* vendor ID and product code are compared to the stored ones. On mismatch, an |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
412 |
* error message is raised and the function returns \a NULL. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
413 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
414 |
* Slaves are addressed with the \a alias and \a position parameters. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
415 |
* - If \a alias is zero, \a position is interpreted as the desired slave's |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
416 |
* ring position. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
417 |
* - If \a alias is non-zero, it matches a slave with the given alias. In this |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
418 |
* case, \a position is interpreted as ring offset, starting from the |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
419 |
* aliased slave, so a position of zero means the aliased slave itself and a |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
420 |
* positive value matches the n-th slave behind the aliased one. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
421 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
422 |
* If the slave with the given address is found during the bus configuration, |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
423 |
* its vendor ID and product code are matched against the given value. On |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
424 |
* mismatch, the slave is not configured and an error message is raised. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
425 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
426 |
* If different slave configurations are pointing to the same slave during bus |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
427 |
* configuration, a warning is raised and only the first configuration is |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
428 |
* applied. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
429 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
430 |
* \retval >0 Pointer to the slave configuration structure. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
431 |
* \retval NULL in the error case. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
432 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
433 |
ec_slave_config_t *ecrt_master_slave_config( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
434 |
ec_master_t *master, /**< EtherCAT master */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
435 |
uint16_t alias, /**< Slave alias. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
436 |
uint16_t position, /**< Slave position. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
437 |
uint32_t vendor_id, /**< Expected vendor ID. */ |
1010
6672b86e7b10
Reverted revision number checking from r1228.
Florian Pose <fp@igh-essen.com>
parents:
1009
diff
changeset
|
438 |
uint32_t product_code /**< Expected product code. */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
439 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
440 |
|
1096 | 441 |
/** Finishes the configuration phase and prepares for cyclic operation. |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
442 |
* |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
443 |
* This function tells the master that the configuration phase is finished and |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
444 |
* the realtime operation will begin. The function allocates internal memory |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
445 |
* for the domains and calculates the logical FMMU addresses for domain |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
446 |
* members. It tells the master state machine that the bus configuration is |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
447 |
* now to be applied. |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
448 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
449 |
* \attention After this function has been called, the realtime application is |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
450 |
* in charge of cyclically calling ecrt_master_send() and |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
451 |
* ecrt_master_receive() to ensure bus communication. Before calling this |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
452 |
* function, the master thread is responsible for that, so these functions may |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
453 |
* not be called! |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
454 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
455 |
* \return 0 in case of success, else < 0 |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
456 |
*/ |
1007 | 457 |
int ecrt_master_activate( |
458 |
ec_master_t *master /**< EtherCAT master. */ |
|
459 |
); |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
460 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
461 |
/** Sends all datagrams in the queue. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
462 |
* |
1092 | 463 |
* This method takes all datagrams, that have been queued for transmission, |
464 |
* puts them into frames, and passes them to the Ethernet device for sending. |
|
465 |
* |
|
466 |
* Has to be called cyclically by the application after ecrt_master_activate() |
|
467 |
* has returned. |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
468 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
469 |
void ecrt_master_send( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
470 |
ec_master_t *master /**< EtherCAT master. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
471 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
472 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
473 |
/** Fetches received frames from the hardware and processes the datagrams. |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
474 |
* |
1092 | 475 |
* Queries the network device for received frames by calling the interrupt |
476 |
* service routine. Extracts received datagrams and dispatches the results to |
|
477 |
* the datagram objects in the queue. Received datagrams, and the ones that |
|
478 |
* timed out, will be marked, and dequeued. |
|
479 |
* |
|
480 |
* Has to be called cyclically by the realtime application after |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
481 |
* ecrt_master_activate() has returned. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
482 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
483 |
void ecrt_master_receive( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
484 |
ec_master_t *master /**< EtherCAT master. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
485 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
486 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
487 |
/** Reads the current master state. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
488 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
489 |
* Stores the master state information in the given \a state structure. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
490 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
491 |
void ecrt_master_state( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
492 |
const ec_master_t *master, /**< EtherCAT master. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
493 |
ec_master_state_t *state /**< Structure to store the information. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
494 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
495 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
496 |
/****************************************************************************** |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
497 |
* Slave configuration methods |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
498 |
*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
499 |
|
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
500 |
/** Configure a sync manager. |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
501 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
502 |
* Sets the direction of a sync manager. This overrides the direction bits |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
503 |
* from the default control register from SII. |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
504 |
* |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
505 |
* \return zero on success, else non-zero |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
506 |
*/ |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
507 |
int ecrt_slave_config_sync_manager( |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
508 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
1083
1322dc34cb37
Updated header docs, features and news file.
Florian Pose <fp@igh-essen.com>
parents:
1082
diff
changeset
|
509 |
uint8_t sync_index, /**< Sync manager index. Must be less |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
510 |
than #EC_MAX_SYNC_MANAGERS. */ |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
511 |
ec_direction_t dir /**< Input/Output. */ |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
512 |
); |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
513 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
514 |
/** Add a Pdo to a sync manager's Pdo assignment. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
515 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
516 |
* \see ecrt_slave_config_pdos() |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
517 |
* \return zero on success, else non-zero |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
518 |
*/ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
519 |
int ecrt_slave_config_pdo_assign_add( |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
520 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
1083
1322dc34cb37
Updated header docs, features and news file.
Florian Pose <fp@igh-essen.com>
parents:
1082
diff
changeset
|
521 |
uint8_t sync_index, /**< Sync manager index. Must be less |
1322dc34cb37
Updated header docs, features and news file.
Florian Pose <fp@igh-essen.com>
parents:
1082
diff
changeset
|
522 |
than #EC_MAX_SYNC_MANAGERS. */ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
523 |
uint16_t index /**< Index of the Pdo to assign. */ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
524 |
); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
525 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
526 |
/** Clear a sync manager's Pdo assignment. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
527 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
528 |
* This can be called before assigning Pdos via |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
529 |
* ecrt_slave_config_pdo_assign_add(), to clear the default assignment of a |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
530 |
* sync manager. |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
531 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
532 |
* \see ecrt_slave_config_pdos() |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
533 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
534 |
void ecrt_slave_config_pdo_assign_clear( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
535 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
1083
1322dc34cb37
Updated header docs, features and news file.
Florian Pose <fp@igh-essen.com>
parents:
1082
diff
changeset
|
536 |
uint8_t sync_index /**< Sync manager index. Must be less |
1322dc34cb37
Updated header docs, features and news file.
Florian Pose <fp@igh-essen.com>
parents:
1082
diff
changeset
|
537 |
than #EC_MAX_SYNC_MANAGERS. */ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
538 |
); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
539 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
540 |
/** Add a Pdo entry to the given Pdo's mapping. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
541 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
542 |
* \see ecrt_slave_config_pdos() |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
543 |
* \return zero on success, else non-zero |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
544 |
*/ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
545 |
int ecrt_slave_config_pdo_mapping_add( |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
546 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
547 |
uint16_t pdo_index, /**< Index of the Pdo. */ |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
548 |
uint16_t entry_index, /**< Index of the Pdo entry to add to the Pdo's |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
549 |
mapping. */ |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
550 |
uint8_t entry_subindex, /**< Subindex of the Pdo entry to add to the |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
551 |
Pdo's mapping. */ |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
552 |
uint8_t entry_bit_length /**< Size of the Pdo entry in bit. */ |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
553 |
); |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
554 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
555 |
/** Clear the mapping of a given Pdo. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
556 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
557 |
* This can be called before mapping Pdo entries via |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
558 |
* ecrt_slave_config_pdo_mapping_add(), to clear the default mapping. |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
559 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
560 |
* \see ecrt_slave_config_pdos() |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
561 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
562 |
void ecrt_slave_config_pdo_mapping_clear( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
563 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
564 |
uint16_t pdo_index /**< Index of the Pdo. */ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
565 |
); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
566 |
|
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
567 |
/** Specify a complete Pdo configuration. |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
568 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
569 |
* This function is a convenience wrapper for the functions |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
570 |
* ecrt_slave_config_sync_manager(), ecrt_slave_config_pdo_assign_clear(), |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
571 |
* ecrt_slave_config_pdo_assign_add(), ecrt_slave_config_pdo_mapping_clear() |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
572 |
* and ecrt_slave_config_pdo_mapping_add(), that are better suitable for |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
573 |
* automatic code generation. |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
574 |
* |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
575 |
* The following example shows, how to specify a complete configuration, |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
576 |
* including the Pdo mappings. With this information, the master is able to |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
577 |
* reserve the complete process data, even if the slave is not present at |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
578 |
* configuration time: |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
579 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
580 |
* \code |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
581 |
* ec_pdo_entry_info_t el3162_channel1[] = { |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
582 |
* {0x3101, 1, 8}, // status |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
583 |
* {0x3101, 2, 16} // value |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
584 |
* }; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
585 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
586 |
* ec_pdo_entry_info_t el3162_channel2[] = { |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
587 |
* {0x3102, 1, 8}, // status |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
588 |
* {0x3102, 2, 16} // value |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
589 |
* }; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
590 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
591 |
* ec_pdo_info_t el3162_pdos[] = { |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
592 |
* {0x1A00, 2, el3162_channel1}, |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
593 |
* {0x1A01, 2, el3162_channel2} |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
594 |
* }; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
595 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
596 |
* ec_sync_info_t el3162_syncs[] = { |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
597 |
* {2, EC_DIR_OUTPUT}, |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
598 |
* {3, EC_DIR_INPUT, 2, el3162_pdos}, |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
599 |
* {0xff} |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
600 |
* }; |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
601 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
602 |
* if (ecrt_slave_config_pdos(sc_ana_in, EC_END, el3162_syncs)) { |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
603 |
* // handle error |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
604 |
* } |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
605 |
* \endcode |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
606 |
* |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
607 |
* The next example shows, how to configure the Pdo assignment only. The |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
608 |
* entries for each assigned Pdo are taken from the Pdo's default mapping. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
609 |
* Please note, that Pdo entry registration will fail, if the Pdo |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
610 |
* configuration is left empty and the slave is offline. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
611 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
612 |
* \code |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
613 |
* ec_pdo_info_t pdos[] = { |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
614 |
* {0x1600}, // Channel 1 |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
615 |
* {0x1601} // Channel 2 |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
616 |
* }; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
617 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
618 |
* ec_sync_info_t syncs[] = { |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
619 |
* {3, EC_DIR_INPUT, 2, pdos}, |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
620 |
* }; |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
621 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
622 |
* if (ecrt_slave_config_pdos(slave_config_ana_in, 1, syncs)) { |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
623 |
* // handle error |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
624 |
* } |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
625 |
* \endcode |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
626 |
* |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
627 |
* Processing of \a syncs will stop, if |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
628 |
* - the number of processed items reaches \a n_syncs, or |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
629 |
* - the \a index member of an ec_sync_info_t item is 0xff. In this case, |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
630 |
* \a n_syncs should set to a number greater than the number of list items; |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
631 |
* using EC_END is recommended. |
878 | 632 |
* |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
633 |
* \return zero on success, else non-zero |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
634 |
*/ |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
635 |
int ecrt_slave_config_pdos( |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
636 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
637 |
unsigned int n_syncs, /**< Number of sync manager configurations in |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
638 |
\a syncs. */ |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
639 |
const ec_sync_info_t syncs[] /**< Array of sync manager |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
640 |
configurations. */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
641 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
642 |
|
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
643 |
/** Registers a Pdo entry for process data exchange in a domain. |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
644 |
* |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
645 |
* Searches the assigned Pdos for the given Pdo entry. An error is raised, if |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
646 |
* the given entry is not mapped. Otherwise, the corresponding sync manager |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
647 |
* and FMMU configurations are provided for slave configuration and the |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
648 |
* respective sync manager's assigned Pdos are appended to the given domain, |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
649 |
* if not already done. The offset of the requested Pdo entry's data inside |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
650 |
* the domain's process data is returned. Optionally, the Pdo entry bit |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
651 |
* position (0-7) can be retrieved via the \a bit_position output parameter. |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
652 |
* This pointer may be \a NULL, in this case an error is raised if the Pdo |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
653 |
* entry does not byte-align. |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
654 |
* |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
655 |
* \retval >=0 Success: Offset of the Pdo entry's process data. |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
656 |
* \retval -1 Error: Pdo entry not found. |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
657 |
* \retval -2 Error: Failed to register Pdo entry. |
916
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
900
diff
changeset
|
658 |
* \retval -3 Error: Pdo entry is not byte-aligned. |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
793
diff
changeset
|
659 |
*/ |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
793
diff
changeset
|
660 |
int ecrt_slave_config_reg_pdo_entry( |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
793
diff
changeset
|
661 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
793
diff
changeset
|
662 |
uint16_t entry_index, /**< Index of the Pdo entry to register. */ |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
793
diff
changeset
|
663 |
uint8_t entry_subindex, /**< Subindex of the Pdo entry to register. */ |
923
a6b51990e7e6
Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents:
916
diff
changeset
|
664 |
ec_domain_t *domain, /**< Domain. */ |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
665 |
unsigned int *bit_position /**< Optional address if bit addressing |
923
a6b51990e7e6
Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents:
916
diff
changeset
|
666 |
is desired */ |
916
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
900
diff
changeset
|
667 |
); |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
900
diff
changeset
|
668 |
|
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
669 |
/** Add an Sdo configuration. |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
670 |
* |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
671 |
* An Sdo configuration is stored in the slave configuration object and is |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
672 |
* downloaded to the slave whenever the slave is being configured by the |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
673 |
* master. This usually happens once on master activation, but can be repeated |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
674 |
* subsequently, for example after the slave's power supply failed. |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
675 |
* |
1104
9e7fe258495e
Added attention to ecrt_slave_config_sdo().
Florian Pose <fp@igh-essen.com>
parents:
1096
diff
changeset
|
676 |
* \attention The Sdos for Pdo assignment (\p 0x1C10 - \p 0x1C2F) and Pdo |
9e7fe258495e
Added attention to ecrt_slave_config_sdo().
Florian Pose <fp@igh-essen.com>
parents:
1096
diff
changeset
|
677 |
* mapping (\p 0x1600 - \p 0x17FF and \p 0x1A00 - \p 0x1BFF) should not be |
9e7fe258495e
Added attention to ecrt_slave_config_sdo().
Florian Pose <fp@igh-essen.com>
parents:
1096
diff
changeset
|
678 |
* configured with this function, because they are part of the slave |
9e7fe258495e
Added attention to ecrt_slave_config_sdo().
Florian Pose <fp@igh-essen.com>
parents:
1096
diff
changeset
|
679 |
* configuration done by the master. Please use ecrt_slave_config_pdos() and |
9e7fe258495e
Added attention to ecrt_slave_config_sdo().
Florian Pose <fp@igh-essen.com>
parents:
1096
diff
changeset
|
680 |
* friends instead. |
9e7fe258495e
Added attention to ecrt_slave_config_sdo().
Florian Pose <fp@igh-essen.com>
parents:
1096
diff
changeset
|
681 |
* |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
682 |
* This is the generic function for adding an Sdo configuration. Please note |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
683 |
* that the this function does not do any endianess correction. If |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
684 |
* datatype-specific functions are needed (that automatically correct the |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
685 |
* endianess), have a look at ecrt_slave_config_sdo8(), |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
686 |
* ecrt_slave_config_sdo16() and ecrt_slave_config_sdo32(). |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
687 |
* |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
688 |
* \return 0 in case of success, else < 0 |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
689 |
*/ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
690 |
int ecrt_slave_config_sdo( |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
691 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
692 |
uint16_t index, /**< Index of the Sdo to configure. */ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
693 |
uint8_t subindex, /**< Subindex of the Sdo to configure. */ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
694 |
const uint8_t *data, /**< Pointer to the data. */ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
695 |
size_t size /**< Size of the \a data. */ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
696 |
); |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
697 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
698 |
/** Add a configuration value for an 8-bit SDO. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
699 |
* |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
700 |
* \see ecrt_slave_config_sdo(). |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
701 |
* \return 0 in case of success, else < 0 |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
702 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
703 |
int ecrt_slave_config_sdo8( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
704 |
ec_slave_config_t *sc, /**< Slave configuration */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
705 |
uint16_t sdo_index, /**< Index of the SDO to configure. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
706 |
uint8_t sdo_subindex, /**< Subindex of the SDO to configure. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
707 |
uint8_t value /**< Value to set. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
708 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
709 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
710 |
/** Add a configuration value for a 16-bit SDO. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
711 |
* |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
712 |
* \see ecrt_slave_config_sdo(). |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
713 |
* \return 0 in case of success, else < 0 |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
714 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
715 |
int ecrt_slave_config_sdo16( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
716 |
ec_slave_config_t *sc, /**< Slave configuration */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
717 |
uint16_t sdo_index, /**< Index of the SDO to configure. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
718 |
uint8_t sdo_subindex, /**< Subindex of the SDO to configure. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
719 |
uint16_t value /**< Value to set. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
720 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
721 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
722 |
/** Add a configuration value for a 32-bit SDO. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
723 |
* |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
724 |
* \see ecrt_slave_config_sdo(). |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
725 |
* \return 0 in case of success, else < 0 |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
726 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
727 |
int ecrt_slave_config_sdo32( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
728 |
ec_slave_config_t *sc, /**< Slave configuration */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
729 |
uint16_t sdo_index, /**< Index of the SDO to configure. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
730 |
uint8_t sdo_subindex, /**< Subindex of the SDO to configure. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
731 |
uint32_t value /**< Value to set. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
732 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
733 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
734 |
/** Create an Sdo request to exchange Sdos during realtime operation. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
735 |
* |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
736 |
* The created Sdo request object is freed automatically when the master is |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
737 |
* released. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
738 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
739 |
ec_sdo_request_t *ecrt_slave_config_create_sdo_request( |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
740 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
741 |
uint16_t index, /**< Sdo index. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
742 |
uint8_t subindex, /**< Sdo subindex. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
743 |
size_t size /**< Data size to reserve. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
744 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
745 |
|
1209 | 746 |
/** Create an VoE handler to exchange vendor-specific data during realtime |
747 |
* operation. |
|
748 |
* |
|
749 |
* The created VoE handler object is freed automatically when the master is |
|
750 |
* released. |
|
751 |
*/ |
|
752 |
ec_voe_handler_t *ecrt_slave_config_create_voe_handler( |
|
753 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
|
754 |
size_t size /**< Data size to reserve. */ |
|
755 |
); |
|
756 |
||
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
757 |
/** Outputs the state of the slave configuration. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
758 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
759 |
* Stores the state information in the given \a state structure. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
760 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
761 |
void ecrt_slave_config_state( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
762 |
const ec_slave_config_t *sc, /**< Slave configuration */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
763 |
ec_slave_config_state_t *state /**< State object to write to. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
764 |
); |
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
288
diff
changeset
|
765 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
766 |
/****************************************************************************** |
779 | 767 |
* Domain methods |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
768 |
*****************************************************************************/ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
769 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
770 |
/** Registers a bunch of Pdo entries for a domain. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
771 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
772 |
* \todo doc |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
773 |
* \attention The registration array has to be terminated with an empty |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
774 |
* structure, or one with the \a index field set to zero! |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
775 |
* \return 0 on success, else non-zero. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
776 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
777 |
int ecrt_domain_reg_pdo_entry_list( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
778 |
ec_domain_t *domain, /**< Domain. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
779 |
const ec_pdo_entry_reg_t *pdo_entry_regs /**< Array of Pdo |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
780 |
registrations. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
781 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
782 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
783 |
/** Returns the current size of the domain's process data. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
784 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
785 |
* \return Size of the process data image. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
786 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
787 |
size_t ecrt_domain_size( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
788 |
ec_domain_t *domain /**< Domain. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
789 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
790 |
|
809 | 791 |
/** Provide external memory to store the domain's process data. |
792 |
* |
|
793 |
* Call this after all Pdo entries have been registered and before activating |
|
794 |
* the master. |
|
795 |
* |
|
796 |
* The size of the allocated memory must be at least ecrt_domain_size(), after |
|
797 |
* all Pdo entries have been registered. |
|
798 |
*/ |
|
799 |
void ecrt_domain_external_memory( |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
800 |
ec_domain_t *domain, /**< Domain. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
801 |
uint8_t *memory /**< Address of the memory to store the process |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
802 |
data in. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
803 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
804 |
|
809 | 805 |
/** Returns the domain's process data. |
806 |
* |
|
807 |
* If external memory was provided with ecrt_domain_external_memory(), the |
|
808 |
* returned pointer will contain the address of that memory. Otherwise it will |
|
809 |
* point to the internally allocated memory. |
|
810 |
* |
|
811 |
* \return Pointer to the process data memory. |
|
812 |
*/ |
|
813 |
uint8_t *ecrt_domain_data( |
|
814 |
ec_domain_t *domain /**< Domain. */ |
|
815 |
); |
|
816 |
||
886 | 817 |
/** Determines the states of the domain's datagrams. |
818 |
* |
|
819 |
* Evaluates the working counters of the received datagrams and outputs |
|
820 |
* statistics, if necessary. This must be called after ecrt_master_receive() |
|
821 |
* is expected to receive the domain datagrams in order to make |
|
822 |
* ecrt_domain_state() return the result of the last process data exchange. |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
823 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
824 |
void ecrt_domain_process( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
825 |
ec_domain_t *domain /**< Domain. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
826 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
827 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
828 |
/** (Re-)queues all domain datagrams in the master's datagram queue. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
829 |
* |
886 | 830 |
* Call this function to mark the domain's datagrams for exchanging at the |
831 |
* next call of ecrt_master_send(). |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
832 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
833 |
void ecrt_domain_queue( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
834 |
ec_domain_t *domain /**< Domain. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
835 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
836 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
837 |
/** Reads the state of a domain. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
838 |
* |
886 | 839 |
* Stores the domain state in the given \a state structure. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
840 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
841 |
void ecrt_domain_state( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
842 |
const ec_domain_t *domain, /**< Domain. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
843 |
ec_domain_state_t *state /**< Pointer to a state object to store the |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
844 |
information. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
845 |
); |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
612
diff
changeset
|
846 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
847 |
/***************************************************************************** |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
848 |
* Sdo request methods. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
849 |
****************************************************************************/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
850 |
|
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
851 |
/** Set the timeout for an Sdo request. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
852 |
* |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
853 |
* If the request cannot be processed in the specified time, if will be marked |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
854 |
* as failed. |
1113 | 855 |
* |
856 |
* The timeout is permanently stored in the request object and is valid until |
|
857 |
* the next call of this method. |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
858 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
859 |
void ecrt_sdo_request_timeout( |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
860 |
ec_sdo_request_t *req, /**< Sdo request. */ |
880 | 861 |
uint32_t timeout /**< Timeout in milliseconds. Zero means no |
862 |
timeout. */ |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
863 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
864 |
|
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
865 |
/** Access to the Sdo request's data. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
866 |
* |
868 | 867 |
* This function returns a pointer to the request's internal Sdo data memory. |
868 |
* |
|
869 |
* - After a read operation was successful, integer data can be evaluated using |
|
870 |
* the EC_READ_*() macros as usual. Example: |
|
871 |
* \code |
|
872 |
* uint16_t value = EC_READ_U16(ecrt_sdo_request_data(sdo))); |
|
873 |
* \endcode |
|
874 |
* - If a write operation shall be triggered, the data have to be written to |
|
875 |
* the internal memory. Use the EC_WRITE_*() macros, if you are writing |
|
876 |
* integer data. Be sure, that the data fit into the memory. The memory size |
|
877 |
* is a parameter of ecrt_slave_config_create_sdo_request(). |
|
878 |
* \code |
|
879 |
* EC_WRITE_U16(ecrt_sdo_request_data(sdo), 0xFFFF); |
|
880 |
* \endcode |
|
881 |
* |
|
864 | 882 |
* \attention The return value can be invalid during a read operation, because |
883 |
* the internal Sdo data memory could be re-allocated if the read Sdo data do |
|
884 |
* not fit inside. |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
885 |
* |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
886 |
* \return Pointer to the internal Sdo data memory. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
887 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
888 |
uint8_t *ecrt_sdo_request_data( |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
889 |
ec_sdo_request_t *req /**< Sdo request. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
890 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
891 |
|
869
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
892 |
/** Returns the current Sdo data size. |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
893 |
* |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
894 |
* When the Sdo request is created, the data size is set to the size of the |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
895 |
* reserved memory. After a read operation the size is set to the size of the |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
896 |
* read data. The size is not modified in any other situation. |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
897 |
* |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
898 |
* \return Sdo data size in bytes. |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
899 |
*/ |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
900 |
size_t ecrt_sdo_request_data_size( |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
901 |
const ec_sdo_request_t *req /**< Sdo request. */ |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
902 |
); |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
903 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
904 |
/** Get the current state of the Sdo request. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
905 |
* |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
906 |
* \return Request state. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
907 |
*/ |
1209 | 908 |
ec_request_state_t ecrt_sdo_request_state( |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
909 |
const ec_sdo_request_t *req /**< Sdo request. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
910 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
911 |
|
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
912 |
/** Schedule an Sdo write operation. |
864 | 913 |
* |
914 |
* \attention This method may not be called while ecrt_sdo_request_state() |
|
915 |
* returns EC_SDO_REQUEST_BUSY. |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
916 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
917 |
void ecrt_sdo_request_write( |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
918 |
ec_sdo_request_t *req /**< Sdo request. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
919 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
920 |
|
864 | 921 |
/** Schedule an Sdo read operation. |
922 |
* |
|
923 |
* \attention This method may not be called while ecrt_sdo_request_state() |
|
924 |
* returns EC_SDO_REQUEST_BUSY. |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
925 |
* |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
926 |
* \attention After calling this function, the return value of |
864 | 927 |
* ecrt_sdo_request_data() must be considered as invalid while |
928 |
* ecrt_sdo_request_state() returns EC_SDO_REQUEST_BUSY. |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
929 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
930 |
void ecrt_sdo_request_read( |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
931 |
ec_sdo_request_t *req /**< Sdo request. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
932 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
933 |
|
1209 | 934 |
/***************************************************************************** |
935 |
* VoE handler methods. |
|
936 |
****************************************************************************/ |
|
937 |
||
1226
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
938 |
/** Sets the VoE header for future send operations. |
1218 | 939 |
* |
940 |
* A VoE message shall contain a 4-byte vendor ID, followed by a 2-byte vendor |
|
941 |
* type at as header. These numbers can be set with this function. |
|
942 |
*/ |
|
1226
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
943 |
void ecrt_voe_handler_send_header( |
1218 | 944 |
ec_voe_handler_t *voe, /**< VoE handler. */ |
945 |
uint32_t vendor_id, /**< Vendor ID. */ |
|
946 |
uint16_t vendor_type /**< Vendor-specific type. */ |
|
947 |
); |
|
948 |
||
1226
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
949 |
/** Reads the header data of a received VoE message. |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
950 |
* |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
951 |
* This method can be used after a read operation has succeded, to get the |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
952 |
* received header information. |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
953 |
* |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
954 |
* The header information is stored at the memory given by the pointer |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
955 |
* parameters. |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
956 |
*/ |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
957 |
void ecrt_voe_handler_received_header( |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
958 |
const ec_voe_handler_t *voe, /**< VoE handler. */ |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
959 |
uint32_t *vendor_id, /**< Vendor ID. */ |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
960 |
uint16_t *vendor_type /**< Vendor-specific type. */ |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
961 |
); |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
962 |
|
1209 | 963 |
/** Access to the VoE handler's data. |
964 |
* |
|
1218 | 965 |
* This function returns a pointer to the VoE handler's internal memory, after |
1226
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
966 |
* the VoE header (see ecrt_voe_handler_send_header()). |
1209 | 967 |
* |
968 |
* - After a read operation was successful, the memory contains the received |
|
969 |
* data. The size of the received data can be determined via |
|
970 |
* ecrt_voe_handler_data_size(). |
|
971 |
* - Before a write operation is triggered, the data have to be written to |
|
972 |
* the internal memory. Be sure, that the data fit into the memory. The |
|
973 |
* memory size is a parameter of ecrt_slave_config_create_voe_handler(). |
|
974 |
* |
|
975 |
* \return Pointer to the internal memory. |
|
976 |
*/ |
|
977 |
uint8_t *ecrt_voe_handler_data( |
|
978 |
ec_voe_handler_t *voe /**< VoE handler. */ |
|
979 |
); |
|
980 |
||
981 |
/** Returns the current data size. |
|
982 |
* |
|
1218 | 983 |
* The data size is the size of the VoE data without the header (see |
1226
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
984 |
* ecrt_voe_handler_send_header()). |
1218 | 985 |
* |
1209 | 986 |
* When the VoE handler is created, the data size is set to the size of the |
987 |
* reserved memory. At a write operation, the data size is set to the number |
|
988 |
* of bytes to write. After a read operation the size is set to the size of |
|
989 |
* the read data. The size is not modified in any other situation. |
|
990 |
* |
|
991 |
* \return Data size in bytes. |
|
992 |
*/ |
|
993 |
size_t ecrt_voe_handler_data_size( |
|
994 |
const ec_voe_handler_t *voe /**< VoE handler. */ |
|
995 |
); |
|
996 |
||
997 |
/** Start a VoE write operation. |
|
998 |
* |
|
999 |
* After this function has been called, the ecrt_voe_handler_execute() method |
|
1226
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1000 |
* must be called in every bus cycle as long as it returns EC_REQUEST_BUSY. No |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1001 |
* other operation may be started while the handler is busy. |
1209 | 1002 |
*/ |
1003 |
void ecrt_voe_handler_write( |
|
1004 |
ec_voe_handler_t *voe, /**< VoE handler. */ |
|
1218 | 1005 |
size_t size /**< Number of bytes to write (without the VoE header). */ |
1209 | 1006 |
); |
1007 |
||
1008 |
/** Start a VoE read operation. |
|
1009 |
* |
|
1010 |
* After this function has been called, the ecrt_voe_handler_execute() method |
|
1226
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1011 |
* must be called in every bus cycle as long as it returns EC_REQUEST_BUSY. No |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1012 |
* other operation may be started while the handler is busy. |
1209 | 1013 |
* |
1014 |
* On success, the size of the read data can be determined via |
|
1226
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1015 |
* ecrt_voe_handler_data_size(), while the VoE header of the received data |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1016 |
* can be retrieved with ecrt_voe_handler_received_header(). |
1209 | 1017 |
*/ |
1018 |
void ecrt_voe_handler_read( |
|
1019 |
ec_voe_handler_t *voe /**< VoE handler. */ |
|
1020 |
); |
|
1021 |
||
1022 |
/** Execute the handler. |
|
1023 |
* |
|
1024 |
* This method executes the VoE handler. It has to be called in every bus cycle |
|
1025 |
* as long as it returns EC_REQUEST_BUSY. |
|
1026 |
* |
|
1027 |
* \return Handler state. |
|
1028 |
*/ |
|
1029 |
ec_request_state_t ecrt_voe_handler_execute( |
|
1030 |
ec_voe_handler_t *voe /**< VoE handler. */ |
|
1031 |
); |
|
1032 |
||
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1033 |
/****************************************************************************** |
779 | 1034 |
* Bitwise read/write macros |
1035 |
*****************************************************************************/ |
|
1036 |
||
1037 |
/** Read a certain bit of an EtherCAT data byte. |
|
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1038 |
* |
640
16e9ad7d8e12
Added parameters for vendor ID and product code to ecrt_get_slave(); PDO
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
1039 |
* \param DATA EtherCAT data pointer |
16e9ad7d8e12
Added parameters for vendor ID and product code to ecrt_get_slave(); PDO
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
1040 |
* \param POS bit position |
16e9ad7d8e12
Added parameters for vendor ID and product code to ecrt_get_slave(); PDO
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
1041 |
*/ |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1042 |
#define EC_READ_BIT(DATA, POS) ((*((uint8_t *) (DATA)) >> (POS)) & 0x01) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1043 |
|
779 | 1044 |
/** Write a certain bit of an EtherCAT data byte. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1045 |
* |
640
16e9ad7d8e12
Added parameters for vendor ID and product code to ecrt_get_slave(); PDO
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
1046 |
* \param DATA EtherCAT data pointer |
16e9ad7d8e12
Added parameters for vendor ID and product code to ecrt_get_slave(); PDO
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
1047 |
* \param POS bit position |
16e9ad7d8e12
Added parameters for vendor ID and product code to ecrt_get_slave(); PDO
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
1048 |
* \param VAL new bit value |
16e9ad7d8e12
Added parameters for vendor ID and product code to ecrt_get_slave(); PDO
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
1049 |
*/ |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1050 |
#define EC_WRITE_BIT(DATA, POS, VAL) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1051 |
do { \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1052 |
if (VAL) *((uint8_t *) (DATA)) |= (1 << (POS)); \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1053 |
else *((uint8_t *) (DATA)) &= ~(1 << (POS)); \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1054 |
} while (0) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1055 |
|
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1056 |
/****************************************************************************** |
779 | 1057 |
* Read macros |
1058 |
*****************************************************************************/ |
|
1059 |
||
1060 |
/** Read an 8-bit unsigned value from EtherCAT data. |
|
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1061 |
* |
779 | 1062 |
* \return EtherCAT data value |
1063 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1064 |
#define EC_READ_U8(DATA) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1065 |
((uint8_t) *((uint8_t *) (DATA))) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1066 |
|
779 | 1067 |
/** Read an 8-bit signed value from EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1068 |
* |
779 | 1069 |
* \param DATA EtherCAT data pointer |
1070 |
* \return EtherCAT data value |
|
1071 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1072 |
#define EC_READ_S8(DATA) \ |
288 | 1073 |
((int8_t) *((uint8_t *) (DATA))) |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1074 |
|
779 | 1075 |
/** Read a 16-bit unsigned value from EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1076 |
* |
779 | 1077 |
* \param DATA EtherCAT data pointer |
1078 |
* \return EtherCAT data value |
|
1079 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1080 |
#define EC_READ_U16(DATA) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1081 |
((uint16_t) le16_to_cpup((void *) (DATA))) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1082 |
|
779 | 1083 |
/** Read a 16-bit signed value from EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1084 |
* |
779 | 1085 |
* \param DATA EtherCAT data pointer |
1086 |
* \return EtherCAT data value |
|
1087 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1088 |
#define EC_READ_S16(DATA) \ |
288 | 1089 |
((int16_t) le16_to_cpup((void *) (DATA))) |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1090 |
|
779 | 1091 |
/** Read a 32-bit unsigned value from EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1092 |
* |
779 | 1093 |
* \param DATA EtherCAT data pointer |
1094 |
* \return EtherCAT data value |
|
1095 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1096 |
#define EC_READ_U32(DATA) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1097 |
((uint32_t) le32_to_cpup((void *) (DATA))) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1098 |
|
779 | 1099 |
/** Read a 32-bit signed value from EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1100 |
* |
779 | 1101 |
* \param DATA EtherCAT data pointer |
1102 |
* \return EtherCAT data value |
|
1103 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1104 |
#define EC_READ_S32(DATA) \ |
288 | 1105 |
((int32_t) le32_to_cpup((void *) (DATA))) |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1106 |
|
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1107 |
/****************************************************************************** |
779 | 1108 |
* Write macros |
1109 |
*****************************************************************************/ |
|
1110 |
||
1111 |
/** Write an 8-bit unsigned value to EtherCAT data. |
|
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1112 |
* |
779 | 1113 |
* \param DATA EtherCAT data pointer |
1114 |
* \param VAL new value |
|
1115 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1116 |
#define EC_WRITE_U8(DATA, VAL) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1117 |
do { \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1118 |
*((uint8_t *)(DATA)) = ((uint8_t) (VAL)); \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1119 |
} while (0) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1120 |
|
779 | 1121 |
/** Write an 8-bit signed value to EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1122 |
* |
779 | 1123 |
* \param DATA EtherCAT data pointer |
1124 |
* \param VAL new value |
|
1125 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1126 |
#define EC_WRITE_S8(DATA, VAL) EC_WRITE_U8(DATA, VAL) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1127 |
|
779 | 1128 |
/** Write a 16-bit unsigned value to EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1129 |
* |
779 | 1130 |
* \param DATA EtherCAT data pointer |
1131 |
* \param VAL new value |
|
1132 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1133 |
#define EC_WRITE_U16(DATA, VAL) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1134 |
do { \ |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1135 |
*((uint16_t *) (DATA)) = cpu_to_le16((uint16_t) (VAL)); \ |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1136 |
} while (0) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1137 |
|
779 | 1138 |
/** Write a 16-bit signed value to EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1139 |
* |
779 | 1140 |
* \param DATA EtherCAT data pointer |
1141 |
* \param VAL new value |
|
1142 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1143 |
#define EC_WRITE_S16(DATA, VAL) EC_WRITE_U16(DATA, VAL) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1144 |
|
779 | 1145 |
/** Write a 32-bit unsigned value to EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1146 |
* |
779 | 1147 |
* \param DATA EtherCAT data pointer |
1148 |
* \param VAL new value |
|
1149 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1150 |
#define EC_WRITE_U32(DATA, VAL) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1151 |
do { \ |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1152 |
*((uint32_t *) (DATA)) = cpu_to_le32((uint32_t) (VAL)); \ |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1153 |
} while (0) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1154 |
|
779 | 1155 |
/** Write a 32-bit signed value to EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1156 |
* |
779 | 1157 |
* \param DATA EtherCAT data pointer |
1158 |
* \param VAL new value |
|
1159 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1160 |
#define EC_WRITE_S32(DATA, VAL) EC_WRITE_U32(DATA, VAL) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1161 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1162 |
/*****************************************************************************/ |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1163 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1164 |
/** @} */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1165 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1166 |
#endif |