include/ecrt.h
author Florian Pose <fp@igh-essen.com>
Thu, 26 Jun 2008 13:41:42 +0000
changeset 1056 7b656881e771
parent 1055 2be8918682fa
child 1082 ff06c58e269c
permissions -rw-r--r--
Configuration error, if sync manager configuration configuration with
assigned Pdos is not provided by 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
 *
125
b01bd5b830d7 Sch?nheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 114
diff changeset
     3
 *  $Id$
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     5
 *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     6
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     8
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    10
 *  and/or modify it under the terms of the GNU General Public License
246
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 206
diff changeset
    11
 *  as published by the Free Software Foundation; either version 2 of the
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 206
diff changeset
    12
 *  License, or (at your option) any later version.
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    13
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    14
 *  The IgH EtherCAT Master is distributed in the hope that it will be
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    15
 *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    17
 *  GNU General Public License for more details.
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    18
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    19
 *  You should have received a copy of the GNU General Public License
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    20
 *  along with the IgH EtherCAT Master; if not, write to the Free Software
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    22
 *
246
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 206
diff changeset
    23
 *  The right to use EtherCAT Technology is granted and comes free of
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 206
diff changeset
    24
 *  charge under condition of compatibility of product made by
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 206
diff changeset
    25
 *  Licensee. People intending to distribute/sell products based on the
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 206
diff changeset
    26
 *  code, have to sign an agreement to guarantee that products using
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 206
diff changeset
    27
 *  software based on IgH EtherCAT master stay compatible with the actual
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 206
diff changeset
    28
 *  EtherCAT specification (which are released themselves as an open
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 206
diff changeset
    29
 *  standard) as the (only) precondition to have the right to use EtherCAT
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 206
diff changeset
    30
 *  Technology, IP and trade marks.
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 206
diff changeset
    31
 *
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
 *****************************************************************************/
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
786
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 781
diff changeset
    34
/** \file
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 781
diff changeset
    35
 *
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
    36
 * EtherCAT Realtime Interface.
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
    37
 *
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
    38
 * \defgroup RealtimeInterface EtherCAT Realtime Interface
786
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 781
diff changeset
    39
 *
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
    40
 * EtherCAT interface for realtime applications. This interface is designed
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
    41
 * for realtime modules that want to use EtherCAT. There are functions to
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
    42
 * request a master, to map process data, to communicate with slaves via CoE
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
    43
 * and to configure and activate the bus.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    44
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    45
 * Changes in Version 1.4:
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    46
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    47
 * - Replaced ec_slave_t with ec_slave_config_t, separating the slave objects
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    48
 *   from the requested bus configuration. Therefore, renamed
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    49
 *   ecrt_master_get_slave() to ecrt_master_slave_config().
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    50
 * - Replaced slave address string with alias and position values. See
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    51
 *   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
    52
 * - Removed ecrt_master_get_slave_by_pos(), because it is no longer
807
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 793
diff changeset
    53
 *   necessary due to alias/position addressing.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    54
 * - Added ec_slave_config_state_t for the new method
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    55
 *   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
    56
 * - Process data memory for a domain can now be allocated externally. This
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
    57
 *   offers the possibility to use a shared-memory region. Therefore,
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
    58
 *   added the domain methods ecrt_domain_size() and
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
    59
 *   ecrt_domain_external_memory().
925
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
    60
 * - Pdo entry registration functions do not return a process data pointer,
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
    61
 *   but an offset in the domain's process data. In addition, an optional bit
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
    62
 *   position can be requested. This was necessary for the external domain
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
    63
 *   memory. An additional advantage is, that the returned offset is
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
    64
 *   immediately valid. If the domain's process data is allocated internally,
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
    65
 *   the start address can be retrieved with ecrt_domain_data().
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    66
 * - Replaced ecrt_slave_pdo_mapping/add/clear() with
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
    67
 *   ecrt_slave_config_pdo_assign_add() to add a Pdo to a sync manager's Pdo
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
    68
 *   assignment and ecrt_slave_config_pdo_mapping_add() to add a Pdo entry to a
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
    69
 *   Pdo's mapping. ecrt_slave_config_pdos() is a convenience function
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
    70
 *   for both, that uses the new data types ec_pdo_info_t and
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
    71
 *   ec_pdo_entry_info_t. Pdo entries, that are mapped with these functions
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
    72
 *   can now immediately be registered, even if the bus is offline.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    73
 * - Renamed ec_bus_status_t, ec_master_status_t to ec_bus_state_t and
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    74
 *   ec_master_state_t, respectively. Renamed ecrt_master_get_status() to
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    75
 *   ecrt_master_state(), for consistency reasons.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    76
 * - Added ec_domain_state_t and ec_wc_state_t for a new output parameter
832
a5b4f1d17908 Updated news.
Florian Pose <fp@igh-essen.com>
parents: 810
diff changeset
    77
 *   of ecrt_domain_state(). The domain state object does now contain
a5b4f1d17908 Updated news.
Florian Pose <fp@igh-essen.com>
parents: 810
diff changeset
    78
 *   information, if the process data was exchanged completely.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    79
 * - Former "Pdo registration" meant Pdo entry registration in fact, therefore
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    80
 *   renamed ec_pdo_reg_t to ec_pdo_entry_reg_t and ecrt_domain_register_pdo()
807
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 793
diff changeset
    81
 *   to ecrt_slave_config_reg_pdo_entry().
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    82
 * - Removed ecrt_domain_register_pdo_range(), because it's functionality can
925
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
    83
 *   be reached by specifying an explicit Pdo assignment/mapping and
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
    84
 *   registering the mapped Pdo entries.
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
    85
 * - Added an Sdo access interface, working with Sdo requests. These can be
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
    86
 *   scheduled for reading and writing during realtime operation.
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
    87
 * - Exported ecrt_slave_config_sdo(), the generic Sdo configuration function.
900
f8b5c6d21705 Removed bus validation; slave configuration during realtime operation;
Florian Pose <fp@igh-essen.com>
parents: 894
diff changeset
    88
 * - Removed the bus_state and bus_tainted flags from ec_master_state_t.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    89
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    90
 * @{
786
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 781
diff changeset
    91
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    92
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    93
/*****************************************************************************/
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    94
125
b01bd5b830d7 Sch?nheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 114
diff changeset
    95
#ifndef __ECRT_H__
b01bd5b830d7 Sch?nheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 114
diff changeset
    96
#define __ECRT_H__
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    97
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    98
#include <asm/byteorder.h>
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    99
110
2346e2963087 Integer-Typen in ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 106
diff changeset
   100
#ifdef __KERNEL__
2346e2963087 Integer-Typen in ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 106
diff changeset
   101
#include <linux/types.h>
2346e2963087 Integer-Typen in ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 106
diff changeset
   102
#else
2346e2963087 Integer-Typen in ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 106
diff changeset
   103
#include <stdint.h>
2346e2963087 Integer-Typen in ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 106
diff changeset
   104
#endif
2346e2963087 Integer-Typen in ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 106
diff changeset
   105
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   106
/******************************************************************************
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   107
 * Global definitions
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   108
 *****************************************************************************/
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   109
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   110
/** EtherCAT realtime interface major version number.
758
8fa6f825eb7d Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents: 707
diff changeset
   111
 */
637
d5d04c868e0e Removed ecrt_master_run(), removed datagram queueing from state
Florian Pose <fp@igh-essen.com>
parents: 635
diff changeset
   112
#define ECRT_VER_MAJOR 1
758
8fa6f825eb7d Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents: 707
diff changeset
   113
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   114
/** EtherCAT realtime interface minor version number.
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   115
 */
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   116
#define ECRT_VER_MINOR 4
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   117
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   118
/** EtherCAT realtime interface version word generator.
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   119
 */
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   120
#define ECRT_VERSION(a, b) (((a) << 8) + (b))
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   121
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   122
/** EtherCAT realtime interface version word.
758
8fa6f825eb7d Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents: 707
diff changeset
   123
 */
541
5a2b1658b67f Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
   124
#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
   125
878
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   126
/*****************************************************************************/
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   127
925
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   128
/** End of the Pdo entry list.
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   129
 *
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   130
 * This is used in ecrt_slave_config_pdos().
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   131
 */
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   132
#define EC_END ~0U
878
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   133
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   134
/******************************************************************************
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   135
 * Data types 
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   136
 *****************************************************************************/
541
5a2b1658b67f Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
   137
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   138
struct ec_master;
286
f3352378b4d4 Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents: 276
diff changeset
   139
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
   140
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   141
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
   142
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
   143
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   144
struct ec_domain;
286
f3352378b4d4 Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents: 276
diff changeset
   145
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
   146
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   147
struct ec_sdo_request;
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   148
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
   149
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   150
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   151
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   152
/** Master state.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   153
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   154
 * 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
   155
 *
9bf2ddf05e17 Completed ec_master_state_t and documented ec_master_state_t and
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   156
 * \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
   157
 */
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 541
diff changeset
   158
typedef struct {
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   159
    unsigned int slaves_responding; /**< Number of slaves in the bus. */
1022
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   160
    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
   161
                                  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
   162
                                  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
   163
                                  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
   164
                                  state:
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   165
                                  - Bit 0: \a INIT
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   166
                                  - Bit 1: \a PREOP
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   167
                                  - Bit 2: \a SAFEOP
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   168
                                  - Bit 3: \a OP */
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   169
    unsigned int link_up : 1; /**< \a true, if the network link is up. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   170
} 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
   171
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   172
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   173
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   174
/** Slave configuration state.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   175
 *
1020
9bf2ddf05e17 Completed ec_master_state_t and documented ec_master_state_t and
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   176
 * This is used as an output parameter of ecrt_slave_config_state().
9bf2ddf05e17 Completed ec_master_state_t and documented ec_master_state_t and
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   177
 * 
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   178
 * \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
   179
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   180
typedef struct  {
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   181
    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
   182
    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
   183
                                    using the specified configuration. */
1022
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   184
    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
   185
                                 - 1: \a INIT
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   186
                                 - 2: \a PREOP
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   187
                                 - 4: \a SAFEOP
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   188
                                 - 8: \a OP
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   189
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1020
diff changeset
   190
                                 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
   191
                                 bit! */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   192
} 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
   193
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   194
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   195
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   196
/** 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
   197
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   198
 * 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
   199
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   200
typedef enum {
925
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   201
    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
   202
    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
   203
                        exchanged. */
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   204
    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
   205
} 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
   206
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   207
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   208
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   209
/** Domain state.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   210
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   211
 * 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
   212
 */
16e9ad7d8e12 Added parameters for vendor ID and product code to ecrt_get_slave(); PDO
Florian Pose <fp@igh-essen.com>
parents: 637
diff changeset
   213
typedef struct {
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   214
    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
   215
    ec_wc_state_t wc_state; /**< Working counter interpretation. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   216
} 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
   217
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   218
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   219
925
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   220
/** Direction type for Pdo assignment functions.
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   221
 */
635
d304ef4af542 Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 612
diff changeset
   222
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
   223
    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
   224
    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
   225
    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
   226
    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
   227
} ec_direction_t;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   228
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   229
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   230
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   231
/** Pdo entry configuration information.
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   232
 *
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   233
 * 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
   234
 *
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   235
 * \see ecrt_slave_config_sync_managers().
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   236
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   237
typedef struct {
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   238
    uint16_t index; /**< Pdo entry index. */
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   239
    uint8_t subindex; /**< Pdo entry subindex. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   240
    uint8_t bit_length; /**< Size of the Pdo entry in bit. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   241
} 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
   242
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   243
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   244
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   245
/** Pdo configuration information.
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   246
 * 
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   247
 * This is the data type of the \a pdos field in ec_sync_info_t.
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   248
 * 
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   249
 * \see ecrt_slave_config_sync_managers().
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
typedef struct {
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   252
    uint16_t index; /**< Pdo index. */
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   253
    uint8_t 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
   254
                              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
   255
                              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
   256
                              present at bus configuration time). */
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   257
    ec_pdo_entry_info_t *entries; /**< Array of Pdo entries to map. Can either
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   258
                                    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
   259
                                    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
   260
} 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
   261
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   262
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   263
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   264
/** 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
   265
 *
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   266
 * This can be use to configure multiple sync managers including the Pdo
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   267
 * assignment and Pdo mapping. It is used as an input parameter type in
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   268
 * ecrt_slave_config_sync_managers().
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   269
 */
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   270
typedef struct {
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   271
    uint8_t index; /**< Sync manager index. */
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   272
    ec_direction_t dir; /**< Sync manager direction. */
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   273
    uint16_t n_pdos; /**< Number of Pdos in \a pdos. */
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   274
    ec_pdo_info_t *pdos; /**< Array with Pdos to assign. This must contain
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   275
                            at least \a n_pdos Pdos. */
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   276
} 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
   277
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   278
/*****************************************************************************/
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   279
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   280
/** List record type for Pdo entry mass-registration.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   281
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   282
 * 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
   283
 * 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
   284
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   285
typedef struct {
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   286
    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
   287
    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
   288
    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
   289
    uint32_t product_code; /**< Slave product code. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   290
    uint16_t index; /**< Pdo entry index. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   291
    uint8_t subindex; /**< Pdo entry subindex. */
925
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   292
    unsigned int *offset; /**< Pointer to a variable to store the Pdo entry's
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   293
                       (byte-)offset in the process data. */
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   294
    unsigned int *bit_position; /** Pointer to a variable to store a bit 
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   295
                                 position (0-7) within the \a offset. Can be
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   296
                                 NULL, in which case an error is raised if the
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   297
                                 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
   298
} ec_pdo_entry_reg_t;
416
4f007cd2a79d ecrt_domain_register_pdo_range() implemented.
Florian Pose <fp@igh-essen.com>
parents: 325
diff changeset
   299
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   300
/*****************************************************************************/
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   301
861
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   302
/** Sdo request state.
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   303
 *
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   304
 * This is used as return type of ecrt_sdo_request_state().
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   305
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   306
typedef enum {
861
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   307
    EC_SDO_REQUEST_UNUSED, /**< Not requested. */
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   308
    EC_SDO_REQUEST_BUSY, /**< Request is being processed. */
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   309
    EC_SDO_REQUEST_SUCCESS, /**< Request was processed successfully. */
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   310
    EC_SDO_REQUEST_ERROR, /**< Request processing failed. */
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   311
} ec_sdo_request_state_t;
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   312
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   313
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   314
 * Global functions
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   315
 *****************************************************************************/
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   316
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   317
/** 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
   318
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   319
 * \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
   320
 */
541
5a2b1658b67f Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
   321
unsigned int ecrt_version_magic(void);
5a2b1658b67f Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
   322
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   323
/** Requests an EtherCAT master for realtime operation.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   324
 * 
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   325
 * \return pointer to reserved master, or NULL on error
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   326
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   327
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
   328
        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
   329
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   330
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   331
/** Releases a requested EtherCAT master.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   332
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   333
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
   334
        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
   335
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   336
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   337
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   338
 * Master methods
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   339
 *****************************************************************************/
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   340
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   341
/** 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
   342
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   343
 * The request_cb function must return zero, to allow another instance
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   344
 * (the EoE process for example) to access the master. Non-zero means,
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   345
 * that access is forbidden at this time.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   346
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   347
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
   348
        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
   349
        int (*request_cb)(void *), /**< Lock request function. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   350
        void (*release_cb)(void *), /**< Lock release function. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   351
        void *cb_data /**< Arbitrary user data. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   352
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   353
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   354
/** Creates a new domain.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   355
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   356
 * \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
   357
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   358
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
   359
        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
   360
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   361
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   362
/** 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
   363
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   364
 * 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
   365
 * 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
   366
 * 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
   367
 * 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
   368
 * 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
   369
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   370
 * 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
   371
 * - 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
   372
 *   ring position.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   373
 * - 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
   374
 *   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
   375
 *   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
   376
 *   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
   377
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   378
 * 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
   379
 * 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
   380
 * 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
   381
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   382
 * 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
   383
 * 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
   384
 * applied.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   385
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   386
 * \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
   387
 * \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
   388
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   389
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
   390
        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
   391
        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
   392
        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
   393
        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
   394
        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
   395
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   396
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   397
/** Finishes the configuration phase and prepares for realtime mode.
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   398
 *
925
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   399
 * 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
   400
 * 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
   401
 * 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
   402
 * 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
   403
 * 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
   404
 *
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   405
 * \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
   406
 * 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
   407
 * 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
   408
 * function, the master thread is responsible for that, so these functions may
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   409
 * not be called!
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   410
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   411
 * \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
   412
 */
1007
b6c3527697c3 Minor change.
Florian Pose <fp@igh-essen.com>
parents: 925
diff changeset
   413
int ecrt_master_activate(
b6c3527697c3 Minor change.
Florian Pose <fp@igh-essen.com>
parents: 925
diff changeset
   414
        ec_master_t *master /**< EtherCAT master. */
b6c3527697c3 Minor change.
Florian Pose <fp@igh-essen.com>
parents: 925
diff changeset
   415
        );
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   416
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   417
/** 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
   418
 *
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   419
 * This has to be called cyclically by the realtime application after
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   420
 * 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
   421
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   422
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
   423
        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
   424
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   425
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   426
/** 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
   427
 *
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   428
 * This has to be called cyclically by the realtime application after
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   429
 * 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
   430
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   431
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
   432
        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
   433
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   434
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   435
/** 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
   436
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   437
 * Stores the master state information in the given \a state structure.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   438
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   439
void ecrt_master_state(
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   440
        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
   441
        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
   442
        );
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
/******************************************************************************
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   445
 * Slave configuration methods
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   446
 *****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   447
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   448
/** 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
   449
 *
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   450
 * Sets the direction of a sync manager. The direction bits from the default
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   451
 * control register from SII will be overriden, when this function is called.
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   452
 *
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   453
 * \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
   454
 */
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   455
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
   456
        ec_slave_config_t *sc, /**< Slave configuration. */
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   457
        uint8_t sync_index, /**< Sync manager index. */
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   458
        ec_direction_t dir /**< Input/Output. */
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   459
        );
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   460
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   461
/** Add a Pdo to a sync manager's Pdo assignment.
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   462
 *
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   463
 * \see ecrt_slave_config_sync_managers()
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   464
 * \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
   465
 */
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   466
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
   467
        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
   468
        uint8_t sync_index, /**< Sync manager index. */
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   469
        uint16_t index /**< Index of the Pdo to assign. */
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   470
        );
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   471
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   472
/** Clear a sync manager's Pdo assignment.
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   473
 *
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   474
 * 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
   475
 * 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
   476
 * 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
   477
 * 
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   478
 * \see ecrt_slave_config_sync_managers()
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   479
 */
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   480
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
   481
        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
   482
        uint8_t sync_index /**< Sync manager index. */
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   483
        );
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   484
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   485
/** Add a Pdo entry to the given Pdo's mapping.
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   486
 *
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   487
 * \see ecrt_slave_config_sync_managers()
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   488
 * \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
   489
 */
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   490
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
   491
        ec_slave_config_t *sc, /**< Slave configuration. */
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   492
        uint16_t pdo_index, /**< Index of the Pdo. */
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   493
        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
   494
                                mapping. */
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   495
        uint8_t entry_subindex, /**< Subindex of the Pdo entry to add to the
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   496
                                  Pdo's mapping. */
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   497
        uint8_t entry_bit_length /**< Size of the Pdo entry in bit. */
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   498
        );
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   499
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   500
/** Clear the mapping of a given Pdo.
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   501
 *
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   502
 * This can be called before mapping Pdo entries via
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   503
 * 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
   504
 *
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   505
 * \see ecrt_slave_config_sync_managers()
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   506
 */
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   507
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
   508
        ec_slave_config_t *sc, /**< Slave configuration. */
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   509
        uint16_t pdo_index /**< Index of the Pdo. */
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   510
        );
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   511
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   512
/** 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
   513
 *
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   514
 * 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
   515
 * 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
   516
 * 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
   517
 * 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
   518
 * 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
   519
 *
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   520
 * The following example shows, how to specify a complete configuration,
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   521
 * including the Pdo mappings. With this information, the master is able to
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   522
 * 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
   523
 * configuration time:
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   524
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   525
 * \code
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   526
 * const ec_pdo_entry_info_t el3162_channel1[] = {
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   527
 *     {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
   528
 *     {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
   529
 * };
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   530
 * 
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   531
 * const ec_pdo_entry_info_t el3162_channel2[] = {
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   532
 *     {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
   533
 *     {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
   534
 * };
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   535
 * 
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   536
 * const 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
   537
 *     {0x1A00, 2, el3162_channel1},
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   538
 *     {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
   539
 * };
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   540
 * 
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   541
 * const ec_pdo_info_t el3162_syncs[] = {
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   542
 *     {2, EC_DIR_INPUT, 2, el3162_el3162_pdos},
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   543
 * };
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   544
 * 
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   545
 * if (ecrt_slave_config_syncs(sc, 1, el3162_syncs))
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   546
 *     return -1; // error
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   547
 * \endcode
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   548
 * 
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   549
 * The next example shows, how to configure the Pdo assignment only. The
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   550
 * entries for each assigned Pdo are taken from the Pdo's default mapping.
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   551
 * Please note, that Pdo entry registration will fail, if the Pdo
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   552
 * 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
   553
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   554
 * \code
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   555
 * const 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
   556
 *     {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
   557
 *     {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
   558
 * };
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   559
 * 
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   560
 * const ec_sync_info_t syncs[] = {
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   561
 *     {2, EC_DIR_INPUT, 2, pdos},
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   562
 * };
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   563
 * 
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   564
 * if (ecrt_slave_config_pdos(slave_config_ana_in, 2, syncs))
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   565
 *     return -1; // error
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   566
 * \endcode
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   567
 *
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   568
 * 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
   569
 * - 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
   570
 * - 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
   571
 *   \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
   572
 *   using EC_END is recommended.
878
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   573
 *
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   574
 * \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
   575
 */
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   576
int ecrt_slave_config_sync_managers(
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   577
        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
   578
        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
   579
                                \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
   580
        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
   581
                                       configurations. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   582
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   583
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   584
/** Registers a Pdo entry for process data exchange in a domain.
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   585
 *
925
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   586
 * Searches the assigned Pdos for the given Pdo entry. An error is raised, if
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   587
 * 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
   588
 * and FMMU configurations are provided for slave configuration and the
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   589
 * respective sync manager's assigned Pdos are appended to the given domain,
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   590
 * if not already done. The offset of the requested Pdo entry's data inside
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   591
 * the domain's process data is returned. Optionally, the Pdo entry bit
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   592
 * position (0-7) can be retrieved via the \a bit_position output parameter.
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   593
 * This pointer may be \a NULL, in this case an error is raised if the Pdo
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   594
 * 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
   595
 *
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   596
 * \retval >=0 Success: Offset of the Pdo entry's process data.
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   597
 * \retval -1  Error: Pdo entry not found.
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   598
 * \retval -2  Error: Failed to register Pdo entry.
916
db73994fbdac Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents: 900
diff changeset
   599
 * \retval -3  Error: Pdo entry is not byte-aligned.
807
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 793
diff changeset
   600
 */
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 793
diff changeset
   601
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
   602
        ec_slave_config_t *sc, /**< Slave configuration. */
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 793
diff changeset
   603
        uint16_t entry_index, /**< Index of the Pdo entry to register. */
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 793
diff changeset
   604
        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
   605
        ec_domain_t *domain, /**< Domain. */
925
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 923
diff changeset
   606
        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
   607
                                 is desired */
916
db73994fbdac Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents: 900
diff changeset
   608
        );
db73994fbdac Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents: 900
diff changeset
   609
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   610
/** Add an Sdo configuration.
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   611
 *
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   612
 * An Sdo configuration is stored in the slave configuration object and is
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   613
 * 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
   614
 * 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
   615
 * 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
   616
 *
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   617
 * This is the generic function for adding an Sdo configuration. Please note
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   618
 * that the this function does not do any endianess correction. If
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   619
 * datatype-specific functions are needed (that automatically correct the
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   620
 * endianess), have a look at ecrt_slave_config_sdo8(),
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   621
 * 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
   622
 *
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   623
 * \return 0 in case of success, else < 0
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   624
 */
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   625
int ecrt_slave_config_sdo(
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   626
        ec_slave_config_t *sc, /**< Slave configuration. */
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   627
        uint16_t index, /**< Index of the Sdo to configure. */
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   628
        uint8_t subindex, /**< Subindex of the Sdo to configure. */
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   629
        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
   630
        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
   631
        );
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   632
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   633
/** 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
   634
 *
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   635
 * \see ecrt_slave_config_sdo().
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   636
 * \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
   637
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   638
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
   639
        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
   640
        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
   641
        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
   642
        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
   643
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   644
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   645
/** 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
   646
 *
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   647
 * \see ecrt_slave_config_sdo().
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   648
 * \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
   649
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   650
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
   651
        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
   652
        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
   653
        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
   654
        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
   655
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   656
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   657
/** 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
   658
 *
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 886
diff changeset
   659
 * \see ecrt_slave_config_sdo().
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   660
 * \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
   661
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   662
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
   663
        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
   664
        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
   665
        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
   666
        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
   667
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   668
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   669
/** Create an Sdo request to exchange Sdos during realtime operation.
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   670
 *
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   671
 * The created Sdo request object is freed automatically when the master is
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   672
 * released.
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   673
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   674
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
   675
        ec_slave_config_t *sc, /**< Slave configuration. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   676
        uint16_t index, /**< Sdo index. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   677
        uint8_t subindex, /**< Sdo subindex. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   678
        size_t size /**< Data size to reserve. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   679
        );
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   680
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   681
/** 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
   682
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   683
 * Stores the state information in the given \a state structure.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   684
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   685
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
   686
        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
   687
        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
   688
        );
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 288
diff changeset
   689
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   690
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   691
 * Domain methods
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   692
 *****************************************************************************/
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   693
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   694
/** Registers a bunch of Pdo entries for a domain.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   695
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   696
 * \todo doc
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   697
 * \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
   698
 *            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
   699
 * \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
   700
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   701
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
   702
        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
   703
        const ec_pdo_entry_reg_t *pdo_entry_regs /**< Array of Pdo
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   704
                                                   registrations. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   705
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   706
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   707
/** 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
   708
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   709
 * \return Size of the process data image.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   710
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   711
size_t ecrt_domain_size(
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   712
        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
   713
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   714
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   715
/** Provide external memory to store the domain's process data.
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   716
 *
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   717
 * Call this after all Pdo entries have been registered and before activating
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   718
 * the master.
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   719
 *
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   720
 * The size of the allocated memory must be at least ecrt_domain_size(), after
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   721
 * all Pdo entries have been registered.
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   722
 */
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   723
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
   724
        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
   725
        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
   726
                          data in. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   727
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   728
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   729
/** Returns the domain's process data.
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   730
 *
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   731
 * If external memory was provided with ecrt_domain_external_memory(), the
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   732
 * returned pointer will contain the address of that memory. Otherwise it will
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   733
 * point to the internally allocated memory.
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   734
 *
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   735
 * \return Pointer to the process data memory.
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   736
 */
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   737
uint8_t *ecrt_domain_data(
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   738
        ec_domain_t *domain /**< Domain. */
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   739
        );
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   740
886
ee1b25db1fbf Added a few docs.
Florian Pose <fp@igh-essen.com>
parents: 880
diff changeset
   741
/** Determines the states of the domain's datagrams.
ee1b25db1fbf Added a few docs.
Florian Pose <fp@igh-essen.com>
parents: 880
diff changeset
   742
 *
ee1b25db1fbf Added a few docs.
Florian Pose <fp@igh-essen.com>
parents: 880
diff changeset
   743
 * 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
   744
 * 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
   745
 * 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
   746
 * 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
   747
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   748
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
   749
        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
   750
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   751
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   752
/** (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
   753
 *
886
ee1b25db1fbf Added a few docs.
Florian Pose <fp@igh-essen.com>
parents: 880
diff changeset
   754
 * 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
   755
 * 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
   756
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   757
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
   758
        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
   759
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   760
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   761
/** 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
   762
 *
886
ee1b25db1fbf Added a few docs.
Florian Pose <fp@igh-essen.com>
parents: 880
diff changeset
   763
 * Stores the domain state in the given \a state structure.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   764
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   765
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
   766
        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
   767
        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
   768
                                   information. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   769
        );
635
d304ef4af542 Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 612
diff changeset
   770
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   771
/*****************************************************************************
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   772
 * Sdo request methods.
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   773
 ****************************************************************************/
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   774
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   775
/** Set the timeout for an Sdo request.
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   776
 *
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   777
 * 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
   778
 * as failed.
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   779
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   780
void ecrt_sdo_request_timeout(
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   781
        ec_sdo_request_t *req, /**< Sdo request. */
880
f6212c54a5e3 Implemented Sdo timeout.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   782
        uint32_t timeout /**< Timeout in milliseconds. Zero means no
f6212c54a5e3 Implemented Sdo timeout.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   783
                           timeout. */
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   784
        );
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   785
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   786
/** Access to the Sdo request's data.
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   787
 *
868
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   788
 * This function returns a pointer to the request's internal Sdo data memory.
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   789
 *
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   790
 * - 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
   791
 *   the EC_READ_*() macros as usual. Example:
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   792
 *   \code
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   793
 *   uint16_t value = EC_READ_U16(ecrt_sdo_request_data(sdo)));
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   794
 *   \endcode
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   795
 * - 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
   796
 *   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
   797
 *   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
   798
 *   is a parameter of ecrt_slave_config_create_sdo_request().
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   799
 *   \code
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   800
 *   EC_WRITE_U16(ecrt_sdo_request_data(sdo), 0xFFFF);
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   801
 *   \endcode
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   802
 *
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   803
 * \attention The return value can be invalid during a read operation, because
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   804
 * the internal Sdo data memory could be re-allocated if the read Sdo data do
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   805
 * not fit inside.
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   806
 *
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   807
 * \return Pointer to the internal Sdo data memory.
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   808
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   809
uint8_t *ecrt_sdo_request_data(
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   810
        ec_sdo_request_t *req /**< Sdo request. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   811
        );
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   812
869
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   813
/** Returns the current Sdo data size.
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   814
 *
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   815
 * When the Sdo request is created, the data size is set to the size of the
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   816
 * 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
   817
 * 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
   818
 *
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   819
 * \return Sdo data size in bytes.
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   820
 */
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   821
size_t ecrt_sdo_request_data_size(
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   822
        const ec_sdo_request_t *req /**< Sdo request. */
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   823
        );
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   824
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   825
/** Get the current state of the Sdo request.
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   826
 *
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   827
 * \return Request state.
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   828
 */
861
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   829
ec_sdo_request_state_t ecrt_sdo_request_state(
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   830
    const ec_sdo_request_t *req /**< Sdo request. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   831
    );
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   832
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   833
/** Schedule an Sdo write operation.
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   834
 *
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   835
 * \attention This method may not be called while ecrt_sdo_request_state()
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   836
 * returns EC_SDO_REQUEST_BUSY.
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   837
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   838
void ecrt_sdo_request_write(
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   839
        ec_sdo_request_t *req /**< Sdo request. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   840
        );
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   841
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   842
/** Schedule an Sdo read operation.
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   843
 *
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   844
 * \attention This method may not be called while ecrt_sdo_request_state()
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   845
 * returns EC_SDO_REQUEST_BUSY.
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   846
 *
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   847
 * \attention After calling this function, the return value of
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   848
 * ecrt_sdo_request_data() must be considered as invalid while
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   849
 * ecrt_sdo_request_state() returns EC_SDO_REQUEST_BUSY.
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   850
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   851
void ecrt_sdo_request_read(
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   852
        ec_sdo_request_t *req /**< Sdo request. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   853
        );
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   854
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   855
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   856
 * Bitwise read/write macros
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   857
 *****************************************************************************/
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   858
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   859
/** 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
   860
 *
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
   861
 * \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
   862
 * \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
   863
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   864
#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
   865
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   866
/** 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
   867
 *
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
   868
 * \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
   869
 * \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
   870
 * \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
   871
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   872
#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
   873
    do { \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   874
        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
   875
        else     *((uint8_t *) (DATA)) &= ~(1 << (POS)); \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   876
    } while (0)
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   877
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   878
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   879
 * Read macros
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   880
 *****************************************************************************/
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   881
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   882
/** 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
   883
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   884
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   885
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   886
#define EC_READ_U8(DATA) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   887
    ((uint8_t) *((uint8_t *) (DATA)))
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   888
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   889
/** 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
   890
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   891
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   892
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   893
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   894
#define EC_READ_S8(DATA) \
288
89d3c61ef3e6 Minor changes to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 286
diff changeset
   895
     ((int8_t) *((uint8_t *) (DATA)))
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   896
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   897
/** 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
   898
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   899
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   900
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   901
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   902
#define EC_READ_U16(DATA) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   903
     ((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
   904
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   905
/** 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
   906
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   907
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   908
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   909
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   910
#define EC_READ_S16(DATA) \
288
89d3c61ef3e6 Minor changes to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 286
diff changeset
   911
     ((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
   912
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   913
/** 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
   914
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   915
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   916
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   917
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   918
#define EC_READ_U32(DATA) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   919
     ((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
   920
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   921
/** 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
   922
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   923
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   924
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   925
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   926
#define EC_READ_S32(DATA) \
288
89d3c61ef3e6 Minor changes to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 286
diff changeset
   927
     ((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
   928
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   929
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   930
 * Write macros
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   931
 *****************************************************************************/
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   932
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   933
/** 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
   934
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   935
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   936
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   937
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   938
#define EC_WRITE_U8(DATA, VAL) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   939
    do { \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   940
        *((uint8_t *)(DATA)) = ((uint8_t) (VAL)); \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   941
    } while (0)
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   942
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   943
/** 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
   944
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   945
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   946
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   947
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   948
#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
   949
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   950
/** 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
   951
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   952
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   953
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   954
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   955
#define EC_WRITE_U16(DATA, VAL) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   956
    do { \
894
440c43d56b33 Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents: 893
diff changeset
   957
        *((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
   958
    } while (0)
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   959
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   960
/** 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
   961
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   962
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   963
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   964
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   965
#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
   966
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   967
/** 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
   968
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   969
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   970
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   971
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   972
#define EC_WRITE_U32(DATA, VAL) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   973
    do { \
894
440c43d56b33 Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents: 893
diff changeset
   974
        *((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
   975
    } while (0)
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   976
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   977
/** 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
   978
 *
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   979
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   980
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   981
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   982
#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
   983
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   984
/*****************************************************************************/
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   985
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   986
/** @} */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   987
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   988
#endif