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 30
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, uint64_t)
107 #define EC_IOCTL_SYNC_REF EC_IO(0x29)
108 #define EC_IOCTL_SYNC_REF_TO EC_IOW(0x2a, uint64_t)
109 #define EC_IOCTL_SYNC_SLAVES EC_IO(0x2b)
110 #define EC_IOCTL_REF_CLOCK_TIME EC_IOR(0x2c, uint32_t)
111 #define EC_IOCTL_SYNC_MON_QUEUE EC_IO(0x2d)
112 #define EC_IOCTL_SYNC_MON_PROCESS EC_IOR(0x2e, uint32_t)
113 #define EC_IOCTL_RESET EC_IO(0x2f)
114 #define EC_IOCTL_SC_SYNC EC_IOW(0x30, ec_ioctl_config_t)
115 #define EC_IOCTL_SC_WATCHDOG EC_IOW(0x31, ec_ioctl_config_t)
116 #define EC_IOCTL_SC_ADD_PDO EC_IOW(0x32, ec_ioctl_config_pdo_t)
117 #define EC_IOCTL_SC_CLEAR_PDOS EC_IOW(0x33, ec_ioctl_config_pdo_t)
118 #define EC_IOCTL_SC_ADD_ENTRY EC_IOW(0x34, ec_ioctl_add_pdo_entry_t)
119 #define EC_IOCTL_SC_CLEAR_ENTRIES EC_IOW(0x35, ec_ioctl_config_pdo_t)
120 #define EC_IOCTL_SC_REG_PDO_ENTRY EC_IOWR(0x36, ec_ioctl_reg_pdo_entry_t)
121 #define EC_IOCTL_SC_REG_PDO_POS EC_IOWR(0x37, ec_ioctl_reg_pdo_pos_t)
122 #define EC_IOCTL_SC_DC EC_IOW(0x38, ec_ioctl_config_t)
123 #define EC_IOCTL_SC_SDO EC_IOW(0x39, ec_ioctl_sc_sdo_t)
124 #define EC_IOCTL_SC_EMERG_SIZE EC_IOW(0x3a, ec_ioctl_sc_emerg_t)
125 #define EC_IOCTL_SC_EMERG_POP EC_IOWR(0x3b, ec_ioctl_sc_emerg_t)
126 #define EC_IOCTL_SC_EMERG_CLEAR EC_IOW(0x3c, ec_ioctl_sc_emerg_t)
127 #define EC_IOCTL_SC_EMERG_OVERRUNS EC_IOWR(0x3d, ec_ioctl_sc_emerg_t)
128 #define EC_IOCTL_SC_SDO_REQUEST EC_IOWR(0x3e, ec_ioctl_sdo_request_t)
129 #define EC_IOCTL_SC_REG_REQUEST EC_IOWR(0x3f, ec_ioctl_reg_request_t)
130 #define EC_IOCTL_SC_VOE EC_IOWR(0x40, ec_ioctl_voe_t)
131 #define EC_IOCTL_SC_STATE EC_IOWR(0x41, ec_ioctl_sc_state_t)
132 #define EC_IOCTL_SC_IDN EC_IOW(0x42, ec_ioctl_sc_idn_t)
133 #define EC_IOCTL_DOMAIN_SIZE EC_IO(0x43)
134 #define EC_IOCTL_DOMAIN_OFFSET EC_IO(0x44)
135 #define EC_IOCTL_DOMAIN_PROCESS EC_IO(0x45)
136 #define EC_IOCTL_DOMAIN_QUEUE EC_IO(0x46)
137 #define EC_IOCTL_DOMAIN_STATE EC_IOWR(0x47, ec_ioctl_domain_state_t)
138 #define EC_IOCTL_SDO_REQUEST_INDEX EC_IOWR(0x48, ec_ioctl_sdo_request_t)
139 #define EC_IOCTL_SDO_REQUEST_TIMEOUT EC_IOWR(0x49, ec_ioctl_sdo_request_t)
140 #define EC_IOCTL_SDO_REQUEST_STATE EC_IOWR(0x4a, ec_ioctl_sdo_request_t)
141 #define EC_IOCTL_SDO_REQUEST_READ EC_IOWR(0x4b, ec_ioctl_sdo_request_t)
142 #define EC_IOCTL_SDO_REQUEST_WRITE EC_IOWR(0x4c, ec_ioctl_sdo_request_t)
143 #define EC_IOCTL_SDO_REQUEST_DATA EC_IOWR(0x4d, ec_ioctl_sdo_request_t)
144 #define EC_IOCTL_REG_REQUEST_DATA EC_IOWR(0x4e, ec_ioctl_reg_request_t)
145 #define EC_IOCTL_REG_REQUEST_STATE EC_IOWR(0x4f, ec_ioctl_reg_request_t)
146 #define EC_IOCTL_REG_REQUEST_WRITE EC_IOWR(0x50, ec_ioctl_reg_request_t)
147 #define EC_IOCTL_REG_REQUEST_READ EC_IOWR(0x51, ec_ioctl_reg_request_t)
148 #define EC_IOCTL_VOE_SEND_HEADER EC_IOW(0x52, ec_ioctl_voe_t)
149 #define EC_IOCTL_VOE_REC_HEADER EC_IOWR(0x53, ec_ioctl_voe_t)
150 #define EC_IOCTL_VOE_READ EC_IOW(0x54, ec_ioctl_voe_t)
151 #define EC_IOCTL_VOE_READ_NOSYNC EC_IOW(0x55, ec_ioctl_voe_t)
152 #define EC_IOCTL_VOE_WRITE EC_IOWR(0x56, ec_ioctl_voe_t)
153 #define EC_IOCTL_VOE_EXEC EC_IOWR(0x57, ec_ioctl_voe_t)
154 #define EC_IOCTL_VOE_DATA EC_IOWR(0x58, ec_ioctl_voe_t)
155 #define EC_IOCTL_SET_SEND_INTERVAL EC_IOW(0x59, 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 #ifdef EC_EOE
175  uint32_t eoe_handler_count;
176 #endif
177  uint8_t phase;
178  uint8_t active;
179  uint8_t scan_busy;
180  struct ec_ioctl_device {
181  uint8_t address[6];
182  uint8_t attached;
183  uint8_t link_state;
184  uint64_t tx_count;
185  uint64_t rx_count;
186  uint64_t tx_bytes;
187  uint64_t rx_bytes;
188  uint64_t tx_errors;
189  int32_t tx_frame_rates[EC_RATE_COUNT];
190  int32_t rx_frame_rates[EC_RATE_COUNT];
191  int32_t tx_byte_rates[EC_RATE_COUNT];
192  int32_t rx_byte_rates[EC_RATE_COUNT];
193  } devices[EC_MAX_NUM_DEVICES];
194  uint32_t num_devices;
195  uint64_t tx_count;
196  uint64_t rx_count;
197  uint64_t tx_bytes;
198  uint64_t rx_bytes;
199  int32_t tx_frame_rates[EC_RATE_COUNT];
200  int32_t rx_frame_rates[EC_RATE_COUNT];
201  int32_t tx_byte_rates[EC_RATE_COUNT];
202  int32_t rx_byte_rates[EC_RATE_COUNT];
203  int32_t loss_rates[EC_RATE_COUNT];
204  uint64_t app_time;
205  uint64_t dc_ref_time;
206  uint16_t ref_clock;
207 } ec_ioctl_master_t;
208 
209 /*****************************************************************************/
210 
211 typedef struct {
212  // input
213  uint16_t position;
214 
215  // outputs
216  unsigned int device_index;
217  uint32_t vendor_id;
218  uint32_t product_code;
219  uint32_t revision_number;
220  uint32_t serial_number;
221  uint16_t alias;
222  uint16_t boot_rx_mailbox_offset;
223  uint16_t boot_rx_mailbox_size;
224  uint16_t boot_tx_mailbox_offset;
225  uint16_t boot_tx_mailbox_size;
226  uint16_t std_rx_mailbox_offset;
227  uint16_t std_rx_mailbox_size;
228  uint16_t std_tx_mailbox_offset;
229  uint16_t std_tx_mailbox_size;
230  uint16_t mailbox_protocols;
231  uint8_t has_general_category;
232  ec_sii_coe_details_t coe_details;
233  ec_sii_general_flags_t general_flags;
234  int16_t current_on_ebus;
235  struct {
238  uint32_t receive_time;
239  uint16_t next_slave;
240  uint32_t delay_to_next_dc;
241  } ports[EC_MAX_PORTS];
242  uint8_t fmmu_bit;
243  uint8_t dc_supported;
244  ec_slave_dc_range_t dc_range;
245  uint8_t has_dc_system_time;
246  uint32_t transmission_delay;
247  uint8_t al_state;
248  uint8_t error_flag;
249  uint8_t sync_count;
250  uint16_t sdo_count;
251  uint32_t sii_nwords;
252  char group[EC_IOCTL_STRING_SIZE];
253  char image[EC_IOCTL_STRING_SIZE];
254  char order[EC_IOCTL_STRING_SIZE];
255  char name[EC_IOCTL_STRING_SIZE];
256 } ec_ioctl_slave_t;
257 
258 /*****************************************************************************/
259 
260 typedef struct {
261  // inputs
262  uint16_t slave_position;
263  uint32_t sync_index;
264 
265  // outputs
266  uint16_t physical_start_address;
267  uint16_t default_size;
268  uint8_t control_register;
269  uint8_t enable;
270  uint8_t pdo_count;
271 } ec_ioctl_slave_sync_t;
272 
273 /*****************************************************************************/
274 
275 typedef struct {
276  // inputs
277  uint16_t slave_position;
278  uint32_t sync_index;
279  uint32_t pdo_pos;
280 
281  // outputs
282  uint16_t index;
283  uint8_t entry_count;
284  int8_t name[EC_IOCTL_STRING_SIZE];
285 } ec_ioctl_slave_sync_pdo_t;
286 
287 /*****************************************************************************/
288 
289 typedef struct {
290  // inputs
291  uint16_t slave_position;
292  uint32_t sync_index;
293  uint32_t pdo_pos;
294  uint32_t entry_pos;
295 
296  // outputs
297  uint16_t index;
298  uint8_t subindex;
299  uint8_t bit_length;
300  int8_t name[EC_IOCTL_STRING_SIZE];
301 } ec_ioctl_slave_sync_pdo_entry_t;
302 
303 /*****************************************************************************/
304 
305 typedef struct {
306  // inputs
307  uint32_t index;
308 
309  // outputs
310  uint32_t data_size;
311  uint32_t logical_base_address;
312  uint16_t working_counter[EC_MAX_NUM_DEVICES];
313  uint16_t expected_working_counter;
314  uint32_t fmmu_count;
315 } ec_ioctl_domain_t;
316 
317 /*****************************************************************************/
318 
319 typedef struct {
320  // inputs
321  uint32_t domain_index;
322  uint32_t fmmu_index;
323 
324  // outputs
325  uint16_t slave_config_alias;
326  uint16_t slave_config_position;
327  uint8_t sync_index;
328  ec_direction_t dir;
329  uint32_t logical_address;
330  uint32_t data_size;
331 } ec_ioctl_domain_fmmu_t;
332 
333 /*****************************************************************************/
334 
335 typedef struct {
336  // inputs
337  uint32_t domain_index;
338  uint32_t data_size;
339  uint8_t *target;
340 } ec_ioctl_domain_data_t;
341 
342 /*****************************************************************************/
343 
344 typedef struct {
345  // inputs
346  uint16_t slave_position;
347  uint8_t al_state;
348 } ec_ioctl_slave_state_t;
349 
350 /*****************************************************************************/
351 
352 typedef struct {
353  // inputs
354  uint16_t slave_position;
355  uint16_t sdo_position;
356 
357  // outputs
358  uint16_t sdo_index;
359  uint8_t max_subindex;
360  int8_t name[EC_IOCTL_STRING_SIZE];
361 } ec_ioctl_slave_sdo_t;
362 
363 /*****************************************************************************/
364 
365 typedef struct {
366  // inputs
367  uint16_t slave_position;
368  int sdo_spec; // positive: index, negative: list position
369  uint8_t sdo_entry_subindex;
370 
371  // outputs
372  uint16_t data_type;
373  uint16_t bit_length;
374  uint8_t read_access[EC_SDO_ENTRY_ACCESS_COUNT];
375  uint8_t write_access[EC_SDO_ENTRY_ACCESS_COUNT];
376  int8_t description[EC_IOCTL_STRING_SIZE];
377 } ec_ioctl_slave_sdo_entry_t;
378 
379 /*****************************************************************************/
380 
381 typedef struct {
382  // inputs
383  uint16_t slave_position;
384  uint16_t sdo_index;
385  uint8_t sdo_entry_subindex;
386  size_t target_size;
387  uint8_t *target;
388 
389  // outputs
390  size_t data_size;
391  uint32_t abort_code;
392 } ec_ioctl_slave_sdo_upload_t;
393 
394 /*****************************************************************************/
395 
396 typedef struct {
397  // inputs
398  uint16_t slave_position;
399  uint16_t sdo_index;
400  uint8_t sdo_entry_subindex;
401  uint8_t complete_access;
402  size_t data_size;
403  uint8_t *data;
404 
405  // outputs
406  uint32_t abort_code;
407 } ec_ioctl_slave_sdo_download_t;
408 
409 /*****************************************************************************/
410 
411 typedef struct {
412  // inputs
413  uint16_t slave_position;
414  uint16_t offset;
415  uint32_t nwords;
416  uint16_t *words;
417 } ec_ioctl_slave_sii_t;
418 
419 /*****************************************************************************/
420 
421 typedef struct {
422  // inputs
423  uint16_t slave_position;
424  uint8_t emergency;
425  uint16_t address;
426  size_t size;
427  uint8_t *data;
428 } ec_ioctl_slave_reg_t;
429 
430 /*****************************************************************************/
431 
432 typedef struct {
433  // inputs
434  uint16_t slave_position;
435  uint16_t offset;
436  size_t buffer_size;
437  uint8_t *buffer;
438 
439  // outputs
440  size_t data_size;
441  uint32_t result;
442  uint32_t error_code;
443  char file_name[32];
444 } ec_ioctl_slave_foe_t;
445 
446 /*****************************************************************************/
447 
448 typedef struct {
449  // inputs
450  uint16_t slave_position;
451  uint8_t drive_no;
452  uint16_t idn;
453  size_t mem_size;
454  uint8_t *data;
455 
456  // outputs
457  size_t data_size;
458  uint16_t error_code;
459 } ec_ioctl_slave_soe_read_t;
460 
461 /*****************************************************************************/
462 
463 typedef struct {
464  // inputs
465  uint16_t slave_position;
466  uint8_t drive_no;
467  uint16_t idn;
468  size_t data_size;
469  uint8_t *data;
470 
471  // outputs
472  uint16_t error_code;
473 } ec_ioctl_slave_soe_write_t;
474 
475 /*****************************************************************************/
476 
477 typedef struct {
478  // inputs
479  uint32_t config_index;
480 
481  // outputs
482  uint16_t alias;
483  uint16_t position;
484  uint32_t vendor_id;
485  uint32_t product_code;
486  struct {
487  ec_direction_t dir;
488  ec_watchdog_mode_t watchdog_mode;
489  uint32_t pdo_count;
490  uint8_t config_this;
491  } syncs[EC_MAX_SYNC_MANAGERS];
492  uint16_t watchdog_divider;
493  uint16_t watchdog_intervals;
494  uint32_t sdo_count;
495  uint32_t idn_count;
496  int32_t slave_position;
497  uint16_t dc_assign_activate;
499 } ec_ioctl_config_t;
500 
501 /*****************************************************************************/
502 
503 typedef struct {
504  // inputs
505  uint32_t config_index;
506  uint8_t sync_index;
507  uint16_t pdo_pos;
508 
509  // outputs
510  uint16_t index;
511  uint8_t entry_count;
512  int8_t name[EC_IOCTL_STRING_SIZE];
513 } ec_ioctl_config_pdo_t;
514 
515 /*****************************************************************************/
516 
517 typedef struct {
518  // inputs
519  uint32_t config_index;
520  uint8_t sync_index;
521  uint16_t pdo_pos;
522  uint8_t entry_pos;
523 
524  // outputs
525  uint16_t index;
526  uint8_t subindex;
527  uint8_t bit_length;
528  int8_t name[EC_IOCTL_STRING_SIZE];
529 } ec_ioctl_config_pdo_entry_t;
530 
531 /*****************************************************************************/
532 
536 #define EC_MAX_SDO_DATA_SIZE 1024
537 
538 typedef struct {
539  // inputs
540  uint32_t config_index;
541  uint32_t sdo_pos;
542 
543  // outputs
544  uint16_t index;
545  uint8_t subindex;
546  size_t size;
547  uint8_t data[EC_MAX_SDO_DATA_SIZE];
548  uint8_t complete_access;
549 } ec_ioctl_config_sdo_t;
550 
551 /*****************************************************************************/
552 
556 #define EC_MAX_IDN_DATA_SIZE 1024
557 
558 typedef struct {
559  // inputs
560  uint32_t config_index;
561  uint32_t idn_pos;
562 
563  // outputs
564  uint8_t drive_no;
565  uint16_t idn;
566  ec_al_state_t state;
567  size_t size;
568  uint8_t data[EC_MAX_IDN_DATA_SIZE];
569 } ec_ioctl_config_idn_t;
570 
571 /*****************************************************************************/
572 
573 #ifdef EC_EOE
574 
575 typedef struct {
576  // input
577  uint16_t eoe_index;
578 
579  // outputs
580  char name[EC_DATAGRAM_NAME_SIZE];
581  uint16_t slave_position;
582  uint8_t open;
583  uint32_t rx_bytes;
584  uint32_t rx_rate;
585  uint32_t tx_bytes;
586  uint32_t tx_rate;
587  uint32_t tx_queued_frames;
588  uint32_t tx_queue_size;
589 } ec_ioctl_eoe_handler_t;
590 
591 #endif
592 
593 /*****************************************************************************/
594 
595 typedef struct {
596  // outputs
597  void *process_data;
598  size_t process_data_size;
599 } ec_ioctl_master_activate_t;
600 
601 /*****************************************************************************/
602 
603 typedef struct {
604  // inputs
605  uint32_t config_index;
606  uint16_t pdo_index;
607  uint16_t entry_index;
608  uint8_t entry_subindex;
609  uint8_t entry_bit_length;
610 } ec_ioctl_add_pdo_entry_t;
611 
612 /*****************************************************************************/
613 
614 typedef struct {
615  // inputs
616  uint32_t config_index;
617  uint16_t entry_index;
618  uint8_t entry_subindex;
619  uint32_t domain_index;
620 
621  // outputs
622  unsigned int bit_position;
623 } ec_ioctl_reg_pdo_entry_t;
624 
625 /*****************************************************************************/
626 
627 typedef struct {
628  // inputs
629  uint32_t config_index;
630  uint32_t sync_index;
631  uint32_t pdo_pos;
632  uint32_t entry_pos;
633  uint32_t domain_index;
634 
635  // outputs
636  unsigned int bit_position;
637 } ec_ioctl_reg_pdo_pos_t;
638 
639 /*****************************************************************************/
640 
641 typedef struct {
642  // inputs
643  uint32_t config_index;
644  uint16_t index;
645  uint8_t subindex;
646  const uint8_t *data;
647  size_t size;
648  uint8_t complete_access;
649 } ec_ioctl_sc_sdo_t;
650 
651 /*****************************************************************************/
652 
653 typedef struct {
654  // inputs
655  uint32_t config_index;
656  size_t size;
657  uint8_t *target;
658 
659  // outputs
660  int32_t overruns;
661 } ec_ioctl_sc_emerg_t;
662 
663 /*****************************************************************************/
664 
665 typedef struct {
666  // inputs
667  uint32_t config_index;
668 
669  // outputs
671 } ec_ioctl_sc_state_t;
672 
673 /*****************************************************************************/
674 
675 typedef struct {
676  // inputs
677  uint32_t config_index;
678  uint8_t drive_no;
679  uint16_t idn;
680  ec_al_state_t al_state;
681  const uint8_t *data;
682  size_t size;
683 } ec_ioctl_sc_idn_t;
684 
685 /*****************************************************************************/
686 
687 typedef struct {
688  // inputs
689  uint32_t domain_index;
690 
691  // outputs
692  ec_domain_state_t *state;
693 } ec_ioctl_domain_state_t;
694 
695 /*****************************************************************************/
696 
697 typedef struct {
698  // inputs
699  uint32_t config_index;
700 
701  // inputs/outputs
702  uint32_t request_index;
703  uint16_t sdo_index;
704  uint8_t sdo_subindex;
705  size_t size;
706  uint8_t *data;
707  uint32_t timeout;
708  ec_request_state_t state;
709 } ec_ioctl_sdo_request_t;
710 
711 /*****************************************************************************/
712 
713 typedef struct {
714  // inputs
715  uint32_t config_index;
716  size_t mem_size;
717 
718  // inputs/outputs
719  uint32_t request_index;
720  uint8_t *data;
721  ec_request_state_t state;
722  uint8_t new_data;
723  uint16_t address;
724  size_t transfer_size;
725 } ec_ioctl_reg_request_t;
726 
727 /*****************************************************************************/
728 
729 typedef struct {
730  // inputs
731  uint32_t config_index;
732 
733  // inputs/outputs
734  uint32_t voe_index;
735  uint32_t *vendor_id;
736  uint16_t *vendor_type;
737  size_t size;
738  uint8_t *data;
739  ec_request_state_t state;
740 } ec_ioctl_voe_t;
741 
742 /*****************************************************************************/
743 
744 typedef struct {
745  // inputs
746  uint32_t dev_idx;
747 
748  // outputs
749  ec_master_link_state_t *state;
750 } ec_ioctl_link_state_t;
751 
752 /*****************************************************************************/
753 
754 #ifdef __KERNEL__
755 
758 typedef struct {
759  unsigned int writable;
760  unsigned int requested;
761  uint8_t *process_data;
762  size_t process_data_size;
763 } ec_ioctl_context_t;
764 
765 long ec_ioctl(ec_master_t *, ec_ioctl_context_t *, unsigned int,
766  void __user *);
767 
768 #ifdef EC_RTDM
769 
770 long ec_ioctl_rtdm(ec_master_t *, ec_ioctl_context_t *, unsigned int,
771  void __user *);
772 int ec_rtdm_mmap(ec_ioctl_context_t *, void **);
773 
774 #endif
775 
776 #endif
777 
778 /*****************************************************************************/
779 
782 #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:434
ec_slave_port_desc_t
EtherCAT slave port descriptor.
Definition: ecrt.h:343
ec_al_state_t
Application-layer state.
Definition: ecrt.h:532
#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:310
Slave information interface CANopen over EtherCAT details flags.
Definition: globals.h:157
Domain state.
Definition: ecrt.h:411
static unsigned int master_count
Number of masters.
Definition: module.c:58
ec_direction_t
Direction type for PDO assignment functions.
Definition: ecrt.h:421
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:213
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:521
EtherCAT master.
Definition: master.h:194
#define EC_MAX_SYNC_MANAGERS
Maximum number of sync managers per slave.
Definition: ecrt.h:204
#define EC_SYNC_SIGNAL_COUNT
Number of DC sync signals.
Definition: globals.h:110