author | Florian Pose <fp@igh-essen.com> |
Tue, 13 May 2008 16:28:55 +0000 | |
changeset 913 | c8ea5da6bf13 |
parent 900 | f8b5c6d21705 |
child 916 | db73994fbdac |
permissions | -rw-r--r-- |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
125 | 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 | 34 |
/** \file |
35 |
* |
|
864 | 36 |
* EtherCAT Realtime Interface. |
37 |
* |
|
38 |
* \defgroup RealtimeInterface EtherCAT Realtime Interface |
|
786 | 39 |
* |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
40 |
* EtherCAT interface for realtime applications. This interface is designed |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
41 |
* for realtime modules that want to use EtherCAT. There are functions to |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
42 |
* request a master, to map process data, to communicate with slaves via CoE |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
43 |
* and to configure and activate the bus. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
44 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
45 |
* Changes in Version 1.4: |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
46 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
47 |
* - Replaced ec_slave_t with ec_slave_config_t, separating the slave objects |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
48 |
* from the requested bus configuration. Therefore, renamed |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
49 |
* ecrt_master_get_slave() to ecrt_master_slave_config(). |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
50 |
* - Replaced slave address string with alias and position values. See |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
51 |
* ecrt_master_slave_config(). |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
52 |
* - Removed ecrt_master_get_slave_by_pos(), because it is no longer |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
793
diff
changeset
|
53 |
* necessary due to alias/position addressing. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
54 |
* - Added ec_slave_config_state_t for the new method |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
55 |
* ecrt_slave_config_state(). |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
56 |
* - Process data memory for a domain can now be allocated externally. This |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
57 |
* offers the possibility to use a shared-memory region. Therefore, |
809 | 58 |
* added the domain methods ecrt_domain_size() and |
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 | 64 |
* is directly usable. If the domain's process data is allocated internally, |
65 |
* the start address can be retrieved with ecrt_domain_data(). |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
66 |
* - Replaced ecrt_slave_pdo_mapping/add/clear() with |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
67 |
* ecrt_slave_config_pdo_assign_add() to add a Pdo to a sync manager's Pdo |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
68 |
* assignment and ecrt_slave_config_pdo_mapping_add() to add a Pdo entry to a |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
69 |
* Pdo's mapping. ecrt_slave_config_pdos() is a convenience function |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
70 |
* for both, that uses the new data types ec_pdo_info_t and |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
71 |
* ec_pdo_entry_info_t. Pdo entries, that are mapped with these functions |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
72 |
* can now immediately be registered, even if the bus is offline. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
73 |
* - Renamed ec_bus_status_t, ec_master_status_t to ec_bus_state_t and |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
74 |
* ec_master_state_t, respectively. Renamed ecrt_master_get_status() to |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
75 |
* ecrt_master_state(), for consistency reasons. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
76 |
* - Added ec_domain_state_t and ec_wc_state_t for a new output parameter |
832 | 77 |
* of ecrt_domain_state(). The domain state object does now contain |
78 |
* information, if the process data was exchanged completely. |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
79 |
* - Former "Pdo registration" meant Pdo entry registration in fact, therefore |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
80 |
* renamed ec_pdo_reg_t to ec_pdo_entry_reg_t and ecrt_domain_register_pdo() |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
793
diff
changeset
|
81 |
* to ecrt_slave_config_reg_pdo_entry(). |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
82 |
* - Removed ecrt_domain_register_pdo_range(), because it's functionality can |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
83 |
* 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
|
84 |
* Pdo entries. |
864 | 85 |
* - Added an Sdo access interface, working with Sdo requests. These can be |
86 |
* scheduled for reading and writing during realtime operation. |
|
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
87 |
* - Exported ecrt_slave_config_sdo(), the generic Sdo configuration function. |
900
f8b5c6d21705
Removed bus validation; slave configuration during realtime operation;
Florian Pose <fp@igh-essen.com>
parents:
894
diff
changeset
|
88 |
* - Removed the bus_state and bus_tainted flags from ec_master_state_t. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
89 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
90 |
* @{ |
786 | 91 |
*/ |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
92 |
|
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
93 |
/*****************************************************************************/ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
94 |
|
125 | 95 |
#ifndef __ECRT_H__ |
96 |
#define __ECRT_H__ |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
|
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
#include <asm/byteorder.h> |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
|
110 | 100 |
#ifdef __KERNEL__ |
101 |
#include <linux/types.h> |
|
102 |
#else |
|
103 |
#include <stdint.h> |
|
104 |
#endif |
|
105 |
||
779 | 106 |
/****************************************************************************** |
107 |
* Global definitions |
|
108 |
*****************************************************************************/ |
|
109 |
||
864 | 110 |
/** EtherCAT realtime interface major version number. |
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
707
diff
changeset
|
111 |
*/ |
637
d5d04c868e0e
Removed ecrt_master_run(), removed datagram queueing from state
Florian Pose <fp@igh-essen.com>
parents:
635
diff
changeset
|
112 |
#define ECRT_VER_MAJOR 1 |
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
707
diff
changeset
|
113 |
|
864 | 114 |
/** EtherCAT realtime interface minor version number. |
779 | 115 |
*/ |
116 |
#define ECRT_VER_MINOR 4 |
|
117 |
||
864 | 118 |
/** EtherCAT realtime interface version word generator. |
779 | 119 |
*/ |
120 |
#define ECRT_VERSION(a, b) (((a) << 8) + (b)) |
|
121 |
||
864 | 122 |
/** EtherCAT realtime interface version word. |
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
707
diff
changeset
|
123 |
*/ |
541
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
124 |
#define ECRT_VERSION_MAGIC ECRT_VERSION(ECRT_VER_MAJOR, ECRT_VER_MINOR) |
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
125 |
|
878 | 126 |
/*****************************************************************************/ |
127 |
||
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
128 |
/** End of the Pdo list. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
129 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
130 |
* This is used in ecrt_slave_config_pdos(). |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
131 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
132 |
#define EC_END ~0U |
878 | 133 |
|
779 | 134 |
/****************************************************************************** |
135 |
* Data types |
|
136 |
*****************************************************************************/ |
|
541
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
137 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
struct ec_master; |
286
f3352378b4d4
Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents:
276
diff
changeset
|
139 |
typedef struct ec_master ec_master_t; /**< \see ec_master */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
141 |
struct ec_slave_config; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
142 |
typedef struct ec_slave_config ec_slave_config_t; /**< \see ec_slave_config */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
143 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
struct ec_domain; |
286
f3352378b4d4
Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents:
276
diff
changeset
|
145 |
typedef struct ec_domain ec_domain_t; /**< \see ec_domain */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
147 |
struct ec_sdo_request; |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
148 |
typedef struct ec_sdo_request ec_sdo_request_t; /**< \see ec_sdo_request. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
149 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
150 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
151 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
152 |
/** Master state. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
153 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
154 |
* This is used for the output parameter of ecrt_master_state(). |
612
aede068f9a74
Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents:
541
diff
changeset
|
155 |
*/ |
aede068f9a74
Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents:
541
diff
changeset
|
156 |
typedef struct { |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
157 |
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
|
158 |
} 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
|
159 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
160 |
/*****************************************************************************/ |
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 |
/** Slave configuration state. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
163 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
164 |
* \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
|
165 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
166 |
typedef struct { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
167 |
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
|
168 |
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
|
169 |
the specified configuration. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
170 |
} 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
|
171 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
172 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
173 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
174 |
/** 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
|
175 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
176 |
* 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
|
177 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
178 |
typedef enum { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
179 |
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
|
180 |
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
|
181 |
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
|
182 |
} 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
|
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 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
186 |
/** Domain state. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
187 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
188 |
* 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
|
189 |
*/ |
16e9ad7d8e12
Added parameters for vendor ID and product code to ecrt_get_slave(); PDO
Florian Pose <fp@igh-essen.com>
parents:
637
diff
changeset
|
190 |
typedef struct { |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
191 |
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
|
192 |
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
|
193 |
} 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
|
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 |
/** Direction type for Pdo mapping functions. |
779 | 198 |
*/ |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
612
diff
changeset
|
199 |
typedef enum { |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
200 |
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
|
201 |
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
|
202 |
} ec_direction_t; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
203 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
204 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
205 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
206 |
/** Pdo entry information. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
207 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
208 |
* This can be used to map multiple Pdo entries into a given Pdo using |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
209 |
* ecrt_slave_config_pdos(). |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
210 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
211 |
typedef struct { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
212 |
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
|
213 |
configuration. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
214 |
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
|
215 |
Pdo configuration. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
216 |
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
|
217 |
} 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
|
218 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
219 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
220 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
221 |
/** Pdo information. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
222 |
* |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
223 |
* This can be use to assign multiple Pdos to a sync manager using |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
224 |
* ecrt_slave_config_pdos(). |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
225 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
226 |
typedef struct { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
227 |
ec_direction_t 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
|
228 |
uint16_t index; /**< Index of the Pdo to map. */ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
229 |
unsigned int n_entries; /**< Number of Pdo entries in \a entries to map. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
230 |
Zero means, that the default mapping shall be |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
231 |
used. */ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
232 |
ec_pdo_entry_info_t *entries; /**< Array of Pdo entries to map. This must |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
233 |
contain at least \a n_entries values. */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
234 |
} 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
|
235 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
236 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
237 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
238 |
/** 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
|
239 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
240 |
* 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
|
241 |
* 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
|
242 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
243 |
typedef struct { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
244 |
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
|
245 |
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
|
246 |
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
|
247 |
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
|
248 |
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
|
249 |
uint8_t subindex; /**< Pdo entry subindex. */ |
809 | 250 |
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
|
251 |
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
|
252 |
} ec_pdo_entry_reg_t; |
416
4f007cd2a79d
ecrt_domain_register_pdo_range() implemented.
Florian Pose <fp@igh-essen.com>
parents:
325
diff
changeset
|
253 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
254 |
/*****************************************************************************/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
255 |
|
861
6e3de145421a
Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
256 |
/** 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
|
257 |
* |
6e3de145421a
Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
258 |
* 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
|
259 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
260 |
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
|
261 |
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
|
262 |
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
|
263 |
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
|
264 |
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
|
265 |
} ec_sdo_request_state_t; |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
266 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
267 |
/****************************************************************************** |
779 | 268 |
* Global functions |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
269 |
*****************************************************************************/ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
271 |
/** 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
|
272 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
273 |
* \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
|
274 |
*/ |
541
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
275 |
unsigned int ecrt_version_magic(void); |
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
276 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
277 |
/** 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
|
278 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
279 |
* \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
|
280 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
281 |
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
|
282 |
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
|
283 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
284 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
285 |
/** 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
|
286 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
287 |
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
|
288 |
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
|
289 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
290 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
291 |
/****************************************************************************** |
779 | 292 |
* Master methods |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
293 |
*****************************************************************************/ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
294 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
295 |
/** 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
|
296 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
297 |
* 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
|
298 |
* (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
|
299 |
* 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
|
300 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
301 |
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
|
302 |
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
|
303 |
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
|
304 |
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
|
305 |
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
|
306 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
307 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
308 |
/** 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
|
309 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
310 |
* \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
|
311 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
312 |
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
|
313 |
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
|
314 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
315 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
316 |
/** 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
|
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 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
|
319 |
* 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
|
320 |
* 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
|
321 |
* 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
|
322 |
* 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
|
323 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
324 |
* 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
|
325 |
* - 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
|
326 |
* ring position. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
327 |
* - 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
|
328 |
* 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
|
329 |
* 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
|
330 |
* 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
|
331 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
332 |
* 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
|
333 |
* 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
|
334 |
* 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
|
335 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
336 |
* 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
|
337 |
* 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
|
338 |
* applied. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
339 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
340 |
* \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
|
341 |
* \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
|
342 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
343 |
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
|
344 |
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
|
345 |
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
|
346 |
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
|
347 |
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
|
348 |
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
|
349 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
350 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
351 |
/** Finishes the configuration phase and prepares for realtime mode. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
352 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
353 |
* This function has to be called after all Pdo entries are registered. It |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
354 |
* tells the master that the configuration phase is finished and the realtime |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
355 |
* operation will begin. The function allocates internal memory for the |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
356 |
* domains and calculates the logical FMMU addresses for domain members. It |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
357 |
* tells the master state machine that the bus configuration is now to be |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
358 |
* applied. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
359 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
360 |
* \attention After this function has been called, the realtime application is |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
361 |
* in charge of cyclically calling ecrt_master_send() and |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
362 |
* ecrt_master_receive() to ensure bus communication. Before calling this |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
363 |
* function, the master thread is responsible for that, so these functions may |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
364 |
* not be called! |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
365 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
366 |
* \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
|
367 |
*/ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
368 |
int ecrt_master_activate( ec_master_t *master /**< EtherCAT master. */); |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
369 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
370 |
/** 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
|
371 |
* |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
372 |
* This has to be called cyclically by the realtime application after |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
373 |
* ecrt_master_activate() has returned. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
374 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
375 |
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
|
376 |
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
|
377 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
378 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
379 |
/** Fetches received frames from the hardware and processes the datagrams. |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
380 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
381 |
* This has to be called cyclically by the realtime application after |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
382 |
* ecrt_master_activate() has returned. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
383 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
384 |
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
|
385 |
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
|
386 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
387 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
388 |
/** 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
|
389 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
390 |
* 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
|
391 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
392 |
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
|
393 |
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
|
394 |
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
|
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 |
/****************************************************************************** |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
398 |
* Slave configuration methods |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
399 |
*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
400 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
401 |
/** Add a Pdo to a sync manager's Pdo assignment. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
402 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
403 |
* \see ecrt_slave_config_pdos() |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
404 |
* \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
|
405 |
*/ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
406 |
int ecrt_slave_config_pdo_assign_add( |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
407 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
408 |
ec_direction_t dir, /**< Sync manager direction (input/output). */ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
409 |
uint16_t index /**< Index of the Pdo to assign. */ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
410 |
); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
411 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
412 |
/** Clear a sync manager's Pdo assignment. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
413 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
414 |
* This can be called before assigning Pdos via |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
415 |
* ecrt_slave_config_pdo_assign_add(), to clear the default assignment. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
416 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
417 |
void ecrt_slave_config_pdo_assign_clear( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
418 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
419 |
ec_direction_t dir /**< Sync manager direction (input/output). */ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
420 |
); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
421 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
422 |
/** Add a Pdo entry to the given Pdo's mapping. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
423 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
424 |
* \see ecrt_slave_config_pdos() |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
425 |
* \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
|
426 |
*/ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
427 |
int ecrt_slave_config_pdo_mapping_add( |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
428 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
429 |
uint16_t pdo_index, /**< Index of the Pdo. */ |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
430 |
uint16_t entry_index, /**< Index of the Pdo entry to add to the Pdo's |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
431 |
mapping. */ |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
432 |
uint8_t entry_subindex, /**< Subindex of the Pdo entry to add to the |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
433 |
Pdo's mapping. */ |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
434 |
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
|
435 |
); |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
436 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
437 |
/** Clear the mapping of a given Pdo. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
438 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
439 |
* This can be called before mapping Pdo entries via |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
440 |
* ecrt_slave_config_pdo_mapping_add(), to clear the default mapping. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
441 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
442 |
void ecrt_slave_config_pdo_mapping_clear( |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
443 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
444 |
uint16_t pdo_index /**< Index of the Pdo. */ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
445 |
); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
446 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
447 |
/** Specify the Pdo assignment and (optionally) the Pdo mappings. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
448 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
449 |
* This function is a convenience wrapper for the functions |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
450 |
* ecrt_slave_config_pdo_assign_clear(), ecrt_slave_config_pdo_assign_add(), |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
451 |
* ecrt_slave_config_pdo_mapping_clear() and |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
452 |
* ecrt_slave_config_pdo_mapping_add(), that are better suitable for automatic |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
453 |
* code generation. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
454 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
455 |
* The following example shows, how to specify a complete Pdo assignment |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
456 |
* including the Pdo mappings. With this information, the master is able to |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
457 |
* reserve the complete process data, even if the slave is not present at |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
458 |
* configuration time: |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
459 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
460 |
* \code |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
461 |
* 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
|
462 |
* {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
|
463 |
* {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
|
464 |
* }; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
465 |
* |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
466 |
* 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
|
467 |
* {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
|
468 |
* {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
|
469 |
* }; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
470 |
* |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
471 |
* const ec_pdo_info_t el3162_pdos[] = { |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
472 |
* {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
|
473 |
* {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
|
474 |
* }; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
475 |
* |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
476 |
* if (ecrt_slave_config_pdos(sc, 2, el3162_pdos)) |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
477 |
* 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
|
478 |
* \endcode |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
479 |
* |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
480 |
* The next example shows, how to configure only the Pdo assignment. The |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
481 |
* entries for each assigned Pdo are taken from the Pdo's default mapping. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
482 |
* Please note, that Pdo entry registration will fail, if the Pdo |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
483 |
* configuration is left empty and the slave is offline. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
484 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
485 |
* \code |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
486 |
* const ec_pdo_info_t pdos[] = { |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
487 |
* {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
|
488 |
* {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
|
489 |
* }; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
490 |
* |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
491 |
* if (ecrt_slave_config_pdos(slave_config_ana_in, 2, pdos)) |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
492 |
* 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
|
493 |
* \endcode |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
494 |
* |
878 | 495 |
* Processing of \a pdo_infos will stop, if |
496 |
* - the number of processed items reaches \a n_infos, or |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
497 |
* - the \a dir member of an ec_pdo_info_t item is EC_END. In this case, |
878 | 498 |
* \a n_infos should set to a number greater than the number of list items; |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
499 |
* using EC_END is recommended. |
878 | 500 |
* |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
501 |
* \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
|
502 |
*/ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
503 |
int ecrt_slave_config_pdos( |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
504 |
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
|
505 |
unsigned int n_infos, /**< Number of Pdo infos in \a pdo_infos. */ |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
506 |
const ec_pdo_info_t pdo_infos[] /**< List with Pdos. */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
507 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
508 |
|
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
509 |
/** 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
|
510 |
* |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
511 |
* Searches the current Pdo assignment and Pdo mappings for the given Pdo |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
512 |
* 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
|
513 |
* corresponding sync manager and FMMU configurations are provided for slave |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
514 |
* configuration and the respective sync manager's assigned Pdos are appended |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
515 |
* to the given domain, if not already done. The offset of the requested Pdo |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
516 |
* entry's data inside the domain's process data is returned. |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
517 |
* |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
832
diff
changeset
|
518 |
* \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
|
519 |
* \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
|
520 |
* \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
|
521 |
*/ |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
793
diff
changeset
|
522 |
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
|
523 |
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
|
524 |
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
|
525 |
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
|
526 |
ec_domain_t *domain /**< Domain. */ |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
793
diff
changeset
|
527 |
); |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
793
diff
changeset
|
528 |
|
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
529 |
/** Add an Sdo configuration. |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
530 |
* |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
531 |
* An Sdo configuration is stored in the slave configuration object and is |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
532 |
* downloaded to the slave whenever the slave is being configured by the |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
533 |
* master. This usually happens once on master activation, but can be repeated |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
534 |
* subsequently, for example after the slave's power supply failed. |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
535 |
* |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
536 |
* This is the generic function for adding an Sdo configuration. Please note |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
537 |
* that the this function does not do any endianess correction. If |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
538 |
* datatype-specific functions are needed (that automatically correct the |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
539 |
* endianess), have a look at ecrt_slave_config_sdo8(), |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
540 |
* ecrt_slave_config_sdo16() and ecrt_slave_config_sdo32(). |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
541 |
* |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
542 |
* \return 0 in case of success, else < 0 |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
543 |
*/ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
544 |
int ecrt_slave_config_sdo( |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
545 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
546 |
uint16_t index, /**< Index of the Sdo to configure. */ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
547 |
uint8_t subindex, /**< Subindex of the Sdo to configure. */ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
548 |
const uint8_t *data, /**< Pointer to the data. */ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
549 |
size_t size /**< Size of the \a data. */ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
550 |
); |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
551 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
552 |
/** 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
|
553 |
* |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
554 |
* \see ecrt_slave_config_sdo(). |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
555 |
* \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
|
556 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
557 |
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
|
558 |
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
|
559 |
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
|
560 |
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
|
561 |
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
|
562 |
); |
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 |
/** 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
|
565 |
* |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
566 |
* \see ecrt_slave_config_sdo(). |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
567 |
* \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
|
568 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
569 |
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
|
570 |
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
|
571 |
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
|
572 |
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
|
573 |
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
|
574 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
575 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
576 |
/** 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
|
577 |
* |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
886
diff
changeset
|
578 |
* \see ecrt_slave_config_sdo(). |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
579 |
* \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
|
580 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
581 |
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
|
582 |
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
|
583 |
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
|
584 |
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
|
585 |
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
|
586 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
587 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
588 |
/** 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
|
589 |
* |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
590 |
* 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
|
591 |
* released. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
592 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
593 |
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
|
594 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
595 |
uint16_t index, /**< Sdo index. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
596 |
uint8_t subindex, /**< Sdo subindex. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
597 |
size_t size /**< Data size to reserve. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
598 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
599 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
600 |
/** 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
|
601 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
602 |
* 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
|
603 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
604 |
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
|
605 |
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
|
606 |
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
|
607 |
); |
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
288
diff
changeset
|
608 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
609 |
/****************************************************************************** |
779 | 610 |
* Domain methods |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
611 |
*****************************************************************************/ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
612 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
613 |
/** 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
|
614 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
615 |
* \todo doc |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
616 |
* \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
|
617 |
* 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
|
618 |
* \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
|
619 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
620 |
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
|
621 |
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
|
622 |
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
|
623 |
registrations. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
624 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
625 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
626 |
/** 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
|
627 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
628 |
* \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
|
629 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
630 |
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
|
631 |
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
|
632 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
633 |
|
809 | 634 |
/** Provide external memory to store the domain's process data. |
635 |
* |
|
636 |
* Call this after all Pdo entries have been registered and before activating |
|
637 |
* the master. |
|
638 |
* |
|
639 |
* The size of the allocated memory must be at least ecrt_domain_size(), after |
|
640 |
* all Pdo entries have been registered. |
|
641 |
*/ |
|
642 |
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
|
643 |
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
|
644 |
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
|
645 |
data in. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
646 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
647 |
|
809 | 648 |
/** Returns the domain's process data. |
649 |
* |
|
650 |
* If external memory was provided with ecrt_domain_external_memory(), the |
|
651 |
* returned pointer will contain the address of that memory. Otherwise it will |
|
652 |
* point to the internally allocated memory. |
|
653 |
* |
|
654 |
* \return Pointer to the process data memory. |
|
655 |
*/ |
|
656 |
uint8_t *ecrt_domain_data( |
|
657 |
ec_domain_t *domain /**< Domain. */ |
|
658 |
); |
|
659 |
||
886 | 660 |
/** Determines the states of the domain's datagrams. |
661 |
* |
|
662 |
* Evaluates the working counters of the received datagrams and outputs |
|
663 |
* statistics, if necessary. This must be called after ecrt_master_receive() |
|
664 |
* is expected to receive the domain datagrams in order to make |
|
665 |
* ecrt_domain_state() return the result of the last process data exchange. |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
666 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
667 |
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
|
668 |
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
|
669 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
670 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
671 |
/** (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
|
672 |
* |
886 | 673 |
* Call this function to mark the domain's datagrams for exchanging at the |
674 |
* next call of ecrt_master_send(). |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
675 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
676 |
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
|
677 |
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
|
678 |
); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
679 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
680 |
/** 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
|
681 |
* |
886 | 682 |
* Stores the domain state in the given \a state structure. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
683 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
684 |
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
|
685 |
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
|
686 |
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
|
687 |
information. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
688 |
); |
635
d304ef4af542
Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents:
612
diff
changeset
|
689 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
690 |
/***************************************************************************** |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
691 |
* Sdo request methods. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
692 |
****************************************************************************/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
693 |
|
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
694 |
/** Set the timeout for an Sdo request. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
695 |
* |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
696 |
* 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
|
697 |
* as failed. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
698 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
699 |
void ecrt_sdo_request_timeout( |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
700 |
ec_sdo_request_t *req, /**< Sdo request. */ |
880 | 701 |
uint32_t timeout /**< Timeout in milliseconds. Zero means no |
702 |
timeout. */ |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
703 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
704 |
|
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
705 |
/** Access to the Sdo request's data. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
706 |
* |
868 | 707 |
* This function returns a pointer to the request's internal Sdo data memory. |
708 |
* |
|
709 |
* - After a read operation was successful, integer data can be evaluated using |
|
710 |
* the EC_READ_*() macros as usual. Example: |
|
711 |
* \code |
|
712 |
* uint16_t value = EC_READ_U16(ecrt_sdo_request_data(sdo))); |
|
713 |
* \endcode |
|
714 |
* - If a write operation shall be triggered, the data have to be written to |
|
715 |
* the internal memory. Use the EC_WRITE_*() macros, if you are writing |
|
716 |
* integer data. Be sure, that the data fit into the memory. The memory size |
|
717 |
* is a parameter of ecrt_slave_config_create_sdo_request(). |
|
718 |
* \code |
|
719 |
* EC_WRITE_U16(ecrt_sdo_request_data(sdo), 0xFFFF); |
|
720 |
* \endcode |
|
721 |
* |
|
864 | 722 |
* \attention The return value can be invalid during a read operation, because |
723 |
* the internal Sdo data memory could be re-allocated if the read Sdo data do |
|
724 |
* not fit inside. |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
725 |
* |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
726 |
* \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
|
727 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
728 |
uint8_t *ecrt_sdo_request_data( |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
729 |
ec_sdo_request_t *req /**< Sdo request. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
730 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
731 |
|
869
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
732 |
/** Returns the current Sdo data size. |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
733 |
* |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
734 |
* 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
|
735 |
* 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
|
736 |
* 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
|
737 |
* |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
738 |
* \return Sdo data size in bytes. |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
739 |
*/ |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
740 |
size_t ecrt_sdo_request_data_size( |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
741 |
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
|
742 |
); |
6c2f4130ed46
Added ecrt_sdo_request_data_size().
Florian Pose <fp@igh-essen.com>
parents:
868
diff
changeset
|
743 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
744 |
/** 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
|
745 |
* |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
746 |
* \return Request state. |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
747 |
*/ |
861
6e3de145421a
Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
748 |
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
|
749 |
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
|
750 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
751 |
|
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
752 |
/** Schedule an Sdo write operation. |
864 | 753 |
* |
754 |
* \attention This method may not be called while ecrt_sdo_request_state() |
|
755 |
* returns EC_SDO_REQUEST_BUSY. |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
756 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
757 |
void ecrt_sdo_request_write( |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
758 |
ec_sdo_request_t *req /**< Sdo request. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
759 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
760 |
|
864 | 761 |
/** Schedule an Sdo read operation. |
762 |
* |
|
763 |
* \attention This method may not be called while ecrt_sdo_request_state() |
|
764 |
* returns EC_SDO_REQUEST_BUSY. |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
765 |
* |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
766 |
* \attention After calling this function, the return value of |
864 | 767 |
* ecrt_sdo_request_data() must be considered as invalid while |
768 |
* 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
|
769 |
*/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
770 |
void ecrt_sdo_request_read( |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
771 |
ec_sdo_request_t *req /**< Sdo request. */ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
772 |
); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
851
diff
changeset
|
773 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
774 |
/****************************************************************************** |
779 | 775 |
* Bitwise read/write macros |
776 |
*****************************************************************************/ |
|
777 |
||
778 |
/** Read a certain bit of an EtherCAT data byte. |
|
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
779 |
* |
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
|
780 |
* \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
|
781 |
* \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
|
782 |
*/ |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
783 |
#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
|
784 |
|
779 | 785 |
/** Write a certain bit of an EtherCAT data byte. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
786 |
* |
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
|
787 |
* \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
|
788 |
* \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
|
789 |
* \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
|
790 |
*/ |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
791 |
#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
|
792 |
do { \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
793 |
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
|
794 |
else *((uint8_t *) (DATA)) &= ~(1 << (POS)); \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
795 |
} while (0) |
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 | 798 |
* Read macros |
799 |
*****************************************************************************/ |
|
800 |
||
801 |
/** Read an 8-bit unsigned value from EtherCAT data. |
|
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
802 |
* |
779 | 803 |
* \return EtherCAT data value |
804 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
805 |
#define EC_READ_U8(DATA) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
806 |
((uint8_t) *((uint8_t *) (DATA))) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
807 |
|
779 | 808 |
/** Read an 8-bit signed value from EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
809 |
* |
779 | 810 |
* \param DATA EtherCAT data pointer |
811 |
* \return EtherCAT data value |
|
812 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
813 |
#define EC_READ_S8(DATA) \ |
288 | 814 |
((int8_t) *((uint8_t *) (DATA))) |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
815 |
|
779 | 816 |
/** Read a 16-bit unsigned value from EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
817 |
* |
779 | 818 |
* \param DATA EtherCAT data pointer |
819 |
* \return EtherCAT data value |
|
820 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
821 |
#define EC_READ_U16(DATA) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
822 |
((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
|
823 |
|
779 | 824 |
/** Read a 16-bit signed value from EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
825 |
* |
779 | 826 |
* \param DATA EtherCAT data pointer |
827 |
* \return EtherCAT data value |
|
828 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
829 |
#define EC_READ_S16(DATA) \ |
288 | 830 |
((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
|
831 |
|
779 | 832 |
/** Read a 32-bit unsigned value from EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
833 |
* |
779 | 834 |
* \param DATA EtherCAT data pointer |
835 |
* \return EtherCAT data value |
|
836 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
837 |
#define EC_READ_U32(DATA) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
838 |
((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
|
839 |
|
779 | 840 |
/** Read a 32-bit signed value from EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
841 |
* |
779 | 842 |
* \param DATA EtherCAT data pointer |
843 |
* \return EtherCAT data value |
|
844 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
845 |
#define EC_READ_S32(DATA) \ |
288 | 846 |
((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
|
847 |
|
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
848 |
/****************************************************************************** |
779 | 849 |
* Write macros |
850 |
*****************************************************************************/ |
|
851 |
||
852 |
/** Write an 8-bit unsigned value to EtherCAT data. |
|
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
853 |
* |
779 | 854 |
* \param DATA EtherCAT data pointer |
855 |
* \param VAL new value |
|
856 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
857 |
#define EC_WRITE_U8(DATA, VAL) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
858 |
do { \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
859 |
*((uint8_t *)(DATA)) = ((uint8_t) (VAL)); \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
860 |
} while (0) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
861 |
|
779 | 862 |
/** Write an 8-bit signed value to EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
863 |
* |
779 | 864 |
* \param DATA EtherCAT data pointer |
865 |
* \param VAL new value |
|
866 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
867 |
#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
|
868 |
|
779 | 869 |
/** Write a 16-bit unsigned value to EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
870 |
* |
779 | 871 |
* \param DATA EtherCAT data pointer |
872 |
* \param VAL new value |
|
873 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
874 |
#define EC_WRITE_U16(DATA, VAL) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
875 |
do { \ |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
876 |
*((uint16_t *) (DATA)) = cpu_to_le16((uint16_t) (VAL)); \ |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
877 |
} while (0) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
878 |
|
779 | 879 |
/** Write a 16-bit signed value to EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
880 |
* |
779 | 881 |
* \param DATA EtherCAT data pointer |
882 |
* \param VAL new value |
|
883 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
884 |
#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
|
885 |
|
779 | 886 |
/** Write a 32-bit unsigned value to EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
887 |
* |
779 | 888 |
* \param DATA EtherCAT data pointer |
889 |
* \param VAL new value |
|
890 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
891 |
#define EC_WRITE_U32(DATA, VAL) \ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
892 |
do { \ |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
893 |
*((uint32_t *) (DATA)) = cpu_to_le32((uint32_t) (VAL)); \ |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
894 |
} while (0) |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
895 |
|
779 | 896 |
/** Write a 32-bit signed value to EtherCAT data. |
894
440c43d56b33
Improved EC_WRITE macros by replacing in-situ conversions
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
897 |
* |
779 | 898 |
* \param DATA EtherCAT data pointer |
899 |
* \param VAL new value |
|
900 |
*/ |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
901 |
#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
|
902 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
903 |
/*****************************************************************************/ |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
904 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
905 |
/** @} */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
786
diff
changeset
|
906 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
907 |
#endif |