author | Florian Pose <fp@igh-essen.com> |
Thu, 07 May 2009 15:00:01 +0000 | |
changeset 1460 | 24d04c86b21e |
parent 1448 | d7ba0c408a07 |
child 1466 | 362147819ca1 |
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 |
* |
1341
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
3 |
* $Id$ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
4 |
* |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
5 |
* Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
6 |
* |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT master userspace library. |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
8 |
* |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
9 |
* The IgH EtherCAT master userspace library is free software; you can |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
10 |
* redistribute it and/or modify it under the terms of the GNU Lesser General |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
11 |
* Public License as published by the Free Software Foundation; version 2.1 |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
12 |
* of the License. |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
13 |
* |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
14 |
* The IgH EtherCAT master userspace library is distributed in the hope that |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
15 |
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
16 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
17 |
* GNU Lesser General Public License for more details. |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
18 |
* |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
19 |
* You should have received a copy of the GNU Lesser General Public License |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
20 |
* along with the IgH EtherCAT master userspace library. If not, see |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
21 |
* <http://www.gnu.org/licenses/>. |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
22 |
* |
1363
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
23 |
* --- |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
24 |
* |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
25 |
* The license mentioned above concerns the source code only. Using the |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
26 |
* EtherCAT technology and brand is only permitted in compliance with the |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
27 |
* industrial property and similar rights of Beckhoff Automation GmbH. |
246
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
206
diff
changeset
|
28 |
* |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
*****************************************************************************/ |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
|
786 | 31 |
/** \file |
32 |
* |
|
1182 | 33 |
* EtherCAT master application interface. |
34 |
* |
|
35 |
* \defgroup ApplicationInterface EtherCAT Application Interface |
|
786 | 36 |
* |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
37 |
* 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
|
38 |
* 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
|
39 |
* 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
|
40 |
* 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
|
41 |
* |
1239
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1226
diff
changeset
|
42 |
* 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
|
43 |
* |
1448
d7ba0c408a07
Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents:
1441
diff
changeset
|
44 |
* - Added the distributed clocks feature and the respective method |
d7ba0c408a07
Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents:
1441
diff
changeset
|
45 |
* ecrt_slave_config_dc() to configure a slave for cyclic |
1438
1d30b96bb04f
Replaced ecrt_slave_config_dc_cycle_times() and ecrt_slave_config_dc_shift_times() by ecrt_slave_config_dc_sync_signals().
Florian Pose <fp@igh-essen.com>
parents:
1434
diff
changeset
|
46 |
* operation, and ecrt_master_application_time(), |
1d30b96bb04f
Replaced ecrt_slave_config_dc_cycle_times() and ecrt_slave_config_dc_shift_times() by ecrt_slave_config_dc_sync_signals().
Florian Pose <fp@igh-essen.com>
parents:
1434
diff
changeset
|
47 |
* ecrt_master_sync_reference_clock() and ecrt_master_sync_slave_clocks() |
1d30b96bb04f
Replaced ecrt_slave_config_dc_cycle_times() and ecrt_slave_config_dc_shift_times() by ecrt_slave_config_dc_sync_signals().
Florian Pose <fp@igh-essen.com>
parents:
1434
diff
changeset
|
48 |
* for offset and drift compensation. The EC_TIMEVAL2NANO() macro can be |
1d30b96bb04f
Replaced ecrt_slave_config_dc_cycle_times() and ecrt_slave_config_dc_shift_times() by ecrt_slave_config_dc_sync_signals().
Florian Pose <fp@igh-essen.com>
parents:
1434
diff
changeset
|
49 |
* used for epoch time conversion. |
1313
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
50 |
* - Changed the meaning of the negative return values of |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
51 |
* ecrt_slave_config_reg_pdo_entry() and ecrt_slave_config_sdo*(). |
1341
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
52 |
* - Imlemented the Vendor-specific over EtherCAT mailbox protocol. See |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
53 |
* ecrt_slave_config_create_voe_handler(). |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
54 |
* - Renamed ec_sdo_request_state_t to ec_request_state_t, because it is also |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
55 |
* used by VoE handlers. |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
56 |
* - Added ecrt_master_slave() to get information about a certain slave. |
1441
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
57 |
* - Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download() methods to |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
58 |
* let an application transfer SDOs before activating the master. |
1352
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1341
diff
changeset
|
59 |
* - Removed 'const' from argument of ecrt_sdo_request_state(), because the |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1341
diff
changeset
|
60 |
* userspace library has to modify object internals. |
1384
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
61 |
* - Added 64-bit data access macros. |
1239
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1226
diff
changeset
|
62 |
* |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
63 |
* @{ |
786 | 64 |
*/ |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
65 |
|
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
66 |
/*****************************************************************************/ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
67 |
|
125 | 68 |
#ifndef __ECRT_H__ |
69 |
#define __ECRT_H__ |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
|
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
71 |
#ifdef __KERNEL__ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
#include <asm/byteorder.h> |
110 | 73 |
#include <linux/types.h> |
1396
9d04cc08f40f
DC sync reference clock to application time. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1394
diff
changeset
|
74 |
#include <linux/time.h> |
110 | 75 |
#else |
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
76 |
#include <stdlib.h> // for size_t |
110 | 77 |
#include <stdint.h> |
1396
9d04cc08f40f
DC sync reference clock to application time. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1394
diff
changeset
|
78 |
#include <sys/time.h> // for struct timeval |
110 | 79 |
#endif |
80 |
||
779 | 81 |
/****************************************************************************** |
82 |
* Global definitions |
|
83 |
*****************************************************************************/ |
|
84 |
||
864 | 85 |
/** EtherCAT realtime interface major version number. |
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
707
diff
changeset
|
86 |
*/ |
637
d5d04c868e0e
Removed ecrt_master_run(), removed datagram queueing from state
Florian Pose <fp@igh-essen.com>
parents:
635
diff
changeset
|
87 |
#define ECRT_VER_MAJOR 1 |
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
707
diff
changeset
|
88 |
|
864 | 89 |
/** EtherCAT realtime interface minor version number. |
779 | 90 |
*/ |
1209 | 91 |
#define ECRT_VER_MINOR 5 |
779 | 92 |
|
864 | 93 |
/** EtherCAT realtime interface version word generator. |
779 | 94 |
*/ |
95 |
#define ECRT_VERSION(a, b) (((a) << 8) + (b)) |
|
96 |
||
864 | 97 |
/** EtherCAT realtime interface version word. |
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
707
diff
changeset
|
98 |
*/ |
541
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
99 |
#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
|
100 |
|
878 | 101 |
/*****************************************************************************/ |
102 |
||
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
103 |
/** 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
|
104 |
* |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
105 |
* 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
|
106 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
107 |
#define EC_END ~0U |
878 | 108 |
|
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
109 |
/** 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
|
110 |
*/ |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
111 |
#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
|
112 |
|
1341
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
113 |
/** Maximum string length. |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
114 |
* |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
115 |
* Used in ec_slave_info_t. |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
116 |
*/ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
117 |
#define EC_MAX_STRING_LENGTH 64 |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
118 |
|
1417
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
119 |
/** Timeval to nanoseconds conversion. |
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
120 |
* |
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
121 |
* This macro converts a unix epoch time to EtherCAT DC time. |
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
122 |
* |
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
123 |
* \see ecrt_master_sync_reference_clock() |
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
124 |
* |
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
125 |
* \param TV Pointer to struct timeval. |
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
126 |
*/ |
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
127 |
#define EC_TIMEVAL2NANO(TV) \ |
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
128 |
(((TV)->tv_sec - 946684800ULL) * 1000000000ULL + (TV)->tv_usec * 1000ULL) |
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
129 |
|
779 | 130 |
/****************************************************************************** |
131 |
* Data types |
|
132 |
*****************************************************************************/ |
|
541
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
133 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
struct ec_master; |
286
f3352378b4d4
Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents:
276
diff
changeset
|
135 |
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
|
136 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
137 |
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
|
138 |
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
|
139 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
struct ec_domain; |
286
f3352378b4d4
Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents:
276
diff
changeset
|
141 |
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
|
142 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
143 |
struct ec_sdo_request; |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
144 |
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
|
145 |
|
1209 | 146 |
struct ec_voe_handler; |
147 |
typedef struct ec_voe_handler ec_voe_handler_t; /**< \see ec_voe_handler. */ |
|
148 |
||
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
149 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
150 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
151 |
/** Master state. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
152 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
153 |
* 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
|
154 |
* |
9bf2ddf05e17
Completed ec_master_state_t and documented ec_master_state_t and
Florian Pose <fp@igh-essen.com>
parents:
1010
diff
changeset
|
155 |
* \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
|
156 |
*/ |
aede068f9a74
Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents:
541
diff
changeset
|
157 |
typedef struct { |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
158 |
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
|
159 |
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
|
160 |
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
|
161 |
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
|
162 |
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
|
163 |
state: |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
164 |
- Bit 0: \a INIT |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
165 |
- Bit 1: \a PREOP |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
166 |
- Bit 2: \a SAFEOP |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
167 |
- Bit 3: \a OP */ |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
168 |
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
|
169 |
} 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
|
170 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
171 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
172 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
173 |
/** Slave configuration state. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
174 |
* |
1020
9bf2ddf05e17
Completed ec_master_state_t and documented ec_master_state_t and
Florian Pose <fp@igh-essen.com>
parents:
1010
diff
changeset
|
175 |
* 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
|
176 |
* |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
177 |
* \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
|
178 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
179 |
typedef struct { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
180 |
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
|
181 |
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
|
182 |
using the specified configuration. */ |
1022
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
183 |
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
|
184 |
- 1: \a INIT |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
185 |
- 2: \a PREOP |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
186 |
- 4: \a SAFEOP |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
187 |
- 8: \a OP |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
188 |
|
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
189 |
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
|
190 |
bit! */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
191 |
} 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
|
192 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
193 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
194 |
|
1341
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
195 |
/** Slave information. |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
196 |
* |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
197 |
* This is used as an output parameter of ecrt_master_slave(). |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
198 |
* |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
199 |
* \see ecrt_master_slave(). |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
200 |
*/ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
201 |
typedef struct { |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
202 |
uint16_t position; /**< Offset of the slave in the ring. */ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
203 |
uint32_t vendor_id; /**< Vendor-ID stored on the slave. */ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
204 |
uint32_t product_code; /**< Product-Code stored on the slave. */ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
205 |
uint32_t revision_number; /**< Revision-Number stored on the slave. */ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
206 |
uint32_t serial_number; /**< Serial-Number stored on the slave. */ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
207 |
uint16_t alias; /**< The slaves alias if not equal to 0. */ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
208 |
int16_t current_on_ebus; |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
209 |
uint8_t al_state; /**< Current state of the slave. */ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
210 |
uint8_t error_flag; /**< Error flag for that slave. */ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
211 |
uint8_t sync_count; /**< Number of sync managers. */ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
212 |
uint16_t sdo_count; /**< Number of SDO's. */ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
213 |
char name[EC_MAX_STRING_LENGTH]; /**< Name of the slave. */ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
214 |
} ec_slave_info_t; |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
215 |
|
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
216 |
/*****************************************************************************/ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
217 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
218 |
/** 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
|
219 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
220 |
* 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
|
221 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
222 |
typedef enum { |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
223 |
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
|
224 |
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
|
225 |
exchanged. */ |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
226 |
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
|
227 |
} 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
|
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 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
231 |
/** Domain state. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
232 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
233 |
* 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
|
234 |
*/ |
16e9ad7d8e12
Added parameters for vendor ID and product code to ecrt_get_slave(); PDO
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
235 |
typedef struct { |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
236 |
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
|
237 |
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
|
238 |
} 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
|
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 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
242 |
/** Direction type for PDO assignment functions. |
779 | 243 |
*/ |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
612
diff
changeset
|
244 |
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
|
245 |
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
|
246 |
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
|
247 |
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
|
248 |
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
|
249 |
} ec_direction_t; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
250 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
251 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
252 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
253 |
/** PDO entry configuration information. |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
254 |
* |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
255 |
* 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
|
256 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
257 |
* \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
|
258 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
259 |
typedef struct { |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
260 |
uint16_t index; /**< PDO entry index. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
261 |
uint8_t subindex; /**< PDO entry subindex. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
262 |
uint8_t bit_length; /**< Size of the PDO entry in bit. */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
263 |
} 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
|
264 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
265 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
266 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
267 |
/** PDO configuration information. |
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 |
* |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
269 |
* 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
|
270 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
271 |
* \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
|
272 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
273 |
typedef struct { |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
274 |
uint16_t index; /**< PDO index. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
275 |
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
|
276 |
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
|
277 |
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
|
278 |
present at bus configuration time). */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
279 |
ec_pdo_entry_info_t *entries; /**< Array of PDO entries to map. Can either |
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 |
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
|
281 |
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
|
282 |
} 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
|
283 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
284 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
285 |
|
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
286 |
/** 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
|
287 |
* |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
288 |
* This can be use to configure multiple sync managers including the PDO |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
289 |
* 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
|
290 |
* 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
|
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 |
typedef struct { |
1083
1322dc34cb37
Updated header docs, features and news file.
Florian Pose <fp@igh-essen.com>
parents:
1082
diff
changeset
|
293 |
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
|
294 |
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
|
295 |
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
|
296 |
ec_direction_t dir; /**< Sync manager direction. */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
297 |
unsigned int n_pdos; /**< Number of PDOs in \a pdos. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
298 |
ec_pdo_info_t *pdos; /**< Array with PDOs to assign. This must contain |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
299 |
at least \a n_pdos 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
|
300 |
} 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
|
301 |
|
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
302 |
/*****************************************************************************/ |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
303 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
304 |
/** List record type for PDO entry mass-registration. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
305 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
306 |
* 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
|
307 |
* 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
|
308 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
309 |
typedef struct { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
310 |
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
|
311 |
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
|
312 |
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
|
313 |
uint32_t product_code; /**< Slave product code. */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
314 |
uint16_t index; /**< PDO entry index. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
315 |
uint8_t subindex; /**< PDO entry subindex. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
316 |
unsigned int *offset; /**< Pointer to a variable to store the PDO entry's |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
317 |
(byte-)offset in the process data. */ |
1092 | 318 |
unsigned int *bit_position; /**< Pointer to a variable to store a bit |
319 |
position (0-7) within the \a offset. Can be |
|
320 |
NULL, in which case an error is raised if the |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
321 |
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
|
322 |
} ec_pdo_entry_reg_t; |
416
4f007cd2a79d
ecrt_domain_register_pdo_range() implemented.
Florian Pose <fp@igh-essen.com>
parents:
325
diff
changeset
|
323 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
324 |
/*****************************************************************************/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
325 |
|
1209 | 326 |
/** Request state. |
327 |
* |
|
328 |
* This is used as return type for ecrt_sdo_request_state() and |
|
329 |
* ecrt_voe_handler_state(). |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
330 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
331 |
typedef enum { |
1209 | 332 |
EC_REQUEST_UNUSED, /**< Not requested. */ |
333 |
EC_REQUEST_BUSY, /**< Request is being processed. */ |
|
334 |
EC_REQUEST_SUCCESS, /**< Request was processed successfully. */ |
|
335 |
EC_REQUEST_ERROR, /**< Request processing failed. */ |
|
336 |
} ec_request_state_t; |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
337 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
338 |
/****************************************************************************** |
779 | 339 |
* Global functions |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
340 |
*****************************************************************************/ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
|
1288
bf0d42ca5aec
Wrapped c function in 'extern "C"' to make the library usable in C++
Florian Pose <fp@igh-essen.com>
parents:
1287
diff
changeset
|
342 |
#ifdef __cplusplus |
bf0d42ca5aec
Wrapped c function in 'extern "C"' to make the library usable in C++
Florian Pose <fp@igh-essen.com>
parents:
1287
diff
changeset
|
343 |
extern "C" { |
bf0d42ca5aec
Wrapped c function in 'extern "C"' to make the library usable in C++
Florian Pose <fp@igh-essen.com>
parents:
1287
diff
changeset
|
344 |
#endif |
bf0d42ca5aec
Wrapped c function in 'extern "C"' to make the library usable in C++
Florian Pose <fp@igh-essen.com>
parents:
1287
diff
changeset
|
345 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
346 |
/** 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
|
347 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
348 |
* \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
|
349 |
*/ |
541
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
350 |
unsigned int ecrt_version_magic(void); |
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
351 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
352 |
/** 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
|
353 |
* |
1092 | 354 |
* Before an application can access an EtherCAT master, it has to reserve one |
355 |
* for exclusive use. |
|
356 |
* |
|
357 |
* This function has to be the first function an application has to call to |
|
358 |
* use EtherCAT. The function takes the index of the master as its argument. |
|
359 |
* The first master has index 0, the n-th master has index n - 1. The number |
|
360 |
* of masters has to be specified when loading the master module. |
|
361 |
* |
|
1312
74853e018898
Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents:
1288
diff
changeset
|
362 |
* \return Pointer to the reserved master, otherwise \a NULL. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
363 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
364 |
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
|
365 |
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
|
366 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
367 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
368 |
/** Releases a requested EtherCAT master. |
1092 | 369 |
* |
370 |
* After use, a master it has to be released to make it available for other |
|
371 |
* applications. |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
372 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
373 |
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
|
374 |
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
|
375 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
376 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
377 |
/****************************************************************************** |
779 | 378 |
* Master methods |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
379 |
*****************************************************************************/ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
|
1244
0b70040d3daa
No kernel handles in userspace; Domain creation.
Florian Pose <fp@igh-essen.com>
parents:
1239
diff
changeset
|
381 |
#ifdef __KERNEL__ |
0b70040d3daa
No kernel handles in userspace; Domain creation.
Florian Pose <fp@igh-essen.com>
parents:
1239
diff
changeset
|
382 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
383 |
/** 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
|
384 |
* |
1092 | 385 |
* For concurrent master access, the application has to provide a locking |
386 |
* mechanism (see section FIXME in the docs). The method takes two function |
|
387 |
* pointers and a data value as its parameters. The arbitrary \a cb_data value |
|
388 |
* will be passed as argument on every callback. Asynchronous master access |
|
389 |
* (like EoE processing) is only possible if the callbacks have been set. |
|
390 |
* |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
391 |
* The request_cb function must return zero, to allow another instance |
1092 | 392 |
* (an EoE process for example) to access the master. Non-zero means, |
393 |
* 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
|
394 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
395 |
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
|
396 |
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
|
397 |
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
|
398 |
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
|
399 |
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
|
400 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
401 |
|
1244
0b70040d3daa
No kernel handles in userspace; Domain creation.
Florian Pose <fp@igh-essen.com>
parents:
1239
diff
changeset
|
402 |
#endif /* __KERNEL__ */ |
0b70040d3daa
No kernel handles in userspace; Domain creation.
Florian Pose <fp@igh-essen.com>
parents:
1239
diff
changeset
|
403 |
|
1092 | 404 |
/** Creates a new process data domain. |
405 |
* |
|
406 |
* For process data exchange, at least one process data domain is needed. |
|
407 |
* This method creates a new process data domain and returns a pointer to the |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
408 |
* new domain object. This object can be used for registering PDOs and |
1092 | 409 |
* 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
|
410 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
411 |
* \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
|
412 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
413 |
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
|
414 |
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
|
415 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
416 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
417 |
/** 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
|
418 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
419 |
* 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
|
420 |
* 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
|
421 |
* 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
|
422 |
* 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
|
423 |
* 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
|
424 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
425 |
* 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
|
426 |
* - 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
|
427 |
* ring position. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
428 |
* - 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
|
429 |
* 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
|
430 |
* 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
|
431 |
* 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
|
432 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
433 |
* 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
|
434 |
* 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
|
435 |
* 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
|
436 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
437 |
* 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
|
438 |
* 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
|
439 |
* applied. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
440 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
441 |
* \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
|
442 |
* \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
|
443 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
444 |
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
|
445 |
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
|
446 |
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
|
447 |
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
|
448 |
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
|
449 |
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
|
450 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
451 |
|
1441
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
452 |
#ifndef __KERNEL__ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
453 |
|
1341
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
454 |
/** Obtains slave information. |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
455 |
* |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
456 |
* Tries to find the slave with the given ring position. The obtained |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
457 |
* information is stored in a structure. No memory is allocated on the heap in |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
458 |
* this function. |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
459 |
* |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
460 |
* \attention The pointer to this structure must point to a valid variable. |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
461 |
* |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
462 |
* \return 0 in case of success, else < 0 |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
463 |
*/ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
464 |
int ecrt_master_slave( |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
465 |
ec_master_t *master, /**< EtherCAT master */ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
466 |
uint16_t position, /**< Slave position. */ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
467 |
ec_slave_info_t *slave_info /**< Structure that will output the |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
468 |
information */ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
469 |
); |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
470 |
|
1441
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
471 |
#endif /* ifndef __KERNEL__ */ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
472 |
|
1096 | 473 |
/** 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
|
474 |
* |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
475 |
* 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
|
476 |
* 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
|
477 |
* 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
|
478 |
* 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
|
479 |
* 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
|
480 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
481 |
* \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
|
482 |
* 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
|
483 |
* 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
|
484 |
* 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
|
485 |
* 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
|
486 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
487 |
* \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
|
488 |
*/ |
1007 | 489 |
int ecrt_master_activate( |
490 |
ec_master_t *master /**< EtherCAT master. */ |
|
491 |
); |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
492 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
493 |
/** 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
|
494 |
* |
1092 | 495 |
* This method takes all datagrams, that have been queued for transmission, |
496 |
* puts them into frames, and passes them to the Ethernet device for sending. |
|
497 |
* |
|
498 |
* Has to be called cyclically by the application after ecrt_master_activate() |
|
499 |
* has returned. |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
500 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
501 |
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
|
502 |
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
|
503 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
504 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
505 |
/** 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
|
506 |
* |
1092 | 507 |
* Queries the network device for received frames by calling the interrupt |
508 |
* service routine. Extracts received datagrams and dispatches the results to |
|
509 |
* the datagram objects in the queue. Received datagrams, and the ones that |
|
510 |
* timed out, will be marked, and dequeued. |
|
511 |
* |
|
512 |
* 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
|
513 |
* 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
|
514 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
515 |
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
|
516 |
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
|
517 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
518 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
519 |
/** 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
|
520 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
521 |
* 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
|
522 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
523 |
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
|
524 |
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
|
525 |
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
|
526 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
527 |
|
1434
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
528 |
/** Sets the application time. |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
529 |
* |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
530 |
* The master has to know the application time when operation slaves with |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
531 |
* distributed clocks. The time is not incremented by the master, so this |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
532 |
* method has to be called cyclically. |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
533 |
* |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
534 |
* The time is defined as nanoseconds from 2000-01-01 00:00. Converting an |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
535 |
* epoch time can be done with the EC_TIMEVAL2NANO() macro. |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
536 |
*/ |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
537 |
void ecrt_master_application_time( |
1396
9d04cc08f40f
DC sync reference clock to application time. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1394
diff
changeset
|
538 |
ec_master_t *master, /**< EtherCAT master. */ |
1417
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
539 |
uint64_t app_time /**< Application time. */ |
1394
e77728ddf0f9
Introduced ecrt_master_sync() for synchronizing slave clocks to reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1392
diff
changeset
|
540 |
); |
e77728ddf0f9
Introduced ecrt_master_sync() for synchronizing slave clocks to reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1392
diff
changeset
|
541 |
|
1434
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
542 |
/** Queues the DC reference clock drift compensation datagram for sending. |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
543 |
* |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
544 |
* The reference clock will by synchronized to the application time provided |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
545 |
* by the last call off ecrt_master_application_time(). |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
546 |
*/ |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
547 |
void ecrt_master_sync_reference_clock( |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
548 |
ec_master_t *master /**< EtherCAT master. */ |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
549 |
); |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
550 |
|
1410
fb6719008bf5
Separated sync_reference_clock() and sync_slave_clocks().
Florian Pose <fp@igh-essen.com>
parents:
1396
diff
changeset
|
551 |
/** Queues the DC clock drift compensation datagram for sending. |
fb6719008bf5
Separated sync_reference_clock() and sync_slave_clocks().
Florian Pose <fp@igh-essen.com>
parents:
1396
diff
changeset
|
552 |
* |
fb6719008bf5
Separated sync_reference_clock() and sync_slave_clocks().
Florian Pose <fp@igh-essen.com>
parents:
1396
diff
changeset
|
553 |
* All slave clocks synchronized to the reference clock. |
fb6719008bf5
Separated sync_reference_clock() and sync_slave_clocks().
Florian Pose <fp@igh-essen.com>
parents:
1396
diff
changeset
|
554 |
*/ |
fb6719008bf5
Separated sync_reference_clock() and sync_slave_clocks().
Florian Pose <fp@igh-essen.com>
parents:
1396
diff
changeset
|
555 |
void ecrt_master_sync_slave_clocks( |
fb6719008bf5
Separated sync_reference_clock() and sync_slave_clocks().
Florian Pose <fp@igh-essen.com>
parents:
1396
diff
changeset
|
556 |
ec_master_t *master /**< EtherCAT master. */ |
fb6719008bf5
Separated sync_reference_clock() and sync_slave_clocks().
Florian Pose <fp@igh-essen.com>
parents:
1396
diff
changeset
|
557 |
); |
fb6719008bf5
Separated sync_reference_clock() and sync_slave_clocks().
Florian Pose <fp@igh-essen.com>
parents:
1396
diff
changeset
|
558 |
|
1441
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
559 |
#ifndef __KERNEL__ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
560 |
|
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
561 |
/** Executes an SDO write request to download data. |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
562 |
* |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
563 |
* This function operates aside of the normal way to request SDOs. Before the |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
564 |
* activation of the master, these requests are processed by the master state |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
565 |
* machine itself. After activation the user has to ensure cyclic processing. |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
566 |
* |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
567 |
* \retval 0 Success. |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
568 |
* \retval -1 An error occured. |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
569 |
*/ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
570 |
int ecrt_slave_sdo_download( |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
571 |
ec_master_t* master, /**< EtherCAT master. */ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
572 |
uint16_t slave_position, /**< Slave position. */ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
573 |
uint16_t index, /**< Index of the SDO. */ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
574 |
uint8_t subindex, /**< Subindex of the SDO. */ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
575 |
uint8_t *data, /**< Data buffer to download. */ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
576 |
size_t data_size, /**< Size of the data buffer. */ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
577 |
uint32_t *abort_code /**< Abort code of the SDO download. */ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
578 |
); |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
579 |
|
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
580 |
/** Executes a SDO read request to upload data. |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
581 |
* |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
582 |
* This function operates aside of the normal way to request SDOs. Before the |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
583 |
* activation of the master, these requests are processed by the master state |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
584 |
* machine itself. After activation the user have to ensure cyclic |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
585 |
* processing. |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
586 |
* |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
587 |
* \retval 0 Success. |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
588 |
* \retval -1 Error occured. |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
589 |
*/ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
590 |
int ecrt_slave_sdo_upload( |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
591 |
ec_master_t* master, /**< EtherCAT master. */ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
592 |
uint16_t slave_position, /**< Slave position. */ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
593 |
uint16_t index, /**< Index of the SDO. */ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
594 |
uint8_t subindex, /**< Subindex of the SDO. */ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
595 |
uint8_t *target, /**< Target buffer for the upload. */ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
596 |
size_t target_size, /**< Size of the target buffer. */ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
597 |
size_t *result_size, /**< Uploaded data size. */ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
598 |
uint32_t *abort_code /**< Abort code of the SDO upload. */ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
599 |
); |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
600 |
|
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
601 |
#endif /* ifndef __KERNEL__ */ |
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
602 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
603 |
/****************************************************************************** |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
604 |
* Slave configuration methods |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
605 |
*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
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 |
/** 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
|
608 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
609 |
* 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
|
610 |
* 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
|
611 |
* |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
612 |
* \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
|
613 |
*/ |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
614 |
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
|
615 |
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
|
616 |
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
|
617 |
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
|
618 |
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
|
619 |
); |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
620 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
621 |
/** Add a PDO to a sync manager's PDO assignment. |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
622 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
623 |
* \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
|
624 |
* \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
|
625 |
*/ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
626 |
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
|
627 |
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
|
628 |
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
|
629 |
than #EC_MAX_SYNC_MANAGERS. */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
630 |
uint16_t index /**< Index of the PDO to assign. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
631 |
); |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
632 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
633 |
/** Clear a sync manager's PDO assignment. |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
634 |
* |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
635 |
* 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
|
636 |
* 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
|
637 |
* 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
|
638 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
639 |
* \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
|
640 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
641 |
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
|
642 |
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
|
643 |
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
|
644 |
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
|
645 |
); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
646 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
647 |
/** Add a PDO entry to the given PDO's mapping. |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
648 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
649 |
* \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
|
650 |
* \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
|
651 |
*/ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
652 |
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
|
653 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
654 |
uint16_t pdo_index, /**< Index of the PDO. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
655 |
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
|
656 |
mapping. */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
657 |
uint8_t entry_subindex, /**< Subindex of the PDO entry to add to the |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
658 |
PDO's mapping. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
659 |
uint8_t entry_bit_length /**< Size of the PDO entry in bit. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
660 |
); |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
661 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
662 |
/** Clear the mapping of a given PDO. |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
663 |
* |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
664 |
* This can be called before mapping PDO entries via |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
665 |
* 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
|
666 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
667 |
* \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
|
668 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
669 |
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
|
670 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
671 |
uint16_t pdo_index /**< Index of the PDO. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
672 |
); |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
673 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
674 |
/** 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
|
675 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
676 |
* 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
|
677 |
* 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
|
678 |
* 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
|
679 |
* 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
|
680 |
* 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
|
681 |
* |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
682 |
* The following example shows, how to specify a complete configuration, |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
683 |
* including the PDO mappings. With this information, the master is able to |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
684 |
* 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
|
685 |
* configuration time: |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
686 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
687 |
* \code |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
688 |
* 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
|
689 |
* {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
|
690 |
* {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
|
691 |
* }; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
692 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
693 |
* 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
|
694 |
* {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
|
695 |
* {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
|
696 |
* }; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
697 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
698 |
* 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
|
699 |
* {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
|
700 |
* {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
|
701 |
* }; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
702 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
703 |
* 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
|
704 |
* {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
|
705 |
* {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
|
706 |
* {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
|
707 |
* }; |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
708 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
709 |
* 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
|
710 |
* // handle error |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
711 |
* } |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
712 |
* \endcode |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
713 |
* |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
714 |
* The next example shows, how to configure the PDO assignment only. The |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
715 |
* entries for each assigned PDO are taken from the PDO's default mapping. |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
716 |
* Please note, that PDO entry registration will fail, if the PDO |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
717 |
* 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
|
718 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
719 |
* \code |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
720 |
* 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
|
721 |
* {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
|
722 |
* {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
|
723 |
* }; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
724 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
725 |
* 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
|
726 |
* {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
|
727 |
* }; |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
728 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
729 |
* 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
|
730 |
* // handle error |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
731 |
* } |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
732 |
* \endcode |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
733 |
* |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
734 |
* 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
|
735 |
* - 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
|
736 |
* - 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
|
737 |
* \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
|
738 |
* using EC_END is recommended. |
878 | 739 |
* |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
740 |
* \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
|
741 |
*/ |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
742 |
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
|
743 |
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
|
744 |
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
|
745 |
\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
|
746 |
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
|
747 |
configurations. */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
748 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
749 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
750 |
/** Registers a PDO entry for process data exchange in a domain. |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
751 |
* |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
752 |
* Searches the assigned PDOs for the given PDO entry. An error is raised, if |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
753 |
* 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
|
754 |
* and FMMU configurations are provided for slave configuration and the |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
755 |
* respective sync manager's assigned PDOs are appended to the given domain, |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
756 |
* if not already done. The offset of the requested PDO entry's data inside |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
757 |
* the domain's process data is returned. Optionally, the PDO entry bit |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
758 |
* position (0-7) can be retrieved via the \a bit_position output parameter. |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
759 |
* This pointer may be \a NULL, in this case an error is raised if the PDO |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
760 |
* 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
|
761 |
* |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
762 |
* \retval >=0 Success: Offset of the PDO entry's process data. |
1313
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
763 |
* \retval <0 Error code. |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
793
diff
changeset
|
764 |
*/ |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
793
diff
changeset
|
765 |
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
|
766 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
767 |
uint16_t entry_index, /**< Index of the PDO entry to register. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
768 |
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
|
769 |
ec_domain_t *domain, /**< Domain. */ |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
770 |
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
|
771 |
is desired */ |
916
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
900
diff
changeset
|
772 |
); |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
900
diff
changeset
|
773 |
|
1448
d7ba0c408a07
Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents:
1441
diff
changeset
|
774 |
/** Configure distributed clocks. |
d7ba0c408a07
Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents:
1441
diff
changeset
|
775 |
* |
d7ba0c408a07
Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents:
1441
diff
changeset
|
776 |
* Sets the AssignActivate word and the cycle and shift times for the sync |
d7ba0c408a07
Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents:
1441
diff
changeset
|
777 |
* signals. |
1392
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1384
diff
changeset
|
778 |
* |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1384
diff
changeset
|
779 |
* The AssignActivate word is vendor-specific and can be taken from the XML |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1384
diff
changeset
|
780 |
* device description file (Device -> Dc -> AssignActivate). Set this to zero, |
1396
9d04cc08f40f
DC sync reference clock to application time. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1394
diff
changeset
|
781 |
* if the slave shall be operated without distributed clocks (default). |
1392
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1384
diff
changeset
|
782 |
*/ |
1448
d7ba0c408a07
Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents:
1441
diff
changeset
|
783 |
void ecrt_slave_config_dc( |
1392
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1384
diff
changeset
|
784 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
1448
d7ba0c408a07
Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents:
1441
diff
changeset
|
785 |
uint16_t assign_activate, /**< AssignActivate word. */ |
1438
1d30b96bb04f
Replaced ecrt_slave_config_dc_cycle_times() and ecrt_slave_config_dc_shift_times() by ecrt_slave_config_dc_sync_signals().
Florian Pose <fp@igh-essen.com>
parents:
1434
diff
changeset
|
786 |
uint32_t sync0_cycle, /**< SYNC0 cycle time [ns]. */ |
1d30b96bb04f
Replaced ecrt_slave_config_dc_cycle_times() and ecrt_slave_config_dc_shift_times() by ecrt_slave_config_dc_sync_signals().
Florian Pose <fp@igh-essen.com>
parents:
1434
diff
changeset
|
787 |
uint32_t sync0_shift, /**< SYNC0 shift time [ns]. */ |
1d30b96bb04f
Replaced ecrt_slave_config_dc_cycle_times() and ecrt_slave_config_dc_shift_times() by ecrt_slave_config_dc_sync_signals().
Florian Pose <fp@igh-essen.com>
parents:
1434
diff
changeset
|
788 |
uint32_t sync1_cycle, /**< SYNC1 cycle time [ns]. */ |
1d30b96bb04f
Replaced ecrt_slave_config_dc_cycle_times() and ecrt_slave_config_dc_shift_times() by ecrt_slave_config_dc_sync_signals().
Florian Pose <fp@igh-essen.com>
parents:
1434
diff
changeset
|
789 |
uint32_t sync1_shift /**< SYNC1 shift time [ns]. */ |
1411 | 790 |
); |
791 |
||
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
792 |
/** Add an SDO configuration. |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
793 |
* |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
794 |
* An SDO configuration is stored in the slave configuration object and is |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
795 |
* 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
|
796 |
* 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
|
797 |
* 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
|
798 |
* |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
799 |
* \attention The SDOs for PDO assignment (\p 0x1C10 - \p 0x1C2F) and PDO |
1104
9e7fe258495e
Added attention to ecrt_slave_config_sdo().
Florian Pose <fp@igh-essen.com>
parents:
1096
diff
changeset
|
800 |
* 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
|
801 |
* 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
|
802 |
* 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
|
803 |
* friends instead. |
9e7fe258495e
Added attention to ecrt_slave_config_sdo().
Florian Pose <fp@igh-essen.com>
parents:
1096
diff
changeset
|
804 |
* |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
805 |
* This is the generic function for adding an SDO configuration. Please note |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
806 |
* 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
|
807 |
* 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
|
808 |
* 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
|
809 |
* 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
|
810 |
* |
1313
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
811 |
* \retval 0 Success. |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
812 |
* \retval <0 Error code. |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
813 |
*/ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
814 |
int ecrt_slave_config_sdo( |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
815 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
816 |
uint16_t index, /**< Index of the SDO to configure. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
817 |
uint8_t subindex, /**< Subindex of the SDO to configure. */ |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
818 |
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
|
819 |
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
|
820 |
); |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
821 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
822 |
/** 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
|
823 |
* |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
824 |
* \see ecrt_slave_config_sdo(). |
1313
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
825 |
* |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
826 |
* \retval 0 Success. |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
827 |
* \retval <0 Error code. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
828 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
829 |
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
|
830 |
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
|
831 |
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
|
832 |
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
|
833 |
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
|
834 |
); |
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 |
/** 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
|
837 |
* |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
838 |
* \see ecrt_slave_config_sdo(). |
1313
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
839 |
* |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
840 |
* \retval 0 Success. |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
841 |
* \retval <0 Error code. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
842 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
843 |
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
|
844 |
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
|
845 |
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
|
846 |
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
|
847 |
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
|
848 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
849 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
850 |
/** 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
|
851 |
* |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
852 |
* \see ecrt_slave_config_sdo(). |
1313
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
853 |
* |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
854 |
* \retval 0 Success. |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
855 |
* \retval <0 Error code. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
856 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
857 |
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
|
858 |
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
|
859 |
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
|
860 |
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
|
861 |
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
|
862 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
863 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
864 |
/** Create an SDO request to exchange SDOs during realtime operation. |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
865 |
* |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
866 |
* The created SDO request object is freed automatically when the master is |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
867 |
* released. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
868 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
869 |
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
|
870 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
871 |
uint16_t index, /**< SDO index. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
872 |
uint8_t subindex, /**< SDO subindex. */ |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
873 |
size_t size /**< Data size to reserve. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
874 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
875 |
|
1209 | 876 |
/** Create an VoE handler to exchange vendor-specific data during realtime |
877 |
* operation. |
|
878 |
* |
|
1267 | 879 |
* The number of VoE handlers per slave configuration is not limited, but |
880 |
* usually it is enough to create one for sending and one for receiving, if |
|
881 |
* both can be done simultaneously. |
|
882 |
* |
|
1209 | 883 |
* The created VoE handler object is freed automatically when the master is |
884 |
* released. |
|
885 |
*/ |
|
886 |
ec_voe_handler_t *ecrt_slave_config_create_voe_handler( |
|
887 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
|
888 |
size_t size /**< Data size to reserve. */ |
|
889 |
); |
|
890 |
||
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
891 |
/** 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
|
892 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
893 |
* 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
|
894 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
895 |
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
|
896 |
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
|
897 |
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
|
898 |
); |
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
288
diff
changeset
|
899 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
900 |
/****************************************************************************** |
779 | 901 |
* Domain methods |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
902 |
*****************************************************************************/ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
903 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
904 |
/** Registers a bunch of PDO entries for a domain. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
905 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
906 |
* \todo doc |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
907 |
* \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
|
908 |
* 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
|
909 |
* \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
|
910 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
911 |
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
|
912 |
ec_domain_t *domain, /**< Domain. */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
913 |
const ec_pdo_entry_reg_t *pdo_entry_regs /**< Array of PDO |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
914 |
registrations. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
915 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
916 |
|
1258
900f1124e8f8
Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents:
1257
diff
changeset
|
917 |
#ifdef __KERNEL__ |
900f1124e8f8
Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents:
1257
diff
changeset
|
918 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
919 |
/** 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
|
920 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
921 |
* \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
|
922 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
923 |
size_t ecrt_domain_size( |
1257
9844ac126275
Made ecrt_domain_size() const.
Florian Pose <fp@igh-essen.com>
parents:
1256
diff
changeset
|
924 |
const ec_domain_t *domain /**< Domain. */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
925 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
926 |
|
809 | 927 |
/** Provide external memory to store the domain's process data. |
928 |
* |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
929 |
* Call this after all PDO entries have been registered and before activating |
809 | 930 |
* the master. |
931 |
* |
|
932 |
* The size of the allocated memory must be at least ecrt_domain_size(), after |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
933 |
* all PDO entries have been registered. |
809 | 934 |
*/ |
935 |
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
|
936 |
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
|
937 |
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
|
938 |
data in. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
939 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
940 |
|
1248
3cc16b60a571
External memory only in kernel space.
Florian Pose <fp@igh-essen.com>
parents:
1244
diff
changeset
|
941 |
#endif /* __KERNEL__ */ |
3cc16b60a571
External memory only in kernel space.
Florian Pose <fp@igh-essen.com>
parents:
1244
diff
changeset
|
942 |
|
809 | 943 |
/** Returns the domain's process data. |
944 |
* |
|
1258
900f1124e8f8
Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents:
1257
diff
changeset
|
945 |
* - In kernel context: If external memory was provided with |
900f1124e8f8
Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents:
1257
diff
changeset
|
946 |
* ecrt_domain_external_memory(), the returned pointer will contain the |
900f1124e8f8
Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents:
1257
diff
changeset
|
947 |
* address of that memory. Otherwise it will point to the internally allocated |
900f1124e8f8
Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents:
1257
diff
changeset
|
948 |
* memory. In the latter case, this method may not be called before |
900f1124e8f8
Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents:
1257
diff
changeset
|
949 |
* ecrt_master_activate(). |
900f1124e8f8
Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents:
1257
diff
changeset
|
950 |
* |
900f1124e8f8
Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents:
1257
diff
changeset
|
951 |
* - In userspace context: This method has to be called after |
900f1124e8f8
Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents:
1257
diff
changeset
|
952 |
* ecrt_master_activate() to get the mapped domain process data memory. |
1256 | 953 |
* |
809 | 954 |
* \return Pointer to the process data memory. |
955 |
*/ |
|
956 |
uint8_t *ecrt_domain_data( |
|
957 |
ec_domain_t *domain /**< Domain. */ |
|
958 |
); |
|
959 |
||
886 | 960 |
/** Determines the states of the domain's datagrams. |
961 |
* |
|
962 |
* Evaluates the working counters of the received datagrams and outputs |
|
963 |
* statistics, if necessary. This must be called after ecrt_master_receive() |
|
964 |
* is expected to receive the domain datagrams in order to make |
|
965 |
* 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
|
966 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
967 |
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
|
968 |
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
|
969 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
970 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
971 |
/** (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
|
972 |
* |
886 | 973 |
* Call this function to mark the domain's datagrams for exchanging at the |
974 |
* 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
|
975 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
976 |
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
|
977 |
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
|
978 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
979 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
980 |
/** 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
|
981 |
* |
886 | 982 |
* 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
|
983 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
984 |
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
|
985 |
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
|
986 |
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
|
987 |
information. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
988 |
); |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
612
diff
changeset
|
989 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
990 |
/***************************************************************************** |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
991 |
* SDO request methods. |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
992 |
****************************************************************************/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
993 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
994 |
/** Set the timeout for an SDO request. |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
995 |
* |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
996 |
* 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
|
997 |
* as failed. |
1113 | 998 |
* |
999 |
* The timeout is permanently stored in the request object and is valid until |
|
1000 |
* the next call of this method. |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1001 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1002 |
void ecrt_sdo_request_timeout( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1003 |
ec_sdo_request_t *req, /**< SDO request. */ |
880 | 1004 |
uint32_t timeout /**< Timeout in milliseconds. Zero means no |
1005 |
timeout. */ |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1006 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1007 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1008 |
/** Access to the SDO request's data. |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1009 |
* |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1010 |
* This function returns a pointer to the request's internal SDO data memory. |
868 | 1011 |
* |
1012 |
* - After a read operation was successful, integer data can be evaluated using |
|
1013 |
* the EC_READ_*() macros as usual. Example: |
|
1014 |
* \code |
|
1015 |
* uint16_t value = EC_READ_U16(ecrt_sdo_request_data(sdo))); |
|
1016 |
* \endcode |
|
1017 |
* - If a write operation shall be triggered, the data have to be written to |
|
1018 |
* the internal memory. Use the EC_WRITE_*() macros, if you are writing |
|
1019 |
* integer data. Be sure, that the data fit into the memory. The memory size |
|
1020 |
* is a parameter of ecrt_slave_config_create_sdo_request(). |
|
1021 |
* \code |
|
1022 |
* EC_WRITE_U16(ecrt_sdo_request_data(sdo), 0xFFFF); |
|
1023 |
* \endcode |
|
1024 |
* |
|
864 | 1025 |
* \attention The return value can be invalid during a read operation, because |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1026 |
* the internal SDO data memory could be re-allocated if the read SDO data do |
864 | 1027 |
* not fit inside. |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1028 |
* |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1029 |
* \return Pointer to the internal SDO data memory. |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1030 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1031 |
uint8_t *ecrt_sdo_request_data( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1032 |
ec_sdo_request_t *req /**< SDO request. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1033 |
); |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1034 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1035 |
/** Returns the current SDO data size. |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1036 |
* |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1037 |
* When the SDO request is created, the data size is set to the size of the |
869
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
1038 |
* 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
|
1039 |
* 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
|
1040 |
* |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1041 |
* \return SDO data size in bytes. |
869
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
1042 |
*/ |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
1043 |
size_t ecrt_sdo_request_data_size( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1044 |
const ec_sdo_request_t *req /**< SDO request. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1045 |
); |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1046 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1047 |
/** Get the current state of the SDO request. |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1048 |
* |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1049 |
* \return Request state. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1050 |
*/ |
1352
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1341
diff
changeset
|
1051 |
#ifdef __KERNEL__ |
1209 | 1052 |
ec_request_state_t ecrt_sdo_request_state( |
1352
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1341
diff
changeset
|
1053 |
const ec_sdo_request_t *req /**< SDO request. */ |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1054 |
); |
1352
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1341
diff
changeset
|
1055 |
#else |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1341
diff
changeset
|
1056 |
ec_request_state_t ecrt_sdo_request_state( |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1341
diff
changeset
|
1057 |
ec_sdo_request_t *req /**< SDO request. */ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1341
diff
changeset
|
1058 |
); |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1341
diff
changeset
|
1059 |
#endif |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1060 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1061 |
/** Schedule an SDO write operation. |
864 | 1062 |
* |
1063 |
* \attention This method may not be called while ecrt_sdo_request_state() |
|
1064 |
* returns EC_SDO_REQUEST_BUSY. |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1065 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1066 |
void ecrt_sdo_request_write( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1067 |
ec_sdo_request_t *req /**< SDO request. */ |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1068 |
); |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1069 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1070 |
/** Schedule an SDO read operation. |
864 | 1071 |
* |
1072 |
* \attention This method may not be called while ecrt_sdo_request_state() |
|
1073 |
* returns EC_SDO_REQUEST_BUSY. |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1074 |
* |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1075 |
* \attention After calling this function, the return value of |
864 | 1076 |
* ecrt_sdo_request_data() must be considered as invalid while |
1077 |
* 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
|
1078 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1079 |
void ecrt_sdo_request_read( |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1080 |
ec_sdo_request_t *req /**< SDO request. */ |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1081 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1082 |
|
1209 | 1083 |
/***************************************************************************** |
1084 |
* VoE handler methods. |
|
1085 |
****************************************************************************/ |
|
1086 |
||
1226
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1087 |
/** Sets the VoE header for future send operations. |
1218 | 1088 |
* |
1089 |
* A VoE message shall contain a 4-byte vendor ID, followed by a 2-byte vendor |
|
1267 | 1090 |
* type at as header. These numbers can be set with this function. The values |
1091 |
* are valid and will be used for future send operations until the next call |
|
1092 |
* of this method. |
|
1218 | 1093 |
*/ |
1226
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1094 |
void ecrt_voe_handler_send_header( |
1218 | 1095 |
ec_voe_handler_t *voe, /**< VoE handler. */ |
1096 |
uint32_t vendor_id, /**< Vendor ID. */ |
|
1097 |
uint16_t vendor_type /**< Vendor-specific type. */ |
|
1098 |
); |
|
1099 |
||
1226
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1100 |
/** 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
|
1101 |
* |
1267 | 1102 |
* This method can be used to get the received VoE header information after a |
1103 |
* read operation has succeeded. |
|
1226
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1104 |
* |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1105 |
* 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
|
1106 |
* parameters. |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1107 |
*/ |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1108 |
void ecrt_voe_handler_received_header( |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1109 |
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
|
1110 |
uint32_t *vendor_id, /**< Vendor ID. */ |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1111 |
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
|
1112 |
); |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1113 |
|
1209 | 1114 |
/** Access to the VoE handler's data. |
1115 |
* |
|
1267 | 1116 |
* This function returns a pointer to the VoE handler's internal memory, that |
1117 |
* points to the actual VoE data right after the VoE header (see |
|
1118 |
* ecrt_voe_handler_send_header()). |
|
1209 | 1119 |
* |
1120 |
* - After a read operation was successful, the memory contains the received |
|
1121 |
* data. The size of the received data can be determined via |
|
1122 |
* ecrt_voe_handler_data_size(). |
|
1267 | 1123 |
* - Before a write operation is triggered, the data have to be written to the |
1124 |
* internal memory. Be sure, that the data fit into the memory. The reserved |
|
1209 | 1125 |
* memory size is a parameter of ecrt_slave_config_create_voe_handler(). |
1126 |
* |
|
1267 | 1127 |
* \attention The returned pointer is not necessarily persistent: After a read |
1128 |
* operation, the internal memory may have been reallocated. This can be |
|
1129 |
* avoided by reserving enough memory via the \a size parameter of |
|
1130 |
* ecrt_slave_config_create_voe_handler(). |
|
1131 |
* |
|
1209 | 1132 |
* \return Pointer to the internal memory. |
1133 |
*/ |
|
1134 |
uint8_t *ecrt_voe_handler_data( |
|
1135 |
ec_voe_handler_t *voe /**< VoE handler. */ |
|
1136 |
); |
|
1137 |
||
1138 |
/** Returns the current data size. |
|
1139 |
* |
|
1218 | 1140 |
* 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
|
1141 |
* ecrt_voe_handler_send_header()). |
1218 | 1142 |
* |
1209 | 1143 |
* When the VoE handler is created, the data size is set to the size of the |
1144 |
* reserved memory. At a write operation, the data size is set to the number |
|
1145 |
* of bytes to write. After a read operation the size is set to the size of |
|
1146 |
* the read data. The size is not modified in any other situation. |
|
1147 |
* |
|
1148 |
* \return Data size in bytes. |
|
1149 |
*/ |
|
1150 |
size_t ecrt_voe_handler_data_size( |
|
1151 |
const ec_voe_handler_t *voe /**< VoE handler. */ |
|
1152 |
); |
|
1153 |
||
1154 |
/** Start a VoE write operation. |
|
1155 |
* |
|
1156 |
* 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
|
1157 |
* 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
|
1158 |
* other operation may be started while the handler is busy. |
1209 | 1159 |
*/ |
1160 |
void ecrt_voe_handler_write( |
|
1161 |
ec_voe_handler_t *voe, /**< VoE handler. */ |
|
1218 | 1162 |
size_t size /**< Number of bytes to write (without the VoE header). */ |
1209 | 1163 |
); |
1164 |
||
1165 |
/** Start a VoE read operation. |
|
1166 |
* |
|
1167 |
* 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
|
1168 |
* 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
|
1169 |
* other operation may be started while the handler is busy. |
1209 | 1170 |
* |
1267 | 1171 |
* The state machine queries the slave's send mailbox for new data to be send |
1172 |
* to the master. If no data appear within the EC_VOE_RESPONSE_TIMEOUT |
|
1173 |
* (defined in master/voe_handler.c), the operation fails. |
|
1174 |
* |
|
1209 | 1175 |
* 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
|
1176 |
* 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
|
1177 |
* can be retrieved with ecrt_voe_handler_received_header(). |
1209 | 1178 |
*/ |
1179 |
void ecrt_voe_handler_read( |
|
1180 |
ec_voe_handler_t *voe /**< VoE handler. */ |
|
1181 |
); |
|
1182 |
||
1314
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1183 |
/** Start a VoE read operation without querying the sync manager status. |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1184 |
* |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1185 |
* After this function has been called, the ecrt_voe_handler_execute() method |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1186 |
* must be called in every bus cycle as long as it returns EC_REQUEST_BUSY. No |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1187 |
* other operation may be started while the handler is busy. |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1188 |
* |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1189 |
* The state machine queries the slave by sending an empty mailbox. The slave |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1190 |
* fills its data to the master in this mailbox. If no data appear within the |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1191 |
* EC_VOE_RESPONSE_TIMEOUT (defined in master/voe_handler.c), the operation |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1192 |
* fails. |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1193 |
* |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1194 |
* On success, the size of the read data can be determined via |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1195 |
* ecrt_voe_handler_data_size(), while the VoE header of the received data |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1196 |
* can be retrieved with ecrt_voe_handler_received_header(). |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1197 |
*/ |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1198 |
void ecrt_voe_handler_read_nosync( |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1199 |
ec_voe_handler_t *voe /**< VoE handler. */ |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1200 |
); |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1201 |
|
1209 | 1202 |
/** Execute the handler. |
1203 |
* |
|
1204 |
* This method executes the VoE handler. It has to be called in every bus cycle |
|
1205 |
* as long as it returns EC_REQUEST_BUSY. |
|
1206 |
* |
|
1207 |
* \return Handler state. |
|
1208 |
*/ |
|
1209 |
ec_request_state_t ecrt_voe_handler_execute( |
|
1210 |
ec_voe_handler_t *voe /**< VoE handler. */ |
|
1211 |
); |
|
1212 |
||
1288
bf0d42ca5aec
Wrapped c function in 'extern "C"' to make the library usable in C++
Florian Pose <fp@igh-essen.com>
parents:
1287
diff
changeset
|
1213 |
/*****************************************************************************/ |
bf0d42ca5aec
Wrapped c function in 'extern "C"' to make the library usable in C++
Florian Pose <fp@igh-essen.com>
parents:
1287
diff
changeset
|
1214 |
|
bf0d42ca5aec
Wrapped c function in 'extern "C"' to make the library usable in C++
Florian Pose <fp@igh-essen.com>
parents:
1287
diff
changeset
|
1215 |
#ifdef __cplusplus |
bf0d42ca5aec
Wrapped c function in 'extern "C"' to make the library usable in C++
Florian Pose <fp@igh-essen.com>
parents:
1287
diff
changeset
|
1216 |
} |
bf0d42ca5aec
Wrapped c function in 'extern "C"' to make the library usable in C++
Florian Pose <fp@igh-essen.com>
parents:
1287
diff
changeset
|
1217 |
#endif |
bf0d42ca5aec
Wrapped c function in 'extern "C"' to make the library usable in C++
Florian Pose <fp@igh-essen.com>
parents:
1287
diff
changeset
|
1218 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1219 |
/****************************************************************************** |
779 | 1220 |
* Bitwise read/write macros |
1221 |
*****************************************************************************/ |
|
1222 |
||
1223 |
/** 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
|
1224 |
* |
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
|
1225 |
* \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
|
1226 |
* \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
|
1227 |
*/ |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1228 |
#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
|
1229 |
|
779 | 1230 |
/** 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
|
1231 |
* |
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
|
1232 |
* \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
|
1233 |
* \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
|
1234 |
* \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
|
1235 |
*/ |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1236 |
#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
|
1237 |
do { \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1238 |
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
|
1239 |
else *((uint8_t *) (DATA)) &= ~(1 << (POS)); \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1240 |
} while (0) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1241 |
|
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1242 |
/****************************************************************************** |
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1243 |
* Byte-swapping functions for user space |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1244 |
*****************************************************************************/ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1245 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1246 |
#ifndef __KERNEL__ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1247 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1248 |
#if __BYTE_ORDER == __LITTLE_ENDIAN |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1249 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1250 |
#define le16_to_cpu(x) x |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1251 |
#define le32_to_cpu(x) x |
1384
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1252 |
#define le64_to_cpu(x) x |
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1253 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1254 |
#define cpu_to_le16(x) x |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1255 |
#define cpu_to_le32(x) x |
1384
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1256 |
#define cpu_to_le64(x) x |
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1257 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1258 |
#elif __BYTE_ORDER == __BIG_ENDIAN |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1259 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1260 |
#define swap16(x) \ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1261 |
((uint16_t)( \ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1262 |
(((uint16_t)(x) & 0x00ffU) << 8) | \ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1263 |
(((uint16_t)(x) & 0xff00U) >> 8) )) |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1264 |
#define swap32(x) \ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1265 |
((uint32_t)( \ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1266 |
(((uint32_t)(x) & 0x000000ffUL) << 24) | \ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1267 |
(((uint32_t)(x) & 0x0000ff00UL) << 8) | \ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1268 |
(((uint32_t)(x) & 0x00ff0000UL) >> 8) | \ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1269 |
(((uint32_t)(x) & 0xff000000UL) >> 24) )) |
1384
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1270 |
#define swap64(x) \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1271 |
((uint64_t)( \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1272 |
(((uint64_t)(x) & 0x00000000000000ffULL) << 56) | \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1273 |
(((uint64_t)(x) & 0x000000000000ff00ULL) << 40) | \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1274 |
(((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1275 |
(((uint64_t)(x) & 0x00000000ff000000ULL) << 8) | \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1276 |
(((uint64_t)(x) & 0x000000ff00000000ULL) >> 8) | \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1277 |
(((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1278 |
(((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1279 |
(((uint64_t)(x) & 0xff00000000000000ULL) >> 56) )) |
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1280 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1281 |
#define le16_to_cpu(x) swap16(x) |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1282 |
#define le32_to_cpu(x) swap32(x) |
1384
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1283 |
#define le64_to_cpu(x) swap64(x) |
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1284 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1285 |
#define cpu_to_le16(x) swap16(x) |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1286 |
#define cpu_to_le32(x) swap32(x) |
1384
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1287 |
#define cpu_to_le64(x) swap64(x) |
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1288 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1289 |
#endif |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1290 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1291 |
#define le16_to_cpup(x) le16_to_cpu(*((uint16_t *)(x))) |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1292 |
#define le32_to_cpup(x) le32_to_cpu(*((uint32_t *)(x))) |
1384
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1293 |
#define le64_to_cpup(x) le64_to_cpu(*((uint64_t *)(x))) |
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1294 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1295 |
#endif /* ifndef __KERNEL__ */ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1296 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1297 |
/****************************************************************************** |
779 | 1298 |
* Read macros |
1299 |
*****************************************************************************/ |
|
1300 |
||
1301 |
/** 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
|
1302 |
* |
779 | 1303 |
* \return EtherCAT data value |
1304 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1305 |
#define EC_READ_U8(DATA) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1306 |
((uint8_t) *((uint8_t *) (DATA))) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1307 |
|
779 | 1308 |
/** 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
|
1309 |
* |
779 | 1310 |
* \param DATA EtherCAT data pointer |
1311 |
* \return EtherCAT data value |
|
1312 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1313 |
#define EC_READ_S8(DATA) \ |
288 | 1314 |
((int8_t) *((uint8_t *) (DATA))) |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1315 |
|
779 | 1316 |
/** 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
|
1317 |
* |
779 | 1318 |
* \param DATA EtherCAT data pointer |
1319 |
* \return EtherCAT data value |
|
1320 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1321 |
#define EC_READ_U16(DATA) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1322 |
((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
|
1323 |
|
779 | 1324 |
/** 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
|
1325 |
* |
779 | 1326 |
* \param DATA EtherCAT data pointer |
1327 |
* \return EtherCAT data value |
|
1328 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1329 |
#define EC_READ_S16(DATA) \ |
288 | 1330 |
((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
|
1331 |
|
779 | 1332 |
/** 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
|
1333 |
* |
779 | 1334 |
* \param DATA EtherCAT data pointer |
1335 |
* \return EtherCAT data value |
|
1336 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1337 |
#define EC_READ_U32(DATA) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1338 |
((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
|
1339 |
|
779 | 1340 |
/** 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
|
1341 |
* |
779 | 1342 |
* \param DATA EtherCAT data pointer |
1343 |
* \return EtherCAT data value |
|
1344 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1345 |
#define EC_READ_S32(DATA) \ |
288 | 1346 |
((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
|
1347 |
|
1384
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1348 |
/** Read a 64-bit unsigned value from EtherCAT data. |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1349 |
* |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1350 |
* \param DATA EtherCAT data pointer |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1351 |
* \return EtherCAT data value |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1352 |
*/ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1353 |
#define EC_READ_U64(DATA) \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1354 |
((uint64_t) le64_to_cpup((void *) (DATA))) |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1355 |
|
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1356 |
/** Read a 64-bit signed value from EtherCAT data. |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1357 |
* |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1358 |
* \param DATA EtherCAT data pointer |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1359 |
* \return EtherCAT data value |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1360 |
*/ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1361 |
#define EC_READ_S64(DATA) \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1362 |
((int64_t) le64_to_cpup((void *) (DATA))) |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1363 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1364 |
/****************************************************************************** |
779 | 1365 |
* Write macros |
1366 |
*****************************************************************************/ |
|
1367 |
||
1368 |
/** 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
|
1369 |
* |
779 | 1370 |
* \param DATA EtherCAT data pointer |
1371 |
* \param VAL new value |
|
1372 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1373 |
#define EC_WRITE_U8(DATA, VAL) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1374 |
do { \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1375 |
*((uint8_t *)(DATA)) = ((uint8_t) (VAL)); \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1376 |
} while (0) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1377 |
|
779 | 1378 |
/** 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
|
1379 |
* |
779 | 1380 |
* \param DATA EtherCAT data pointer |
1381 |
* \param VAL new value |
|
1382 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1383 |
#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
|
1384 |
|
779 | 1385 |
/** 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
|
1386 |
* |
779 | 1387 |
* \param DATA EtherCAT data pointer |
1388 |
* \param VAL new value |
|
1389 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1390 |
#define EC_WRITE_U16(DATA, VAL) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1391 |
do { \ |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1392 |
*((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
|
1393 |
} while (0) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1394 |
|
779 | 1395 |
/** 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
|
1396 |
* |
779 | 1397 |
* \param DATA EtherCAT data pointer |
1398 |
* \param VAL new value |
|
1399 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1400 |
#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
|
1401 |
|
779 | 1402 |
/** 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
|
1403 |
* |
779 | 1404 |
* \param DATA EtherCAT data pointer |
1405 |
* \param VAL new value |
|
1406 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1407 |
#define EC_WRITE_U32(DATA, VAL) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1408 |
do { \ |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1409 |
*((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
|
1410 |
} while (0) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1411 |
|
779 | 1412 |
/** 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
|
1413 |
* |
779 | 1414 |
* \param DATA EtherCAT data pointer |
1415 |
* \param VAL new value |
|
1416 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1417 |
#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
|
1418 |
|
1384
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1419 |
/** Write a 64-bit unsigned value to EtherCAT data. |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1420 |
* |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1421 |
* \param DATA EtherCAT data pointer |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1422 |
* \param VAL new value |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1423 |
*/ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1424 |
#define EC_WRITE_U64(DATA, VAL) \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1425 |
do { \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1426 |
*((uint64_t *) (DATA)) = cpu_to_le64((uint64_t) (VAL)); \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1427 |
} while (0) |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1428 |
|
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1429 |
/** Write a 64-bit signed value to EtherCAT data. |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1430 |
* |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1431 |
* \param DATA EtherCAT data pointer |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1432 |
* \param VAL new value |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1433 |
*/ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1434 |
#define EC_WRITE_S64(DATA, VAL) EC_WRITE_U64(DATA, VAL) |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1435 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1436 |
/*****************************************************************************/ |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1437 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1438 |
/** @} */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1439 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1440 |
#endif |