include/ecrt.h
author Florian Pose <fp@igh-essen.com>
Mon, 31 Mar 2008 09:42:37 +0000
changeset 878 40c379697ebf
parent 869 6c2f4130ed46
child 879 9b395c5646ab
permissions -rw-r--r--
Introduced EC_MAP_END.
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
 *
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 781
diff changeset
    40
 * EtherCAT interface for realtime modules. This interface is designed for
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 781
diff changeset
    41
 * realtime modules that want to use EtherCAT. There are functions to request
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 781
diff changeset
    42
 * a master, to map process data, to communicate with slaves via CoE and to
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 781
diff changeset
    43
 * 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().
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    60
 * - Replaced the process data pointers in the Pdo entry registration
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    61
 *   functions with a process data offset, that is now returned by
807
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 793
diff changeset
    62
 *   ecrt_slave_config_reg_pdo_entry(). This was necessary for the external
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    63
 *   domain memory. An additional advantage is, that the returned offset value
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
    64
 *   is directly usable. If the domain's process data is allocated internally,
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
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
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
    67
 *   ecrt_slave_config_pdo() to add a Pdo to the mapping and
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
    68
 *   ecrt_slave_config_pdo_entry() to add a Pdo entry to a Pdo configuration.
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
    69
 *   ecrt_slave_config_mapping() is a convenience function for
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
    70
 *   both, that uses the new data types ec_pdo_info_t and ec_pdo_entry_info_t.
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
    71
 *   Mapped Pdo entries can now immediately be registered.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    72
 * - 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
    73
 *   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
    74
 *   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
    75
 * - 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
    76
 *   of ecrt_domain_state(). The domain state object does now contain
a5b4f1d17908 Updated news.
Florian Pose <fp@igh-essen.com>
parents: 810
diff changeset
    77
 *   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
    78
 * - 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
    79
 *   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
    80
 *   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
    81
 * - Removed ecrt_domain_register_pdo_range(), because it's functionality can
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    82
 *   be reached by specifying an explicit Pdo mapping and registering those
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    83
 *   Pdo entries.
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
    84
 * - 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
    85
 *   scheduled for reading and writing during realtime operation.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    86
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    87
 * @{
786
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 781
diff changeset
    88
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    89
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    90
/*****************************************************************************/
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    91
125
b01bd5b830d7 Sch?nheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 114
diff changeset
    92
#ifndef __ECRT_H__
b01bd5b830d7 Sch?nheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 114
diff changeset
    93
#define __ECRT_H__
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    94
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    95
#include <asm/byteorder.h>
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    96
110
2346e2963087 Integer-Typen in ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 106
diff changeset
    97
#ifdef __KERNEL__
2346e2963087 Integer-Typen in ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 106
diff changeset
    98
#include <linux/types.h>
2346e2963087 Integer-Typen in ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 106
diff changeset
    99
#else
2346e2963087 Integer-Typen in ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 106
diff changeset
   100
#include <stdint.h>
2346e2963087 Integer-Typen in ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 106
diff changeset
   101
#endif
2346e2963087 Integer-Typen in ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 106
diff changeset
   102
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   103
/******************************************************************************
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   104
 * Global definitions
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   105
 *****************************************************************************/
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   106
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   107
/** EtherCAT realtime interface major version number.
758
8fa6f825eb7d Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents: 707
diff changeset
   108
 */
637
d5d04c868e0e Removed ecrt_master_run(), removed datagram queueing from state
Florian Pose <fp@igh-essen.com>
parents: 635
diff changeset
   109
#define ECRT_VER_MAJOR 1
758
8fa6f825eb7d Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents: 707
diff changeset
   110
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   111
/** EtherCAT realtime interface minor version number.
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   112
 */
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   113
#define ECRT_VER_MINOR 4
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   114
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   115
/** EtherCAT realtime interface version word generator.
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   116
 */
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   117
#define ECRT_VERSION(a, b) (((a) << 8) + (b))
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   118
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   119
/** EtherCAT realtime interface version word.
758
8fa6f825eb7d Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents: 707
diff changeset
   120
 */
541
5a2b1658b67f Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
   121
#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
   122
878
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   123
/*****************************************************************************/
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   124
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   125
/** End of mapping.
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
 * This is used in ecrt_slave_config_mapping().
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   128
 */
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   129
#define EC_MAP_END ~0U
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   130
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   131
/******************************************************************************
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   132
 * Data types 
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   133
 *****************************************************************************/
541
5a2b1658b67f Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
   134
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   135
struct ec_master;
286
f3352378b4d4 Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents: 276
diff changeset
   136
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
   137
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   138
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
   139
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
   140
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   141
struct ec_domain;
286
f3352378b4d4 Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents: 276
diff changeset
   142
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
   143
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   144
struct ec_sdo_request;
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   145
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
   146
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   147
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   148
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   149
/** Bus state.
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
 * This is used in ec_master_state_t.
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   152
 */
612
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 541
diff changeset
   153
typedef enum {
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   154
    EC_BUS_FAILURE = -1, /**< At least one configured slave is offline. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   155
    EC_BUS_OK            /**< All configured slaves are online. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   156
} ec_bus_state_t;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   157
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   158
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   159
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   160
/** Master state.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   161
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   162
 * This is used for the output parameter of ecrt_master_state().
612
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 541
diff changeset
   163
 */
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 541
diff changeset
   164
typedef struct {
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   165
    ec_bus_state_t bus_state; /**< \see ec_bus_state_t */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   166
    unsigned int bus_tainted; /**< Non-zero, if the bus topology differs from
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   167
                                the requested configuration. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   168
    unsigned int slaves_responding; /**< Number of slaves in the bus. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   169
} ec_master_state_t;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   170
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   171
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   172
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   173
/** Slave configuration state.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   174
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   175
 * \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
   176
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   177
typedef struct  {
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   178
    unsigned int online : 1; /**< The slave is online. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   179
    unsigned int configured : 1; /**< The slave was configured according to
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   180
                                   the specified configuration. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   181
} 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
   182
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   183
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   184
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   185
/** 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
   186
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   187
 * 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
   188
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   189
typedef enum {
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   190
    EC_WC_ZERO = 0,   /**< No Pdos were exchanged. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   191
    EC_WC_INCOMPLETE, /**< Some of the registered Pdos were exchanged. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   192
    EC_WC_COMPLETE    /**< All registered Pdos were exchanged. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   193
} 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
   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
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   197
/** Domain state.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   198
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   199
 * 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
   200
 */
16e9ad7d8e12 Added parameters for vendor ID and product code to ecrt_get_slave(); PDO
Florian Pose <fp@igh-essen.com>
parents: 637
diff changeset
   201
typedef struct {
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   202
    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
   203
    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
   204
} 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
   205
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   206
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   207
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   208
/** Direction type for Pdo mapping functions.
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   209
 */
635
d304ef4af542 Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 612
diff changeset
   210
typedef enum {
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   211
    EC_DIR_OUTPUT, /**< Values written by the master. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   212
    EC_DIR_INPUT   /**< Values read by the master. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   213
} ec_direction_t;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   214
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   215
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   216
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   217
/** Pdo entry mapping.
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
 * \see ecrt_slave_config_mapping().
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   220
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   221
typedef struct {
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   222
    uint16_t index; /**< Index of the Pdo entry to add to the Pdo
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   223
                            configuration. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   224
    uint8_t subindex; /**< Subindex of the Pdo entry to add to the
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   225
                              Pdo configuration. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   226
    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
   227
} 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
   228
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   229
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   230
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   231
/** Pdo information.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   232
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   233
 * \see ecrt_slave_config_mapping().
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   234
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   235
typedef struct {
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   236
    ec_direction_t dir; /**< Pdo direction (input/output). */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   237
    uint16_t index; /**< Index of the Pdo to map. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   238
    unsigned int n_entries; /**< Number of Pdo entries for the Pdo
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   239
                              configuration. Zero means, that the default Pdo
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   240
                              configuration shall be used. */
851
2bb18adcd204 Removed 'const' from Pdo configuration entries.
Florian Pose <fp@igh-essen.com>
parents: 844
diff changeset
   241
    ec_pdo_entry_info_t *entries; /**< Pdo configuration array. This
2bb18adcd204 Removed 'const' from Pdo configuration entries.
Florian Pose <fp@igh-essen.com>
parents: 844
diff changeset
   242
                                    array must contain at least \a
2bb18adcd204 Removed 'const' from Pdo configuration entries.
Florian Pose <fp@igh-essen.com>
parents: 844
diff changeset
   243
                                    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
   244
} 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
   245
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   246
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   247
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   248
/** 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
   249
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   250
 * This type is used for the array parameter of the
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   251
 * ecrt_domain_reg_pdo_entry_list() convenience function.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   252
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   253
typedef struct {
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   254
    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
   255
    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
   256
    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
   257
    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
   258
    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
   259
    uint8_t subindex; /**< Pdo entry subindex. */
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   260
    unsigned int *offset; /**< Pointer to a variable to store the Pdo's
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   261
                       offset in the process data. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   262
} ec_pdo_entry_reg_t;
416
4f007cd2a79d ecrt_domain_register_pdo_range() implemented.
Florian Pose <fp@igh-essen.com>
parents: 325
diff changeset
   263
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   264
/*****************************************************************************/
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   265
861
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   266
/** 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
   267
 *
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   268
 * 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
   269
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   270
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
   271
    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
   272
    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
   273
    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
   274
    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
   275
} ec_sdo_request_state_t;
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   276
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   277
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   278
 * Global functions
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   279
 *****************************************************************************/
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   280
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   281
/** 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
   282
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   283
 * \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
   284
 */
541
5a2b1658b67f Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
   285
unsigned int ecrt_version_magic(void);
5a2b1658b67f Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
   286
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   287
/** 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
   288
 * 
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   289
 * \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
   290
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   291
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
   292
        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
   293
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   294
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   295
/** 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
   296
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   297
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
   298
        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
   299
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   300
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   301
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   302
 * Master methods
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   303
 *****************************************************************************/
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   304
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   305
/** 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
   306
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   307
 * 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
   308
 * (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
   309
 * 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
   310
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   311
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
   312
        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
   313
        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
   314
        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
   315
        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
   316
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   317
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   318
/** 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
   319
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   320
 * \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
   321
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   322
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
   323
        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
   324
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   325
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   326
/** 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
   327
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   328
 * 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
   329
 * 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
   330
 * 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
   331
 * 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
   332
 * 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
   333
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   334
 * 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
   335
 * - 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
   336
 *   ring position.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   337
 * - 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
   338
 *   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
   339
 *   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
   340
 *   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
   341
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   342
 * 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
   343
 * 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
   344
 * 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
   345
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   346
 * 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
   347
 * 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
   348
 * applied.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   349
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   350
 * \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
   351
 * \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
   352
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   353
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
   354
        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
   355
        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
   356
        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
   357
        uint32_t vendor_id, /**< Expected vendor ID. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   358
        uint32_t product_code /**< Expected product code. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   359
        );
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
/** Applies the bus configuration and switches to realtime mode.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   362
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   363
 * Does the complete configuration and activation for all slaves. Sets sync
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   364
 * managers and FMMUs, and does the appropriate transitions, until the slave
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   365
 * is operational.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   366
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   367
 * \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
   368
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   369
int ecrt_master_activate(
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   370
        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
   371
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   372
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   373
/** 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
   374
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   375
 * \todo doc
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   376
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   377
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
   378
        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
   379
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   380
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   381
/** Fetches received frames from the hardware and processes the datagrams.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   382
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   383
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
   384
        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
   385
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   386
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   387
/** 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
   388
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   389
 * 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
   390
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   391
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
   392
        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
   393
        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
   394
        );
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
/******************************************************************************
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   397
 * Slave configuration methods
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   398
 *****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   399
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   400
/** Add a Pdo to the slave's Pdo mapping for the given direction.
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   401
 *
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   402
 * The first call of this function for a given \a dir will clear the default
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   403
 * mapping.
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   404
 *
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   405
 * \see ecrt_slave_config_mapping()
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   406
 * \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
   407
 */
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   408
int ecrt_slave_config_pdo(
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   409
        ec_slave_config_t *sc, /**< Slave configuration. */
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   410
        ec_direction_t dir, /**< Pdo direction (input/output). */
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   411
        uint16_t index /**< Index of the Pdo to map. */
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   412
        );
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   413
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   414
/** Add a Pdo entry to the given Pdo's configuration.
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   415
 *
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   416
 * The first call of this function for a given \a pdo_index will clear the
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   417
 * default Pdo configuration.
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   418
 *
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   419
 * \see ecrt_slave_config_mapping()
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   420
 * \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
   421
 */
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   422
int ecrt_slave_config_pdo_entry(
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   423
        ec_slave_config_t *sc, /**< Slave configuration. */
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   424
        uint16_t pdo_index, /**< Index of the Pdo to configure. */
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   425
        uint16_t entry_index, /**< Index of the Pdo entry to add to the Pdo's
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   426
                                configuration. */
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   427
        uint8_t entry_subindex, /**< Subindex of the Pdo entry to add to the
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   428
                                  Pdo's configuration. */
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   429
        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
   430
        );
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   431
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   432
/** Specify the Pdo mapping and (optionally) the Pdo configuration.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   433
 *
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   434
 * This function is a convenience function for the ecrt_slave_config_pdo()
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   435
 * and ecrt_slave_config_pdo_entry() functions, that are better suitable
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   436
 * for automatic code generation.
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   437
 *
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   438
 * The following example shows, how to specify a complete Pdo mapping
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   439
 * including the Pdo configuration. With this information, the master is able
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   440
 * to reserve the complete process data, even if the slave is not present
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   441
 * at configuration time:
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
 * \code
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   444
 * 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
   445
 *     {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
   446
 *     {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
   447
 * };
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   448
 * 
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   449
 * 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
   450
 *     {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
   451
 *     {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
   452
 * };
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   453
 * 
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   454
 * const ec_pdo_info_t el3162_mapping[] = {
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   455
 *     {EC_DIR_INPUT, 0x1A00, 2, el3162_channel1},
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   456
 *     {EC_DIR_INPUT, 0x1A01, 2, el3162_channel2},
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   457
 * };
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   458
 * 
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   459
 * if (ecrt_slave_config_mapping(sc, 2, el3162_mapping))
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   460
 *     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
   461
 * \endcode
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   462
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   463
 * The next example shows, how to configure only the Pdo mapping. The entries
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   464
 * for each mapped Pdo are taken from the default Pdo configuration. Please
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   465
 * note, that Pdo entry registration will fail, if the Pdo configuration is
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   466
 * 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
   467
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   468
 * \code
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   469
 * const ec_pdo_info_t pdo_mapping[] = {
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   470
 *     {EC_DIR_INPUT, 0x1600}, // Channel 1
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   471
 *     {EC_DIR_INPUT, 0x1601}  // Channel 2
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   472
 * };
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   473
 * 
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   474
 * if (ecrt_slave_config_mapping(slave_config_ana_in, 2, pdo_mapping))
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   475
 *     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
   476
 * \endcode
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   477
 *
878
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   478
 * Processing of \a pdo_infos will stop, if
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   479
 * - the number of processed items reaches \a n_infos, or
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   480
 * - the \a dir member of an ec_pdo_info_t item is EC_MAP_END. In this case,
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   481
 *   \a n_infos should set to a number greater than the number of list items;
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   482
 *   using EC_MAP_END is recommended.
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 869
diff changeset
   483
 *
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   484
 * \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
   485
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   486
int ecrt_slave_config_mapping(
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   487
        ec_slave_config_t *sc, /**< Slave configuration. */
844
8839ba8bfeb4 Fixed 2 bugs in new Pdo mapping function.
Florian Pose <fp@igh-essen.com>
parents: 842
diff changeset
   488
        unsigned int n_infos, /**< Number of Pdo infos in \a pdo_infos. */
8839ba8bfeb4 Fixed 2 bugs in new Pdo mapping function.
Florian Pose <fp@igh-essen.com>
parents: 842
diff changeset
   489
        const ec_pdo_info_t pdo_infos[] /**< List with Pdo mapping. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   490
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   491
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   492
/** 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
   493
 *
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   494
 * Searches the current mapping and Pdo configurations for the given Pdo
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   495
 * entry. An error is raised, if the given entry is not mapped. Otherwise, the
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   496
 * corresponding sync manager and FMMU configurations are provided for slave
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   497
 * configuration and the respective sync manager's Pdos are appended to the
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   498
 * given domain, if not already done. The offset of the requested Pdo entry's
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   499
 * data inside the domain's process data is returned.
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   500
 *
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 832
diff changeset
   501
 * \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
   502
 * \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
   503
 * \retval -2  Error: Failed to register Pdo entry.
807
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 793
diff changeset
   504
 */
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 793
diff changeset
   505
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
   506
        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
   507
        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
   508
        uint8_t entry_subindex, /**< Subindex of the Pdo entry to register. */
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 793
diff changeset
   509
        ec_domain_t *domain /**< Domain. */
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 793
diff changeset
   510
        );
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 793
diff changeset
   511
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   512
/** 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
   513
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   514
 * \todo doc
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   515
 * \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
   516
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   517
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
   518
        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
   519
        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
   520
        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
   521
        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
   522
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   523
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   524
/** 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
   525
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   526
 * \todo doc
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   527
 * \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
   528
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   529
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
   530
        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
   531
        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
   532
        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
   533
        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
   534
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   535
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   536
/** 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
   537
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   538
 * \todo doc
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   539
 * \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
   540
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   541
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
   542
        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
   543
        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
   544
        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
   545
        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
   546
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   547
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   548
/** 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
   549
 *
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   550
 * 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
   551
 * released.
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   552
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   553
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
   554
        ec_slave_config_t *sc, /**< Slave configuration. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   555
        uint16_t index, /**< Sdo index. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   556
        uint8_t subindex, /**< Sdo subindex. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   557
        size_t size /**< Data size to reserve. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   558
        );
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   559
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   560
/** 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
   561
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   562
 * 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
   563
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   564
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
   565
        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
   566
        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
   567
        );
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 288
diff changeset
   568
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   569
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   570
 * Domain methods
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   571
 *****************************************************************************/
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   572
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   573
/** 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
   574
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   575
 * \todo doc
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   576
 * \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
   577
 *            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
   578
 * \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
   579
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   580
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
   581
        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
   582
        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
   583
                                                   registrations. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   584
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   585
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   586
/** 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
   587
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   588
 * \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
   589
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   590
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
   591
        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
   592
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   593
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   594
/** Provide external memory to store the domain's process data.
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   595
 *
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   596
 * 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
   597
 * the master.
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   598
 *
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   599
 * 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
   600
 * all Pdo entries have been registered.
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   601
 */
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   602
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
   603
        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
   604
        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
   605
                          data in. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   606
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   607
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   608
/** Returns the domain's process data.
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   609
 *
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   610
 * 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
   611
 * 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
   612
 * point to the internally allocated memory.
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   613
 *
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   614
 * \return Pointer to the process data memory.
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   615
 */
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   616
uint8_t *ecrt_domain_data(
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   617
        ec_domain_t *domain /**< Domain. */
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   618
        );
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 807
diff changeset
   619
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   620
/** Processes received datagrams.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   621
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   622
 * \todo doc
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   623
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   624
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
   625
        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
   626
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   627
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   628
/** (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
   629
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   630
 * \todo doc
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   631
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   632
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
   633
        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
   634
        );
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   635
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   636
/** 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
   637
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   638
 * Stores the domain state in the giveb \a state structure.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   639
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   640
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
   641
        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
   642
        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
   643
                                   information. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   644
        );
635
d304ef4af542 Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 612
diff changeset
   645
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   646
/*****************************************************************************
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   647
 * Sdo request methods.
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   648
 ****************************************************************************/
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   649
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   650
/** Set the timeout for an Sdo request.
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   651
 *
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   652
 * 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
   653
 * as failed.
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   654
 *
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   655
 * \todo The timeout functionality is not yet implemented.
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   656
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   657
void ecrt_sdo_request_timeout(
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   658
        ec_sdo_request_t *req, /**< Sdo request. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   659
        uint32_t timeout /**< Timeout in milliseconds. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   660
        );
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   661
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   662
/** Access to the Sdo request's data.
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   663
 *
868
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   664
 * 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
   665
 *
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   666
 * - 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
   667
 *   the EC_READ_*() macros as usual. Example:
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   668
 *   \code
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   669
 *   uint16_t value = EC_READ_U16(ecrt_sdo_request_data(sdo)));
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   670
 *   \endcode
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   671
 * - 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
   672
 *   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
   673
 *   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
   674
 *   is a parameter of ecrt_slave_config_create_sdo_request().
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   675
 *   \code
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   676
 *   EC_WRITE_U16(ecrt_sdo_request_data(sdo), 0xFFFF);
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   677
 *   \endcode
aaf175ef0171 Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 864
diff changeset
   678
 *
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   679
 * \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
   680
 * 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
   681
 * not fit inside.
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   682
 *
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   683
 * \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
   684
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   685
uint8_t *ecrt_sdo_request_data(
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   686
        ec_sdo_request_t *req /**< Sdo request. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   687
        );
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   688
869
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   689
/** Returns the current Sdo data size.
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   690
 *
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   691
 * 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
   692
 * 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
   693
 * 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
   694
 *
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   695
 * \return Sdo data size in bytes.
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   696
 */
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   697
size_t ecrt_sdo_request_data_size(
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   698
        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
   699
        );
6c2f4130ed46 Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents: 868
diff changeset
   700
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   701
/** 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
   702
 *
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   703
 * \return Request state.
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   704
 */
861
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   705
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
   706
    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
   707
    );
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   708
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   709
/** Schedule an Sdo write operation.
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   710
 *
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   711
 * \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
   712
 * returns EC_SDO_REQUEST_BUSY.
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   713
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   714
void ecrt_sdo_request_write(
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   715
        ec_sdo_request_t *req /**< Sdo request. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   716
        );
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   717
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   718
/** Schedule an Sdo read operation.
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   719
 *
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   720
 * \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
   721
 * returns EC_SDO_REQUEST_BUSY.
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   722
 *
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   723
 * \attention After calling this function, the return value of
864
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   724
 * ecrt_sdo_request_data() must be considered as invalid while
5b6992df2931 Updated docs.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   725
 * 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
   726
 */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   727
void ecrt_sdo_request_read(
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   728
        ec_sdo_request_t *req /**< Sdo request. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   729
        );
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   730
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   731
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   732
 * Bitwise read/write macros
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   733
 *****************************************************************************/
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   734
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   735
/** Read a certain bit of an EtherCAT data byte.
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
   736
 * \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
   737
 * \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
   738
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   739
#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
   740
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   741
/** Write a certain bit of an EtherCAT data byte.
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
   742
 * \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
   743
 * \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
   744
 * \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
   745
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   746
#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
   747
    do { \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   748
        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
   749
        else     *((uint8_t *) (DATA)) &= ~(1 << (POS)); \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   750
    } while (0)
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   751
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   752
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   753
 * Read macros
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   754
 *****************************************************************************/
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   755
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   756
/** Read an 8-bit unsigned value from EtherCAT data.
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   757
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   758
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   759
#define EC_READ_U8(DATA) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   760
    ((uint8_t) *((uint8_t *) (DATA)))
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   761
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   762
/** Read an 8-bit signed value from EtherCAT data.
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   763
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   764
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   765
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   766
#define EC_READ_S8(DATA) \
288
89d3c61ef3e6 Minor changes to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 286
diff changeset
   767
     ((int8_t) *((uint8_t *) (DATA)))
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   768
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   769
/** Read a 16-bit unsigned value from EtherCAT data.
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   770
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   771
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   772
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   773
#define EC_READ_U16(DATA) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   774
     ((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
   775
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   776
/** Read a 16-bit signed value from EtherCAT data.
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   777
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   778
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   779
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   780
#define EC_READ_S16(DATA) \
288
89d3c61ef3e6 Minor changes to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 286
diff changeset
   781
     ((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
   782
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   783
/** Read a 32-bit unsigned value from EtherCAT data.
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   784
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   785
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   786
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   787
#define EC_READ_U32(DATA) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   788
     ((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
   789
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   790
/** Read a 32-bit signed value from EtherCAT data.
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   791
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   792
 * \return EtherCAT data value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   793
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   794
#define EC_READ_S32(DATA) \
288
89d3c61ef3e6 Minor changes to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents: 286
diff changeset
   795
     ((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
   796
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   797
/******************************************************************************
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   798
 * Write macros
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   799
 *****************************************************************************/
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   800
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   801
/** Write an 8-bit unsigned value to EtherCAT data.
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   802
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   803
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   804
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   805
#define EC_WRITE_U8(DATA, VAL) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   806
    do { \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   807
        *((uint8_t *)(DATA)) = ((uint8_t) (VAL)); \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   808
    } while (0)
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   809
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   810
/** Write an 8-bit signed value to EtherCAT data.
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   811
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   812
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   813
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   814
#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
   815
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   816
/** Write a 16-bit unsigned value to EtherCAT data.
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   817
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   818
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   819
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   820
#define EC_WRITE_U16(DATA, VAL) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   821
    do { \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   822
        *((uint16_t *) (DATA)) = (uint16_t) (VAL); \
810
7d7c59e1427e Avoided warning concerning EC_READ/WRITE() macros on some compilers.
Florian Pose <fp@igh-essen.com>
parents: 809
diff changeset
   823
        cpu_to_le16s((uint16_t *) (DATA)); \
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   824
    } while (0)
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   825
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   826
/** Write a 16-bit signed value to EtherCAT data.
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   827
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   828
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   829
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   830
#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
   831
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   832
/** Write a 32-bit unsigned value to EtherCAT data.
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   833
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   834
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   835
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   836
#define EC_WRITE_U32(DATA, VAL) \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   837
    do { \
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   838
        *((uint32_t *) (DATA)) = (uint32_t) (VAL); \
810
7d7c59e1427e Avoided warning concerning EC_READ/WRITE() macros on some compilers.
Florian Pose <fp@igh-essen.com>
parents: 809
diff changeset
   839
        cpu_to_le32s((uint32_t *) (DATA)); \
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   840
    } while (0)
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   841
779
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   842
/** Write a 32-bit signed value to EtherCAT data.
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   843
 * \param DATA EtherCAT data pointer
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   844
 * \param VAL new value
b39a6a4d3671 Prepared RT interface 1.4.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
   845
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   846
#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
   847
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   848
/*****************************************************************************/
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   849
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   850
/** @} */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
   851
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   852
#endif