IgH EtherCAT Master  1.5.3
ioctl.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Copyright (C) 2006-2021 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 33
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 #define EC_IOCTL_CONFIG EC_IOWR(0x18, ec_ioctl_config_t)
78 #define EC_IOCTL_CONFIG_PDO EC_IOWR(0x19, ec_ioctl_config_pdo_t)
79 #define EC_IOCTL_CONFIG_PDO_ENTRY EC_IOWR(0x1a, ec_ioctl_config_pdo_entry_t)
80 #define EC_IOCTL_CONFIG_SDO EC_IOWR(0x1b, ec_ioctl_config_sdo_t)
81 #define EC_IOCTL_CONFIG_IDN EC_IOWR(0x1c, ec_ioctl_config_idn_t)
82 #define EC_IOCTL_CONFIG_FLAG EC_IOWR(0x1d, ec_ioctl_config_flag_t)
83 #ifdef EC_EOE
84 #define EC_IOCTL_EOE_HANDLER EC_IOWR(0x1e, ec_ioctl_eoe_handler_t)
85 #endif
86 
87 // Application interface
88 #define EC_IOCTL_REQUEST EC_IO(0x1f)
89 #define EC_IOCTL_CREATE_DOMAIN EC_IO(0x20)
90 #define EC_IOCTL_CREATE_SLAVE_CONFIG EC_IOWR(0x21, ec_ioctl_config_t)
91 #define EC_IOCTL_SELECT_REF_CLOCK EC_IOW(0x22, uint32_t)
92 #define EC_IOCTL_ACTIVATE EC_IOR(0x23, ec_ioctl_master_activate_t)
93 #define EC_IOCTL_DEACTIVATE EC_IO(0x24)
94 #define EC_IOCTL_SEND EC_IO(0x25)
95 #define EC_IOCTL_RECEIVE EC_IO(0x26)
96 #define EC_IOCTL_MASTER_STATE EC_IOR(0x27, ec_master_state_t)
97 #define EC_IOCTL_MASTER_LINK_STATE EC_IOWR(0x28, ec_ioctl_link_state_t)
98 #define EC_IOCTL_APP_TIME EC_IOW(0x29, uint64_t)
99 #define EC_IOCTL_SYNC_REF EC_IO(0x2a)
100 #define EC_IOCTL_SYNC_REF_TO EC_IOW(0x2b, uint64_t)
101 #define EC_IOCTL_SYNC_SLAVES EC_IO(0x2c)
102 #define EC_IOCTL_REF_CLOCK_TIME EC_IOR(0x2d, uint32_t)
103 #define EC_IOCTL_SYNC_MON_QUEUE EC_IO(0x2e)
104 #define EC_IOCTL_SYNC_MON_PROCESS EC_IOR(0x2f, uint32_t)
105 #define EC_IOCTL_RESET EC_IO(0x30)
106 #define EC_IOCTL_SC_SYNC EC_IOW(0x31, ec_ioctl_config_t)
107 #define EC_IOCTL_SC_WATCHDOG EC_IOW(0x32, ec_ioctl_config_t)
108 #define EC_IOCTL_SC_ADD_PDO EC_IOW(0x33, ec_ioctl_config_pdo_t)
109 #define EC_IOCTL_SC_CLEAR_PDOS EC_IOW(0x34, ec_ioctl_config_pdo_t)
110 #define EC_IOCTL_SC_ADD_ENTRY EC_IOW(0x35, ec_ioctl_add_pdo_entry_t)
111 #define EC_IOCTL_SC_CLEAR_ENTRIES EC_IOW(0x36, ec_ioctl_config_pdo_t)
112 #define EC_IOCTL_SC_REG_PDO_ENTRY EC_IOWR(0x37, ec_ioctl_reg_pdo_entry_t)
113 #define EC_IOCTL_SC_REG_PDO_POS EC_IOWR(0x38, ec_ioctl_reg_pdo_pos_t)
114 #define EC_IOCTL_SC_DC EC_IOW(0x39, ec_ioctl_config_t)
115 #define EC_IOCTL_SC_SDO EC_IOW(0x3a, ec_ioctl_sc_sdo_t)
116 #define EC_IOCTL_SC_EMERG_SIZE EC_IOW(0x3b, ec_ioctl_sc_emerg_t)
117 #define EC_IOCTL_SC_EMERG_POP EC_IOWR(0x3c, ec_ioctl_sc_emerg_t)
118 #define EC_IOCTL_SC_EMERG_CLEAR EC_IOW(0x3d, ec_ioctl_sc_emerg_t)
119 #define EC_IOCTL_SC_EMERG_OVERRUNS EC_IOWR(0x3e, ec_ioctl_sc_emerg_t)
120 #define EC_IOCTL_SC_SDO_REQUEST EC_IOWR(0x3f, ec_ioctl_sdo_request_t)
121 #define EC_IOCTL_SC_SOE_REQUEST EC_IOWR(0x40, ec_ioctl_soe_request_t)
122 #define EC_IOCTL_SC_REG_REQUEST EC_IOWR(0x41, ec_ioctl_reg_request_t)
123 #define EC_IOCTL_SC_VOE EC_IOWR(0x42, ec_ioctl_voe_t)
124 #define EC_IOCTL_SC_STATE EC_IOWR(0x43, ec_ioctl_sc_state_t)
125 #define EC_IOCTL_SC_IDN EC_IOW(0x44, ec_ioctl_sc_idn_t)
126 #define EC_IOCTL_SC_FLAG EC_IOW(0x45, ec_ioctl_sc_flag_t)
127 #define EC_IOCTL_DOMAIN_SIZE EC_IO(0x46)
128 #define EC_IOCTL_DOMAIN_OFFSET EC_IO(0x47)
129 #define EC_IOCTL_DOMAIN_PROCESS EC_IO(0x48)
130 #define EC_IOCTL_DOMAIN_QUEUE EC_IO(0x49)
131 #define EC_IOCTL_DOMAIN_STATE EC_IOWR(0x4a, ec_ioctl_domain_state_t)
132 #define EC_IOCTL_SDO_REQUEST_INDEX EC_IOWR(0x4b, ec_ioctl_sdo_request_t)
133 #define EC_IOCTL_SDO_REQUEST_TIMEOUT EC_IOWR(0x4c, ec_ioctl_sdo_request_t)
134 #define EC_IOCTL_SDO_REQUEST_STATE EC_IOWR(0x4d, ec_ioctl_sdo_request_t)
135 #define EC_IOCTL_SDO_REQUEST_READ EC_IOWR(0x4e, ec_ioctl_sdo_request_t)
136 #define EC_IOCTL_SDO_REQUEST_WRITE EC_IOWR(0x4f, ec_ioctl_sdo_request_t)
137 #define EC_IOCTL_SDO_REQUEST_DATA EC_IOWR(0x50, ec_ioctl_sdo_request_t)
138 #define EC_IOCTL_SOE_REQUEST_IDN EC_IOWR(0x51, ec_ioctl_soe_request_t)
139 #define EC_IOCTL_SOE_REQUEST_TIMEOUT EC_IOWR(0x52, ec_ioctl_soe_request_t)
140 #define EC_IOCTL_SOE_REQUEST_STATE EC_IOWR(0x53, ec_ioctl_soe_request_t)
141 #define EC_IOCTL_SOE_REQUEST_READ EC_IOWR(0x54, ec_ioctl_soe_request_t)
142 #define EC_IOCTL_SOE_REQUEST_WRITE EC_IOWR(0x55, ec_ioctl_soe_request_t)
143 #define EC_IOCTL_SOE_REQUEST_DATA EC_IOWR(0x56, ec_ioctl_soe_request_t)
144 #define EC_IOCTL_REG_REQUEST_DATA EC_IOWR(0x57, ec_ioctl_reg_request_t)
145 #define EC_IOCTL_REG_REQUEST_STATE EC_IOWR(0x58, ec_ioctl_reg_request_t)
146 #define EC_IOCTL_REG_REQUEST_WRITE EC_IOWR(0x59, ec_ioctl_reg_request_t)
147 #define EC_IOCTL_REG_REQUEST_READ EC_IOWR(0x5a, ec_ioctl_reg_request_t)
148 #define EC_IOCTL_VOE_SEND_HEADER EC_IOW(0x5b, ec_ioctl_voe_t)
149 #define EC_IOCTL_VOE_REC_HEADER EC_IOWR(0x5c, ec_ioctl_voe_t)
150 #define EC_IOCTL_VOE_READ EC_IOW(0x5d, ec_ioctl_voe_t)
151 #define EC_IOCTL_VOE_READ_NOSYNC EC_IOW(0x5e, ec_ioctl_voe_t)
152 #define EC_IOCTL_VOE_WRITE EC_IOWR(0x5f, ec_ioctl_voe_t)
153 #define EC_IOCTL_VOE_EXEC EC_IOWR(0x60, ec_ioctl_voe_t)
154 #define EC_IOCTL_VOE_DATA EC_IOWR(0x61, ec_ioctl_voe_t)
155 #define EC_IOCTL_SET_SEND_INTERVAL EC_IOW(0x62, size_t)
156 
157 /*****************************************************************************/
158 
159 #define EC_IOCTL_STRING_SIZE 64
160 
161 /*****************************************************************************/
162 
163 typedef struct {
164  uint32_t ioctl_version_magic;
165  uint32_t master_count;
166 } ec_ioctl_module_t;
167 
168 /*****************************************************************************/
169 
170 typedef struct {
171  uint32_t slave_count;
172  uint32_t config_count;
173  uint32_t domain_count;
174  uint32_t eoe_handler_count;
175  uint8_t phase;
176  uint8_t active;
177  uint8_t scan_busy;
178  struct ec_ioctl_device {
179  uint8_t address[6];
180  uint8_t attached;
181  uint8_t link_state;
182  uint64_t tx_count;
183  uint64_t rx_count;
184  uint64_t tx_bytes;
185  uint64_t rx_bytes;
186  uint64_t tx_errors;
187  int32_t tx_frame_rates[EC_RATE_COUNT];
188  int32_t rx_frame_rates[EC_RATE_COUNT];
189  int32_t tx_byte_rates[EC_RATE_COUNT];
190  int32_t rx_byte_rates[EC_RATE_COUNT];
191  } devices[EC_MAX_NUM_DEVICES];
192  uint32_t num_devices;
193  uint64_t tx_count;
194  uint64_t rx_count;
195  uint64_t tx_bytes;
196  uint64_t rx_bytes;
197  int32_t tx_frame_rates[EC_RATE_COUNT];
198  int32_t rx_frame_rates[EC_RATE_COUNT];
199  int32_t tx_byte_rates[EC_RATE_COUNT];
200  int32_t rx_byte_rates[EC_RATE_COUNT];
201  int32_t loss_rates[EC_RATE_COUNT];
202  uint64_t app_time;
203  uint64_t dc_ref_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  uint32_t flag_count;
495  int32_t slave_position;
496  uint16_t dc_assign_activate;
498 } ec_ioctl_config_t;
499 
500 /*****************************************************************************/
501 
502 typedef struct {
503  // inputs
504  uint32_t config_index;
505  uint8_t sync_index;
506  uint16_t pdo_pos;
507 
508  // outputs
509  uint16_t index;
510  uint8_t entry_count;
511  int8_t name[EC_IOCTL_STRING_SIZE];
512 } ec_ioctl_config_pdo_t;
513 
514 /*****************************************************************************/
515 
516 typedef struct {
517  // inputs
518  uint32_t config_index;
519  uint8_t sync_index;
520  uint16_t pdo_pos;
521  uint8_t entry_pos;
522 
523  // outputs
524  uint16_t index;
525  uint8_t subindex;
526  uint8_t bit_length;
527  int8_t name[EC_IOCTL_STRING_SIZE];
528 } ec_ioctl_config_pdo_entry_t;
529 
530 /*****************************************************************************/
531 
535 #define EC_MAX_SDO_DATA_SIZE 1024
536 
537 typedef struct {
538  // inputs
539  uint32_t config_index;
540  uint32_t sdo_pos;
541 
542  // outputs
543  uint16_t index;
544  uint8_t subindex;
545  size_t size;
546  uint8_t data[EC_MAX_SDO_DATA_SIZE];
547  uint8_t complete_access;
548 } ec_ioctl_config_sdo_t;
549 
550 /*****************************************************************************/
551 
555 #define EC_MAX_IDN_DATA_SIZE 1024
556 
557 typedef struct {
558  // inputs
559  uint32_t config_index;
560  uint32_t idn_pos;
561 
562  // outputs
563  uint8_t drive_no;
564  uint16_t idn;
565  ec_al_state_t state;
566  size_t size;
567  uint8_t data[EC_MAX_IDN_DATA_SIZE];
568 } ec_ioctl_config_idn_t;
569 
570 /*****************************************************************************/
571 
574 #define EC_MAX_FLAG_KEY_SIZE 128
575 
576 typedef struct {
577  // inputs
578  uint32_t config_index;
579  uint32_t flag_pos;
580 
581  // outputs
582  char key[EC_MAX_FLAG_KEY_SIZE];
583  int32_t value;
584 } ec_ioctl_config_flag_t;
585 
586 /*****************************************************************************/
587 
588 #ifdef EC_EOE
589 
590 typedef struct {
591  // input
592  uint16_t eoe_index;
593 
594  // outputs
595  char name[EC_DATAGRAM_NAME_SIZE];
596  uint16_t slave_position;
597  uint8_t open;
598  uint32_t rx_bytes;
599  uint32_t rx_rate;
600  uint32_t tx_bytes;
601  uint32_t tx_rate;
602  uint32_t tx_queued_frames;
603  uint32_t tx_queue_size;
604 } ec_ioctl_eoe_handler_t;
605 
606 #endif
607 
608 /*****************************************************************************/
609 
610 typedef struct {
611  // outputs
612  void *process_data;
613  size_t process_data_size;
614 } ec_ioctl_master_activate_t;
615 
616 /*****************************************************************************/
617 
618 typedef struct {
619  // inputs
620  uint32_t config_index;
621  uint16_t pdo_index;
622  uint16_t entry_index;
623  uint8_t entry_subindex;
624  uint8_t entry_bit_length;
625 } ec_ioctl_add_pdo_entry_t;
626 
627 /*****************************************************************************/
628 
629 typedef struct {
630  // inputs
631  uint32_t config_index;
632  uint16_t entry_index;
633  uint8_t entry_subindex;
634  uint32_t domain_index;
635 
636  // outputs
637  unsigned int bit_position;
638 } ec_ioctl_reg_pdo_entry_t;
639 
640 /*****************************************************************************/
641 
642 typedef struct {
643  // inputs
644  uint32_t config_index;
645  uint32_t sync_index;
646  uint32_t pdo_pos;
647  uint32_t entry_pos;
648  uint32_t domain_index;
649 
650  // outputs
651  unsigned int bit_position;
652 } ec_ioctl_reg_pdo_pos_t;
653 
654 /*****************************************************************************/
655 
656 typedef struct {
657  // inputs
658  uint32_t config_index;
659  uint16_t index;
660  uint8_t subindex;
661  const uint8_t *data;
662  size_t size;
663  uint8_t complete_access;
664 } ec_ioctl_sc_sdo_t;
665 
666 /*****************************************************************************/
667 
668 typedef struct {
669  // inputs
670  uint32_t config_index;
671  size_t size;
672  uint8_t *target;
673 
674  // outputs
675  int32_t overruns;
676 } ec_ioctl_sc_emerg_t;
677 
678 /*****************************************************************************/
679 
680 typedef struct {
681  // inputs
682  uint32_t config_index;
683 
684  // outputs
686 } ec_ioctl_sc_state_t;
687 
688 /*****************************************************************************/
689 
690 typedef struct {
691  // inputs
692  uint32_t config_index;
693  uint8_t drive_no;
694  uint16_t idn;
695  ec_al_state_t al_state;
696  const uint8_t *data;
697  size_t size;
698 } ec_ioctl_sc_idn_t;
699 
700 /*****************************************************************************/
701 
702 typedef struct {
703  // inputs
704  uint32_t config_index;
705  size_t key_size;
706  char *key;
707  int32_t value;
708 } ec_ioctl_sc_flag_t;
709 
710 /*****************************************************************************/
711 
712 typedef struct {
713  // inputs
714  uint32_t domain_index;
715 
716  // outputs
717  ec_domain_state_t *state;
718 } ec_ioctl_domain_state_t;
719 
720 /*****************************************************************************/
721 
722 typedef struct {
723  // inputs
724  uint32_t config_index;
725 
726  // inputs/outputs
727  uint32_t request_index;
728  uint16_t sdo_index;
729  uint8_t sdo_subindex;
730  size_t size;
731  uint8_t *data;
732  uint32_t timeout;
733  ec_request_state_t state;
734 } ec_ioctl_sdo_request_t;
735 
736 /*****************************************************************************/
737 
738 typedef struct {
739  // inputs
740  uint32_t config_index;
741 
742  // inputs/outputs
743  uint32_t request_index;
744  uint8_t drive_no;
745  uint16_t idn;
746  size_t size;
747  uint8_t *data;
748  uint32_t timeout;
749  ec_request_state_t state;
750 } ec_ioctl_soe_request_t;
751 
752 /*****************************************************************************/
753 
754 typedef struct {
755  // inputs
756  uint32_t config_index;
757  size_t mem_size;
758 
759  // inputs/outputs
760  uint32_t request_index;
761  uint8_t *data;
762  ec_request_state_t state;
763  uint8_t new_data;
764  uint16_t address;
765  size_t transfer_size;
766 } ec_ioctl_reg_request_t;
767 
768 /*****************************************************************************/
769 
770 typedef struct {
771  // inputs
772  uint32_t config_index;
773 
774  // inputs/outputs
775  uint32_t voe_index;
776  uint32_t *vendor_id;
777  uint16_t *vendor_type;
778  size_t size;
779  uint8_t *data;
780  ec_request_state_t state;
781 } ec_ioctl_voe_t;
782 
783 /*****************************************************************************/
784 
785 typedef struct {
786  // inputs
787  uint32_t dev_idx;
788 
789  // outputs
790  ec_master_link_state_t *state;
791 } ec_ioctl_link_state_t;
792 
793 /*****************************************************************************/
794 
795 #ifdef __KERNEL__
796 
799 typedef struct {
800  unsigned int writable;
801  unsigned int requested;
802  uint8_t *process_data;
803  size_t process_data_size;
804 } ec_ioctl_context_t;
805 
806 long ec_ioctl(ec_master_t *, ec_ioctl_context_t *, unsigned int,
807  void __user *);
808 
809 #ifdef EC_RTDM
810 
811 long ec_ioctl_rtdm(ec_master_t *, ec_ioctl_context_t *, unsigned int,
812  void __user *);
813 int ec_rtdm_mmap(ec_ioctl_context_t *, void **);
814 
815 #endif
816 
817 #endif
818 
819 /*****************************************************************************/
820 
823 #endif
Slave information interface general flags.
Definition: globals.h:156
#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:459
ec_slave_port_desc_t
EtherCAT slave port descriptor.
Definition: ecrt.h:368
ec_al_state_t
Application-layer state.
Definition: ecrt.h:557
#define EC_RATE_COUNT
Number of statistic rate intervals to maintain.
Definition: globals.h:60
Global definitions and macros.
Slave configuration state.
Definition: ecrt.h:335
Slave information interface CANopen over EtherCAT details flags.
Definition: globals.h:145
Domain state.
Definition: ecrt.h:436
static unsigned int master_count
Number of masters.
Definition: module.c:58
ec_direction_t
Direction type for PDO assignment functions.
Definition: ecrt.h:446
ec_slave_dc_range_t
EtherCAT slave distributed clocks range.
Definition: globals.h:163
Number of states.
Definition: globals.h:184
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:235
EtherCAT slave sync signal configuration.
Definition: globals.h:171
ec_request_state_t
Request state.
Definition: ecrt.h:546
EtherCAT master.
Definition: master.h:194
#define EC_MAX_SYNC_MANAGERS
Maximum number of sync managers per slave.
Definition: ecrt.h:226
#define EC_SYNC_SIGNAL_COUNT
Number of DC sync signals.
Definition: globals.h:98