author | Florian Pose <fp@igh-essen.com> |
Tue, 23 Feb 2010 13:18:31 +0100 | |
changeset 1821 | 40321a37d085 |
parent 1804 | 742607c464c4 |
child 1844 | b6bd88d4806b |
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 |
1500
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
45 |
* ecrt_slave_config_dc() to configure a slave for cyclic operation, and |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
46 |
* ecrt_master_application_time(), ecrt_master_sync_reference_clock() and |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
47 |
* ecrt_master_sync_slave_clocks() for offset and drift compensation. The |
1535
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
48 |
* EC_TIMEVAL2NANO() macro can be used for epoch time conversion, while the |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
49 |
* ecrt_master_sync_monitor_queue() and ecrt_master_sync_monitor_process() |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
50 |
* methods can be used to monitor the synchrony. |
1500
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
51 |
* - Improved the callback mechanism. ecrt_master_callbacks() now takes two |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
52 |
* callback functions for sending and receiving datagrams. |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
53 |
* ecrt_master_send_ext() is used to execute the sending of non-application |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
54 |
* datagrams. |
1509
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
55 |
* - Added watchdog configuration (method ecrt_slave_config_watchdog(), |
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
56 |
* #ec_watchdog_mode_t, \a watchdog_mode parameter in ec_sync_info_t and |
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
57 |
* ecrt_slave_config_sync_manager()). |
1526
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
58 |
* - Added ecrt_slave_config_complete_sdo() method to download an SDO during |
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
59 |
* configuration via CompleteAccess. |
1530
96629de2202b
Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents:
1526
diff
changeset
|
60 |
* - Added ecrt_master_deactivate() to remove the bus configuration. |
1497
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
61 |
* - Added ecrt_open_master() and ecrt_master_reserve() separation for |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
62 |
* userspace. |
1510
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
63 |
* - Added bus information interface (methods ecrt_master(), |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
64 |
* ecrt_master_get_slave(), ecrt_master_get_sync_manager(), |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
65 |
* ecrt_master_get_pdo() and ecrt_master_get_pdo_entry()) to get information |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
66 |
* about the currently connected slaves and the PDO entries provided. |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
67 |
* - Added ecrt_master_sdo_download() and ecrt_master_sdo_upload() |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
68 |
* methods to let an application transfer SDOs before activating the master. |
1313
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
69 |
* - 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
|
70 |
* ecrt_slave_config_reg_pdo_entry() and ecrt_slave_config_sdo*(). |
1512 | 71 |
* - Implemented the Vendor-specific over EtherCAT mailbox protocol. See |
1341
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
72 |
* ecrt_slave_config_create_voe_handler(). |
1509
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
73 |
* - Renamed ec_sdo_request_state_t to #ec_request_state_t, because it is also |
1341
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
74 |
* used by VoE handlers. |
1352
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1341
diff
changeset
|
75 |
* - 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
|
76 |
* 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
|
77 |
* - 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
|
78 |
* |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
79 |
* @{ |
786 | 80 |
*/ |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
81 |
|
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
82 |
/*****************************************************************************/ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
83 |
|
125 | 84 |
#ifndef __ECRT_H__ |
85 |
#define __ECRT_H__ |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
|
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
87 |
#ifdef __KERNEL__ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
#include <asm/byteorder.h> |
110 | 89 |
#include <linux/types.h> |
1396
9d04cc08f40f
DC sync reference clock to application time. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1394
diff
changeset
|
90 |
#include <linux/time.h> |
110 | 91 |
#else |
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
92 |
#include <stdlib.h> // for size_t |
110 | 93 |
#include <stdint.h> |
1396
9d04cc08f40f
DC sync reference clock to application time. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1394
diff
changeset
|
94 |
#include <sys/time.h> // for struct timeval |
110 | 95 |
#endif |
96 |
||
779 | 97 |
/****************************************************************************** |
98 |
* Global definitions |
|
99 |
*****************************************************************************/ |
|
100 |
||
864 | 101 |
/** EtherCAT realtime interface major version number. |
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
707
diff
changeset
|
102 |
*/ |
637
d5d04c868e0e
Removed ecrt_master_run(), removed datagram queueing from state
Florian Pose <fp@igh-essen.com>
parents:
635
diff
changeset
|
103 |
#define ECRT_VER_MAJOR 1 |
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
707
diff
changeset
|
104 |
|
864 | 105 |
/** EtherCAT realtime interface minor version number. |
779 | 106 |
*/ |
1209 | 107 |
#define ECRT_VER_MINOR 5 |
779 | 108 |
|
864 | 109 |
/** EtherCAT realtime interface version word generator. |
779 | 110 |
*/ |
111 |
#define ECRT_VERSION(a, b) (((a) << 8) + (b)) |
|
112 |
||
864 | 113 |
/** EtherCAT realtime interface version word. |
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
707
diff
changeset
|
114 |
*/ |
541
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
115 |
#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
|
116 |
|
878 | 117 |
/*****************************************************************************/ |
118 |
||
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
119 |
/** 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
|
120 |
* |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
121 |
* 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
|
122 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
123 |
#define EC_END ~0U |
878 | 124 |
|
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
125 |
/** 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
|
126 |
*/ |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
127 |
#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
|
128 |
|
1341
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
129 |
/** Maximum string length. |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
130 |
* |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
131 |
* Used in ec_slave_info_t. |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
132 |
*/ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
133 |
#define EC_MAX_STRING_LENGTH 64 |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
134 |
|
1417
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
135 |
/** Timeval to nanoseconds conversion. |
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
136 |
* |
1512 | 137 |
* This macro converts a Unix epoch time to EtherCAT DC time. |
1417
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
138 |
* |
1466
362147819ca1
EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents:
1448
diff
changeset
|
139 |
* \see void ecrt_master_application_time() |
362147819ca1
EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents:
1448
diff
changeset
|
140 |
* |
362147819ca1
EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents:
1448
diff
changeset
|
141 |
* \param TV struct timeval containing epoch time. |
1417
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
142 |
*/ |
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
143 |
#define EC_TIMEVAL2NANO(TV) \ |
1466
362147819ca1
EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents:
1448
diff
changeset
|
144 |
(((TV).tv_sec - 946684800ULL) * 1000000000ULL + (TV).tv_usec * 1000ULL) |
1417
7c2d5d69134c
Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents:
1411
diff
changeset
|
145 |
|
779 | 146 |
/****************************************************************************** |
147 |
* Data types |
|
148 |
*****************************************************************************/ |
|
541
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
149 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
struct ec_master; |
286
f3352378b4d4
Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents:
276
diff
changeset
|
151 |
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
|
152 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
153 |
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
|
154 |
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
|
155 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
struct ec_domain; |
286
f3352378b4d4
Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents:
276
diff
changeset
|
157 |
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
|
158 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
159 |
struct ec_sdo_request; |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
160 |
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
|
161 |
|
1209 | 162 |
struct ec_voe_handler; |
163 |
typedef struct ec_voe_handler ec_voe_handler_t; /**< \see ec_voe_handler. */ |
|
164 |
||
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
165 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
166 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
167 |
/** Master state. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
168 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
169 |
* 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
|
170 |
* |
9bf2ddf05e17
Completed ec_master_state_t and documented ec_master_state_t and
Florian Pose <fp@igh-essen.com>
parents:
1010
diff
changeset
|
171 |
* \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
|
172 |
*/ |
aede068f9a74
Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents:
541
diff
changeset
|
173 |
typedef struct { |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
174 |
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
|
175 |
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
|
176 |
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
|
177 |
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
|
178 |
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
|
179 |
state: |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
180 |
- Bit 0: \a INIT |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
181 |
- Bit 1: \a PREOP |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
182 |
- Bit 2: \a SAFEOP |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
183 |
- Bit 3: \a OP */ |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
184 |
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
|
185 |
} 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
|
186 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
187 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
188 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
189 |
/** Slave configuration state. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
190 |
* |
1020
9bf2ddf05e17
Completed ec_master_state_t and documented ec_master_state_t and
Florian Pose <fp@igh-essen.com>
parents:
1010
diff
changeset
|
191 |
* 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
|
192 |
* |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
193 |
* \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
|
194 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
195 |
typedef struct { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
196 |
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
|
197 |
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
|
198 |
using the specified configuration. */ |
1022
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
199 |
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
|
200 |
- 1: \a INIT |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
201 |
- 2: \a PREOP |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
202 |
- 4: \a SAFEOP |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
203 |
- 8: \a OP |
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
204 |
|
8e49b519e6ba
Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents:
1020
diff
changeset
|
205 |
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
|
206 |
bit! */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
207 |
} 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
|
208 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
209 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
210 |
|
1497
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
211 |
/** Master information. |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
212 |
* |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
213 |
* This is used as an output parameter of ecrt_master(). |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
214 |
* |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
215 |
* \see ecrt_master(). |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
216 |
*/ |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
217 |
typedef struct { |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
218 |
unsigned int slave_count; /**< Number of slaves in the bus. */ |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
219 |
unsigned int link_up : 1; /**< \a true, if the network link is up. */ |
1804 | 220 |
uint8_t scan_busy; /**< \a true, while the master is scanning the bus */ |
1497
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
221 |
uint64_t app_time; /**< Application time. */ |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
222 |
} ec_master_info_t; |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
223 |
|
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
224 |
/*****************************************************************************/ |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
225 |
|
1341
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
226 |
/** Slave information. |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
227 |
* |
1510
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
228 |
* This is used as an output parameter of ecrt_master_get_slave(). |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
229 |
* |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
230 |
* \see ecrt_master_get_slave(). |
1341
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
231 |
*/ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
232 |
typedef struct { |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
233 |
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
|
234 |
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
|
235 |
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
|
236 |
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
|
237 |
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
|
238 |
uint16_t alias; /**< The slaves alias if not equal to 0. */ |
1466
362147819ca1
EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents:
1448
diff
changeset
|
239 |
int16_t current_on_ebus; /**< Used current in mA. */ |
1341
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
240 |
uint8_t al_state; /**< Current state of the slave. */ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
241 |
uint8_t error_flag; /**< Error flag for that slave. */ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
242 |
uint8_t sync_count; /**< Number of sync managers. */ |
1512 | 243 |
uint16_t sdo_count; /**< Number of SDOs. */ |
1341
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
244 |
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
|
245 |
} ec_slave_info_t; |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
246 |
|
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
247 |
/*****************************************************************************/ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
248 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
249 |
/** 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
|
250 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
251 |
* 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
|
252 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
253 |
typedef enum { |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
254 |
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
|
255 |
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
|
256 |
exchanged. */ |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
257 |
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
|
258 |
} 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
|
259 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
260 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
261 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
262 |
/** Domain state. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
263 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
264 |
* 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
|
265 |
*/ |
16e9ad7d8e12
Added parameters for vendor ID and product code to ecrt_get_slave(); PDO
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
266 |
typedef struct { |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
267 |
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
|
268 |
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
|
269 |
} 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
|
270 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
271 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
272 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
273 |
/** Direction type for PDO assignment functions. |
779 | 274 |
*/ |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
612
diff
changeset
|
275 |
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
|
276 |
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
|
277 |
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
|
278 |
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
|
279 |
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
|
280 |
} ec_direction_t; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
281 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
282 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
283 |
|
1509
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
284 |
/** Watchdog mode for sync manager configuration. |
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
285 |
* |
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
286 |
* Used to specify, if a sync manager's watchdog is to be enabled. |
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
287 |
*/ |
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
288 |
typedef enum { |
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
289 |
EC_WD_DEFAULT, /**< Use the default setting of the sync manager. */ |
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
290 |
EC_WD_ENABLE, /**< Enable the watchdog. */ |
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
291 |
EC_WD_DISABLE, /**< Disable the watchdog. */ |
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
292 |
} ec_watchdog_mode_t; |
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
293 |
|
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
294 |
/*****************************************************************************/ |
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
295 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
296 |
/** 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
|
297 |
* |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
298 |
* 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
|
299 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
300 |
* \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
|
301 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
302 |
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
|
303 |
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
|
304 |
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
|
305 |
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
|
306 |
} 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
|
307 |
|
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 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
310 |
/** 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
|
311 |
* |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
312 |
* 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
|
313 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
314 |
* \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
|
315 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
316 |
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
|
317 |
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
|
318 |
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
|
319 |
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
|
320 |
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
|
321 |
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
|
322 |
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
|
323 |
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
|
324 |
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
|
325 |
} 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
|
326 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
327 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
328 |
|
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
329 |
/** 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
|
330 |
* |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
331 |
* 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
|
332 |
* 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
|
333 |
* 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
|
334 |
*/ |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
335 |
typedef struct { |
1083
1322dc34cb37
Updated header docs, features and news file.
Florian Pose <fp@igh-essen.com>
parents:
1082
diff
changeset
|
336 |
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
|
337 |
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
|
338 |
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
|
339 |
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
|
340 |
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
|
341 |
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
|
342 |
at least \a n_pdos PDOs. */ |
1509
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
343 |
ec_watchdog_mode_t watchdog_mode; /**< Watchdog mode. */ |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
344 |
} 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
|
345 |
|
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
346 |
/*****************************************************************************/ |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
347 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
348 |
/** 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
|
349 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
350 |
* 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
|
351 |
* 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
|
352 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
353 |
typedef struct { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
354 |
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
|
355 |
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
|
356 |
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
|
357 |
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
|
358 |
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
|
359 |
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
|
360 |
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
|
361 |
(byte-)offset in the process data. */ |
1092 | 362 |
unsigned int *bit_position; /**< Pointer to a variable to store a bit |
363 |
position (0-7) within the \a offset. Can be |
|
364 |
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
|
365 |
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
|
366 |
} ec_pdo_entry_reg_t; |
416
4f007cd2a79d
ecrt_domain_register_pdo_range() implemented.
Florian Pose <fp@igh-essen.com>
parents:
325
diff
changeset
|
367 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
368 |
/*****************************************************************************/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
369 |
|
1209 | 370 |
/** Request state. |
371 |
* |
|
372 |
* This is used as return type for ecrt_sdo_request_state() and |
|
373 |
* ecrt_voe_handler_state(). |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
374 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
375 |
typedef enum { |
1209 | 376 |
EC_REQUEST_UNUSED, /**< Not requested. */ |
377 |
EC_REQUEST_BUSY, /**< Request is being processed. */ |
|
378 |
EC_REQUEST_SUCCESS, /**< Request was processed successfully. */ |
|
379 |
EC_REQUEST_ERROR, /**< Request processing failed. */ |
|
380 |
} ec_request_state_t; |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
381 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
382 |
/****************************************************************************** |
779 | 383 |
* Global functions |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
384 |
*****************************************************************************/ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
|
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
|
386 |
#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
|
387 |
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
|
388 |
#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
|
389 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
390 |
/** 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
|
391 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
392 |
* \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
|
393 |
*/ |
541
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
394 |
unsigned int ecrt_version_magic(void); |
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
395 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
396 |
/** 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
|
397 |
* |
1092 | 398 |
* Before an application can access an EtherCAT master, it has to reserve one |
399 |
* for exclusive use. |
|
400 |
* |
|
1497
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
401 |
* In userspace, this is a convenience function for ecrt_open_master() and |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
402 |
* ecrt_master_reserve(). |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
403 |
* |
1092 | 404 |
* This function has to be the first function an application has to call to |
405 |
* use EtherCAT. The function takes the index of the master as its argument. |
|
406 |
* The first master has index 0, the n-th master has index n - 1. The number |
|
407 |
* of masters has to be specified when loading the master module. |
|
408 |
* |
|
1312
74853e018898
Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents:
1288
diff
changeset
|
409 |
* \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
|
410 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
411 |
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
|
412 |
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
|
413 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
414 |
|
1497
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
415 |
#ifndef __KERNEL__ |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
416 |
|
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
417 |
/** Opens an EtherCAT master for userspace access. |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
418 |
* |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
419 |
* This function has to be the first function an application has to call to |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
420 |
* use EtherCAT. The function takes the index of the master as its argument. |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
421 |
* The first master has index 0, the n-th master has index n - 1. The number |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
422 |
* of masters has to be specified when loading the master module. |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
423 |
* |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
424 |
* For convenience, the function ecrt_request_master() can be used. |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
425 |
* |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
426 |
* \return Pointer to the opened master, otherwise \a NULL. |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
427 |
*/ |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
428 |
ec_master_t *ecrt_open_master( |
1804 | 429 |
unsigned int master_index /**< Index of the master to request. */ |
430 |
); |
|
1497
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
431 |
|
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
432 |
#endif // #ifndef __KERNEL__ |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
433 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
434 |
/** Releases a requested EtherCAT master. |
1092 | 435 |
* |
436 |
* After use, a master it has to be released to make it available for other |
|
437 |
* applications. |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
438 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
439 |
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
|
440 |
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
|
441 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
442 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
443 |
/****************************************************************************** |
779 | 444 |
* Master methods |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
445 |
*****************************************************************************/ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
446 |
|
1497
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
447 |
#ifndef __KERNEL__ |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
448 |
|
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
449 |
/** Reserves an EtherCAT master for realtime operation. |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
450 |
* |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
451 |
* Before an application can use PDO/domain registration functions or SDO |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
452 |
* request functions on the master, it has to reserve one for exclusive use. |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
453 |
* |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
454 |
* \return 0 in case of success, else < 0 |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
455 |
* |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
456 |
*/ |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
457 |
int ecrt_master_reserve( |
1804 | 458 |
ec_master_t *master /**< EtherCAT master */ |
459 |
); |
|
1497
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
460 |
|
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
461 |
#endif // #ifndef __KERNEL__ |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
462 |
|
1244
0b70040d3daa
No kernel handles in userspace; Domain creation.
Florian Pose <fp@igh-essen.com>
parents:
1239
diff
changeset
|
463 |
#ifdef __KERNEL__ |
0b70040d3daa
No kernel handles in userspace; Domain creation.
Florian Pose <fp@igh-essen.com>
parents:
1239
diff
changeset
|
464 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
465 |
/** 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
|
466 |
* |
1500
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
467 |
* For concurrent master access, i. e. if other instances than the application |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
468 |
* want to send and receive datagrams on the bus, the application has to |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
469 |
* provide a callback mechanism. This method takes two function pointers as |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
470 |
* its parameters. Asynchronous master access (like EoE processing) is only |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
471 |
* possible if the callbacks have been set. |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
472 |
* |
1512 | 473 |
* The task of the send callback (\a send_cb) is to decide, if the bus is |
474 |
* currently accessible and whether or not to call the ecrt_master_send_ext() |
|
1500
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
475 |
* method. |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
476 |
* |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
477 |
* The task of the receive callback (\a receive_cb) is to decide, if a call to |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
478 |
* ecrt_master_receive() is allowed and to execute it respectively. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
479 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
480 |
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
|
481 |
ec_master_t *master, /**< EtherCAT master */ |
1513
60ca68d853b8
Re-added callback data pointer, because it is necessary for some applications.
Florian Pose <fp@igh-essen.com>
parents:
1512
diff
changeset
|
482 |
void (*send_cb)(void *), /**< Datagram sending callback. */ |
60ca68d853b8
Re-added callback data pointer, because it is necessary for some applications.
Florian Pose <fp@igh-essen.com>
parents:
1512
diff
changeset
|
483 |
void (*receive_cb)(void *), /**< Receive callback. */ |
60ca68d853b8
Re-added callback data pointer, because it is necessary for some applications.
Florian Pose <fp@igh-essen.com>
parents:
1512
diff
changeset
|
484 |
void *cb_data /**< Arbitraty pointer passed to the callback functions. |
60ca68d853b8
Re-added callback data pointer, because it is necessary for some applications.
Florian Pose <fp@igh-essen.com>
parents:
1512
diff
changeset
|
485 |
*/ |
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 |
|
1244
0b70040d3daa
No kernel handles in userspace; Domain creation.
Florian Pose <fp@igh-essen.com>
parents:
1239
diff
changeset
|
488 |
#endif /* __KERNEL__ */ |
0b70040d3daa
No kernel handles in userspace; Domain creation.
Florian Pose <fp@igh-essen.com>
parents:
1239
diff
changeset
|
489 |
|
1092 | 490 |
/** Creates a new process data domain. |
491 |
* |
|
492 |
* For process data exchange, at least one process data domain is needed. |
|
493 |
* 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
|
494 |
* new domain object. This object can be used for registering PDOs and |
1092 | 495 |
* 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
|
496 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
497 |
* \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
|
498 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
499 |
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
|
500 |
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
|
501 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
502 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
503 |
/** 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
|
504 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
505 |
* 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
|
506 |
* 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
|
507 |
* 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
|
508 |
* 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
|
509 |
* 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
|
510 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
511 |
* 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
|
512 |
* - 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
|
513 |
* ring position. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
514 |
* - 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
|
515 |
* 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
|
516 |
* 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
|
517 |
* 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
|
518 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
519 |
* 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
|
520 |
* 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
|
521 |
* 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
|
522 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
523 |
* 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
|
524 |
* 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
|
525 |
* applied. |
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 |
* \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
|
528 |
* \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
|
529 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
530 |
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
|
531 |
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
|
532 |
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
|
533 |
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
|
534 |
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
|
535 |
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
|
536 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
537 |
|
1497
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
538 |
/** Obtains master information. |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
539 |
* |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
540 |
* No memory is allocated on the heap in |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
541 |
* this function. |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
542 |
* |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
543 |
* \attention The pointer to this structure must point to a valid variable. |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
544 |
* |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
545 |
* \return 0 in case of success, else < 0 |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
546 |
*/ |
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
547 |
int ecrt_master( |
1804 | 548 |
ec_master_t *master, /**< EtherCAT master */ |
549 |
ec_master_info_t *master_info /**< Structure that will output the |
|
550 |
information */ |
|
551 |
); |
|
1497
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
552 |
|
1341
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
553 |
/** Obtains slave information. |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
554 |
* |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
555 |
* 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
|
556 |
* 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
|
557 |
* this function. |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
558 |
* |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
559 |
* \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
|
560 |
* |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
561 |
* \return 0 in case of success, else < 0 |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
562 |
*/ |
1510
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
563 |
int ecrt_master_get_slave( |
1341
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
564 |
ec_master_t *master, /**< EtherCAT master */ |
1510
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
565 |
uint16_t slave_position, /**< Slave position. */ |
1341
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
566 |
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
|
567 |
information */ |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
568 |
); |
32ba7ffb6c7f
Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents:
1327
diff
changeset
|
569 |
|
1594
2019bec460ad
Implemented ecrt_master() and ecrt_master_get_slave() in kernel space.
Florian Pose <fp@igh-essen.com>
parents:
1585
diff
changeset
|
570 |
#ifndef __KERNEL__ |
2019bec460ad
Implemented ecrt_master() and ecrt_master_get_slave() in kernel space.
Florian Pose <fp@igh-essen.com>
parents:
1585
diff
changeset
|
571 |
|
1510
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
572 |
/** Returns the proposed configuration of a slave's sync manager. |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
573 |
* |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
574 |
* Fills a given ec_sync_info_t structure with the attributes of a sync |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
575 |
* manager. The \a pdos field of the return value is left empty. Use |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
576 |
* ecrt_master_get_pdo() to get the PDO information. |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
577 |
* |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
578 |
* \return zero on success, else non-zero |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
579 |
*/ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
580 |
int ecrt_master_get_sync_manager( |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
581 |
ec_master_t *master, /**< EtherCAT master. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
582 |
uint16_t slave_position, /**< Slave position. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
583 |
uint8_t sync_index, /**< Sync manager index. Must be less |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
584 |
than #EC_MAX_SYNC_MANAGERS. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
585 |
ec_sync_info_t *sync /**< Pointer to output structure. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
586 |
); |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
587 |
|
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
588 |
/** Returns information about a currently assigned PDO. |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
589 |
* |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
590 |
* Fills a given ec_pdo_info_t structure with the attributes of a currently |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
591 |
* assigned PDO of the given sync manager. The \a entries field of the return |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
592 |
* value is left empty. Use ecrt_master_get_pdo_entry() to get the PDO |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
593 |
* entry information. |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
594 |
* |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
595 |
* \retval zero on success, else non-zero |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
596 |
*/ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
597 |
int ecrt_master_get_pdo( |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
598 |
ec_master_t *master, /**< EtherCAT master. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
599 |
uint16_t slave_position, /**< Slave position. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
600 |
uint8_t sync_index, /**< Sync manager index. Must be less |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
601 |
than #EC_MAX_SYNC_MANAGERS. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
602 |
uint16_t pos, /**< Zero-based PDO position. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
603 |
ec_pdo_info_t *pdo /**< Pointer to output structure. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
604 |
); |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
605 |
|
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
606 |
/** Returns information about a currently mapped PDO entry. |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
607 |
* |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
608 |
* Fills a given ec_pdo_entry_info_t structure with the attributes of a |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
609 |
* currently mapped PDO entry of the given PDO. |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
610 |
* |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
611 |
* \retval zero on success, else non-zero |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
612 |
*/ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
613 |
int ecrt_master_get_pdo_entry( |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
614 |
ec_master_t *master, /**< EtherCAT master. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
615 |
uint16_t slave_position, /**< Slave position. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
616 |
uint8_t sync_index, /**< Sync manager index. Must be less |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
617 |
than #EC_MAX_SYNC_MANAGERS. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
618 |
uint16_t pdo_pos, /**< Zero-based PDO position. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
619 |
uint16_t entry_pos, /**< Zero-based PDO entry position. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
620 |
ec_pdo_entry_info_t *entry /**< Pointer to output structure. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
621 |
); |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
622 |
|
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
623 |
/** Executes an SDO write request to download data. |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
624 |
* |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
625 |
* This function operates aside of the normal way to request SDOs. Before the |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
626 |
* activation of the master, these requests are processed by the master state |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
627 |
* machine itself. After activation the user has to ensure cyclic processing. |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
628 |
* |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
629 |
* \retval 0 Success. |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
630 |
* \retval -1 An error occured. |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
631 |
*/ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
632 |
int ecrt_master_sdo_download( |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
633 |
ec_master_t *master, /**< EtherCAT master. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
634 |
uint16_t slave_position, /**< Slave position. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
635 |
uint16_t index, /**< Index of the SDO. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
636 |
uint8_t subindex, /**< Subindex of the SDO. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
637 |
uint8_t *data, /**< Data buffer to download. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
638 |
size_t data_size, /**< Size of the data buffer. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
639 |
uint32_t *abort_code /**< Abort code of the SDO download. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
640 |
); |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
641 |
|
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
642 |
/** Executes a SDO read request to upload data. |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
643 |
* |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
644 |
* This function operates aside of the normal way to request SDOs. Before the |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
645 |
* activation of the master, these requests are processed by the master state |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
646 |
* machine itself. After activation the user have to ensure cyclic |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
647 |
* processing. |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
648 |
* |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
649 |
* \retval 0 Success. |
1512 | 650 |
* \retval -1 Error occurred. |
1510
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
651 |
*/ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
652 |
int ecrt_master_sdo_upload( |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
653 |
ec_master_t *master, /**< EtherCAT master. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
654 |
uint16_t slave_position, /**< Slave position. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
655 |
uint16_t index, /**< Index of the SDO. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
656 |
uint8_t subindex, /**< Subindex of the SDO. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
657 |
uint8_t *target, /**< Target buffer for the upload. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
658 |
size_t target_size, /**< Size of the target buffer. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
659 |
size_t *result_size, /**< Uploaded data size. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
660 |
uint32_t *abort_code /**< Abort code of the SDO upload. */ |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
661 |
); |
88b608a1a7f3
Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents:
1509
diff
changeset
|
662 |
|
1497
c9308eb34c0e
Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1495
diff
changeset
|
663 |
#endif /* #ifndef __KERNEL__ */ |
1441
27a8d6f97a95
Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download(). Thanks to
Florian Pose <fp@igh-essen.com>
parents:
1438
diff
changeset
|
664 |
|
1096 | 665 |
/** 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
|
666 |
* |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
667 |
* 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
|
668 |
* 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
|
669 |
* 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
|
670 |
* 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
|
671 |
* 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
|
672 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
673 |
* \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
|
674 |
* 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
|
675 |
* 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
|
676 |
* 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
|
677 |
* 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
|
678 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
679 |
* \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
|
680 |
*/ |
1007 | 681 |
int ecrt_master_activate( |
682 |
ec_master_t *master /**< EtherCAT master. */ |
|
683 |
); |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
684 |
|
1530
96629de2202b
Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents:
1526
diff
changeset
|
685 |
/** Deactivates the master. |
96629de2202b
Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents:
1526
diff
changeset
|
686 |
* |
96629de2202b
Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents:
1526
diff
changeset
|
687 |
* Removes the bus configuration. All objects created by |
96629de2202b
Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents:
1526
diff
changeset
|
688 |
* ecrt_master_create_domain(), ecrt_master_slave_config(), ecrt_domain_data() |
96629de2202b
Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents:
1526
diff
changeset
|
689 |
* ecrt_slave_config_create_sdo_request() and |
96629de2202b
Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents:
1526
diff
changeset
|
690 |
* ecrt_slave_config_create_voe_handler() are freed, so pointers to them |
96629de2202b
Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents:
1526
diff
changeset
|
691 |
* become invalid. |
96629de2202b
Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents:
1526
diff
changeset
|
692 |
*/ |
96629de2202b
Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents:
1526
diff
changeset
|
693 |
void ecrt_master_deactivate( |
96629de2202b
Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents:
1526
diff
changeset
|
694 |
ec_master_t *master /**< EtherCAT master. */ |
96629de2202b
Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents:
1526
diff
changeset
|
695 |
); |
96629de2202b
Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents:
1526
diff
changeset
|
696 |
|
1585
1f640e321ee4
ecrt_master_set_max_cycle_size: limit SDO traffic
Martin Troxler <martin.troxler@komaxgroup.com>
parents:
1580
diff
changeset
|
697 |
|
1600
e36c92cf58a9
use given send interval to limit SDO/FOE traffic
Martin Troxler <martin.troxler@komaxgroup.com>
parents:
1585
diff
changeset
|
698 |
/** Set interval between calls to ecrt_master_send |
e36c92cf58a9
use given send interval to limit SDO/FOE traffic
Martin Troxler <martin.troxler@komaxgroup.com>
parents:
1585
diff
changeset
|
699 |
* |
e36c92cf58a9
use given send interval to limit SDO/FOE traffic
Martin Troxler <martin.troxler@komaxgroup.com>
parents:
1585
diff
changeset
|
700 |
*/ |
e36c92cf58a9
use given send interval to limit SDO/FOE traffic
Martin Troxler <martin.troxler@komaxgroup.com>
parents:
1585
diff
changeset
|
701 |
int ecrt_master_set_send_interval( |
1585
1f640e321ee4
ecrt_master_set_max_cycle_size: limit SDO traffic
Martin Troxler <martin.troxler@komaxgroup.com>
parents:
1580
diff
changeset
|
702 |
ec_master_t *master, /**< EtherCAT master. */ |
1804 | 703 |
size_t send_interval /**< Send interval in us */ |
1585
1f640e321ee4
ecrt_master_set_max_cycle_size: limit SDO traffic
Martin Troxler <martin.troxler@komaxgroup.com>
parents:
1580
diff
changeset
|
704 |
); |
1f640e321ee4
ecrt_master_set_max_cycle_size: limit SDO traffic
Martin Troxler <martin.troxler@komaxgroup.com>
parents:
1580
diff
changeset
|
705 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
706 |
/** 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
|
707 |
* |
1092 | 708 |
* This method takes all datagrams, that have been queued for transmission, |
709 |
* puts them into frames, and passes them to the Ethernet device for sending. |
|
710 |
* |
|
711 |
* Has to be called cyclically by the application after ecrt_master_activate() |
|
712 |
* has returned. |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
713 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
714 |
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
|
715 |
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
|
716 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
717 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
718 |
/** 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
|
719 |
* |
1092 | 720 |
* Queries the network device for received frames by calling the interrupt |
721 |
* service routine. Extracts received datagrams and dispatches the results to |
|
722 |
* the datagram objects in the queue. Received datagrams, and the ones that |
|
723 |
* timed out, will be marked, and dequeued. |
|
724 |
* |
|
725 |
* 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
|
726 |
* 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
|
727 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
728 |
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
|
729 |
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
|
730 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
731 |
|
1500
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
732 |
/** Sends non-application datagrams. |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
733 |
* |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
734 |
* This method has to be called in the send callback function passed via |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
735 |
* ecrt_master_callbacks() to allow the sending of non-application datagrams. |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
736 |
*/ |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
737 |
void ecrt_master_send_ext( |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
738 |
ec_master_t *master /**< EtherCAT master. */ |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
739 |
); |
ed1a733efbc5
Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents:
1497
diff
changeset
|
740 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
741 |
/** 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
|
742 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
743 |
* 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
|
744 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
745 |
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
|
746 |
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
|
747 |
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
|
748 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
749 |
|
1434
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
750 |
/** Sets the application time. |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
751 |
* |
1466
362147819ca1
EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents:
1448
diff
changeset
|
752 |
* The master has to know the application's time when operating slaves with |
362147819ca1
EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents:
1448
diff
changeset
|
753 |
* distributed clocks. The time is not incremented by the master itself, so |
362147819ca1
EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents:
1448
diff
changeset
|
754 |
* this method has to be called cyclically. |
362147819ca1
EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents:
1448
diff
changeset
|
755 |
* |
362147819ca1
EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents:
1448
diff
changeset
|
756 |
* The time is used when setting the slaves' <tt>System Time Offset</tt> and |
362147819ca1
EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents:
1448
diff
changeset
|
757 |
* <tt>Cyclic Operation Start Time</tt> registers and when synchronizing the |
362147819ca1
EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents:
1448
diff
changeset
|
758 |
* DC reference clock to the application time via |
362147819ca1
EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents:
1448
diff
changeset
|
759 |
* ecrt_master_sync_reference_clock(). |
1434
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
760 |
* |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
761 |
* 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
|
762 |
* 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
|
763 |
*/ |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
764 |
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
|
765 |
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
|
766 |
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
|
767 |
); |
e77728ddf0f9
Introduced ecrt_master_sync() for synchronizing slave clocks to reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1392
diff
changeset
|
768 |
|
1434
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
769 |
/** 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
|
770 |
* |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
771 |
* 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
|
772 |
* 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
|
773 |
*/ |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
774 |
void ecrt_master_sync_reference_clock( |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
775 |
ec_master_t *master /**< EtherCAT master. */ |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
776 |
); |
4c6fe0ae37f1
Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents:
1417
diff
changeset
|
777 |
|
1410
fb6719008bf5
Separated sync_reference_clock() and sync_slave_clocks().
Florian Pose <fp@igh-essen.com>
parents:
1396
diff
changeset
|
778 |
/** 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
|
779 |
* |
fb6719008bf5
Separated sync_reference_clock() and sync_slave_clocks().
Florian Pose <fp@igh-essen.com>
parents:
1396
diff
changeset
|
780 |
* 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
|
781 |
*/ |
fb6719008bf5
Separated sync_reference_clock() and sync_slave_clocks().
Florian Pose <fp@igh-essen.com>
parents:
1396
diff
changeset
|
782 |
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
|
783 |
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
|
784 |
); |
fb6719008bf5
Separated sync_reference_clock() and sync_slave_clocks().
Florian Pose <fp@igh-essen.com>
parents:
1396
diff
changeset
|
785 |
|
1535
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
786 |
/** Queues the DC synchonity monitoring datagram for sending. |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
787 |
* |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
788 |
* The datagram broadcast-reads all "System time difference" registers (\a |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
789 |
* 0x092c) to get an upper estiomation of the DC synchony. The result can be |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
790 |
* checked with the ecrt_master_sync_monitor_process() method. |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
791 |
*/ |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
792 |
void ecrt_master_sync_monitor_queue( |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
793 |
ec_master_t *master /**< EtherCAT master. */ |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
794 |
); |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
795 |
|
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
796 |
/** Processes the DC synchonity monitoring datagram. |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
797 |
* |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
798 |
* If the sync monitoring datagram was sent before with |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
799 |
* ecrt_master_sync_monitor_queue(), the result can be queried with this |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
800 |
* method. |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
801 |
* |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
802 |
* \return Upper estination of the maximum time difference in ns. |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
803 |
*/ |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
804 |
uint32_t ecrt_master_sync_monitor_process( |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
805 |
ec_master_t *master /**< EtherCAT master. */ |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
806 |
); |
0c484ee12d89
DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents:
1530
diff
changeset
|
807 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
808 |
/****************************************************************************** |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
809 |
* Slave configuration methods |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
810 |
*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
811 |
|
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
812 |
/** 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
|
813 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
814 |
* 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
|
815 |
* 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
|
816 |
* |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
817 |
* \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
|
818 |
*/ |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
819 |
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
|
820 |
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
|
821 |
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
|
822 |
than #EC_MAX_SYNC_MANAGERS. */ |
1509
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
823 |
ec_direction_t direction, /**< Input/Output. */ |
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
824 |
ec_watchdog_mode_t watchdog_mode /** Watchdog mode. */ |
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
825 |
); |
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
826 |
|
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
827 |
/** Configure a slave's watchdog times. |
1536
171ddba165d2
Added watchdog documentation.
Florian Pose <fp@igh-essen.com>
parents:
1535
diff
changeset
|
828 |
*/ |
1509
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
829 |
void ecrt_slave_config_watchdog( |
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
830 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
831 |
uint16_t watchdog_divider, /**< Number of 40 ns intervals. Used as a |
1536
171ddba165d2
Added watchdog documentation.
Florian Pose <fp@igh-essen.com>
parents:
1535
diff
changeset
|
832 |
base unit for all slave watchdogs. If set |
171ddba165d2
Added watchdog documentation.
Florian Pose <fp@igh-essen.com>
parents:
1535
diff
changeset
|
833 |
to zero, the value is not written, so the |
171ddba165d2
Added watchdog documentation.
Florian Pose <fp@igh-essen.com>
parents:
1535
diff
changeset
|
834 |
default ist used. */ |
1509
a864688e7de5
Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents:
1500
diff
changeset
|
835 |
uint16_t watchdog_intervals /**< Number of base intervals for process |
1536
171ddba165d2
Added watchdog documentation.
Florian Pose <fp@igh-essen.com>
parents:
1535
diff
changeset
|
836 |
data watchdog. If set to zero, the value |
171ddba165d2
Added watchdog documentation.
Florian Pose <fp@igh-essen.com>
parents:
1535
diff
changeset
|
837 |
is not written, so the default is used. |
171ddba165d2
Added watchdog documentation.
Florian Pose <fp@igh-essen.com>
parents:
1535
diff
changeset
|
838 |
*/ |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
839 |
); |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
840 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
841 |
/** 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
|
842 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
843 |
* \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
|
844 |
* \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
|
845 |
*/ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
846 |
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
|
847 |
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
|
848 |
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
|
849 |
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
|
850 |
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
|
851 |
); |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
852 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
853 |
/** 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
|
854 |
* |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
855 |
* 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
|
856 |
* 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
|
857 |
* 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
|
858 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
859 |
* \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
|
860 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
861 |
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
|
862 |
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
|
863 |
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
|
864 |
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
|
865 |
); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
866 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
867 |
/** 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
|
868 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
869 |
* \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
|
870 |
* \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
|
871 |
*/ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
872 |
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
|
873 |
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
|
874 |
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
|
875 |
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
|
876 |
mapping. */ |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
877 |
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
|
878 |
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
|
879 |
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
|
880 |
); |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
881 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
882 |
/** 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
|
883 |
* |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
884 |
* 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
|
885 |
* 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
|
886 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
887 |
* \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
|
888 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
889 |
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
|
890 |
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
|
891 |
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
|
892 |
); |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
893 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
894 |
/** 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
|
895 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
896 |
* 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
|
897 |
* 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
|
898 |
* 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
|
899 |
* 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
|
900 |
* 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
|
901 |
* |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
902 |
* 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
|
903 |
* 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
|
904 |
* 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
|
905 |
* configuration time: |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
906 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
907 |
* \code |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
908 |
* 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
|
909 |
* {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
|
910 |
* {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
|
911 |
* }; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
912 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
913 |
* 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
|
914 |
* {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
|
915 |
* {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
|
916 |
* }; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
917 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
918 |
* 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
|
919 |
* {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
|
920 |
* {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
|
921 |
* }; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
922 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
923 |
* 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
|
924 |
* {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
|
925 |
* {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
|
926 |
* {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
|
927 |
* }; |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
928 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
929 |
* 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
|
930 |
* // handle error |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
931 |
* } |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
932 |
* \endcode |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
933 |
* |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
934 |
* 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
|
935 |
* 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
|
936 |
* 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
|
937 |
* 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
|
938 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
939 |
* \code |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
940 |
* 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
|
941 |
* {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
|
942 |
* {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
|
943 |
* }; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
944 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
945 |
* 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
|
946 |
* {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
|
947 |
* }; |
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
948 |
* |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
949 |
* 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
|
950 |
* // handle error |
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
951 |
* } |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
952 |
* \endcode |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
953 |
* |
1055
2be8918682fa
Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents:
1022
diff
changeset
|
954 |
* 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
|
955 |
* - 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
|
956 |
* - 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
|
957 |
* \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
|
958 |
* using EC_END is recommended. |
878 | 959 |
* |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
960 |
* \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
|
961 |
*/ |
1082
ff06c58e269c
Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents:
1055
diff
changeset
|
962 |
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
|
963 |
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
|
964 |
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
|
965 |
\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
|
966 |
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
|
967 |
configurations. */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
968 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
969 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
970 |
/** 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
|
971 |
* |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
972 |
* 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
|
973 |
* 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
|
974 |
* 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
|
975 |
* 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
|
976 |
* 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
|
977 |
* 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
|
978 |
* 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
|
979 |
* 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
|
980 |
* 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
|
981 |
* |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
982 |
* \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
|
983 |
* \retval <0 Error code. |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
793
diff
changeset
|
984 |
*/ |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
793
diff
changeset
|
985 |
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
|
986 |
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
|
987 |
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
|
988 |
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
|
989 |
ec_domain_t *domain, /**< Domain. */ |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
923
diff
changeset
|
990 |
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
|
991 |
is desired */ |
916
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
900
diff
changeset
|
992 |
); |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
900
diff
changeset
|
993 |
|
1448
d7ba0c408a07
Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents:
1441
diff
changeset
|
994 |
/** Configure distributed clocks. |
d7ba0c408a07
Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents:
1441
diff
changeset
|
995 |
* |
d7ba0c408a07
Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents:
1441
diff
changeset
|
996 |
* 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
|
997 |
* signals. |
1392
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1384
diff
changeset
|
998 |
* |
8fcc1d0987c1
DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1384
diff
changeset
|
999 |
* 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
|
1000 |
* 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
|
1001 |
* 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
|
1002 |
*/ |
1448
d7ba0c408a07
Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents:
1441
diff
changeset
|
1003 |
void ecrt_slave_config_dc( |
1804 | 1004 |
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
|
1005 |
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
|
1006 |
uint32_t sync0_cycle, /**< SYNC0 cycle time [ns]. */ |
1804 | 1007 |
uint32_t sync0_shift, /**< SYNC0 shift time [ns]. */ |
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
|
1008 |
uint32_t sync1_cycle, /**< SYNC1 cycle time [ns]. */ |
1804 | 1009 |
uint32_t sync1_shift /**< SYNC1 shift time [ns]. */ |
1010 |
); |
|
1411 | 1011 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1012 |
/** 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
|
1013 |
* |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1014 |
* 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
|
1015 |
* 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
|
1016 |
* 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
|
1017 |
* 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
|
1018 |
* |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1019 |
* \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
|
1020 |
* 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
|
1021 |
* 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
|
1022 |
* 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
|
1023 |
* friends instead. |
9e7fe258495e
Added attention to ecrt_slave_config_sdo().
Florian Pose <fp@igh-essen.com>
parents:
1096
diff
changeset
|
1024 |
* |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1025 |
* 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
|
1026 |
* 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
|
1027 |
* 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
|
1028 |
* 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
|
1029 |
* 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
|
1030 |
* |
1313
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
1031 |
* \retval 0 Success. |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
1032 |
* \retval <0 Error code. |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
1033 |
*/ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
1034 |
int ecrt_slave_config_sdo( |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
1035 |
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
|
1036 |
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
|
1037 |
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
|
1038 |
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
|
1039 |
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
|
1040 |
); |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
1041 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1042 |
/** 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
|
1043 |
* |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
1044 |
* \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
|
1045 |
* |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
1046 |
* \retval 0 Success. |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
1047 |
* \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
|
1048 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1049 |
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
|
1050 |
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
|
1051 |
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
|
1052 |
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
|
1053 |
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
|
1054 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1055 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1056 |
/** 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
|
1057 |
* |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
1058 |
* \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
|
1059 |
* |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
1060 |
* \retval 0 Success. |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
1061 |
* \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
|
1062 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1063 |
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
|
1064 |
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
|
1065 |
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
|
1066 |
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
|
1067 |
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
|
1068 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1069 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1070 |
/** 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
|
1071 |
* |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
1072 |
* \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
|
1073 |
* |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
1074 |
* \retval 0 Success. |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
1075 |
* \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
|
1076 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1077 |
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
|
1078 |
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
|
1079 |
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
|
1080 |
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
|
1081 |
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
|
1082 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1083 |
|
1526
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
1084 |
/** Add configuration data for a complete SDO. |
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
1085 |
* |
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
1086 |
* The SDO data are transferred via CompleteAccess. Data for the first |
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
1087 |
* subindex (0) have to be included. |
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
1088 |
* |
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
1089 |
* \see ecrt_slave_config_sdo(). |
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
1090 |
* |
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
1091 |
* \retval 0 Success. |
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
1092 |
* \retval <0 Error code. |
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
1093 |
*/ |
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
1094 |
int ecrt_slave_config_complete_sdo( |
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
1095 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
1096 |
uint16_t index, /**< Index of the SDO to configure. */ |
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
1097 |
const uint8_t *data, /**< Pointer to the data. */ |
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
1098 |
size_t size /**< Size of the \a data. */ |
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
1099 |
); |
66edd310830c
Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents:
1513
diff
changeset
|
1100 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1101 |
/** 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
|
1102 |
* |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1103 |
* 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
|
1104 |
* released. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1105 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1106 |
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
|
1107 |
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
|
1108 |
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
|
1109 |
uint8_t subindex, /**< SDO subindex. */ |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1110 |
size_t size /**< Data size to reserve. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1111 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1112 |
|
1209 | 1113 |
/** Create an VoE handler to exchange vendor-specific data during realtime |
1114 |
* operation. |
|
1115 |
* |
|
1267 | 1116 |
* The number of VoE handlers per slave configuration is not limited, but |
1117 |
* usually it is enough to create one for sending and one for receiving, if |
|
1118 |
* both can be done simultaneously. |
|
1119 |
* |
|
1209 | 1120 |
* The created VoE handler object is freed automatically when the master is |
1121 |
* released. |
|
1122 |
*/ |
|
1123 |
ec_voe_handler_t *ecrt_slave_config_create_voe_handler( |
|
1124 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
|
1125 |
size_t size /**< Data size to reserve. */ |
|
1126 |
); |
|
1127 |
||
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1128 |
/** 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
|
1129 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1130 |
* 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
|
1131 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1132 |
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
|
1133 |
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
|
1134 |
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
|
1135 |
); |
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
288
diff
changeset
|
1136 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1137 |
/****************************************************************************** |
779 | 1138 |
* Domain methods |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1139 |
*****************************************************************************/ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1140 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1141 |
/** 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
|
1142 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1143 |
* \todo doc |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1144 |
* \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
|
1145 |
* 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
|
1146 |
* \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
|
1147 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1148 |
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
|
1149 |
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
|
1150 |
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
|
1151 |
registrations. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1152 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1153 |
|
1258
900f1124e8f8
Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents:
1257
diff
changeset
|
1154 |
#ifdef __KERNEL__ |
900f1124e8f8
Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents:
1257
diff
changeset
|
1155 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1156 |
/** 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
|
1157 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1158 |
* \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
|
1159 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1160 |
size_t ecrt_domain_size( |
1257
9844ac126275
Made ecrt_domain_size() const.
Florian Pose <fp@igh-essen.com>
parents:
1256
diff
changeset
|
1161 |
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
|
1162 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1163 |
|
809 | 1164 |
/** Provide external memory to store the domain's process data. |
1165 |
* |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1166 |
* Call this after all PDO entries have been registered and before activating |
809 | 1167 |
* the master. |
1168 |
* |
|
1169 |
* 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
|
1170 |
* all PDO entries have been registered. |
809 | 1171 |
*/ |
1172 |
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
|
1173 |
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
|
1174 |
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
|
1175 |
data in. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1176 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1177 |
|
1248
3cc16b60a571
External memory only in kernel space.
Florian Pose <fp@igh-essen.com>
parents:
1244
diff
changeset
|
1178 |
#endif /* __KERNEL__ */ |
3cc16b60a571
External memory only in kernel space.
Florian Pose <fp@igh-essen.com>
parents:
1244
diff
changeset
|
1179 |
|
809 | 1180 |
/** Returns the domain's process data. |
1181 |
* |
|
1258
900f1124e8f8
Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents:
1257
diff
changeset
|
1182 |
* - In kernel context: If external memory was provided with |
900f1124e8f8
Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents:
1257
diff
changeset
|
1183 |
* 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
|
1184 |
* 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
|
1185 |
* 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
|
1186 |
* ecrt_master_activate(). |
900f1124e8f8
Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents:
1257
diff
changeset
|
1187 |
* |
900f1124e8f8
Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents:
1257
diff
changeset
|
1188 |
* - 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
|
1189 |
* ecrt_master_activate() to get the mapped domain process data memory. |
1256 | 1190 |
* |
809 | 1191 |
* \return Pointer to the process data memory. |
1192 |
*/ |
|
1193 |
uint8_t *ecrt_domain_data( |
|
1194 |
ec_domain_t *domain /**< Domain. */ |
|
1195 |
); |
|
1196 |
||
886 | 1197 |
/** Determines the states of the domain's datagrams. |
1198 |
* |
|
1199 |
* Evaluates the working counters of the received datagrams and outputs |
|
1200 |
* statistics, if necessary. This must be called after ecrt_master_receive() |
|
1201 |
* is expected to receive the domain datagrams in order to make |
|
1202 |
* 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
|
1203 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1204 |
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
|
1205 |
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
|
1206 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1207 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1208 |
/** (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
|
1209 |
* |
886 | 1210 |
* Call this function to mark the domain's datagrams for exchanging at the |
1211 |
* 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
|
1212 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1213 |
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
|
1214 |
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
|
1215 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1216 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1217 |
/** 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
|
1218 |
* |
886 | 1219 |
* 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
|
1220 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1221 |
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
|
1222 |
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
|
1223 |
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
|
1224 |
information. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1225 |
); |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
612
diff
changeset
|
1226 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1227 |
/***************************************************************************** |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1228 |
* SDO request methods. |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1229 |
****************************************************************************/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1230 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1231 |
/** 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
|
1232 |
* |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1233 |
* 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
|
1234 |
* as failed. |
1113 | 1235 |
* |
1236 |
* The timeout is permanently stored in the request object and is valid until |
|
1237 |
* the next call of this method. |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1238 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1239 |
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
|
1240 |
ec_sdo_request_t *req, /**< SDO request. */ |
880 | 1241 |
uint32_t timeout /**< Timeout in milliseconds. Zero means no |
1242 |
timeout. */ |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1243 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1244 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1245 |
/** 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
|
1246 |
* |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1247 |
* This function returns a pointer to the request's internal SDO data memory. |
868 | 1248 |
* |
1249 |
* - After a read operation was successful, integer data can be evaluated using |
|
1250 |
* the EC_READ_*() macros as usual. Example: |
|
1251 |
* \code |
|
1252 |
* uint16_t value = EC_READ_U16(ecrt_sdo_request_data(sdo))); |
|
1253 |
* \endcode |
|
1254 |
* - If a write operation shall be triggered, the data have to be written to |
|
1255 |
* the internal memory. Use the EC_WRITE_*() macros, if you are writing |
|
1256 |
* integer data. Be sure, that the data fit into the memory. The memory size |
|
1257 |
* is a parameter of ecrt_slave_config_create_sdo_request(). |
|
1258 |
* \code |
|
1259 |
* EC_WRITE_U16(ecrt_sdo_request_data(sdo), 0xFFFF); |
|
1260 |
* \endcode |
|
1261 |
* |
|
864 | 1262 |
* \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
|
1263 |
* the internal SDO data memory could be re-allocated if the read SDO data do |
864 | 1264 |
* not fit inside. |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1265 |
* |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1266 |
* \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
|
1267 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1268 |
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
|
1269 |
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
|
1270 |
); |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1271 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1272 |
/** 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
|
1273 |
* |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1274 |
* 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
|
1275 |
* 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
|
1276 |
* 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
|
1277 |
* |
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1278 |
* \return SDO data size in bytes. |
869
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
1279 |
*/ |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
1280 |
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
|
1281 |
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
|
1282 |
); |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1283 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1284 |
/** 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
|
1285 |
* |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1286 |
* \return Request state. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1287 |
*/ |
1352
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1341
diff
changeset
|
1288 |
#ifdef __KERNEL__ |
1209 | 1289 |
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
|
1290 |
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
|
1291 |
); |
1352
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1341
diff
changeset
|
1292 |
#else |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1341
diff
changeset
|
1293 |
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
|
1294 |
ec_sdo_request_t *req /**< SDO request. */ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1341
diff
changeset
|
1295 |
); |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
1341
diff
changeset
|
1296 |
#endif |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1297 |
|
1327
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1298 |
/** Schedule an SDO write operation. |
864 | 1299 |
* |
1300 |
* \attention This method may not be called while ecrt_sdo_request_state() |
|
1301 |
* returns EC_SDO_REQUEST_BUSY. |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1302 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1303 |
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
|
1304 |
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
|
1305 |
); |
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1306 |
|
4d179b06dd3c
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
1307 |
/** Schedule an SDO read operation. |
864 | 1308 |
* |
1309 |
* \attention This method may not be called while ecrt_sdo_request_state() |
|
1310 |
* returns EC_SDO_REQUEST_BUSY. |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1311 |
* |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1312 |
* \attention After calling this function, the return value of |
864 | 1313 |
* ecrt_sdo_request_data() must be considered as invalid while |
1314 |
* 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
|
1315 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1316 |
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
|
1317 |
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
|
1318 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
1319 |
|
1209 | 1320 |
/***************************************************************************** |
1321 |
* VoE handler methods. |
|
1322 |
****************************************************************************/ |
|
1323 |
||
1226
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1324 |
/** Sets the VoE header for future send operations. |
1218 | 1325 |
* |
1326 |
* A VoE message shall contain a 4-byte vendor ID, followed by a 2-byte vendor |
|
1267 | 1327 |
* type at as header. These numbers can be set with this function. The values |
1328 |
* are valid and will be used for future send operations until the next call |
|
1329 |
* of this method. |
|
1218 | 1330 |
*/ |
1226
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1331 |
void ecrt_voe_handler_send_header( |
1218 | 1332 |
ec_voe_handler_t *voe, /**< VoE handler. */ |
1333 |
uint32_t vendor_id, /**< Vendor ID. */ |
|
1334 |
uint16_t vendor_type /**< Vendor-specific type. */ |
|
1335 |
); |
|
1336 |
||
1226
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1337 |
/** 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
|
1338 |
* |
1267 | 1339 |
* This method can be used to get the received VoE header information after a |
1340 |
* read operation has succeeded. |
|
1226
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1341 |
* |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1342 |
* 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
|
1343 |
* parameters. |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1344 |
*/ |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1345 |
void ecrt_voe_handler_received_header( |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1346 |
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
|
1347 |
uint32_t *vendor_id, /**< Vendor ID. */ |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1348 |
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
|
1349 |
); |
afb189516fcf
Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents:
1218
diff
changeset
|
1350 |
|
1209 | 1351 |
/** Access to the VoE handler's data. |
1352 |
* |
|
1267 | 1353 |
* This function returns a pointer to the VoE handler's internal memory, that |
1354 |
* points to the actual VoE data right after the VoE header (see |
|
1355 |
* ecrt_voe_handler_send_header()). |
|
1209 | 1356 |
* |
1357 |
* - After a read operation was successful, the memory contains the received |
|
1358 |
* data. The size of the received data can be determined via |
|
1359 |
* ecrt_voe_handler_data_size(). |
|
1267 | 1360 |
* - Before a write operation is triggered, the data have to be written to the |
1361 |
* internal memory. Be sure, that the data fit into the memory. The reserved |
|
1209 | 1362 |
* memory size is a parameter of ecrt_slave_config_create_voe_handler(). |
1363 |
* |
|
1267 | 1364 |
* \attention The returned pointer is not necessarily persistent: After a read |
1365 |
* operation, the internal memory may have been reallocated. This can be |
|
1366 |
* avoided by reserving enough memory via the \a size parameter of |
|
1367 |
* ecrt_slave_config_create_voe_handler(). |
|
1368 |
* |
|
1209 | 1369 |
* \return Pointer to the internal memory. |
1370 |
*/ |
|
1371 |
uint8_t *ecrt_voe_handler_data( |
|
1372 |
ec_voe_handler_t *voe /**< VoE handler. */ |
|
1373 |
); |
|
1374 |
||
1375 |
/** Returns the current data size. |
|
1376 |
* |
|
1218 | 1377 |
* 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
|
1378 |
* ecrt_voe_handler_send_header()). |
1218 | 1379 |
* |
1209 | 1380 |
* When the VoE handler is created, the data size is set to the size of the |
1381 |
* reserved memory. At a write operation, the data size is set to the number |
|
1382 |
* of bytes to write. After a read operation the size is set to the size of |
|
1383 |
* the read data. The size is not modified in any other situation. |
|
1384 |
* |
|
1385 |
* \return Data size in bytes. |
|
1386 |
*/ |
|
1387 |
size_t ecrt_voe_handler_data_size( |
|
1388 |
const ec_voe_handler_t *voe /**< VoE handler. */ |
|
1389 |
); |
|
1390 |
||
1391 |
/** Start a VoE write operation. |
|
1392 |
* |
|
1393 |
* 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
|
1394 |
* 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
|
1395 |
* other operation may be started while the handler is busy. |
1209 | 1396 |
*/ |
1397 |
void ecrt_voe_handler_write( |
|
1398 |
ec_voe_handler_t *voe, /**< VoE handler. */ |
|
1218 | 1399 |
size_t size /**< Number of bytes to write (without the VoE header). */ |
1209 | 1400 |
); |
1401 |
||
1402 |
/** Start a VoE read operation. |
|
1403 |
* |
|
1404 |
* 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
|
1405 |
* 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
|
1406 |
* other operation may be started while the handler is busy. |
1209 | 1407 |
* |
1267 | 1408 |
* The state machine queries the slave's send mailbox for new data to be send |
1409 |
* to the master. If no data appear within the EC_VOE_RESPONSE_TIMEOUT |
|
1410 |
* (defined in master/voe_handler.c), the operation fails. |
|
1411 |
* |
|
1209 | 1412 |
* 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
|
1413 |
* 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
|
1414 |
* can be retrieved with ecrt_voe_handler_received_header(). |
1209 | 1415 |
*/ |
1416 |
void ecrt_voe_handler_read( |
|
1417 |
ec_voe_handler_t *voe /**< VoE handler. */ |
|
1418 |
); |
|
1419 |
||
1314
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1420 |
/** 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
|
1421 |
* |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1422 |
* 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
|
1423 |
* 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
|
1424 |
* 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
|
1425 |
* |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1426 |
* 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
|
1427 |
* 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
|
1428 |
* 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
|
1429 |
* fails. |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1430 |
* |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1431 |
* 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
|
1432 |
* 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
|
1433 |
* 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
|
1434 |
*/ |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1435 |
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
|
1436 |
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
|
1437 |
); |
b3d06a8807b3
Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
1438 |
|
1209 | 1439 |
/** Execute the handler. |
1440 |
* |
|
1441 |
* This method executes the VoE handler. It has to be called in every bus cycle |
|
1442 |
* as long as it returns EC_REQUEST_BUSY. |
|
1443 |
* |
|
1444 |
* \return Handler state. |
|
1445 |
*/ |
|
1446 |
ec_request_state_t ecrt_voe_handler_execute( |
|
1447 |
ec_voe_handler_t *voe /**< VoE handler. */ |
|
1448 |
); |
|
1449 |
||
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
|
1450 |
/*****************************************************************************/ |
bf0d42ca5aec
Wrapped c function in 'extern "C"' to make the library usable in C++
Florian Pose <fp@igh-essen.com>
parents:
1287
diff
changeset
|
1451 |
|
bf0d42ca5aec
Wrapped c function in 'extern "C"' to make the library usable in C++
Florian Pose <fp@igh-essen.com>
parents:
1287
diff
changeset
|
1452 |
#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
|
1453 |
} |
bf0d42ca5aec
Wrapped c function in 'extern "C"' to make the library usable in C++
Florian Pose <fp@igh-essen.com>
parents:
1287
diff
changeset
|
1454 |
#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
|
1455 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1456 |
/****************************************************************************** |
779 | 1457 |
* Bitwise read/write macros |
1458 |
*****************************************************************************/ |
|
1459 |
||
1460 |
/** 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
|
1461 |
* |
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
|
1462 |
* \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
|
1463 |
* \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
|
1464 |
*/ |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1465 |
#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
|
1466 |
|
779 | 1467 |
/** 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
|
1468 |
* |
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
|
1469 |
* \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
|
1470 |
* \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
|
1471 |
* \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
|
1472 |
*/ |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1473 |
#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
|
1474 |
do { \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1475 |
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
|
1476 |
else *((uint8_t *) (DATA)) &= ~(1 << (POS)); \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1477 |
} while (0) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1478 |
|
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1479 |
/****************************************************************************** |
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1480 |
* Byte-swapping functions for user space |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1481 |
*****************************************************************************/ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1482 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1483 |
#ifndef __KERNEL__ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1484 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1485 |
#if __BYTE_ORDER == __LITTLE_ENDIAN |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1486 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1487 |
#define le16_to_cpu(x) x |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1488 |
#define le32_to_cpu(x) x |
1384
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1489 |
#define le64_to_cpu(x) x |
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1490 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1491 |
#define cpu_to_le16(x) x |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1492 |
#define cpu_to_le32(x) x |
1384
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1493 |
#define cpu_to_le64(x) x |
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1494 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1495 |
#elif __BYTE_ORDER == __BIG_ENDIAN |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1496 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1497 |
#define swap16(x) \ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1498 |
((uint16_t)( \ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1499 |
(((uint16_t)(x) & 0x00ffU) << 8) | \ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1500 |
(((uint16_t)(x) & 0xff00U) >> 8) )) |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1501 |
#define swap32(x) \ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1502 |
((uint32_t)( \ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1503 |
(((uint32_t)(x) & 0x000000ffUL) << 24) | \ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1504 |
(((uint32_t)(x) & 0x0000ff00UL) << 8) | \ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1505 |
(((uint32_t)(x) & 0x00ff0000UL) >> 8) | \ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1506 |
(((uint32_t)(x) & 0xff000000UL) >> 24) )) |
1384
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1507 |
#define swap64(x) \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1508 |
((uint64_t)( \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1509 |
(((uint64_t)(x) & 0x00000000000000ffULL) << 56) | \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1510 |
(((uint64_t)(x) & 0x000000000000ff00ULL) << 40) | \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1511 |
(((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1512 |
(((uint64_t)(x) & 0x00000000ff000000ULL) << 8) | \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1513 |
(((uint64_t)(x) & 0x000000ff00000000ULL) >> 8) | \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1514 |
(((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1515 |
(((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1516 |
(((uint64_t)(x) & 0xff00000000000000ULL) >> 56) )) |
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1517 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1518 |
#define le16_to_cpu(x) swap16(x) |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1519 |
#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
|
1520 |
#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
|
1521 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1522 |
#define cpu_to_le16(x) swap16(x) |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1523 |
#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
|
1524 |
#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
|
1525 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1526 |
#endif |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1527 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1528 |
#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
|
1529 |
#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
|
1530 |
#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
|
1531 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1532 |
#endif /* ifndef __KERNEL__ */ |
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1533 |
|
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1248
diff
changeset
|
1534 |
/****************************************************************************** |
779 | 1535 |
* Read macros |
1536 |
*****************************************************************************/ |
|
1537 |
||
1538 |
/** 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
|
1539 |
* |
779 | 1540 |
* \return EtherCAT data value |
1541 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1542 |
#define EC_READ_U8(DATA) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1543 |
((uint8_t) *((uint8_t *) (DATA))) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1544 |
|
779 | 1545 |
/** 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
|
1546 |
* |
779 | 1547 |
* \param DATA EtherCAT data pointer |
1548 |
* \return EtherCAT data value |
|
1549 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1550 |
#define EC_READ_S8(DATA) \ |
288 | 1551 |
((int8_t) *((uint8_t *) (DATA))) |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1552 |
|
779 | 1553 |
/** 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
|
1554 |
* |
779 | 1555 |
* \param DATA EtherCAT data pointer |
1556 |
* \return EtherCAT data value |
|
1557 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1558 |
#define EC_READ_U16(DATA) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1559 |
((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
|
1560 |
|
779 | 1561 |
/** 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
|
1562 |
* |
779 | 1563 |
* \param DATA EtherCAT data pointer |
1564 |
* \return EtherCAT data value |
|
1565 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1566 |
#define EC_READ_S16(DATA) \ |
288 | 1567 |
((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
|
1568 |
|
779 | 1569 |
/** 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
|
1570 |
* |
779 | 1571 |
* \param DATA EtherCAT data pointer |
1572 |
* \return EtherCAT data value |
|
1573 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1574 |
#define EC_READ_U32(DATA) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1575 |
((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
|
1576 |
|
779 | 1577 |
/** 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
|
1578 |
* |
779 | 1579 |
* \param DATA EtherCAT data pointer |
1580 |
* \return EtherCAT data value |
|
1581 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1582 |
#define EC_READ_S32(DATA) \ |
288 | 1583 |
((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
|
1584 |
|
1384
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1585 |
/** 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
|
1586 |
* |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1587 |
* \param DATA EtherCAT data pointer |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1588 |
* \return EtherCAT data value |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1589 |
*/ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1590 |
#define EC_READ_U64(DATA) \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1591 |
((uint64_t) le64_to_cpup((void *) (DATA))) |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1592 |
|
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1593 |
/** 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
|
1594 |
* |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1595 |
* \param DATA EtherCAT data pointer |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1596 |
* \return EtherCAT data value |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1597 |
*/ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1598 |
#define EC_READ_S64(DATA) \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1599 |
((int64_t) le64_to_cpup((void *) (DATA))) |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1600 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1601 |
/****************************************************************************** |
779 | 1602 |
* Write macros |
1603 |
*****************************************************************************/ |
|
1604 |
||
1605 |
/** 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
|
1606 |
* |
779 | 1607 |
* \param DATA EtherCAT data pointer |
1608 |
* \param VAL new value |
|
1609 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1610 |
#define EC_WRITE_U8(DATA, VAL) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1611 |
do { \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1612 |
*((uint8_t *)(DATA)) = ((uint8_t) (VAL)); \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1613 |
} while (0) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1614 |
|
779 | 1615 |
/** 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
|
1616 |
* |
779 | 1617 |
* \param DATA EtherCAT data pointer |
1618 |
* \param VAL new value |
|
1619 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1620 |
#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
|
1621 |
|
779 | 1622 |
/** 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
|
1623 |
* |
779 | 1624 |
* \param DATA EtherCAT data pointer |
1625 |
* \param VAL new value |
|
1626 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1627 |
#define EC_WRITE_U16(DATA, VAL) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1628 |
do { \ |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1629 |
*((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
|
1630 |
} while (0) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1631 |
|
779 | 1632 |
/** 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
|
1633 |
* |
779 | 1634 |
* \param DATA EtherCAT data pointer |
1635 |
* \param VAL new value |
|
1636 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1637 |
#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
|
1638 |
|
779 | 1639 |
/** 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
|
1640 |
* |
779 | 1641 |
* \param DATA EtherCAT data pointer |
1642 |
* \param VAL new value |
|
1643 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1644 |
#define EC_WRITE_U32(DATA, VAL) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1645 |
do { \ |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
1646 |
*((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
|
1647 |
} while (0) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1648 |
|
779 | 1649 |
/** 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
|
1650 |
* |
779 | 1651 |
* \param DATA EtherCAT data pointer |
1652 |
* \param VAL new value |
|
1653 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
1654 |
#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
|
1655 |
|
1384
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1656 |
/** 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
|
1657 |
* |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1658 |
* \param DATA EtherCAT data pointer |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1659 |
* \param VAL new value |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1660 |
*/ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1661 |
#define EC_WRITE_U64(DATA, VAL) \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1662 |
do { \ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1663 |
*((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
|
1664 |
} while (0) |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1665 |
|
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1666 |
/** 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
|
1667 |
* |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1668 |
* \param DATA EtherCAT data pointer |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1669 |
* \param VAL new value |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1670 |
*/ |
21b5343910c2
Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents:
1377
diff
changeset
|
1671 |
#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
|
1672 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1673 |
/*****************************************************************************/ |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1674 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1675 |
/** @} */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
1676 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1677 |
#endif |