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