IgH EtherCAT Master  1.6.2
ioctl.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2006-2024 Florian Pose, Ingenieurgemeinschaft IgH
4  *
5  * This file is part of the IgH EtherCAT master.
6  *
7  * The file is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation; version 2.1 of the License.
10  *
11  * This file is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this file. If not, see <http://www.gnu.org/licenses/>.
18  *
19  ****************************************************************************/
20 
26 /****************************************************************************/
27 
28 #ifndef __EC_IOCTL_H__
29 #define __EC_IOCTL_H__
30 
31 #include <linux/ioctl.h>
32 
33 #include "globals.h"
34 
35 /****************************************************************************/
36 
39 #define EC_IOCTL_TYPE 0xa4
40 
41 #define EC_IO(nr) _IO(EC_IOCTL_TYPE, nr)
42 #define EC_IOR(nr, type) _IOR(EC_IOCTL_TYPE, nr, type)
43 #define EC_IOW(nr, type) _IOW(EC_IOCTL_TYPE, nr, type)
44 #define EC_IOWR(nr, type) _IOWR(EC_IOCTL_TYPE, nr, type)
45 
50 #define EC_IOCTL_VERSION_MAGIC 37
51 
52 // Command-line tool
53 #define EC_IOCTL_MODULE EC_IOR(0x00, ec_ioctl_module_t)
54 #define EC_IOCTL_MASTER EC_IOR(0x01, ec_ioctl_master_t)
55 #define EC_IOCTL_SLAVE EC_IOWR(0x02, ec_ioctl_slave_t)
56 #define EC_IOCTL_SLAVE_SYNC EC_IOWR(0x03, ec_ioctl_slave_sync_t)
57 #define EC_IOCTL_SLAVE_SYNC_PDO EC_IOWR(0x04, ec_ioctl_slave_sync_pdo_t)
58 #define EC_IOCTL_SLAVE_SYNC_PDO_ENTRY EC_IOWR(0x05, ec_ioctl_slave_sync_pdo_entry_t)
59 #define EC_IOCTL_DOMAIN EC_IOWR(0x06, ec_ioctl_domain_t)
60 #define EC_IOCTL_DOMAIN_FMMU EC_IOWR(0x07, ec_ioctl_domain_fmmu_t)
61 #define EC_IOCTL_DOMAIN_DATA EC_IOWR(0x08, ec_ioctl_domain_data_t)
62 #define EC_IOCTL_MASTER_DEBUG EC_IO(0x09)
63 #define EC_IOCTL_MASTER_RESCAN EC_IO(0x0a)
64 #define EC_IOCTL_SLAVE_STATE EC_IOW(0x0b, ec_ioctl_slave_state_t)
65 #define EC_IOCTL_SLAVE_SDO EC_IOWR(0x0c, ec_ioctl_slave_sdo_t)
66 #define EC_IOCTL_SLAVE_SDO_ENTRY EC_IOWR(0x0d, ec_ioctl_slave_sdo_entry_t)
67 #define EC_IOCTL_SLAVE_SDO_UPLOAD EC_IOWR(0x0e, ec_ioctl_slave_sdo_upload_t)
68 #define EC_IOCTL_SLAVE_SDO_DOWNLOAD EC_IOWR(0x0f, ec_ioctl_slave_sdo_download_t)
69 #define EC_IOCTL_SLAVE_SII_READ EC_IOWR(0x10, ec_ioctl_slave_sii_t)
70 #define EC_IOCTL_SLAVE_SII_WRITE EC_IOW(0x11, ec_ioctl_slave_sii_t)
71 #define EC_IOCTL_SLAVE_REG_READ EC_IOWR(0x12, ec_ioctl_slave_reg_t)
72 #define EC_IOCTL_SLAVE_REG_WRITE EC_IOW(0x13, ec_ioctl_slave_reg_t)
73 #define EC_IOCTL_SLAVE_FOE_READ EC_IOWR(0x14, ec_ioctl_slave_foe_t)
74 #define EC_IOCTL_SLAVE_FOE_WRITE EC_IOW(0x15, ec_ioctl_slave_foe_t)
75 #define EC_IOCTL_SLAVE_SOE_READ EC_IOWR(0x16, ec_ioctl_slave_soe_read_t)
76 #define EC_IOCTL_SLAVE_SOE_WRITE EC_IOWR(0x17, ec_ioctl_slave_soe_write_t)
77 #ifdef EC_EOE
78 #define EC_IOCTL_SLAVE_EOE_IP_PARAM EC_IOW(0x18, ec_ioctl_eoe_ip_t)
79 #endif
80 #define EC_IOCTL_CONFIG EC_IOWR(0x19, ec_ioctl_config_t)
81 #define EC_IOCTL_CONFIG_PDO EC_IOWR(0x1a, ec_ioctl_config_pdo_t)
82 #define EC_IOCTL_CONFIG_PDO_ENTRY EC_IOWR(0x1b, ec_ioctl_config_pdo_entry_t)
83 #define EC_IOCTL_CONFIG_SDO EC_IOWR(0x1c, ec_ioctl_config_sdo_t)
84 #define EC_IOCTL_CONFIG_IDN EC_IOWR(0x1d, ec_ioctl_config_idn_t)
85 #define EC_IOCTL_CONFIG_FLAG EC_IOWR(0x1e, ec_ioctl_config_flag_t)
86 #ifdef EC_EOE
87 #define EC_IOCTL_CONFIG_EOE_IP_PARAM EC_IOWR(0x1f, ec_ioctl_eoe_ip_t)
88 #define EC_IOCTL_EOE_HANDLER EC_IOWR(0x20, ec_ioctl_eoe_handler_t)
89 #endif
90 
91 // Application interface
92 #define EC_IOCTL_REQUEST EC_IO(0x21)
93 #define EC_IOCTL_CREATE_DOMAIN EC_IO(0x22)
94 #define EC_IOCTL_CREATE_SLAVE_CONFIG EC_IOWR(0x23, ec_ioctl_config_t)
95 #define EC_IOCTL_SELECT_REF_CLOCK EC_IOW(0x24, uint32_t)
96 #define EC_IOCTL_ACTIVATE EC_IOR(0x25, ec_ioctl_master_activate_t)
97 #define EC_IOCTL_DEACTIVATE EC_IO(0x26)
98 #define EC_IOCTL_SEND EC_IO(0x27)
99 #define EC_IOCTL_RECEIVE EC_IO(0x28)
100 #define EC_IOCTL_MASTER_STATE EC_IOR(0x29, ec_master_state_t)
101 #define EC_IOCTL_MASTER_LINK_STATE EC_IOWR(0x2a, ec_ioctl_link_state_t)
102 #define EC_IOCTL_APP_TIME EC_IOW(0x2b, uint64_t)
103 #define EC_IOCTL_SYNC_REF EC_IO(0x2c)
104 #define EC_IOCTL_SYNC_REF_TO EC_IOW(0x2d, uint64_t)
105 #define EC_IOCTL_SYNC_SLAVES EC_IO(0x2e)
106 #define EC_IOCTL_REF_CLOCK_TIME EC_IOR(0x2f, uint32_t)
107 #define EC_IOCTL_SYNC_MON_QUEUE EC_IO(0x30)
108 #define EC_IOCTL_SYNC_MON_PROCESS EC_IOR(0x31, uint32_t)
109 #define EC_IOCTL_RESET EC_IO(0x32)
110 #define EC_IOCTL_SC_SYNC EC_IOW(0x33, ec_ioctl_config_t)
111 #define EC_IOCTL_SC_WATCHDOG EC_IOW(0x34, ec_ioctl_config_t)
112 #define EC_IOCTL_SC_ADD_PDO EC_IOW(0x35, ec_ioctl_config_pdo_t)
113 #define EC_IOCTL_SC_CLEAR_PDOS EC_IOW(0x36, ec_ioctl_config_pdo_t)
114 #define EC_IOCTL_SC_ADD_ENTRY EC_IOW(0x37, ec_ioctl_add_pdo_entry_t)
115 #define EC_IOCTL_SC_CLEAR_ENTRIES EC_IOW(0x38, ec_ioctl_config_pdo_t)
116 #define EC_IOCTL_SC_REG_PDO_ENTRY EC_IOWR(0x39, ec_ioctl_reg_pdo_entry_t)
117 #define EC_IOCTL_SC_REG_PDO_POS EC_IOWR(0x3a, ec_ioctl_reg_pdo_pos_t)
118 #define EC_IOCTL_SC_DC EC_IOW(0x3b, ec_ioctl_config_t)
119 #define EC_IOCTL_SC_SDO EC_IOW(0x3c, ec_ioctl_sc_sdo_t)
120 #define EC_IOCTL_SC_EMERG_SIZE EC_IOW(0x3d, ec_ioctl_sc_emerg_t)
121 #define EC_IOCTL_SC_EMERG_POP EC_IOWR(0x3e, ec_ioctl_sc_emerg_t)
122 #define EC_IOCTL_SC_EMERG_CLEAR EC_IOW(0x3f, ec_ioctl_sc_emerg_t)
123 #define EC_IOCTL_SC_EMERG_OVERRUNS EC_IOWR(0x40, ec_ioctl_sc_emerg_t)
124 #define EC_IOCTL_SC_SDO_REQUEST EC_IOWR(0x41, ec_ioctl_sdo_request_t)
125 #define EC_IOCTL_SC_SOE_REQUEST EC_IOWR(0x42, ec_ioctl_soe_request_t)
126 #define EC_IOCTL_SC_REG_REQUEST EC_IOWR(0x43, ec_ioctl_reg_request_t)
127 #define EC_IOCTL_SC_VOE EC_IOWR(0x44, ec_ioctl_voe_t)
128 #define EC_IOCTL_SC_STATE EC_IOWR(0x45, ec_ioctl_sc_state_t)
129 #define EC_IOCTL_SC_IDN EC_IOW(0x46, ec_ioctl_sc_idn_t)
130 #define EC_IOCTL_SC_FLAG EC_IOW(0x47, ec_ioctl_sc_flag_t)
131 #ifdef EC_EOE
132 #define EC_IOCTL_SC_EOE_IP_PARAM EC_IOW(0x48, ec_ioctl_eoe_ip_t)
133 #endif
134 #define EC_IOCTL_SC_STATE_TIMEOUT EC_IOW(0x49, ec_ioctl_sc_state_timeout_t)
135 #define EC_IOCTL_DOMAIN_SIZE EC_IO(0x4a)
136 #define EC_IOCTL_DOMAIN_OFFSET EC_IO(0x4b)
137 #define EC_IOCTL_DOMAIN_PROCESS EC_IO(0x4c)
138 #define EC_IOCTL_DOMAIN_QUEUE EC_IO(0x4d)
139 #define EC_IOCTL_DOMAIN_STATE EC_IOWR(0x4e, ec_ioctl_domain_state_t)
140 #define EC_IOCTL_SDO_REQUEST_INDEX EC_IOWR(0x4f, ec_ioctl_sdo_request_t)
141 #define EC_IOCTL_SDO_REQUEST_TIMEOUT EC_IOWR(0x50, ec_ioctl_sdo_request_t)
142 #define EC_IOCTL_SDO_REQUEST_STATE EC_IOWR(0x51, ec_ioctl_sdo_request_t)
143 #define EC_IOCTL_SDO_REQUEST_READ EC_IOWR(0x52, ec_ioctl_sdo_request_t)
144 #define EC_IOCTL_SDO_REQUEST_WRITE EC_IOWR(0x53, ec_ioctl_sdo_request_t)
145 #define EC_IOCTL_SDO_REQUEST_DATA EC_IOWR(0x54, ec_ioctl_sdo_request_t)
146 #define EC_IOCTL_SOE_REQUEST_IDN EC_IOWR(0x55, ec_ioctl_soe_request_t)
147 #define EC_IOCTL_SOE_REQUEST_TIMEOUT EC_IOWR(0x56, ec_ioctl_soe_request_t)
148 #define EC_IOCTL_SOE_REQUEST_STATE EC_IOWR(0x57, ec_ioctl_soe_request_t)
149 #define EC_IOCTL_SOE_REQUEST_READ EC_IOWR(0x58, ec_ioctl_soe_request_t)
150 #define EC_IOCTL_SOE_REQUEST_WRITE EC_IOWR(0x59, ec_ioctl_soe_request_t)
151 #define EC_IOCTL_SOE_REQUEST_DATA EC_IOWR(0x5a, ec_ioctl_soe_request_t)
152 #define EC_IOCTL_REG_REQUEST_DATA EC_IOWR(0x5b, ec_ioctl_reg_request_t)
153 #define EC_IOCTL_REG_REQUEST_STATE EC_IOWR(0x5c, ec_ioctl_reg_request_t)
154 #define EC_IOCTL_REG_REQUEST_WRITE EC_IOWR(0x5d, ec_ioctl_reg_request_t)
155 #define EC_IOCTL_REG_REQUEST_READ EC_IOWR(0x5e, ec_ioctl_reg_request_t)
156 #define EC_IOCTL_VOE_SEND_HEADER EC_IOW(0x5f, ec_ioctl_voe_t)
157 #define EC_IOCTL_VOE_REC_HEADER EC_IOWR(0x60, ec_ioctl_voe_t)
158 #define EC_IOCTL_VOE_READ EC_IOW(0x61, ec_ioctl_voe_t)
159 #define EC_IOCTL_VOE_READ_NOSYNC EC_IOW(0x62, ec_ioctl_voe_t)
160 #define EC_IOCTL_VOE_WRITE EC_IOWR(0x63, ec_ioctl_voe_t)
161 #define EC_IOCTL_VOE_EXEC EC_IOWR(0x64, ec_ioctl_voe_t)
162 #define EC_IOCTL_VOE_DATA EC_IOWR(0x65, ec_ioctl_voe_t)
163 #define EC_IOCTL_SET_SEND_INTERVAL EC_IOW(0x66, size_t)
164 
165 /****************************************************************************/
166 
167 #define EC_IOCTL_STRING_SIZE 64
168 
169 /****************************************************************************/
170 
171 typedef struct {
172  uint32_t ioctl_version_magic;
173  uint32_t master_count;
174 } ec_ioctl_module_t;
175 
176 /****************************************************************************/
177 
178 typedef struct {
179  uint32_t slave_count;
180  uint32_t scan_index;
181  uint32_t config_count;
182  uint32_t domain_count;
183  uint32_t eoe_handler_count;
184  uint8_t phase;
185  uint8_t active;
186  uint8_t scan_busy;
187  struct ec_ioctl_device {
188  uint8_t address[6];
189  uint8_t attached;
190  uint8_t link_state;
191  uint64_t tx_count;
192  uint64_t rx_count;
193  uint64_t tx_bytes;
194  uint64_t rx_bytes;
195  uint64_t tx_errors;
196  int32_t tx_frame_rates[EC_RATE_COUNT];
197  int32_t rx_frame_rates[EC_RATE_COUNT];
198  int32_t tx_byte_rates[EC_RATE_COUNT];
199  int32_t rx_byte_rates[EC_RATE_COUNT];
200  } devices[EC_MAX_NUM_DEVICES];
201  uint32_t num_devices;
202  uint64_t tx_count;
203  uint64_t rx_count;
204  uint64_t tx_bytes;
205  uint64_t rx_bytes;
206  int32_t tx_frame_rates[EC_RATE_COUNT];
207  int32_t rx_frame_rates[EC_RATE_COUNT];
208  int32_t tx_byte_rates[EC_RATE_COUNT];
209  int32_t rx_byte_rates[EC_RATE_COUNT];
210  int32_t loss_rates[EC_RATE_COUNT];
211  uint64_t app_time;
212  uint64_t dc_ref_time;
213  uint16_t ref_clock;
214 } ec_ioctl_master_t;
215 
216 /****************************************************************************/
217 
218 typedef struct {
219  // input
220  uint16_t position;
221 
222  // outputs
223  unsigned int device_index;
224  uint32_t vendor_id;
225  uint32_t product_code;
226  uint32_t revision_number;
227  uint32_t serial_number;
228  uint16_t alias;
229  uint16_t boot_rx_mailbox_offset;
230  uint16_t boot_rx_mailbox_size;
231  uint16_t boot_tx_mailbox_offset;
232  uint16_t boot_tx_mailbox_size;
233  uint16_t std_rx_mailbox_offset;
234  uint16_t std_rx_mailbox_size;
235  uint16_t std_tx_mailbox_offset;
236  uint16_t std_tx_mailbox_size;
237  uint16_t mailbox_protocols;
238  uint8_t has_general_category;
239  ec_sii_coe_details_t coe_details;
240  ec_sii_general_flags_t general_flags;
241  int16_t current_on_ebus;
242  struct {
245  uint32_t receive_time;
246  uint16_t next_slave;
247  uint32_t delay_to_next_dc;
248  } ports[EC_MAX_PORTS];
249  uint8_t fmmu_bit;
250  uint8_t dc_supported;
251  ec_slave_dc_range_t dc_range;
252  uint8_t has_dc_system_time;
253  uint32_t transmission_delay;
254  uint8_t al_state;
255  uint8_t error_flag;
256  uint8_t sync_count;
257  uint16_t sdo_count;
258  uint32_t sii_nwords;
259  char group[EC_IOCTL_STRING_SIZE];
260  char image[EC_IOCTL_STRING_SIZE];
261  char order[EC_IOCTL_STRING_SIZE];
262  char name[EC_IOCTL_STRING_SIZE];
263 } ec_ioctl_slave_t;
264 
265 /****************************************************************************/
266 
267 typedef struct {
268  // inputs
269  uint16_t slave_position;
270  uint32_t sync_index;
271 
272  // outputs
273  uint16_t physical_start_address;
274  uint16_t default_size;
275  uint8_t control_register;
276  uint8_t enable;
277  uint8_t pdo_count;
278 } ec_ioctl_slave_sync_t;
279 
280 /****************************************************************************/
281 
282 typedef struct {
283  // inputs
284  uint16_t slave_position;
285  uint32_t sync_index;
286  uint32_t pdo_pos;
287 
288  // outputs
289  uint16_t index;
290  uint8_t entry_count;
291  int8_t name[EC_IOCTL_STRING_SIZE];
292 } ec_ioctl_slave_sync_pdo_t;
293 
294 /****************************************************************************/
295 
296 typedef struct {
297  // inputs
298  uint16_t slave_position;
299  uint32_t sync_index;
300  uint32_t pdo_pos;
301  uint32_t entry_pos;
302 
303  // outputs
304  uint16_t index;
305  uint8_t subindex;
306  uint8_t bit_length;
307  int8_t name[EC_IOCTL_STRING_SIZE];
308 } ec_ioctl_slave_sync_pdo_entry_t;
309 
310 /****************************************************************************/
311 
312 typedef struct {
313  // inputs
314  uint32_t index;
315 
316  // outputs
317  uint32_t data_size;
318  uint32_t logical_base_address;
319  uint16_t working_counter[EC_MAX_NUM_DEVICES];
320  uint16_t expected_working_counter;
321  uint32_t fmmu_count;
322 } ec_ioctl_domain_t;
323 
324 /****************************************************************************/
325 
326 typedef struct {
327  // inputs
328  uint32_t domain_index;
329  uint32_t fmmu_index;
330 
331  // outputs
332  uint16_t slave_config_alias;
333  uint16_t slave_config_position;
334  uint8_t sync_index;
335  ec_direction_t dir;
336  uint32_t logical_address;
337  uint32_t data_size;
338 } ec_ioctl_domain_fmmu_t;
339 
340 /****************************************************************************/
341 
342 typedef struct {
343  // inputs
344  uint32_t domain_index;
345  uint32_t data_size;
346  uint8_t *target;
347 } ec_ioctl_domain_data_t;
348 
349 /****************************************************************************/
350 
351 typedef struct {
352  // inputs
353  uint16_t slave_position;
354  uint8_t al_state;
355 } ec_ioctl_slave_state_t;
356 
357 /****************************************************************************/
358 
359 typedef struct {
360  // inputs
361  uint16_t slave_position;
362  uint16_t sdo_position;
363 
364  // outputs
365  uint16_t sdo_index;
366  uint8_t max_subindex;
367  int8_t name[EC_IOCTL_STRING_SIZE];
368 } ec_ioctl_slave_sdo_t;
369 
370 /****************************************************************************/
371 
372 typedef struct {
373  // inputs
374  uint16_t slave_position;
375  int sdo_spec; // positive: index, negative: list position
376  uint8_t sdo_entry_subindex;
377 
378  // outputs
379  uint16_t data_type;
380  uint16_t bit_length;
381  uint8_t read_access[EC_SDO_ENTRY_ACCESS_COUNT];
382  uint8_t write_access[EC_SDO_ENTRY_ACCESS_COUNT];
383  int8_t description[EC_IOCTL_STRING_SIZE];
384 } ec_ioctl_slave_sdo_entry_t;
385 
386 /****************************************************************************/
387 
388 typedef struct {
389  // inputs
390  uint16_t slave_position;
391  uint16_t sdo_index;
392  uint8_t sdo_entry_subindex;
393  size_t target_size;
394  uint8_t *target;
395 
396  // outputs
397  size_t data_size;
398  uint32_t abort_code;
399 } ec_ioctl_slave_sdo_upload_t;
400 
401 /****************************************************************************/
402 
403 typedef struct {
404  // inputs
405  uint16_t slave_position;
406  uint16_t sdo_index;
407  uint8_t sdo_entry_subindex;
408  uint8_t complete_access;
409  size_t data_size;
410  uint8_t *data;
411 
412  // outputs
413  uint32_t abort_code;
414 } ec_ioctl_slave_sdo_download_t;
415 
416 /****************************************************************************/
417 
418 typedef struct {
419  // inputs
420  uint16_t slave_position;
421  uint16_t offset;
422  uint32_t nwords;
423  uint16_t *words;
424 } ec_ioctl_slave_sii_t;
425 
426 /****************************************************************************/
427 
428 typedef struct {
429  // inputs
430  uint16_t slave_position;
431  uint8_t emergency;
432  uint16_t address;
433  size_t size;
434  uint8_t *data;
435 } ec_ioctl_slave_reg_t;
436 
437 /****************************************************************************/
438 
439 typedef struct {
440  // inputs
441  uint16_t slave_position;
442  uint16_t offset;
443  size_t buffer_size;
444  uint8_t *buffer;
445 
446  // outputs
447  size_t data_size;
448  uint32_t result;
449  uint32_t error_code;
450  char file_name[32];
451 } ec_ioctl_slave_foe_t;
452 
453 /****************************************************************************/
454 
455 typedef struct {
456  // inputs
457  uint16_t slave_position;
458  uint8_t drive_no;
459  uint16_t idn;
460  size_t mem_size;
461  uint8_t *data;
462 
463  // outputs
464  size_t data_size;
465  uint16_t error_code;
466 } ec_ioctl_slave_soe_read_t;
467 
468 /****************************************************************************/
469 
470 typedef struct {
471  // inputs
472  uint16_t slave_position;
473  uint8_t drive_no;
474  uint16_t idn;
475  size_t data_size;
476  uint8_t *data;
477 
478  // outputs
479  uint16_t error_code;
480 } ec_ioctl_slave_soe_write_t;
481 
482 /****************************************************************************/
483 
484 typedef struct {
485  // inputs
486  uint32_t config_index;
487 
488  // outputs
489  uint16_t alias;
490  uint16_t position;
491  uint32_t vendor_id;
492  uint32_t product_code;
493  struct {
494  ec_direction_t dir;
495  ec_watchdog_mode_t watchdog_mode;
496  uint32_t pdo_count;
497  uint8_t config_this;
498  } syncs[EC_MAX_SYNC_MANAGERS];
499  uint16_t watchdog_divider;
500  uint16_t watchdog_intervals;
501  uint32_t sdo_count;
502  uint32_t idn_count;
503  uint32_t flag_count;
504  int32_t slave_position;
505  uint16_t dc_assign_activate;
507 } ec_ioctl_config_t;
508 
509 /****************************************************************************/
510 
511 typedef struct {
512  // inputs
513  uint32_t config_index;
514  uint8_t sync_index;
515  uint16_t pdo_pos;
516 
517  // outputs
518  uint16_t index;
519  uint8_t entry_count;
520  int8_t name[EC_IOCTL_STRING_SIZE];
521 } ec_ioctl_config_pdo_t;
522 
523 /****************************************************************************/
524 
525 typedef struct {
526  // inputs
527  uint32_t config_index;
528  uint8_t sync_index;
529  uint16_t pdo_pos;
530  uint8_t entry_pos;
531 
532  // outputs
533  uint16_t index;
534  uint8_t subindex;
535  uint8_t bit_length;
536  int8_t name[EC_IOCTL_STRING_SIZE];
537 } ec_ioctl_config_pdo_entry_t;
538 
539 /****************************************************************************/
540 
544 #define EC_MAX_SDO_DATA_SIZE 1024
545 
546 typedef struct {
547  // inputs
548  uint32_t config_index;
549  uint32_t sdo_pos;
550 
551  // outputs
552  uint16_t index;
553  uint8_t subindex;
554  size_t size;
555  uint8_t data[EC_MAX_SDO_DATA_SIZE];
556  uint8_t complete_access;
557 } ec_ioctl_config_sdo_t;
558 
559 /****************************************************************************/
560 
564 #define EC_MAX_IDN_DATA_SIZE 1024
565 
566 typedef struct {
567  // inputs
568  uint32_t config_index;
569  uint32_t idn_pos;
570 
571  // outputs
572  uint8_t drive_no;
573  uint16_t idn;
574  ec_al_state_t state;
575  size_t size;
576  uint8_t data[EC_MAX_IDN_DATA_SIZE];
577 } ec_ioctl_config_idn_t;
578 
579 /****************************************************************************/
580 
583 #define EC_MAX_FLAG_KEY_SIZE 128
584 
585 typedef struct {
586  // inputs
587  uint32_t config_index;
588  uint32_t flag_pos;
589 
590  // outputs
591  char key[EC_MAX_FLAG_KEY_SIZE];
592  int32_t value;
593 } ec_ioctl_config_flag_t;
594 
595 /****************************************************************************/
596 
597 #ifdef EC_EOE
598 
599 typedef struct {
600  // input
601  uint16_t eoe_index;
602 
603  // outputs
604  char name[EC_DATAGRAM_NAME_SIZE];
605  uint16_t slave_position;
606  uint8_t open;
607  uint32_t rx_bytes;
608  uint32_t rx_rate;
609  uint32_t tx_bytes;
610  uint32_t tx_rate;
611  uint32_t tx_queued_frames;
612  uint32_t tx_queue_size;
613 } ec_ioctl_eoe_handler_t;
614 
615 #endif
616 
617 /****************************************************************************/
618 
619 #define EC_ETH_ALEN 6
620 #ifdef ETH_ALEN
621 #if ETH_ALEN != EC_ETH_ALEN
622 #error Ethernet address length mismatch
623 #endif
624 #endif
625 
626 typedef struct {
627  // input
628  uint16_t slave_position;
629  uint16_t config_index; // alternatively
630 
631  uint8_t mac_address_included;
632  uint8_t ip_address_included;
633  uint8_t subnet_mask_included;
634  uint8_t gateway_included;
635  uint8_t dns_included;
636  uint8_t name_included;
637 
638  unsigned char mac_address[EC_ETH_ALEN];
639  struct in_addr ip_address;
640  struct in_addr subnet_mask;
641  struct in_addr gateway;
642  struct in_addr dns;
643  char name[EC_MAX_HOSTNAME_SIZE];
644 
645  // output
646  uint16_t result;
647 } ec_ioctl_eoe_ip_t;
648 
649 /*****************************************************************************/
650 
651 typedef struct {
652  // outputs
653  void *process_data;
654  size_t process_data_size;
655 } ec_ioctl_master_activate_t;
656 
657 /****************************************************************************/
658 
659 typedef struct {
660  // inputs
661  uint32_t config_index;
662  uint16_t pdo_index;
663  uint16_t entry_index;
664  uint8_t entry_subindex;
665  uint8_t entry_bit_length;
666 } ec_ioctl_add_pdo_entry_t;
667 
668 /****************************************************************************/
669 
670 typedef struct {
671  // inputs
672  uint32_t config_index;
673  uint16_t entry_index;
674  uint8_t entry_subindex;
675  uint32_t domain_index;
676 
677  // outputs
678  unsigned int bit_position;
679 } ec_ioctl_reg_pdo_entry_t;
680 
681 /****************************************************************************/
682 
683 typedef struct {
684  // inputs
685  uint32_t config_index;
686  uint32_t sync_index;
687  uint32_t pdo_pos;
688  uint32_t entry_pos;
689  uint32_t domain_index;
690 
691  // outputs
692  unsigned int bit_position;
693 } ec_ioctl_reg_pdo_pos_t;
694 
695 /****************************************************************************/
696 
697 typedef struct {
698  // inputs
699  uint32_t config_index;
700  uint16_t index;
701  uint8_t subindex;
702  const uint8_t *data;
703  size_t size;
704  uint8_t complete_access;
705 } ec_ioctl_sc_sdo_t;
706 
707 /****************************************************************************/
708 
709 typedef struct {
710  // inputs
711  uint32_t config_index;
712  size_t size;
713  uint8_t *target;
714 
715  // outputs
716  int32_t overruns;
717 } ec_ioctl_sc_emerg_t;
718 
719 /****************************************************************************/
720 
721 typedef struct {
722  // inputs
723  uint32_t config_index;
724 
725  // outputs
727 } ec_ioctl_sc_state_t;
728 
729 /****************************************************************************/
730 
731 typedef struct {
732  // inputs
733  uint32_t config_index;
734  uint8_t drive_no;
735  uint16_t idn;
736  ec_al_state_t al_state;
737  const uint8_t *data;
738  size_t size;
739 } ec_ioctl_sc_idn_t;
740 
741 /****************************************************************************/
742 
743 typedef struct {
744  // inputs
745  uint32_t config_index;
746  size_t key_size;
747  char *key;
748  int32_t value;
749 } ec_ioctl_sc_flag_t;
750 
751 /****************************************************************************/
752 
753 typedef struct {
754  // inputs
755  uint32_t config_index;
756  ec_al_state_t from_state;
757  ec_al_state_t to_state;
758  uint32_t timeout_ms;
759 } ec_ioctl_sc_state_timeout_t;
760 
761 /****************************************************************************/
762 
763 typedef struct {
764  // inputs
765  uint32_t domain_index;
766 
767  // outputs
768  ec_domain_state_t *state;
769 } ec_ioctl_domain_state_t;
770 
771 /****************************************************************************/
772 
773 typedef struct {
774  // inputs
775  uint32_t config_index;
776 
777  // inputs/outputs
778  uint32_t request_index;
779  uint16_t sdo_index;
780  uint8_t sdo_subindex;
781  size_t size;
782  uint8_t *data;
783  uint32_t timeout;
784  ec_request_state_t state;
785 } ec_ioctl_sdo_request_t;
786 
787 /****************************************************************************/
788 
789 typedef struct {
790  // inputs
791  uint32_t config_index;
792 
793  // inputs/outputs
794  uint32_t request_index;
795  uint8_t drive_no;
796  uint16_t idn;
797  size_t size;
798  uint8_t *data;
799  uint32_t timeout;
800  ec_request_state_t state;
801 } ec_ioctl_soe_request_t;
802 
803 /****************************************************************************/
804 
805 typedef struct {
806  // inputs
807  uint32_t config_index;
808  size_t mem_size;
809 
810  // inputs/outputs
811  uint32_t request_index;
812  uint8_t *data;
813  ec_request_state_t state;
814  uint8_t new_data;
815  uint16_t address;
816  size_t transfer_size;
817 } ec_ioctl_reg_request_t;
818 
819 /****************************************************************************/
820 
821 typedef struct {
822  // inputs
823  uint32_t config_index;
824 
825  // inputs/outputs
826  uint32_t voe_index;
827  uint32_t *vendor_id;
828  uint16_t *vendor_type;
829  size_t size;
830  uint8_t *data;
831  ec_request_state_t state;
832 } ec_ioctl_voe_t;
833 
834 /****************************************************************************/
835 
836 typedef struct {
837  // inputs
838  uint32_t dev_idx;
839 
840  // outputs
841  ec_master_link_state_t *state;
842 } ec_ioctl_link_state_t;
843 
844 /****************************************************************************/
845 
846 #ifdef __KERNEL__
847 
850 typedef struct {
851  unsigned int writable;
852  unsigned int requested;
853  uint8_t *process_data;
854  size_t process_data_size;
855 } ec_ioctl_context_t;
856 
857 long ec_ioctl(ec_master_t *, ec_ioctl_context_t *, unsigned int,
858  void __user *);
859 
860 #ifdef EC_RTDM
861 
862 long ec_ioctl_rtdm_rt(ec_master_t *, ec_ioctl_context_t *, unsigned int,
863  void __user *);
864 long ec_ioctl_rtdm_nrt(ec_master_t *, ec_ioctl_context_t *, unsigned int,
865  void __user *);
866 
867 #ifndef EC_RTDM_XENOMAI_V3
868 int ec_rtdm_mmap(ec_ioctl_context_t *, void **);
869 #endif
870 
871 #endif
872 
873 #endif
874 
875 /****************************************************************************/
876 
879 #endif
Slave information interface general flags.
Definition: globals.h:165
#define EC_DATAGRAM_NAME_SIZE
Size of the datagram description string.
Definition: globals.h:104
ec_watchdog_mode_t
Watchdog mode for sync manager configuration.
Definition: ecrt.h:517
ec_slave_port_desc_t
EtherCAT slave port descriptor.
Definition: ecrt.h:426
ec_al_state_t
Application-layer state.
Definition: ecrt.h:615
#define EC_RATE_COUNT
Number of statistic rate intervals to maintain.
Definition: globals.h:60
#define EC_MAX_HOSTNAME_SIZE
Maximum hostname size.
Definition: globals.h:110
Global definitions and macros.
Slave configuration state.
Definition: ecrt.h:376
Slave information interface CANopen over EtherCAT details flags.
Definition: globals.h:154
Domain state.
Definition: ecrt.h:494
static unsigned int master_count
Number of masters.
Definition: module.c:52
ec_direction_t
Direction type for PDO assignment functions.
Definition: ecrt.h:504
long ec_ioctl(ec_master_t *master, ec_ioctl_context_t *ctx, unsigned int cmd, void *arg)
Called when an ioctl() command is issued.
Definition: ioctl.c:4970
ec_slave_dc_range_t
EtherCAT slave distributed clocks range.
Definition: globals.h:172
int ec_rtdm_mmap(ec_ioctl_context_t *ioctl_ctx, void **user_address)
Memory-map process data to user space.
Definition: rtdm.c:238
#define EC_MAX_PORTS
Maximum number of slave ports.
Definition: ecrt.h:276
EtherCAT slave sync signal configuration.
Definition: globals.h:180
ec_request_state_t
Request state.
Definition: ecrt.h:604
EtherCAT master.
Definition: master.h:187
#define EC_MAX_SYNC_MANAGERS
Maximum number of sync managers per slave.
Definition: ecrt.h:267
#define EC_SYNC_SIGNAL_COUNT
Number of DC sync signals.
Definition: globals.h:98
Number of states.
Definition: globals.h:193