include/ecrt.h
author Knud Baastrup <kba@deif.com>
Tue, 14 Apr 2015 10:12:55 -0400
changeset 2625 e25af8bd3957
parent 2622 1aee02c1e294
child 2630 a380cce7d6f0
permissions -rw-r--r--
Eoe mac address now derived from unique mac.
The EoE MAC address is now derived from the NIC part of the first global
unique MAC address of the linked list of available network interfaces or
otherwise the MAC address used by the EtherCAT master. The EoE MAC address
will get the format 02:NIC:NIC:NIC:RP:RP where NIC comes from the unique MAC
address (if available) and RP is the ring position of the EoE slave.
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
 *
2245
13ef066f37d3 Improved docs.
Florian Pose <fp@igh-essen.com>
parents: 2150
diff changeset
     3
 *  $Id$
1341
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
     4
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
     5
 *  Copyright (C) 2006-2012  Florian Pose, Ingenieurgemeinschaft IgH
1341
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.
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
     8
 *
1341
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/>.
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
    22
 *
1363
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1352
diff changeset
    23
 *  ---
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
    24
 *
1363
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
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 781
diff changeset
    31
/** \file
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 781
diff changeset
    32
 *
1182
f5e725aa5483 ApplicationInterface
Florian Pose <fp@igh-essen.com>
parents: 1113
diff changeset
    33
 * EtherCAT master application interface.
f5e725aa5483 ApplicationInterface
Florian Pose <fp@igh-essen.com>
parents: 1113
diff changeset
    34
 *
f5e725aa5483 ApplicationInterface
Florian Pose <fp@igh-essen.com>
parents: 1113
diff changeset
    35
 * \defgroup ApplicationInterface EtherCAT Application Interface
786
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 781
diff changeset
    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
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    42
 * Changes in version 1.5.2:
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    43
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    44
 * - Added redundancy_active flag to ec_domain_state_t.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    45
 * - Added ecrt_master_link_state() method and ec_master_link_state_t to query
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    46
 *   the state of a redundant link.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    47
 * - Added the EC_HAVE_REDUNDANCY define, to check, if the interface contains
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    48
 *   redundancy features.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    49
 * - Added ecrt_sdo_request_index() to change SDO index and subindex after
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    50
 *   handler creation.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    51
 * - Added interface for retrieving CoE emergency messages, i. e.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    52
 *   ecrt_slave_config_emerg_size(), ecrt_slave_config_emerg_pop(),
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    53
 *   ecrt_slave_config_emerg_clear(), ecrt_slave_config_emerg_overruns() and
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    54
 *   the defines EC_HAVE_EMERGENCY and EC_COE_EMERGENCY_MSG_SIZE.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    55
 * - Added interface for direct EtherCAT register access: Added data type
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    56
 *   ec_reg_request_t and methods ecrt_slave_config_create_reg_request(),
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    57
 *   ecrt_reg_request_data(), ecrt_reg_request_state(),
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    58
 *   ecrt_reg_request_write(), ecrt_reg_request_read() and the feature flag
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    59
 *   EC_HAVE_REG_ACCESS.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    60
 * - Added method to select the reference clock,
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    61
 *   ecrt_master_select_reference_clock() and the feature flag
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    62
 *   EC_HAVE_SELECT_REF_CLOCK to check, if the method is available.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    63
 * - Added method to get the reference clock time,
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    64
 *   ecrt_master_reference_clock_time() and the feature flag
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    65
 *   EC_HAVE_REF_CLOCK_TIME to have the possibility to synchronize the master
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    66
 *   clock to the reference clock.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    67
 * - Changed the data types of the shift times in ecrt_slave_config_dc() to
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    68
 *   int32_t to correctly display negative shift times.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    69
 * - Added ecrt_slave_config_reg_pdo_entry_pos() and the feature flag
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    70
 *   EC_HAVE_REG_BY_POS for registering PDO entries with non-unique indices
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    71
 *   via their positions in the mapping.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    72
 *
1239
b50b93faaf3e Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents: 1226
diff changeset
    73
 * 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
    74
 *
1448
d7ba0c408a07 Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents: 1441
diff changeset
    75
 * - 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
    76
 *   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
    77
 *   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
    78
 *   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
    79
 *   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
    80
 *   ecrt_master_sync_monitor_queue() and ecrt_master_sync_monitor_process()
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
    81
 *   methods can be used to monitor the synchrony.
1500
ed1a733efbc5 Improved the callback mechanism.
Florian Pose <fp@igh-essen.com>
parents: 1497
diff changeset
    82
 * - Improved the callback mechanism. ecrt_master_callbacks() now takes two
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    83
 *   callback functions for sending and receiving datagrams.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    84
 *   ecrt_master_send_ext() is used to execute the sending of non-application
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
    85
 *   datagrams.
1509
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1500
diff changeset
    86
 * - 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
    87
 *   #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
    88
 *   ecrt_slave_config_sync_manager()).
1526
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1513
diff changeset
    89
 * - 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
    90
 *   configuration via CompleteAccess.
1530
96629de2202b Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
    91
 * - 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
    92
 * - 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
    93
 *   userspace.
1510
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
    94
 * - Added bus information interface (methods ecrt_master(),
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
    95
 *   ecrt_master_get_slave(), ecrt_master_get_sync_manager(),
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
    96
 *   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
    97
 *   about the currently connected slaves and the PDO entries provided.
2150
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
    98
 * - Added ecrt_master_sdo_download(), ecrt_master_sdo_download_complete() and
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
    99
 *   ecrt_master_sdo_upload() methods to let an application transfer SDOs
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   100
 *   before activating the master.
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   101
 * - 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
   102
 *   ecrt_slave_config_reg_pdo_entry() and ecrt_slave_config_sdo*().
1512
388901f44a5e Fixed typos.
Florian Pose <fp@igh-essen.com>
parents: 1510
diff changeset
   103
 * - 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
   104
 *   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
   105
 * - 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
   106
 *   used by VoE handlers.
1352
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1341
diff changeset
   107
 * - 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
   108
 *   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
   109
 * - Added 64-bit data access macros.
1913
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   110
 * - Added ecrt_slave_config_idn() method for storing SoE IDN configurations,
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   111
 *   and ecrt_master_read_idn() and ecrt_master_write_idn() to read/write IDNs
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   112
 *   ad-hoc via the user-space library.
2009
b5391b329b5d Added ecrt_master_reset() method.
Florian Pose <fp@igh-essen.com>
parents: 1952
diff changeset
   113
 * - Added ecrt_master_reset() to initiate retrying to configure slaves.
1981
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1980
diff changeset
   114
 *
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   115
 * @{
786
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 781
diff changeset
   116
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   117
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   118
/*****************************************************************************/
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   119
125
b01bd5b830d7 Sch?nheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 114
diff changeset
   120
#ifndef __ECRT_H__
b01bd5b830d7 Sch?nheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 114
diff changeset
   121
#define __ECRT_H__
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   122
1254
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
   123
#ifdef __KERNEL__
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   124
#include <asm/byteorder.h>
110
2346e2963087 Integer-Typen in ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 106
diff changeset
   125
#include <linux/types.h>
1396
9d04cc08f40f DC sync reference clock to application time. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1394
diff changeset
   126
#include <linux/time.h>
110
2346e2963087 Integer-Typen in ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 106
diff changeset
   127
#else
1254
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
   128
#include <stdlib.h> // for size_t
110
2346e2963087 Integer-Typen in ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 106
diff changeset
   129
#include <stdint.h>
1396
9d04cc08f40f DC sync reference clock to application time. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1394
diff changeset
   130
#include <sys/time.h> // for struct timeval
110
2346e2963087 Integer-Typen in ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 106
diff changeset
   131
#endif
2346e2963087 Integer-Typen in ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 106
diff changeset
   132
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   133
/******************************************************************************
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   134
 * Global definitions
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   135
 *****************************************************************************/
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   136
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   137
/** EtherCAT realtime interface major version number.
758
8fa6f825eb7d Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents: 707
diff changeset
   138
 */
637
d5d04c868e0e Removed ecrt_master_run(), removed datagram queueing from state
Florian Pose <fp@igh-essen.com>
parents: 635
diff changeset
   139
#define ECRT_VER_MAJOR 1
758
8fa6f825eb7d Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents: 707
diff changeset
   140
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   141
/** EtherCAT realtime interface minor version number.
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   142
 */
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
   143
#define ECRT_VER_MINOR 5
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   144
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   145
/** EtherCAT realtime interface version word generator.
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   146
 */
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   147
#define ECRT_VERSION(a, b) (((a) << 8) + (b))
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   148
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   149
/** EtherCAT realtime interface version word.
758
8fa6f825eb7d Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents: 707
diff changeset
   150
 */
541
5a2b1658b67f Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
   151
#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
   152
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   153
/******************************************************************************
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   154
 * Feature flags
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   155
 *****************************************************************************/
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   156
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   157
/** Defined, if the redundancy features are available.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   158
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   159
 * I. e. if the \a redundancy_active flag in ec_domain_state_t and the
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   160
 * ecrt_master_link_state() method are available.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   161
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   162
#define EC_HAVE_REDUNDANCY
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   163
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   164
/** Defined, if the CoE emergency ring feature is available.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   165
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   166
 * I. e. if the ecrt_slave_config_emerg_*() methods are available.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   167
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   168
#define EC_HAVE_EMERGENCY
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   169
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   170
/** Defined, if the register access interface is available.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   171
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   172
 * I. e. if the methods ecrt_slave_config_create_reg_request(),
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   173
 * ecrt_reg_request_data(), ecrt_reg_request_state(), ecrt_reg_request_write()
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   174
 * and ecrt_reg_request_read() are available.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   175
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   176
#define EC_HAVE_REG_ACCESS
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   177
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   178
/** Defined if the method ecrt_master_select_reference_clock() is available.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   179
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   180
#define EC_HAVE_SELECT_REF_CLOCK
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   181
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   182
/** Defined if the method ecrt_master_reference_clock_time() is available.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   183
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   184
#define EC_HAVE_REF_CLOCK_TIME
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   185
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   186
/** Defined if the method ecrt_slave_config_reg_pdo_entry_pos() is available.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   187
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   188
#define EC_HAVE_REG_BY_POS
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   189
878
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   190
/*****************************************************************************/
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   191
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
   192
/** 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
   193
 *
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
   194
 * 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
   195
 */
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   196
#define EC_END ~0U
878
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   197
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
   198
/** 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
   199
 */
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
   200
#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
   201
1341
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   202
/** Maximum string length.
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   203
 *
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   204
 * Used in ec_slave_info_t.
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   205
 */
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   206
#define EC_MAX_STRING_LENGTH 64
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   207
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   208
/** Maximum number of slave ports. */
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   209
#define EC_MAX_PORTS 4
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   210
1417
7c2d5d69134c Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents: 1411
diff changeset
   211
/** Timeval to nanoseconds conversion.
7c2d5d69134c Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents: 1411
diff changeset
   212
 *
1512
388901f44a5e Fixed typos.
Florian Pose <fp@igh-essen.com>
parents: 1510
diff changeset
   213
 * 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
   214
 *
1466
362147819ca1 EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   215
 * \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
   216
 *
362147819ca1 EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   217
 * \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
   218
 */
7c2d5d69134c Replaced timeval by 64-bit EtherCAT time.
Florian Pose <fp@igh-essen.com>
parents: 1411
diff changeset
   219
#define EC_TIMEVAL2NANO(TV) \
1466
362147819ca1 EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   220
    (((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
   221
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   222
/** Size of a CoE emergency message in byte.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   223
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   224
 * \see ecrt_slave_config_emerg_pop().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   225
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   226
#define EC_COE_EMERGENCY_MSG_SIZE 8
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   227
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   228
/******************************************************************************
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   229
 * Data types
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   230
 *****************************************************************************/
541
5a2b1658b67f Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
   231
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   232
struct ec_master;
286
f3352378b4d4 Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents: 276
diff changeset
   233
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
   234
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   235
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
   236
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
   237
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   238
struct ec_domain;
286
f3352378b4d4 Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents: 276
diff changeset
   239
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
   240
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   241
struct ec_sdo_request;
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   242
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
   243
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
   244
struct ec_voe_handler;
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
   245
typedef struct ec_voe_handler ec_voe_handler_t; /**< \see ec_voe_handler. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
   246
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   247
struct ec_reg_request;
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   248
typedef struct ec_reg_request ec_reg_request_t; /**< \see ec_sdo_request. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   249
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   250
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   251
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   252
/** Master state.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   253
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   254
 * 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
   255
 *
9bf2ddf05e17 Completed ec_master_state_t and documented ec_master_state_t and
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   256
 * \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
   257
 */
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 541
diff changeset
   258
typedef struct {
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   259
    unsigned int slaves_responding; /**< Sum of responding slaves on all
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   260
                                      Ethernet devices. */
1022
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   261
    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
   262
                                  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
   263
                                  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
   264
                                  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
   265
                                  state:
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   266
                                  - Bit 0: \a INIT
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   267
                                  - Bit 1: \a PREOP
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   268
                                  - Bit 2: \a SAFEOP
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   269
                                  - Bit 3: \a OP */
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   270
    unsigned int link_up : 1; /**< \a true, if at least one Ethernet link is
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   271
                                up. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   272
} 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
   273
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   274
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   275
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   276
/** Redundant link state.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   277
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   278
 * This is used for the output parameter of ecrt_master_link_state().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   279
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   280
 * \see ecrt_master_link_state().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   281
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   282
typedef struct {
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   283
    unsigned int slaves_responding; /**< Sum of responding slaves on the given
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   284
                                      link. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   285
    unsigned int al_states : 4; /**< Application-layer states of the slaves on
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   286
                                  the given link.  The states are coded in the
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   287
                                  lower 4 bits.  If a bit is set, it means
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   288
                                  that at least one slave in the bus is in the
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   289
                                  corresponding state:
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   290
                                  - Bit 0: \a INIT
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   291
                                  - Bit 1: \a PREOP
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   292
                                  - Bit 2: \a SAFEOP
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   293
                                  - Bit 3: \a OP */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   294
    unsigned int link_up : 1; /**< \a true, if the given Ethernet link is up.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   295
                               */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   296
} ec_master_link_state_t;
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   297
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   298
/*****************************************************************************/
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   299
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   300
/** Slave configuration state.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   301
 *
1020
9bf2ddf05e17 Completed ec_master_state_t and documented ec_master_state_t and
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   302
 * This is used as an output parameter of ecrt_slave_config_state().
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   303
 *
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   304
 * \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
   305
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   306
typedef struct  {
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   307
    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
   308
    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
   309
                                    using the specified configuration. */
1022
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   310
    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
   311
                                 - 1: \a INIT
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   312
                                 - 2: \a PREOP
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   313
                                 - 4: \a SAFEOP
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   314
                                 - 8: \a OP
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   315
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   316
                                 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
   317
                                 bit! */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   318
} 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
   319
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   320
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   321
1497
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   322
/** Master information.
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   323
 *
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   324
 * 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
   325
 *
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   326
 * \see ecrt_master().
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   327
 */
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   328
typedef struct {
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   329
   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
   330
   unsigned int link_up : 1; /**< \a true, if the network link is up. */
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   331
   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
   332
   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
   333
} 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
   334
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   335
/*****************************************************************************/
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   336
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   337
/** EtherCAT slave port descriptor.
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   338
 */
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   339
typedef enum {
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   340
    EC_PORT_NOT_IMPLEMENTED, /**< Port is not implemented. */
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   341
    EC_PORT_NOT_CONFIGURED, /**< Port is not configured. */
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   342
    EC_PORT_EBUS, /**< Port is an E-Bus. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   343
    EC_PORT_MII /**< Port is a MII. */
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   344
} ec_slave_port_desc_t;
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   345
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   346
/*****************************************************************************/
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   347
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   348
/** EtherCAT slave port information.
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   349
 */
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   350
typedef struct {
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   351
    uint8_t link_up; /**< Link detected. */
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   352
    uint8_t loop_closed; /**< Loop closed. */
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   353
    uint8_t signal_detected; /**< Detected signal on RX port. */
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   354
} ec_slave_port_link_t;
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   355
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   356
/*****************************************************************************/
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   357
1341
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   358
/** Slave information.
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   359
 *
1510
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   360
 * 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
   361
 *
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   362
 * \see ecrt_master_get_slave().
1341
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   363
 */
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   364
typedef struct {
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   365
    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
   366
    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
   367
    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
   368
    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
   369
    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
   370
    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
   371
    int16_t current_on_ebus; /**< Used current in mA. */
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   372
    struct {
2248
82afd3a5bab1 Added slave_info documentation.
Florian Pose <fp@igh-essen.com>
parents: 2245
diff changeset
   373
        ec_slave_port_desc_t desc; /**< Physical port type. */
82afd3a5bab1 Added slave_info documentation.
Florian Pose <fp@igh-essen.com>
parents: 2245
diff changeset
   374
        ec_slave_port_link_t link; /**< Port link state. */
82afd3a5bab1 Added slave_info documentation.
Florian Pose <fp@igh-essen.com>
parents: 2245
diff changeset
   375
        uint32_t receive_time; /**< Receive time on DC transmission delay
82afd3a5bab1 Added slave_info documentation.
Florian Pose <fp@igh-essen.com>
parents: 2245
diff changeset
   376
                                 measurement. */
82afd3a5bab1 Added slave_info documentation.
Florian Pose <fp@igh-essen.com>
parents: 2245
diff changeset
   377
        uint16_t next_slave; /**< Ring position of next DC slave on that
82afd3a5bab1 Added slave_info documentation.
Florian Pose <fp@igh-essen.com>
parents: 2245
diff changeset
   378
                               port.  */
82afd3a5bab1 Added slave_info documentation.
Florian Pose <fp@igh-essen.com>
parents: 2245
diff changeset
   379
        uint32_t delay_to_next_dc; /**< Delay [ns] to next DC slave. */
82afd3a5bab1 Added slave_info documentation.
Florian Pose <fp@igh-essen.com>
parents: 2245
diff changeset
   380
    } ports[EC_MAX_PORTS]; /**< Port information. */
1341
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   381
    uint8_t al_state; /**< Current state of the slave. */
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   382
    uint8_t error_flag; /**< Error flag for that slave. */
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   383
    uint8_t sync_count; /**< Number of sync managers. */
1512
388901f44a5e Fixed typos.
Florian Pose <fp@igh-essen.com>
parents: 1510
diff changeset
   384
    uint16_t sdo_count; /**< Number of SDOs. */
1341
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   385
    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
   386
} ec_slave_info_t;
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   387
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   388
/*****************************************************************************/
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
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
/** 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
   391
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   392
 * 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
   393
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   394
typedef enum {
925
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   395
    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
   396
    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
   397
                        exchanged. */
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   398
    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
   399
} 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
   400
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   401
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   402
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   403
/** Domain state.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   404
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   405
 * 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
   406
 */
16e9ad7d8e12 Added parameters for vendor ID and product code to ecrt_get_slave(); PDO
Florian Pose <fp@igh-essen.com>
parents: 637
diff changeset
   407
typedef struct {
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   408
    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
   409
    ec_wc_state_t wc_state; /**< Working counter interpretation. */
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   410
    unsigned int redundancy_active; /**< Redundant link is in use. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   411
} 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
   412
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
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   415
/** Direction type for PDO assignment functions.
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   416
 */
635
d304ef4af542 Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 612
diff changeset
   417
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
   418
    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
   419
    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
   420
    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
   421
    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
   422
} ec_direction_t;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   423
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   424
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   425
1509
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1500
diff changeset
   426
/** 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
   427
 *
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1500
diff changeset
   428
 * 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
   429
 */
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1500
diff changeset
   430
typedef enum {
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1500
diff changeset
   431
    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
   432
    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
   433
    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
   434
} 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
   435
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1500
diff changeset
   436
/*****************************************************************************/
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1500
diff changeset
   437
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   438
/** 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
   439
 *
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   440
 * 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
   441
 *
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
   442
 * \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
   443
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   444
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
   445
    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
   446
    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
   447
    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
   448
} 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
   449
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   450
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   451
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   452
/** PDO configuration information.
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   453
 *
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   454
 * This is the data type of the \a pdos field in ec_sync_info_t.
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   455
 *
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
   456
 * \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
   457
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   458
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
   459
    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
   460
    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
   461
                              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
   462
                              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
   463
                              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
   464
    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
   465
                                    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
   466
                                    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
   467
} 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
   468
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   469
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   470
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   471
/** 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
   472
 *
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   473
 * 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
   474
 * 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
   475
 * 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
   476
 */
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   477
typedef struct {
1083
1322dc34cb37 Updated header docs, features and news file.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   478
    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
   479
                     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
   480
                     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
   481
    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
   482
    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
   483
    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
   484
                            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
   485
    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
   486
} 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
   487
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   488
/*****************************************************************************/
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   489
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   490
/** 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
   491
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   492
 * 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
   493
 * 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
   494
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   495
typedef struct {
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   496
    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
   497
    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
   498
    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
   499
    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
   500
    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
   501
    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
   502
    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
   503
                       (byte-)offset in the process data. */
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   504
    unsigned int *bit_position; /**< Pointer to a variable to store a bit
1092
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   505
                                  position (0-7) within the \a offset. Can be
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   506
                                  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
   507
                                  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
   508
} ec_pdo_entry_reg_t;
416
4f007cd2a79d ecrt_domain_register_pdo_range() implemented.
Florian Pose <fp@igh-essen.com>
parents: 325
diff changeset
   509
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   510
/*****************************************************************************/
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   511
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
   512
/** Request state.
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
   513
 *
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
   514
 * This is used as return type for ecrt_sdo_request_state() and
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
   515
 * ecrt_voe_handler_state().
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   516
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   517
typedef enum {
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
   518
    EC_REQUEST_UNUSED, /**< Not requested. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
   519
    EC_REQUEST_BUSY, /**< Request is being processed. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
   520
    EC_REQUEST_SUCCESS, /**< Request was processed successfully. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
   521
    EC_REQUEST_ERROR, /**< Request processing failed. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
   522
} ec_request_state_t;
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   523
1944
73896ef6d077 Added state parameter to ecrt_slave_config_idn().
Florian Pose <fp@igh-essen.com>
parents: 1913
diff changeset
   524
/*****************************************************************************/
73896ef6d077 Added state parameter to ecrt_slave_config_idn().
Florian Pose <fp@igh-essen.com>
parents: 1913
diff changeset
   525
73896ef6d077 Added state parameter to ecrt_slave_config_idn().
Florian Pose <fp@igh-essen.com>
parents: 1913
diff changeset
   526
/** Application-layer state.
73896ef6d077 Added state parameter to ecrt_slave_config_idn().
Florian Pose <fp@igh-essen.com>
parents: 1913
diff changeset
   527
 */
73896ef6d077 Added state parameter to ecrt_slave_config_idn().
Florian Pose <fp@igh-essen.com>
parents: 1913
diff changeset
   528
typedef enum {
73896ef6d077 Added state parameter to ecrt_slave_config_idn().
Florian Pose <fp@igh-essen.com>
parents: 1913
diff changeset
   529
    EC_AL_STATE_INIT = 1, /**< Init. */
73896ef6d077 Added state parameter to ecrt_slave_config_idn().
Florian Pose <fp@igh-essen.com>
parents: 1913
diff changeset
   530
    EC_AL_STATE_PREOP = 2, /**< Pre-operational. */
73896ef6d077 Added state parameter to ecrt_slave_config_idn().
Florian Pose <fp@igh-essen.com>
parents: 1913
diff changeset
   531
    EC_AL_STATE_SAFEOP = 4, /**< Safe-operational. */
73896ef6d077 Added state parameter to ecrt_slave_config_idn().
Florian Pose <fp@igh-essen.com>
parents: 1913
diff changeset
   532
    EC_AL_STATE_OP = 8, /**< Operational. */
73896ef6d077 Added state parameter to ecrt_slave_config_idn().
Florian Pose <fp@igh-essen.com>
parents: 1913
diff changeset
   533
} ec_al_state_t;
73896ef6d077 Added state parameter to ecrt_slave_config_idn().
Florian Pose <fp@igh-essen.com>
parents: 1913
diff changeset
   534
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   535
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   536
 * Global functions
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   537
 *****************************************************************************/
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   538
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
   539
#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
   540
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
   541
#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
   542
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   543
/** 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
   544
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   545
 * \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
   546
 */
541
5a2b1658b67f Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
   547
unsigned int ecrt_version_magic(void);
5a2b1658b67f Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
   548
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   549
/** Requests an EtherCAT master for realtime operation.
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
   550
 *
1092
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   551
 * Before an application can access an EtherCAT master, it has to reserve one
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   552
 * for exclusive use.
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   553
 *
1497
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   554
 * 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
   555
 * ecrt_master_reserve().
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   556
 *
1092
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   557
 * This function has to be the first function an application has to call to
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   558
 * use EtherCAT. The function takes the index of the master as its argument.
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   559
 * The first master has index 0, the n-th master has index n - 1. The number
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   560
 * of masters has to be specified when loading the master module.
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   561
 *
1312
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1288
diff changeset
   562
 * \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
   563
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   564
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
   565
        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
   566
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   567
1497
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   568
#ifndef __KERNEL__
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   569
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   570
/** 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
   571
 *
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   572
 * 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
   573
 * 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
   574
 * 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
   575
 * 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
   576
 *
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   577
 * 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
   578
 *
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   579
 * \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
   580
 */
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   581
ec_master_t *ecrt_open_master(
1804
742607c464c4 Removed tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1611
diff changeset
   582
        unsigned int master_index /**< Index of the master to request. */
742607c464c4 Removed tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1611
diff changeset
   583
        );
1497
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   584
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   585
#endif // #ifndef __KERNEL__
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   586
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   587
/** Releases a requested EtherCAT master.
1092
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   588
 *
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   589
 * After use, a master it has to be released to make it available for other
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   590
 * applications.
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   591
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   592
 * This method frees all created data structures. It should not be called in
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   593
 * realtime context.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   594
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   595
 * If the master was activated, ecrt_master_deactivate() is called internally.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   596
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   597
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
   598
        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
   599
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   600
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   601
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   602
 * Master methods
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   603
 *****************************************************************************/
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   604
1497
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   605
#ifndef __KERNEL__
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   606
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   607
/** 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
   608
 *
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   609
 * 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
   610
 * 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
   611
 *
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   612
 * \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
   613
 */
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   614
int ecrt_master_reserve(
1804
742607c464c4 Removed tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1611
diff changeset
   615
        ec_master_t *master /**< EtherCAT master */
742607c464c4 Removed tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1611
diff changeset
   616
        );
1497
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   617
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   618
#endif // #ifndef __KERNEL__
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   619
1244
0b70040d3daa No kernel handles in userspace; Domain creation.
Florian Pose <fp@igh-essen.com>
parents: 1239
diff changeset
   620
#ifdef __KERNEL__
0b70040d3daa No kernel handles in userspace; Domain creation.
Florian Pose <fp@igh-essen.com>
parents: 1239
diff changeset
   621
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   622
/** 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
   623
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   624
 * For concurrent master access, i. e. if other instances than the application
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   625
 * want to send and receive datagrams on the bus, the application has to
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   626
 * provide a callback mechanism. This method takes two function pointers as
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   627
 * its parameters. Asynchronous master access (like EoE processing) is only
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   628
 * possible if the callbacks have been set.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   629
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   630
 * The task of the send callback (\a send_cb) is to decide, if the bus is
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   631
 * currently accessible and whether or not to call the ecrt_master_send_ext()
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   632
 * method.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   633
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   634
 * The task of the receive callback (\a receive_cb) is to decide, if a call to
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   635
 * ecrt_master_receive() is allowed and to execute it respectively.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   636
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   637
 * \attention This method has to be called before ecrt_master_activate().
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   638
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   639
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
   640
        ec_master_t *master, /**< EtherCAT master */
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   641
        void (*send_cb)(void *), /**< Datagram sending callback. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   642
        void (*receive_cb)(void *), /**< Receive callback. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   643
        void *cb_data /**< Arbitrary pointer passed to the callback functions.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   644
                       */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   645
        );
2054
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2009
diff changeset
   646
1244
0b70040d3daa No kernel handles in userspace; Domain creation.
Florian Pose <fp@igh-essen.com>
parents: 1239
diff changeset
   647
#endif /* __KERNEL__ */
0b70040d3daa No kernel handles in userspace; Domain creation.
Florian Pose <fp@igh-essen.com>
parents: 1239
diff changeset
   648
1092
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   649
/** Creates a new process data domain.
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   650
 *
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   651
 * For process data exchange, at least one process data domain is needed.
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   652
 * 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
   653
 * new domain object. This object can be used for registering PDOs and
1092
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   654
 * 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
   655
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   656
 * This method allocates memory and should be called in non-realtime context
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   657
 * before ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   658
 *
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   659
 * \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
   660
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   661
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
   662
        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
   663
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   664
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   665
/** 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
   666
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   667
 * 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
   668
 * 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
   669
 * 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
   670
 * 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
   671
 * 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
   672
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   673
 * 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
   674
 * - 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
   675
 *   ring position.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   676
 * - 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
   677
 *   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
   678
 *   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
   679
 *   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
   680
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   681
 * 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
   682
 * 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
   683
 * 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
   684
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   685
 * 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
   686
 * 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
   687
 * applied.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   688
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   689
 * This method allocates memory and should be called in non-realtime context
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   690
 * before ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   691
 *
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   692
 * \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
   693
 * \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
   694
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   695
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
   696
        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
   697
        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
   698
        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
   699
        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
   700
        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
   701
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   702
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   703
/** Selects the reference clock for distributed clocks.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   704
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   705
 * If this method is not called for a certain master, or if the slave
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   706
 * configuration pointer is NULL, then the first slave with DC functionality
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   707
 * will provide the reference clock.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   708
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   709
 * \return 0 on success, otherwise negative error code.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   710
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   711
int ecrt_master_select_reference_clock(
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   712
        ec_master_t *master, /**< EtherCAT master. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   713
        ec_slave_config_t *sc /**< Slave config of the slave to use as the
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   714
                               * reference slave (or NULL). */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   715
        );
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   716
1497
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   717
/** Obtains master information.
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   718
 *
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   719
 * 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
   720
 * this function.
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   721
 *
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   722
 * \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
   723
 *
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   724
 * \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
   725
 */
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   726
int ecrt_master(
1804
742607c464c4 Removed tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1611
diff changeset
   727
        ec_master_t *master, /**< EtherCAT master */
742607c464c4 Removed tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1611
diff changeset
   728
        ec_master_info_t *master_info /**< Structure that will output the
742607c464c4 Removed tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1611
diff changeset
   729
                                        information */
742607c464c4 Removed tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1611
diff changeset
   730
        );
1497
c9308eb34c0e Separated master requesting into open and reserve for userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1495
diff changeset
   731
1341
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   732
/** Obtains slave information.
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   733
 *
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   734
 * 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
   735
 * 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
   736
 * this function.
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   737
 *
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   738
 * \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
   739
 *
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   740
 * \return 0 in case of success, else < 0
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   741
 */
1510
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   742
int ecrt_master_get_slave(
1341
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   743
        ec_master_t *master, /**< EtherCAT master */
1510
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   744
        uint16_t slave_position, /**< Slave position. */
1341
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   745
        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
   746
                                      information */
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   747
        );
32ba7ffb6c7f Added ecrt_master_slave().
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   748
1594
2019bec460ad Implemented ecrt_master() and ecrt_master_get_slave() in kernel space.
Florian Pose <fp@igh-essen.com>
parents: 1585
diff changeset
   749
#ifndef __KERNEL__
2019bec460ad Implemented ecrt_master() and ecrt_master_get_slave() in kernel space.
Florian Pose <fp@igh-essen.com>
parents: 1585
diff changeset
   750
1510
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   751
/** 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
   752
 *
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   753
 * 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
   754
 * 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
   755
 * ecrt_master_get_pdo() to get the PDO information.
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   756
 *
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   757
 * \return zero on success, else non-zero
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   758
 */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   759
int ecrt_master_get_sync_manager(
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   760
        ec_master_t *master, /**< EtherCAT master. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   761
        uint16_t slave_position, /**< Slave position. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   762
        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
   763
                                than #EC_MAX_SYNC_MANAGERS. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   764
        ec_sync_info_t *sync /**< Pointer to output structure. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   765
        );
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   766
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   767
/** Returns information about a currently assigned PDO.
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   768
 *
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   769
 * 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
   770
 * 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
   771
 * 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
   772
 * entry information.
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   773
 *
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   774
 * \retval zero on success, else non-zero
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   775
 */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   776
int ecrt_master_get_pdo(
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   777
        ec_master_t *master, /**< EtherCAT master. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   778
        uint16_t slave_position, /**< Slave position. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   779
        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
   780
                                 than #EC_MAX_SYNC_MANAGERS. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   781
        uint16_t pos, /**< Zero-based PDO position. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   782
        ec_pdo_info_t *pdo /**< Pointer to output structure. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   783
        );
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   784
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   785
/** Returns information about a currently mapped PDO entry.
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   786
 *
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   787
 * 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
   788
 * currently mapped PDO entry of the given PDO.
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   789
 *
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   790
 * \retval zero on success, else non-zero
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   791
 */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   792
int ecrt_master_get_pdo_entry(
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   793
        ec_master_t *master, /**< EtherCAT master. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   794
        uint16_t slave_position, /**< Slave position. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   795
        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
   796
                                 than #EC_MAX_SYNC_MANAGERS. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   797
        uint16_t pdo_pos, /**< Zero-based PDO position. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   798
        uint16_t entry_pos, /**< Zero-based PDO entry position. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   799
        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
   800
        );
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   801
2107
ebda087981e1 Implemented ecrt_master_sdo_upload() and ecrt_master_sdo_download() for kernel
Florian Pose <fp@igh-essen.com>
parents: 2088
diff changeset
   802
#endif /* #ifndef __KERNEL__ */
ebda087981e1 Implemented ecrt_master_sdo_upload() and ecrt_master_sdo_download() for kernel
Florian Pose <fp@igh-essen.com>
parents: 2088
diff changeset
   803
ebda087981e1 Implemented ecrt_master_sdo_upload() and ecrt_master_sdo_download() for kernel
Florian Pose <fp@igh-essen.com>
parents: 2088
diff changeset
   804
/** Executes an SDO download request to write data to a slave.
ebda087981e1 Implemented ecrt_master_sdo_upload() and ecrt_master_sdo_download() for kernel
Florian Pose <fp@igh-essen.com>
parents: 2088
diff changeset
   805
 *
ebda087981e1 Implemented ecrt_master_sdo_upload() and ecrt_master_sdo_download() for kernel
Florian Pose <fp@igh-essen.com>
parents: 2088
diff changeset
   806
 * This request is processed by the master state machine. This method blocks,
ebda087981e1 Implemented ecrt_master_sdo_upload() and ecrt_master_sdo_download() for kernel
Florian Pose <fp@igh-essen.com>
parents: 2088
diff changeset
   807
 * until the request has been processed and may not be called in realtime
ebda087981e1 Implemented ecrt_master_sdo_upload() and ecrt_master_sdo_download() for kernel
Florian Pose <fp@igh-essen.com>
parents: 2088
diff changeset
   808
 * context.
1510
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   809
 *
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   810
 * \retval  0 Success.
2107
ebda087981e1 Implemented ecrt_master_sdo_upload() and ecrt_master_sdo_download() for kernel
Florian Pose <fp@igh-essen.com>
parents: 2088
diff changeset
   811
 * \retval <0 Error code.
1510
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   812
 */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   813
int ecrt_master_sdo_download(
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   814
        ec_master_t *master, /**< EtherCAT master. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   815
        uint16_t slave_position, /**< Slave position. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   816
        uint16_t index, /**< Index of the SDO. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   817
        uint8_t subindex, /**< Subindex of the SDO. */
2622
1aee02c1e294 Mark download data as const.
Gavin Lambert <uecasm@users.sourceforge.net>
parents: 2609
diff changeset
   818
        const uint8_t *data, /**< Data buffer to download. */
1510
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   819
        size_t data_size, /**< Size of the data buffer. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   820
        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
   821
        );
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   822
2150
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   823
/** Executes an SDO download request to write data to a slave via complete
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   824
 * access.
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   825
 *
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   826
 * This request is processed by the master state machine. This method blocks,
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   827
 * until the request has been processed and may not be called in realtime
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   828
 * context.
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   829
 *
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   830
 * \retval  0 Success.
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   831
 * \retval <0 Error code.
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   832
 */
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   833
int ecrt_master_sdo_download_complete(
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   834
        ec_master_t *master, /**< EtherCAT master. */
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   835
        uint16_t slave_position, /**< Slave position. */
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   836
        uint16_t index, /**< Index of the SDO. */
2622
1aee02c1e294 Mark download data as const.
Gavin Lambert <uecasm@users.sourceforge.net>
parents: 2609
diff changeset
   837
        const uint8_t *data, /**< Data buffer to download. */
2150
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   838
        size_t data_size, /**< Size of the data buffer. */
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   839
        uint32_t *abort_code /**< Abort code of the SDO download. */
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   840
        );
5144a4bc6184 Added ecrt_master_sdo_download_complete() for ad-hoc downloading SDOs (also
Florian Pose <fp@igh-essen.com>
parents: 2107
diff changeset
   841
2107
ebda087981e1 Implemented ecrt_master_sdo_upload() and ecrt_master_sdo_download() for kernel
Florian Pose <fp@igh-essen.com>
parents: 2088
diff changeset
   842
/** Executes an SDO upload request to read data from a slave.
ebda087981e1 Implemented ecrt_master_sdo_upload() and ecrt_master_sdo_download() for kernel
Florian Pose <fp@igh-essen.com>
parents: 2088
diff changeset
   843
 *
ebda087981e1 Implemented ecrt_master_sdo_upload() and ecrt_master_sdo_download() for kernel
Florian Pose <fp@igh-essen.com>
parents: 2088
diff changeset
   844
 * This request is processed by the master state machine. This method blocks,
ebda087981e1 Implemented ecrt_master_sdo_upload() and ecrt_master_sdo_download() for kernel
Florian Pose <fp@igh-essen.com>
parents: 2088
diff changeset
   845
 * until the request has been processed and may not be called in realtime
ebda087981e1 Implemented ecrt_master_sdo_upload() and ecrt_master_sdo_download() for kernel
Florian Pose <fp@igh-essen.com>
parents: 2088
diff changeset
   846
 * context.
1510
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   847
 *
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   848
 * \retval  0 Success.
2107
ebda087981e1 Implemented ecrt_master_sdo_upload() and ecrt_master_sdo_download() for kernel
Florian Pose <fp@igh-essen.com>
parents: 2088
diff changeset
   849
 * \retval <0 Error code.
1510
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   850
 */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   851
int ecrt_master_sdo_upload(
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   852
        ec_master_t *master, /**< EtherCAT master. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   853
        uint16_t slave_position, /**< Slave position. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   854
        uint16_t index, /**< Index of the SDO. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   855
        uint8_t subindex, /**< Subindex of the SDO. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   856
        uint8_t *target, /**< Target buffer for the upload. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   857
        size_t target_size, /**< Size of the target buffer. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   858
        size_t *result_size, /**< Uploaded data size. */
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   859
        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
   860
        );
88b608a1a7f3 Improved bus information API.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   861
1913
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   862
/** Executes an SoE write request.
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   863
 *
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   864
 * Starts writing an IDN and blocks until the request was processed, or an
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   865
 * error occurred.
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   866
 *
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   867
 * \retval  0 Success.
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   868
 * \retval <0 Error code.
1913
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   869
 */
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   870
int ecrt_master_write_idn(
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   871
        ec_master_t *master, /**< EtherCAT master. */
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   872
        uint16_t slave_position, /**< Slave position. */
1952
7d9fb723fc4b Added drive_no parameter to SoE layer.
Florian Pose <fp@igh-essen.com>
parents: 1947
diff changeset
   873
        uint8_t drive_no, /**< Drive number. */
1913
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   874
        uint16_t idn, /**< SoE IDN (see ecrt_slave_config_idn()). */
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   875
        uint8_t *data, /**< Pointer to data to write. */
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   876
        size_t data_size, /**< Size of data to write. */
1947
024a3c6aa3f7 Implemented ecrt_master_read_idn() and ecrt_master_write_idn() in kernel space.
Florian Pose <fp@igh-essen.com>
parents: 1944
diff changeset
   877
        uint16_t *error_code /**< Pointer to variable, where an SoE error code
1913
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   878
                               can be stored. */
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   879
        );
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   880
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   881
/** Executes an SoE read request.
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   882
 *
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   883
 * Starts reading an IDN and blocks until the request was processed, or an
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   884
 * error occurred.
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   885
 *
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   886
 * \retval  0 Success.
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   887
 * \retval <0 Error code.
1913
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   888
 */
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   889
int ecrt_master_read_idn(
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   890
        ec_master_t *master, /**< EtherCAT master. */
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   891
        uint16_t slave_position, /**< Slave position. */
1952
7d9fb723fc4b Added drive_no parameter to SoE layer.
Florian Pose <fp@igh-essen.com>
parents: 1947
diff changeset
   892
        uint8_t drive_no, /**< Drive number. */
1913
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   893
        uint16_t idn, /**< SoE IDN (see ecrt_slave_config_idn()). */
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   894
        uint8_t *target, /**< Pointer to memory where the read data can be
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   895
                           stored. */
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   896
        size_t target_size, /**< Size of the memory \a target points to. */
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   897
        size_t *result_size, /**< Actual size of the received data. */
1947
024a3c6aa3f7 Implemented ecrt_master_read_idn() and ecrt_master_write_idn() in kernel space.
Florian Pose <fp@igh-essen.com>
parents: 1944
diff changeset
   898
        uint16_t *error_code /**< Pointer to variable, where an SoE error code
1913
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   899
                               can be stored. */
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   900
        );
cbef34ba142b Added ecrt_master_read_idn() and ecrt_master_write_idn() to read/write SoE
Florian Pose <fp@igh-essen.com>
parents: 1891
diff changeset
   901
1096
a32a102a30db Minor change.
Florian Pose <fp@igh-essen.com>
parents: 1092
diff changeset
   902
/** 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
   903
 *
925
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   904
 * 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
   905
 * 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
   906
 * 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
   907
 * 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
   908
 * 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
   909
 *
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   910
 * \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
   911
 * 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
   912
 * 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
   913
 * function, the master thread is responsible for that, so these functions may
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   914
 * not be called! The method itself allocates memory and should not be called
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   915
 * in realtime context.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   916
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   917
 * \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
   918
 */
1007
b6c3527697c3 Minor change.
Florian Pose <fp@igh-essen.com>
parents: 925
diff changeset
   919
int ecrt_master_activate(
b6c3527697c3 Minor change.
Florian Pose <fp@igh-essen.com>
parents: 925
diff changeset
   920
        ec_master_t *master /**< EtherCAT master. */
b6c3527697c3 Minor change.
Florian Pose <fp@igh-essen.com>
parents: 925
diff changeset
   921
        );
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   922
1530
96629de2202b Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   923
/** Deactivates the master.
96629de2202b Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   924
 *
96629de2202b Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   925
 * 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
   926
 * 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
   927
 * 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
   928
 * 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
   929
 * become invalid.
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   930
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   931
 * This method should not be called in realtime context.
1530
96629de2202b Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   932
 */
96629de2202b Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   933
void ecrt_master_deactivate(
96629de2202b Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   934
        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
   935
        );
96629de2202b Added ecrt_master_deactivate() to remove the bus configuration.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   936
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   937
/** Set interval between calls to ecrt_master_send().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   938
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   939
 * This information helps the master to decide, how much data can be appended
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   940
 * to a frame by the master state machine. When the master is configured with
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   941
 * --enable-hrtimers, this is used to calculate the scheduling of the master
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   942
 * thread.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   943
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   944
 * \retval 0 on success.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   945
 * \retval <0 Error code.
1600
e36c92cf58a9 use given send interval to limit SDO/FOE traffic
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1585
diff changeset
   946
 */
e36c92cf58a9 use given send interval to limit SDO/FOE traffic
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1585
diff changeset
   947
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
   948
        ec_master_t *master, /**< EtherCAT master. */
1804
742607c464c4 Removed tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1611
diff changeset
   949
        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
   950
        );
1f640e321ee4 ecrt_master_set_max_cycle_size: limit SDO traffic
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1580
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
/** 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
   953
 *
1092
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   954
 * This method takes all datagrams, that have been queued for transmission,
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   955
 * puts them into frames, and passes them to the Ethernet device for sending.
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   956
 *
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   957
 * Has to be called cyclically by the application after ecrt_master_activate()
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   958
 * has returned.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   959
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   960
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
   961
        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
   962
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   963
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   964
/** 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
   965
 *
1092
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   966
 * Queries the network device for received frames by calling the interrupt
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   967
 * service routine. Extracts received datagrams and dispatches the results to
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   968
 * the datagram objects in the queue. Received datagrams, and the ones that
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   969
 * timed out, will be marked, and dequeued.
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   970
 *
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1083
diff changeset
   971
 * 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
   972
 * 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
   973
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   974
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
   975
        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
   976
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   977
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   978
/** Sends non-application datagrams.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   979
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   980
 * This method has to be called in the send callback function passed via
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   981
 * ecrt_master_callbacks() to allow the sending of non-application datagrams.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   982
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   983
void ecrt_master_send_ext(
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   984
        ec_master_t *master /**< EtherCAT master. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   985
        );
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   986
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   987
/** 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
   988
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   989
 * Stores the master state information in the given \a state structure.
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   990
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   991
 * This method returns a global state. For the link-specific states in a
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   992
 * redundant bus topology, use the ecrt_master_link_state() method.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   993
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   994
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
   995
        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
   996
        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
   997
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   998
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
   999
/** Reads the current state of a redundant link.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1000
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1001
 * Stores the link state information in the given \a state structure.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1002
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1003
 * \return Zero on success, otherwise negative error code.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1004
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1005
int ecrt_master_link_state(
1978
d9b6e641eaeb added API ecrt_master_configured_slaves_state
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1861
diff changeset
  1006
        const ec_master_t *master, /**< EtherCAT master. */
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1007
        unsigned int dev_idx, /**< Index of the device (0 = main device, 1 =
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1008
                                first backup device, ...). */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1009
        ec_master_link_state_t *state /**< Structure to store the information.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1010
                                       */
1978
d9b6e641eaeb added API ecrt_master_configured_slaves_state
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1861
diff changeset
  1011
        );
d9b6e641eaeb added API ecrt_master_configured_slaves_state
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1861
diff changeset
  1012
1434
4c6fe0ae37f1 Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents: 1417
diff changeset
  1013
/** Sets the application time.
4c6fe0ae37f1 Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents: 1417
diff changeset
  1014
 *
1466
362147819ca1 EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
  1015
 * 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
  1016
 * 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
  1017
 * this method has to be called cyclically.
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
  1018
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1019
 * \attention The first call of this method is used to calculate the phase
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1020
 * delay for the slaves' SYNC0/1 interrupts. Either the method has to be
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1021
 * called during the realtime cycle *only*, or the first time submitted must
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1022
 * be in-phase with the realtime cycle. Otherwise synchronisation problems can
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1023
 * occur.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1024
 *
1466
362147819ca1 EC_TIMEVAL2NANO() takes no pointer argument any more.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
  1025
 * 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
  1026
 * <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
  1027
 * 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
  1028
 * ecrt_master_sync_reference_clock().
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
  1029
 *
1434
4c6fe0ae37f1 Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents: 1417
diff changeset
  1030
 * 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
  1031
 * 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
  1032
 */
4c6fe0ae37f1 Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents: 1417
diff changeset
  1033
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
  1034
        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
  1035
        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
  1036
        );
e77728ddf0f9 Introduced ecrt_master_sync() for synchronizing slave clocks to reference clock.
Florian Pose <fp@igh-essen.com>
parents: 1392
diff changeset
  1037
1434
4c6fe0ae37f1 Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents: 1417
diff changeset
  1038
/** 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
  1039
 *
4c6fe0ae37f1 Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents: 1417
diff changeset
  1040
 * 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
  1041
 * 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
  1042
 */
4c6fe0ae37f1 Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents: 1417
diff changeset
  1043
void ecrt_master_sync_reference_clock(
4c6fe0ae37f1 Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents: 1417
diff changeset
  1044
        ec_master_t *master /**< EtherCAT master. */
4c6fe0ae37f1 Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents: 1417
diff changeset
  1045
        );
4c6fe0ae37f1 Separated application time from synchronizing reference clock.
Florian Pose <fp@igh-essen.com>
parents: 1417
diff changeset
  1046
1410
fb6719008bf5 Separated sync_reference_clock() and sync_slave_clocks().
Florian Pose <fp@igh-essen.com>
parents: 1396
diff changeset
  1047
/** 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
  1048
 *
fb6719008bf5 Separated sync_reference_clock() and sync_slave_clocks().
Florian Pose <fp@igh-essen.com>
parents: 1396
diff changeset
  1049
 * 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
  1050
 */
fb6719008bf5 Separated sync_reference_clock() and sync_slave_clocks().
Florian Pose <fp@igh-essen.com>
parents: 1396
diff changeset
  1051
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
  1052
        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
  1053
        );
fb6719008bf5 Separated sync_reference_clock() and sync_slave_clocks().
Florian Pose <fp@igh-essen.com>
parents: 1396
diff changeset
  1054
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1055
/** Get the lower 32 bit of the reference clock system time.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1056
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1057
 * This method can be used to synchronize the master to the reference clock.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1058
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1059
 * The reference clock system time is queried via the
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1060
 * ecrt_master_sync_slave_clocks() method, that reads the system time of the
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1061
 * reference clock and writes it to the slave clocks (so be sure to call it
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1062
 * cyclically to get valid data).
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1063
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1064
 * \attention The returned time is the system time of the reference clock
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1065
 * minus the transmission delay of the reference clock.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1066
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1067
 * \retval 0 success, system time was written into \a time.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1068
 * \retval -ENXIO No reference clock found.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1069
 * \retval -EIO Slave synchronization datagram was not received.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1070
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1071
int ecrt_master_reference_clock_time(
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1072
        ec_master_t *master, /**< EtherCAT master. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1073
        uint32_t *time /**< Pointer to store the queried system time. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1074
        );
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1075
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1076
/** Queues the DC synchrony monitoring datagram for sending.
1535
0c484ee12d89 DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents: 1530
diff changeset
  1077
 *
0c484ee12d89 DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents: 1530
diff changeset
  1078
 * The datagram broadcast-reads all "System time difference" registers (\a
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1079
 * 0x092c) to get an upper estimation of the DC synchrony. The result can be
1535
0c484ee12d89 DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents: 1530
diff changeset
  1080
 * checked with the ecrt_master_sync_monitor_process() method.
0c484ee12d89 DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents: 1530
diff changeset
  1081
 */
0c484ee12d89 DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents: 1530
diff changeset
  1082
void ecrt_master_sync_monitor_queue(
0c484ee12d89 DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents: 1530
diff changeset
  1083
        ec_master_t *master /**< EtherCAT master. */
0c484ee12d89 DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents: 1530
diff changeset
  1084
        );
0c484ee12d89 DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents: 1530
diff changeset
  1085
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1086
/** Processes the DC synchrony monitoring datagram.
1535
0c484ee12d89 DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents: 1530
diff changeset
  1087
 *
0c484ee12d89 DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents: 1530
diff changeset
  1088
 * If the sync monitoring datagram was sent before with
0c484ee12d89 DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents: 1530
diff changeset
  1089
 * 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
  1090
 * method.
0c484ee12d89 DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents: 1530
diff changeset
  1091
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1092
 * \return Upper estimation of the maximum time difference in ns.
1535
0c484ee12d89 DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents: 1530
diff changeset
  1093
 */
0c484ee12d89 DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents: 1530
diff changeset
  1094
uint32_t ecrt_master_sync_monitor_process(
0c484ee12d89 DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents: 1530
diff changeset
  1095
        ec_master_t *master /**< EtherCAT master. */
0c484ee12d89 DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents: 1530
diff changeset
  1096
        );
0c484ee12d89 DC synchrony monitoring methods.
Florian Pose <fp@igh-essen.com>
parents: 1530
diff changeset
  1097
2009
b5391b329b5d Added ecrt_master_reset() method.
Florian Pose <fp@igh-essen.com>
parents: 1952
diff changeset
  1098
/** Retry configuring slaves.
b5391b329b5d Added ecrt_master_reset() method.
Florian Pose <fp@igh-essen.com>
parents: 1952
diff changeset
  1099
 *
b5391b329b5d Added ecrt_master_reset() method.
Florian Pose <fp@igh-essen.com>
parents: 1952
diff changeset
  1100
 * Via this method, the application can tell the master to bring all slaves to
b5391b329b5d Added ecrt_master_reset() method.
Florian Pose <fp@igh-essen.com>
parents: 1952
diff changeset
  1101
 * OP state. In general, this is not necessary, because it is automatically
b5391b329b5d Added ecrt_master_reset() method.
Florian Pose <fp@igh-essen.com>
parents: 1952
diff changeset
  1102
 * done by the master. But with special slaves, that can be reconfigured by
b5391b329b5d Added ecrt_master_reset() method.
Florian Pose <fp@igh-essen.com>
parents: 1952
diff changeset
  1103
 * the vendor during runtime, it can be useful.
b5391b329b5d Added ecrt_master_reset() method.
Florian Pose <fp@igh-essen.com>
parents: 1952
diff changeset
  1104
 */
b5391b329b5d Added ecrt_master_reset() method.
Florian Pose <fp@igh-essen.com>
parents: 1952
diff changeset
  1105
void ecrt_master_reset(
b5391b329b5d Added ecrt_master_reset() method.
Florian Pose <fp@igh-essen.com>
parents: 1952
diff changeset
  1106
        ec_master_t *master /**< EtherCAT master. */
b5391b329b5d Added ecrt_master_reset() method.
Florian Pose <fp@igh-essen.com>
parents: 1952
diff changeset
  1107
        );
b5391b329b5d Added ecrt_master_reset() method.
Florian Pose <fp@igh-essen.com>
parents: 1952
diff changeset
  1108
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1109
/******************************************************************************
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1110
 * Slave configuration methods
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1111
 *****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1112
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
  1113
/** 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
  1114
 *
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
  1115
 * 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
  1116
 * 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
  1117
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1118
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1119
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1120
 *
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
  1121
 * \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
  1122
 */
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
  1123
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
  1124
        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
  1125
        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
  1126
                              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
  1127
        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
  1128
        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
  1129
        );
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1500
diff changeset
  1130
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1500
diff changeset
  1131
/** Configure a slave's watchdog times.
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1132
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1133
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1134
 * ecrt_master_activate().
1536
171ddba165d2 Added watchdog documentation.
Florian Pose <fp@igh-essen.com>
parents: 1535
diff changeset
  1135
 */
1509
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1500
diff changeset
  1136
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
  1137
        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
  1138
        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
  1139
                                     base unit for all slave watchdogs. If set
171ddba165d2 Added watchdog documentation.
Florian Pose <fp@igh-essen.com>
parents: 1535
diff changeset
  1140
                                     to zero, the value is not written, so the
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1141
                                     default is used. */
1509
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1500
diff changeset
  1142
        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
  1143
                                      data watchdog. If set to zero, the value
171ddba165d2 Added watchdog documentation.
Florian Pose <fp@igh-essen.com>
parents: 1535
diff changeset
  1144
                                      is not written, so the default is used.
171ddba165d2 Added watchdog documentation.
Florian Pose <fp@igh-essen.com>
parents: 1535
diff changeset
  1145
                                     */
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
  1146
        );
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
  1147
2609
777d1a8b3a27 Integrate skeleton of allow_overlapping_pdos from af21f0bdc7c9
Dave Page <dave.page@gleeble.com>
parents: 2589
diff changeset
  1148
/** Configure whether a slave allows overlapping PDOs.
777d1a8b3a27 Integrate skeleton of allow_overlapping_pdos from af21f0bdc7c9
Dave Page <dave.page@gleeble.com>
parents: 2589
diff changeset
  1149
 *
777d1a8b3a27 Integrate skeleton of allow_overlapping_pdos from af21f0bdc7c9
Dave Page <dave.page@gleeble.com>
parents: 2589
diff changeset
  1150
 * Overlapping PDOs allows inputs to use the same space as outputs on the frame.
777d1a8b3a27 Integrate skeleton of allow_overlapping_pdos from af21f0bdc7c9
Dave Page <dave.page@gleeble.com>
parents: 2589
diff changeset
  1151
 * This reduces the frame length.
777d1a8b3a27 Integrate skeleton of allow_overlapping_pdos from af21f0bdc7c9
Dave Page <dave.page@gleeble.com>
parents: 2589
diff changeset
  1152
 */
777d1a8b3a27 Integrate skeleton of allow_overlapping_pdos from af21f0bdc7c9
Dave Page <dave.page@gleeble.com>
parents: 2589
diff changeset
  1153
void ecrt_slave_config_overlapping_pdos(
777d1a8b3a27 Integrate skeleton of allow_overlapping_pdos from af21f0bdc7c9
Dave Page <dave.page@gleeble.com>
parents: 2589
diff changeset
  1154
        ec_slave_config_t *sc, /**< Slave configuration. */
777d1a8b3a27 Integrate skeleton of allow_overlapping_pdos from af21f0bdc7c9
Dave Page <dave.page@gleeble.com>
parents: 2589
diff changeset
  1155
        uint8_t allow_overlapping_pdos /**< Allow overlapping PDOs */
777d1a8b3a27 Integrate skeleton of allow_overlapping_pdos from af21f0bdc7c9
Dave Page <dave.page@gleeble.com>
parents: 2589
diff changeset
  1156
        );
777d1a8b3a27 Integrate skeleton of allow_overlapping_pdos from af21f0bdc7c9
Dave Page <dave.page@gleeble.com>
parents: 2589
diff changeset
  1157
777d1a8b3a27 Integrate skeleton of allow_overlapping_pdos from af21f0bdc7c9
Dave Page <dave.page@gleeble.com>
parents: 2589
diff changeset
  1158
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1159
/** 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
  1160
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1161
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1162
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1163
 *
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
  1164
 * \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
  1165
 * \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
  1166
 */
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
  1167
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
  1168
        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
  1169
        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
  1170
                              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
  1171
        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
  1172
        );
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1173
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1174
/** 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
  1175
 *
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1176
 * 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
  1177
 * 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
  1178
 * sync manager.
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
  1179
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1180
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1181
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1182
 *
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
  1183
 * \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
  1184
 */
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
  1185
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
  1186
        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
  1187
        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
  1188
                              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
  1189
        );
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
  1190
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1191
/** 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
  1192
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1193
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1194
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1195
 *
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
  1196
 * \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
  1197
 * \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
  1198
 */
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
  1199
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
  1200
        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
  1201
        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
  1202
        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
  1203
                                mapping. */
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1204
        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
  1205
                                  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
  1206
        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
  1207
        );
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1208
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1209
/** 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
  1210
 *
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1211
 * 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
  1212
 * 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
  1213
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1214
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1215
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1216
 *
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
  1217
 * \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
  1218
 */
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
  1219
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
  1220
        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
  1221
        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
  1222
        );
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1223
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1224
/** 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
  1225
 *
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
  1226
 * 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
  1227
 * 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
  1228
 * 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
  1229
 * 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
  1230
 * 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
  1231
 *
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
  1232
 * 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
  1233
 * 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
  1234
 * 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
  1235
 * configuration time:
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1236
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1237
 * \code
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
  1238
 * 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
  1239
 *     {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
  1240
 *     {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
  1241
 * };
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
  1242
 *
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
  1243
 * 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
  1244
 *     {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
  1245
 *     {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
  1246
 * };
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
  1247
 *
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
  1248
 * 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
  1249
 *     {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
  1250
 *     {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
  1251
 * };
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
  1252
 *
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
  1253
 * 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
  1254
 *     {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
  1255
 *     {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
  1256
 *     {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
  1257
 * };
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
  1258
 *
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
  1259
 * 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
  1260
 *     // handle error
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
  1261
 * }
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1262
 * \endcode
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
  1263
 *
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1264
 * 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
  1265
 * 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
  1266
 * 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
  1267
 * 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
  1268
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1269
 * \code
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
  1270
 * 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
  1271
 *     {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
  1272
 *     {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
  1273
 * };
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
  1274
 *
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
  1275
 * 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
  1276
 *     {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
  1277
 * };
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
  1278
 *
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
  1279
 * 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
  1280
 *     // handle error
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
  1281
 * }
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1282
 * \endcode
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1283
 *
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
  1284
 * 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
  1285
 * - 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
  1286
 * - 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
  1287
 *   \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
  1288
 *   using EC_END is recommended.
878
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
  1289
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1290
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1291
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1292
 *
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1293
 * \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
  1294
 */
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
  1295
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
  1296
        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
  1297
        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
  1298
                                \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
  1299
        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
  1300
                                       configurations. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1301
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1302
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1303
/** 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
  1304
 *
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1305
 * 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
  1306
 * 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
  1307
 * 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
  1308
 * 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
  1309
 * 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
  1310
 * 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
  1311
 * 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
  1312
 * 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
  1313
 * 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
  1314
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1315
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1316
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1317
 *
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1318
 * \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
  1319
 * \retval  <0 Error code.
807
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 793
diff changeset
  1320
 */
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 793
diff changeset
  1321
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
  1322
        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
  1323
        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
  1324
        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
  1325
        ec_domain_t *domain, /**< Domain. */
1982
7421bca39b6d Insert port information into slave info.
Stefan Weiser <ch1010858@ch10pc584>
parents: 1981
diff changeset
  1326
        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
  1327
                                 is desired */
916
db73994fbdac Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents: 900
diff changeset
  1328
        );
db73994fbdac Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents: 900
diff changeset
  1329
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1330
/** Registers a PDO entry using its position.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1331
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1332
 * Similar to ecrt_slave_config_reg_pdo_entry(), but not using PDO indices but
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1333
 * offsets in the PDO mapping, because PDO entry indices may not be unique
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1334
 * inside a slave's PDO mapping. An error is raised, if
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1335
 * one of the given positions is out of range.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1336
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1337
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1338
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1339
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1340
 * \retval >=0 Success: Offset of the PDO entry's process data.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1341
 * \retval  <0 Error code.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1342
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1343
int ecrt_slave_config_reg_pdo_entry_pos(
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1344
        ec_slave_config_t *sc, /**< Slave configuration. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1345
        uint8_t sync_index, /**< Sync manager index. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1346
        unsigned int pdo_pos, /**< Position of the PDO inside the SM. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1347
        unsigned int entry_pos, /**< Position of the entry inside the PDO. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1348
        ec_domain_t *domain, /**< Domain. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1349
        unsigned int *bit_position /**< Optional address if bit addressing
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1350
                                 is desired */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1351
        );
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1352
1448
d7ba0c408a07 Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents: 1441
diff changeset
  1353
/** Configure distributed clocks.
d7ba0c408a07 Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents: 1441
diff changeset
  1354
 *
d7ba0c408a07 Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents: 1441
diff changeset
  1355
 * 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
  1356
 * signals.
1392
8fcc1d0987c1 DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1384
diff changeset
  1357
 *
8fcc1d0987c1 DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1384
diff changeset
  1358
 * 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
  1359
 * 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
  1360
 * if the slave shall be operated without distributed clocks (default).
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1361
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1362
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1363
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1364
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1365
 * \attention The \a sync1_shift time is ignored.
1392
8fcc1d0987c1 DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1384
diff changeset
  1366
 */
1448
d7ba0c408a07 Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents: 1441
diff changeset
  1367
void ecrt_slave_config_dc(
1804
742607c464c4 Removed tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1611
diff changeset
  1368
        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
  1369
        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
  1370
        uint32_t sync0_cycle, /**< SYNC0 cycle time [ns]. */
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1371
        int32_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
  1372
        uint32_t sync1_cycle, /**< SYNC1 cycle time [ns]. */
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1373
        int32_t sync1_shift /**< SYNC1 shift time [ns]. */
1804
742607c464c4 Removed tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1611
diff changeset
  1374
        );
1411
3ebef749275c Added shift times to api.
Florian Pose <fp@igh-essen.com>
parents: 1410
diff changeset
  1375
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1376
/** 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
  1377
 *
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1378
 * 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
  1379
 * 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
  1380
 * 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
  1381
 * 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
  1382
 *
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1383
 * \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
  1384
 * 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
  1385
 * 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
  1386
 * 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
  1387
 * friends instead.
9e7fe258495e Added attention to ecrt_slave_config_sdo().
Florian Pose <fp@igh-essen.com>
parents: 1096
diff changeset
  1388
 *
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1389
 * This is the generic function for adding an SDO configuration. Please note
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1390
 * that the this function does not do any endianness correction. If
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
  1391
 * datatype-specific functions are needed (that automatically correct the
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1392
 * endianness), have a look at ecrt_slave_config_sdo8(),
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
  1393
 * 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
  1394
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1395
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1396
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1397
 *
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
  1398
 * \retval  0 Success.
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
  1399
 * \retval <0 Error code.
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
  1400
 */
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
  1401
int ecrt_slave_config_sdo(
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
  1402
        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
  1403
        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
  1404
        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
  1405
        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
  1406
        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
  1407
        );
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
  1408
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1409
/** 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
  1410
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1411
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1412
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1413
 *
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
  1414
 * \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
  1415
 *
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
  1416
 * \retval  0 Success.
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
  1417
 * \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
  1418
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1419
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
  1420
        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
  1421
        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
  1422
        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
  1423
        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
  1424
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1425
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1426
/** 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
  1427
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1428
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1429
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1430
 *
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
  1431
 * \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
  1432
 *
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
  1433
 * \retval  0 Success.
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
  1434
 * \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
  1435
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1436
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
  1437
        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
  1438
        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
  1439
        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
  1440
        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
  1441
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1442
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1443
/** 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
  1444
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1445
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1446
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1447
 *
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
  1448
 * \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
  1449
 *
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
  1450
 * \retval  0 Success.
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
  1451
 * \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
  1452
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1453
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
  1454
        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
  1455
        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
  1456
        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
  1457
        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
  1458
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1459
1526
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1513
diff changeset
  1460
/** Add configuration data for a complete SDO.
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1513
diff changeset
  1461
 *
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1513
diff changeset
  1462
 * 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
  1463
 * subindex (0) have to be included.
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1513
diff changeset
  1464
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1465
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1466
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1467
 *
1526
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1513
diff changeset
  1468
 * \see ecrt_slave_config_sdo().
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1513
diff changeset
  1469
 *
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1513
diff changeset
  1470
 * \retval  0 Success.
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1513
diff changeset
  1471
 * \retval <0 Error code.
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1513
diff changeset
  1472
 */
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1513
diff changeset
  1473
int ecrt_slave_config_complete_sdo(
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1513
diff changeset
  1474
        ec_slave_config_t *sc, /**< Slave configuration. */
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1513
diff changeset
  1475
        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
  1476
        const uint8_t *data, /**< Pointer to the data. */
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1513
diff changeset
  1477
        size_t size /**< Size of the \a data. */
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1513
diff changeset
  1478
        );
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1513
diff changeset
  1479
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1480
/** Set the size of the CoE emergency ring buffer.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1481
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1482
 * The initial size is zero, so all messages will be dropped. This method can
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1483
 * be called even after master activation, but it will clear the ring buffer!
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1484
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1485
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1486
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1487
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1488
 * \return 0 on success, or negative error code.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1489
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1490
int ecrt_slave_config_emerg_size(
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1491
        ec_slave_config_t *sc, /**< Slave configuration. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1492
        size_t elements /**< Number of records of the CoE emergency ring. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1493
        );
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1494
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1495
/** Read and remove one record from the CoE emergency ring buffer.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1496
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1497
 * A record consists of 8 bytes:
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1498
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1499
 * Byte 0-1: Error code (little endian)
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1500
 * Byte   2: Error register
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1501
 * Byte 3-7: Data
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1502
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1503
 * \return 0 on success (record popped), or negative error code (i. e.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1504
 * -ENOENT, if ring is empty).
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1505
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1506
int ecrt_slave_config_emerg_pop(
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1507
        ec_slave_config_t *sc, /**< Slave configuration. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1508
        uint8_t *target /**< Pointer to target memory (at least
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1509
                          EC_COE_EMERGENCY_MSG_SIZE bytes). */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1510
        );
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1511
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1512
/** Clears CoE emergency ring buffer and the overrun counter.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1513
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1514
 * \return 0 on success, or negative error code.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1515
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1516
int ecrt_slave_config_emerg_clear(
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1517
        ec_slave_config_t *sc /**< Slave configuration. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1518
        );
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1519
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1520
/** Read the number of CoE emergency overruns.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1521
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1522
 * The overrun counter will be incremented when a CoE emergency message could
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1523
 * not be stored in the ring buffer and had to be dropped. Call
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1524
 * ecrt_slave_config_emerg_clear() to reset the counter.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1525
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1526
 * \return Number of overruns since last clear, or negative error code.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1527
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1528
int ecrt_slave_config_emerg_overruns(
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1529
        ec_slave_config_t *sc /**< Slave configuration. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1530
        );
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1531
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1532
/** 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
  1533
 *
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1534
 * 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
  1535
 * released.
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1536
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1537
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1538
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1539
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1540
 * \return New SDO request, or NULL on error.
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1541
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1542
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
  1543
        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
  1544
        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
  1545
        uint8_t subindex, /**< SDO subindex. */
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1546
        size_t size /**< Data size to reserve. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1547
        );
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1548
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1549
/** Create an VoE handler to exchange vendor-specific data during realtime
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1550
 * operation.
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1551
 *
1267
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1552
 * The number of VoE handlers per slave configuration is not limited, but
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1553
 * usually it is enough to create one for sending and one for receiving, if
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1554
 * both can be done simultaneously.
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1555
 *
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1556
 * The created VoE handler object is freed automatically when the master is
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1557
 * released.
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1558
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1559
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1560
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1561
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1562
 * \return New VoE handler, or NULL on error.
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1563
 */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1564
ec_voe_handler_t *ecrt_slave_config_create_voe_handler(
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1565
        ec_slave_config_t *sc, /**< Slave configuration. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1566
        size_t size /**< Data size to reserve. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1567
        );
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1568
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1569
/** Create a register request to exchange EtherCAT register contents during
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1570
 * realtime operation.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1571
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1572
 * This interface should not be used to take over master functionality,
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1573
 * instead it is intended for debugging and monitoring reasons.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1574
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1575
 * The created register request object is freed automatically when the master
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1576
 * is released.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1577
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1578
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1579
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1580
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1581
 * \return New register request, or NULL on error.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1582
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1583
ec_reg_request_t *ecrt_slave_config_create_reg_request(
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1584
        ec_slave_config_t *sc, /**< Slave configuration. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1585
        size_t size /**< Data size to reserve. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1586
        );
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1587
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1588
/** 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
  1589
 *
1891
dd7879e2e72b Added api doc.
Florian Pose <fp@igh-essen.com>
parents: 1861
diff changeset
  1590
 * Stores the state information in the given \a state structure. The state
dd7879e2e72b Added api doc.
Florian Pose <fp@igh-essen.com>
parents: 1861
diff changeset
  1591
 * information is updated by the master state machine, so it may take a few
dd7879e2e72b Added api doc.
Florian Pose <fp@igh-essen.com>
parents: 1861
diff changeset
  1592
 * cycles, until it changes.
dd7879e2e72b Added api doc.
Florian Pose <fp@igh-essen.com>
parents: 1861
diff changeset
  1593
 *
dd7879e2e72b Added api doc.
Florian Pose <fp@igh-essen.com>
parents: 1861
diff changeset
  1594
 * \attention If the state of process data exchange shall be monitored in
dd7879e2e72b Added api doc.
Florian Pose <fp@igh-essen.com>
parents: 1861
diff changeset
  1595
 * realtime, ecrt_domain_state() should be used.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1596
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1597
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
  1598
        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
  1599
        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
  1600
        );
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 288
diff changeset
  1601
1844
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1602
/** Add an SoE IDN configuration.
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1603
 *
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1604
 * A configuration for a Sercos-over-EtherCAT IDN is stored in the slave
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1605
 * configuration object and is written to the slave whenever the slave is
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1606
 * being configured by the master. This usually happens once on master
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1607
 * activation, but can be repeated subsequently, for example after the slave's
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1608
 * power supply failed.
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1609
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1610
 * The \a idn parameter can be separated into several sections:
1861
5b285964b4e7 Documented idn parameter.
Florian Pose <fp@igh-essen.com>
parents: 1844
diff changeset
  1611
 *  - Bit 15: Standard data (0) or Product data (1)
5b285964b4e7 Documented idn parameter.
Florian Pose <fp@igh-essen.com>
parents: 1844
diff changeset
  1612
 *  - Bit 14 - 12: Parameter set (0 - 7)
5b285964b4e7 Documented idn parameter.
Florian Pose <fp@igh-essen.com>
parents: 1844
diff changeset
  1613
 *  - Bit 11 - 0: Data block number (0 - 4095)
5b285964b4e7 Documented idn parameter.
Florian Pose <fp@igh-essen.com>
parents: 1844
diff changeset
  1614
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1615
 * Please note that the this function does not do any endianness correction.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1616
 * Multi-byte data have to be passed in EtherCAT endianness (little-endian).
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1617
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1618
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1619
 * ecrt_master_activate().
1844
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1620
 *
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1621
 * \retval  0 Success.
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1622
 * \retval <0 Error code.
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1623
 */
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1624
int ecrt_slave_config_idn(
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1625
        ec_slave_config_t *sc, /**< Slave configuration. */
1952
7d9fb723fc4b Added drive_no parameter to SoE layer.
Florian Pose <fp@igh-essen.com>
parents: 1947
diff changeset
  1626
        uint8_t drive_no, /**< Drive number. */
1844
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1627
        uint16_t idn, /**< SoE IDN. */
1944
73896ef6d077 Added state parameter to ecrt_slave_config_idn().
Florian Pose <fp@igh-essen.com>
parents: 1913
diff changeset
  1628
        ec_al_state_t state, /**< AL state in which to write the IDN (PREOP or
73896ef6d077 Added state parameter to ecrt_slave_config_idn().
Florian Pose <fp@igh-essen.com>
parents: 1913
diff changeset
  1629
                               SAFEOP). */
1844
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1630
        const uint8_t *data, /**< Pointer to the data. */
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1631
        size_t size /**< Size of the \a data. */
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1632
        );
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1804
diff changeset
  1633
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  1634
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  1635
 * Domain methods
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  1636
 *****************************************************************************/
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1637
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1638
/** 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
  1639
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1640
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1641
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1642
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1643
 * \see ecrt_slave_config_reg_pdo_entry()
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1644
 *
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1645
 * \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
  1646
 *            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
  1647
 * \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
  1648
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1649
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
  1650
        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
  1651
        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
  1652
                                                   registrations. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1653
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1654
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1655
/** 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
  1656
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1657
 * \return Size of the process data image, or a negative error code.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1658
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1659
size_t ecrt_domain_size(
1257
9844ac126275 Made ecrt_domain_size() const.
Florian Pose <fp@igh-essen.com>
parents: 1256
diff changeset
  1660
        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
  1661
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1662
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1663
#ifdef __KERNEL__
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1664
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
  1665
/** Provide external memory to store the domain's process data.
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
  1666
 *
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1667
 * Call this after all PDO entries have been registered and before activating
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
  1668
 * the master.
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
  1669
 *
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
  1670
 * 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
  1671
 * all PDO entries have been registered.
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1672
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1673
 * This method has to be called in non-realtime context before
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1674
 * ecrt_master_activate().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1675
 *
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
  1676
 */
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
  1677
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
  1678
        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
  1679
        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
  1680
                          data in. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1681
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1682
1248
3cc16b60a571 External memory only in kernel space.
Florian Pose <fp@igh-essen.com>
parents: 1244
diff changeset
  1683
#endif /* __KERNEL__ */
3cc16b60a571 External memory only in kernel space.
Florian Pose <fp@igh-essen.com>
parents: 1244
diff changeset
  1684
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
  1685
/** Returns the domain's process data.
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
  1686
 *
1258
900f1124e8f8 Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents: 1257
diff changeset
  1687
 * - In kernel context: If external memory was provided with
900f1124e8f8 Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents: 1257
diff changeset
  1688
 * 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
  1689
 * 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
  1690
 * 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
  1691
 * ecrt_master_activate().
900f1124e8f8 Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents: 1257
diff changeset
  1692
 *
900f1124e8f8 Memory-mapped process data.
Florian Pose <fp@igh-essen.com>
parents: 1257
diff changeset
  1693
 * - 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
  1694
 * ecrt_master_activate() to get the mapped domain process data memory.
1256
45fe0af4340b Warning.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
  1695
 *
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
  1696
 * \return Pointer to the process data memory.
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
  1697
 */
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
  1698
uint8_t *ecrt_domain_data(
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
  1699
        ec_domain_t *domain /**< Domain. */
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
  1700
        );
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
  1701
886
ee1b25db1fbf Added a few docs.
Florian Pose <fp@igh-essen.com>
parents: 880
diff changeset
  1702
/** Determines the states of the domain's datagrams.
ee1b25db1fbf Added a few docs.
Florian Pose <fp@igh-essen.com>
parents: 880
diff changeset
  1703
 *
ee1b25db1fbf Added a few docs.
Florian Pose <fp@igh-essen.com>
parents: 880
diff changeset
  1704
 * Evaluates the working counters of the received datagrams and outputs
ee1b25db1fbf Added a few docs.
Florian Pose <fp@igh-essen.com>
parents: 880
diff changeset
  1705
 * statistics, if necessary. This must be called after ecrt_master_receive()
ee1b25db1fbf Added a few docs.
Florian Pose <fp@igh-essen.com>
parents: 880
diff changeset
  1706
 * is expected to receive the domain datagrams in order to make
ee1b25db1fbf Added a few docs.
Florian Pose <fp@igh-essen.com>
parents: 880
diff changeset
  1707
 * 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
  1708
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1709
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
  1710
        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
  1711
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1712
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1713
/** (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
  1714
 *
886
ee1b25db1fbf Added a few docs.
Florian Pose <fp@igh-essen.com>
parents: 880
diff changeset
  1715
 * Call this function to mark the domain's datagrams for exchanging at the
ee1b25db1fbf Added a few docs.
Florian Pose <fp@igh-essen.com>
parents: 880
diff changeset
  1716
 * 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
  1717
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1718
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
  1719
        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
  1720
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1721
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1722
/** 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
  1723
 *
886
ee1b25db1fbf Added a few docs.
Florian Pose <fp@igh-essen.com>
parents: 880
diff changeset
  1724
 * Stores the domain state in the given \a state structure.
1891
dd7879e2e72b Added api doc.
Florian Pose <fp@igh-essen.com>
parents: 1861
diff changeset
  1725
 *
dd7879e2e72b Added api doc.
Florian Pose <fp@igh-essen.com>
parents: 1861
diff changeset
  1726
 * Using this method, the process data exchange can be monitored in realtime.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1727
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1728
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
  1729
        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
  1730
        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
  1731
                                   information. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  1732
        );
635
d304ef4af542 Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 612
diff changeset
  1733
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1734
/*****************************************************************************
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1735
 * SDO request methods.
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1736
 ****************************************************************************/
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1737
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1738
/** Set the SDO index and subindex.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1739
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1740
 * \attention If the SDO index and/or subindex is changed while
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1741
 * ecrt_sdo_request_state() returns EC_REQUEST_BUSY, this may lead to
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1742
 * unexpected results.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1743
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1744
void ecrt_sdo_request_index(
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1745
        ec_sdo_request_t *req, /**< SDO request. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1746
        uint16_t index, /**< SDO index. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1747
        uint8_t subindex /**< SDO subindex. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1748
        );
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1749
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1750
/** 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
  1751
 *
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1752
 * 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
  1753
 * as failed.
1113
4d720feb915d Updated doc.
Florian Pose <fp@igh-essen.com>
parents: 1104
diff changeset
  1754
 *
4d720feb915d Updated doc.
Florian Pose <fp@igh-essen.com>
parents: 1104
diff changeset
  1755
 * The timeout is permanently stored in the request object and is valid until
4d720feb915d Updated doc.
Florian Pose <fp@igh-essen.com>
parents: 1104
diff changeset
  1756
 * the next call of this method.
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1757
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1758
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
  1759
        ec_sdo_request_t *req, /**< SDO request. */
880
f6212c54a5e3 Implemented Sdo timeout.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
  1760
        uint32_t timeout /**< Timeout in milliseconds. Zero means no
f6212c54a5e3 Implemented Sdo timeout.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
  1761
                           timeout. */
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1762
        );
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1763
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1764
/** 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
  1765
 *
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1766
 * This function returns a pointer to the request's internal SDO data memory.
868
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
  1767
 *
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
  1768
 * - After a read operation was successful, integer data can be evaluated using
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
  1769
 *   the EC_READ_*() macros as usual. Example:
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
  1770
 *   \code
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
  1771
 *   uint16_t value = EC_READ_U16(ecrt_sdo_request_data(sdo)));
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
  1772
 *   \endcode
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
  1773
 * - If a write operation shall be triggered, the data have to be written to
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
  1774
 *   the internal memory. Use the EC_WRITE_*() macros, if you are writing
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
  1775
 *   integer data. Be sure, that the data fit into the memory. The memory size
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
  1776
 *   is a parameter of ecrt_slave_config_create_sdo_request().
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
  1777
 *   \code
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
  1778
 *   EC_WRITE_U16(ecrt_sdo_request_data(sdo), 0xFFFF);
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
  1779
 *   \endcode
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
  1780
 *
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
  1781
 * \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
  1782
 * the internal SDO data memory could be re-allocated if the read SDO data do
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
  1783
 * not fit inside.
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1784
 *
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1785
 * \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
  1786
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1787
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
  1788
        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
  1789
        );
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1790
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1791
/** 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
  1792
 *
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1793
 * 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
  1794
 * 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
  1795
 * 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
  1796
 *
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1797
 * \return SDO data size in bytes.
869
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
  1798
 */
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
  1799
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
  1800
        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
  1801
        );
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1802
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1803
/** 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
  1804
 *
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1805
 * \return Request state.
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1806
 */
1352
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1341
diff changeset
  1807
#ifdef __KERNEL__
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1808
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
  1809
        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
  1810
    );
1352
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1341
diff changeset
  1811
#else
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1341
diff changeset
  1812
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
  1813
        ec_sdo_request_t *req /**< SDO request. */
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1341
diff changeset
  1814
    );
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1341
diff changeset
  1815
#endif
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1816
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1817
/** Schedule an SDO write operation.
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
  1818
 *
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
  1819
 * \attention This method may not be called while ecrt_sdo_request_state()
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1820
 * returns EC_REQUEST_BUSY.
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1821
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1822
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
  1823
        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
  1824
        );
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1825
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
  1826
/** Schedule an SDO read operation.
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
  1827
 *
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
  1828
 * \attention This method may not be called while ecrt_sdo_request_state()
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1829
 * returns EC_REQUEST_BUSY.
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1830
 *
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1831
 * \attention After calling this function, the return value of
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
  1832
 * ecrt_sdo_request_data() must be considered as invalid while
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1833
 * ecrt_sdo_request_state() returns EC_REQUEST_BUSY.
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1834
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1835
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
  1836
        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
  1837
        );
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
  1838
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1839
/*****************************************************************************
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1840
 * VoE handler methods.
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1841
 ****************************************************************************/
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1842
1226
afb189516fcf Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents: 1218
diff changeset
  1843
/** Sets the VoE header for future send operations.
1218
6f3a973fc29e Introduced VoE header.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
  1844
 *
6f3a973fc29e Introduced VoE header.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
  1845
 * A VoE message shall contain a 4-byte vendor ID, followed by a 2-byte vendor
1267
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1846
 * type at as header. These numbers can be set with this function. The values
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1847
 * are valid and will be used for future send operations until the next call
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1848
 * of this method.
1218
6f3a973fc29e Introduced VoE header.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
  1849
 */
1226
afb189516fcf Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents: 1218
diff changeset
  1850
void ecrt_voe_handler_send_header(
1218
6f3a973fc29e Introduced VoE header.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
  1851
        ec_voe_handler_t *voe, /**< VoE handler. */
6f3a973fc29e Introduced VoE header.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
  1852
        uint32_t vendor_id, /**< Vendor ID. */
6f3a973fc29e Introduced VoE header.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
  1853
        uint16_t vendor_type /**< Vendor-specific type. */
6f3a973fc29e Introduced VoE header.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
  1854
        );
6f3a973fc29e Introduced VoE header.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
  1855
1226
afb189516fcf Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents: 1218
diff changeset
  1856
/** 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
  1857
 *
1267
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1858
 * This method can be used to get the received VoE header information after a
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1859
 * read operation has succeeded.
1226
afb189516fcf Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents: 1218
diff changeset
  1860
 *
afb189516fcf Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents: 1218
diff changeset
  1861
 * 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
  1862
 * parameters.
afb189516fcf Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents: 1218
diff changeset
  1863
 */
afb189516fcf Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents: 1218
diff changeset
  1864
void ecrt_voe_handler_received_header(
afb189516fcf Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents: 1218
diff changeset
  1865
        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
  1866
        uint32_t *vendor_id, /**< Vendor ID. */
afb189516fcf Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents: 1218
diff changeset
  1867
        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
  1868
        );
afb189516fcf Introduced ecrt_voe_handler_received_header(); renamed
Florian Pose <fp@igh-essen.com>
parents: 1218
diff changeset
  1869
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1870
/** Access to the VoE handler's data.
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1871
 *
1267
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1872
 * This function returns a pointer to the VoE handler's internal memory, that
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1873
 * points to the actual VoE data right after the VoE header (see
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1874
 * ecrt_voe_handler_send_header()).
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1875
 *
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1876
 * - After a read operation was successful, the memory contains the received
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1877
 *   data. The size of the received data can be determined via
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1878
 *   ecrt_voe_handler_data_size().
1267
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1879
 * - Before a write operation is triggered, the data have to be written to the
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1880
 *   internal memory. Be sure, that the data fit into the memory. The reserved
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1881
 *   memory size is a parameter of ecrt_slave_config_create_voe_handler().
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1882
 *
1267
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1883
 * \attention The returned pointer is not necessarily persistent: After a read
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1884
 * operation, the internal memory may have been reallocated. This can be
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1885
 * avoided by reserving enough memory via the \a size parameter of
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1886
 * ecrt_slave_config_create_voe_handler().
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1887
 *
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1888
 * \return Pointer to the internal memory.
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1889
 */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1890
uint8_t *ecrt_voe_handler_data(
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1891
        ec_voe_handler_t *voe /**< VoE handler. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1892
        );
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1893
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1894
/** Returns the current data size.
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1895
 *
1218
6f3a973fc29e Introduced VoE header.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
  1896
 * 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
  1897
 * ecrt_voe_handler_send_header()).
1218
6f3a973fc29e Introduced VoE header.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
  1898
 *
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1899
 * When the VoE handler is created, the data size is set to the size of the
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1900
 * reserved memory. At a write operation, the data size is set to the number
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1901
 * of bytes to write. After a read operation the size is set to the size of
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1902
 * the read data. The size is not modified in any other situation.
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1903
 *
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1904
 * \return Data size in bytes.
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1905
 */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1906
size_t ecrt_voe_handler_data_size(
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1907
        const ec_voe_handler_t *voe /**< VoE handler. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1908
        );
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1909
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1910
/** Start a VoE write operation.
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1911
 *
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1912
 * 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
  1913
 * 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
  1914
 * other operation may be started while the handler is busy.
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1915
 */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1916
void ecrt_voe_handler_write(
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1917
        ec_voe_handler_t *voe, /**< VoE handler. */
1218
6f3a973fc29e Introduced VoE header.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
  1918
        size_t size /**< Number of bytes to write (without the VoE header). */
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1919
        );
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1920
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1921
/** Start a VoE read operation.
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1922
 *
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1923
 * 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
  1924
 * 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
  1925
 * other operation may be started while the handler is busy.
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1926
 *
1267
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1927
 * The state machine queries the slave's send mailbox for new data to be send
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1928
 * to the master. If no data appear within the EC_VOE_RESPONSE_TIMEOUT
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1929
 * (defined in master/voe_handler.c), the operation fails.
75900030f0c3 Improved VoE docs.
Florian Pose <fp@igh-essen.com>
parents: 1258
diff changeset
  1930
 *
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1931
 * 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
  1932
 * 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
  1933
 * can be retrieved with ecrt_voe_handler_received_header().
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1934
 */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1935
void ecrt_voe_handler_read(
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1936
        ec_voe_handler_t *voe /**< VoE handler. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1937
        );
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1938
1314
b3d06a8807b3 Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
  1939
/** 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
  1940
 *
b3d06a8807b3 Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
  1941
 * 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
  1942
 * 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
  1943
 * 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
  1944
 *
b3d06a8807b3 Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
  1945
 * 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
  1946
 * 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
  1947
 * 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
  1948
 * fails.
b3d06a8807b3 Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
  1949
 *
b3d06a8807b3 Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
  1950
 * 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
  1951
 * 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
  1952
 * 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
  1953
 */
b3d06a8807b3 Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
  1954
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
  1955
        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
  1956
        );
b3d06a8807b3 Included ecrt_voe_handler_read_nosync()-Patch by Mathias Weber.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
  1957
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1958
/** Execute the handler.
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1959
 *
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1960
 * This method executes the VoE handler. It has to be called in every bus
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1961
 * cycle as long as it returns EC_REQUEST_BUSY.
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1962
 *
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1963
 * \return Handler state.
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1964
 */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1965
ec_request_state_t ecrt_voe_handler_execute(
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1966
    ec_voe_handler_t *voe /**< VoE handler. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1967
    );
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1182
diff changeset
  1968
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1969
/*****************************************************************************
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1970
 * Register request methods.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1971
 ****************************************************************************/
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1972
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1973
/** Access to the register request's data.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1974
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1975
 * This function returns a pointer to the request's internal memory.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1976
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1977
 * - After a read operation was successful, integer data can be evaluated
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1978
 *   using the EC_READ_*() macros as usual. Example:
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1979
 *   \code
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1980
 *   uint16_t value = EC_READ_U16(ecrt_reg_request_data(reg_request)));
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1981
 *   \endcode
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1982
 * - If a write operation shall be triggered, the data have to be written to
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1983
 *   the internal memory. Use the EC_WRITE_*() macros, if you are writing
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1984
 *   integer data. Be sure, that the data fit into the memory. The memory size
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1985
 *   is a parameter of ecrt_slave_config_create_reg_request().
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1986
 *   \code
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1987
 *   EC_WRITE_U16(ecrt_reg_request_data(reg_request), 0xFFFF);
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1988
 *   \endcode
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1989
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1990
 * \return Pointer to the internal memory.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1991
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1992
uint8_t *ecrt_reg_request_data(
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1993
        ec_reg_request_t *req /**< Register request. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1994
        );
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1995
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1996
/** Get the current state of the register request.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1997
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1998
 * \return Request state.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  1999
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2000
#ifdef __KERNEL__
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2001
ec_request_state_t ecrt_reg_request_state(
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2002
        const ec_reg_request_t *req /**< Register request. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2003
    );
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2004
#else
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2005
ec_request_state_t ecrt_reg_request_state(
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2006
        ec_reg_request_t *req /**< Register request. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2007
    );
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2008
#endif
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2009
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2010
/** Schedule an register write operation.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2011
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2012
 * \attention This method may not be called while ecrt_reg_request_state()
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2013
 * returns EC_REQUEST_BUSY.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2014
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2015
 * \attention The \a size parameter is truncated to the size given at request
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2016
 * creation.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2017
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2018
void ecrt_reg_request_write(
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2019
        ec_reg_request_t *req, /**< Register request. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2020
        uint16_t address, /**< Register address. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2021
        size_t size /**< Size to write. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2022
        );
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2023
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2024
/** Schedule a register read operation.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2025
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2026
 * \attention This method may not be called while ecrt_reg_request_state()
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2027
 * returns EC_REQUEST_BUSY.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2028
 *
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2029
 * \attention The \a size parameter is truncated to the size given at request
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2030
 * creation.
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2031
 */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2032
void ecrt_reg_request_read(
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2033
        ec_reg_request_t *req, /**< Register request. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2034
        uint16_t address, /**< Register address. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2035
        size_t size /**< Size to write. */
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2036
        );
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2248
diff changeset
  2037
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
  2038
/*****************************************************************************/
bf0d42ca5aec Wrapped c function in 'extern "C"' to make the library usable in C++
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
  2039
bf0d42ca5aec Wrapped c function in 'extern "C"' to make the library usable in C++
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
  2040
#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
  2041
}
bf0d42ca5aec Wrapped c function in 'extern "C"' to make the library usable in C++
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
  2042
#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
  2043
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2044
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2045
 * Bitwise read/write macros
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2046
 *****************************************************************************/
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2047
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2048
/** 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
  2049
 *
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
  2050
 * \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
  2051
 * \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
  2052
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2053
#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
  2054
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2055
/** 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
  2056
 *
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
  2057
 * \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
  2058
 * \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
  2059
 * \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
  2060
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2061
#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
  2062
    do { \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2063
        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
  2064
        else     *((uint8_t *) (DATA)) &= ~(1 << (POS)); \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2065
    } while (0)
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2066
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2067
/******************************************************************************
1254
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2068
 * Byte-swapping functions for user space
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2069
 *****************************************************************************/
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2070
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2071
#ifndef __KERNEL__
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2072
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2073
#if __BYTE_ORDER == __LITTLE_ENDIAN
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2074
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2075
#define le16_to_cpu(x) x
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2076
#define le32_to_cpu(x) x
1384
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2077
#define le64_to_cpu(x) x
1254
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2078
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2079
#define cpu_to_le16(x) x
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2080
#define cpu_to_le32(x) x
1384
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2081
#define cpu_to_le64(x) x
1254
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2082
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2083
#elif __BYTE_ORDER == __BIG_ENDIAN
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2084
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2085
#define swap16(x) \
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2086
        ((uint16_t)( \
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2087
        (((uint16_t)(x) & 0x00ffU) << 8) | \
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2088
        (((uint16_t)(x) & 0xff00U) >> 8) ))
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2089
#define swap32(x) \
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2090
        ((uint32_t)( \
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2091
        (((uint32_t)(x) & 0x000000ffUL) << 24) | \
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2092
        (((uint32_t)(x) & 0x0000ff00UL) <<  8) | \
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2093
        (((uint32_t)(x) & 0x00ff0000UL) >>  8) | \
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2094
        (((uint32_t)(x) & 0xff000000UL) >> 24) ))
1384
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2095
#define swap64(x) \
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2096
        ((uint64_t)( \
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2097
        (((uint64_t)(x) & 0x00000000000000ffULL) << 56) | \
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2098
        (((uint64_t)(x) & 0x000000000000ff00ULL) << 40) | \
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2099
        (((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2100
        (((uint64_t)(x) & 0x00000000ff000000ULL) <<  8) | \
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2101
        (((uint64_t)(x) & 0x000000ff00000000ULL) >>  8) | \
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2102
        (((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | \
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2103
        (((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2104
        (((uint64_t)(x) & 0xff00000000000000ULL) >> 56) ))
1254
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2105
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2106
#define le16_to_cpu(x) swap16(x)
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2107
#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
  2108
#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
  2109
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2110
#define cpu_to_le16(x) swap16(x)
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2111
#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
  2112
#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
  2113
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2114
#endif
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2115
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2116
#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
  2117
#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
  2118
#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
  2119
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2120
#endif /* ifndef __KERNEL__ */
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2121
c19d273a9e76 Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 1248
diff changeset
  2122
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2123
 * Read macros
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2124
 *****************************************************************************/
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2125
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2126
/** 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
  2127
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2128
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2129
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2130
#define EC_READ_U8(DATA) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2131
    ((uint8_t) *((uint8_t *) (DATA)))
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2132
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2133
/** 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
  2134
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2135
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2136
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2137
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2138
#define EC_READ_S8(DATA) \
288
89d3c61ef3e6 Minor changes to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 286
diff changeset
  2139
     ((int8_t) *((uint8_t *) (DATA)))
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2140
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2141
/** 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
  2142
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2143
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2144
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2145
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2146
#define EC_READ_U16(DATA) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2147
     ((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
  2148
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2149
/** 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
  2150
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2151
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2152
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2153
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2154
#define EC_READ_S16(DATA) \
288
89d3c61ef3e6 Minor changes to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 286
diff changeset
  2155
     ((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
  2156
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2157
/** 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
  2158
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2159
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2160
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2161
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2162
#define EC_READ_U32(DATA) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2163
     ((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
  2164
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2165
/** 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
  2166
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2167
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2168
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2169
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2170
#define EC_READ_S32(DATA) \
288
89d3c61ef3e6 Minor changes to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 286
diff changeset
  2171
     ((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
  2172
1384
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2173
/** 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
  2174
 *
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2175
 * \param DATA EtherCAT data pointer
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2176
 * \return EtherCAT data value
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2177
 */
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2178
#define EC_READ_U64(DATA) \
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2179
     ((uint64_t) le64_to_cpup((void *) (DATA)))
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2180
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2181
/** 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
  2182
 *
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2183
 * \param DATA EtherCAT data pointer
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2184
 * \return EtherCAT data value
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2185
 */
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2186
#define EC_READ_S64(DATA) \
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2187
     ((int64_t) le64_to_cpup((void *) (DATA)))
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2188
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2189
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2190
 * Write macros
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2191
 *****************************************************************************/
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2192
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2193
/** 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
  2194
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2195
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2196
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2197
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2198
#define EC_WRITE_U8(DATA, VAL) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2199
    do { \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2200
        *((uint8_t *)(DATA)) = ((uint8_t) (VAL)); \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2201
    } while (0)
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2202
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2203
/** 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
  2204
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2205
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2206
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2207
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2208
#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
  2209
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2210
/** 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
  2211
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2212
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2213
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2214
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2215
#define EC_WRITE_U16(DATA, VAL) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2216
    do { \
894
440c43d56b33 Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents: 893
diff changeset
  2217
        *((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
  2218
    } while (0)
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2219
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2220
/** 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
  2221
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2222
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2223
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2224
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2225
#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
  2226
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2227
/** 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
  2228
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2229
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2230
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2231
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2232
#define EC_WRITE_U32(DATA, VAL) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2233
    do { \
894
440c43d56b33 Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents: 893
diff changeset
  2234
        *((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
  2235
    } while (0)
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2236
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2237
/** 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
  2238
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2239
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2240
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
  2241
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
  2242
#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
  2243
1384
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2244
/** 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
  2245
 *
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2246
 * \param DATA EtherCAT data pointer
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2247
 * \param VAL new value
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2248
 */
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2249
#define EC_WRITE_U64(DATA, VAL) \
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2250
    do { \
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2251
        *((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
  2252
    } while (0)
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2253
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2254
/** 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
  2255
 *
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2256
 * \param DATA EtherCAT data pointer
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2257
 * \param VAL new value
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2258
 */
21b5343910c2 Added 64-bit data access macros.
Florian Pose <fp@igh-essen.com>
parents: 1377
diff changeset
  2259
#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
  2260
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2261
/*****************************************************************************/
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2262
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  2263
/** @} */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
  2264
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2265
#endif