28 #ifndef __EC_IOCTL_H__ 29 #define __EC_IOCTL_H__ 31 #include <linux/ioctl.h> 39 #define EC_IOCTL_TYPE 0xa4 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) 50 #define EC_IOCTL_VERSION_MAGIC 33 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) 84 #define EC_IOCTL_EOE_HANDLER EC_IOWR(0x1e, ec_ioctl_eoe_handler_t) 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) 159 #define EC_IOCTL_STRING_SIZE 64 164 uint32_t ioctl_version_magic;
171 uint32_t slave_count;
172 uint32_t config_count;
173 uint32_t domain_count;
174 uint32_t eoe_handler_count;
178 struct ec_ioctl_device {
191 } devices[EC_MAX_NUM_DEVICES];
192 uint32_t num_devices;
203 uint64_t dc_ref_time;
214 unsigned int device_index;
216 uint32_t product_code;
217 uint32_t revision_number;
218 uint32_t serial_number;
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;
232 int16_t current_on_ebus;
236 uint32_t receive_time;
238 uint32_t delay_to_next_dc;
241 uint8_t dc_supported;
243 uint8_t has_dc_system_time;
244 uint32_t transmission_delay;
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];
260 uint16_t slave_position;
264 uint16_t physical_start_address;
265 uint16_t default_size;
266 uint8_t control_register;
269 } ec_ioctl_slave_sync_t;
275 uint16_t slave_position;
282 int8_t name[EC_IOCTL_STRING_SIZE];
283 } ec_ioctl_slave_sync_pdo_t;
289 uint16_t slave_position;
298 int8_t name[EC_IOCTL_STRING_SIZE];
299 } ec_ioctl_slave_sync_pdo_entry_t;
309 uint32_t logical_base_address;
310 uint16_t working_counter[EC_MAX_NUM_DEVICES];
311 uint16_t expected_working_counter;
319 uint32_t domain_index;
323 uint16_t slave_config_alias;
324 uint16_t slave_config_position;
327 uint32_t logical_address;
329 } ec_ioctl_domain_fmmu_t;
335 uint32_t domain_index;
338 } ec_ioctl_domain_data_t;
344 uint16_t slave_position;
346 } ec_ioctl_slave_state_t;
352 uint16_t slave_position;
353 uint16_t sdo_position;
357 uint8_t max_subindex;
358 int8_t name[EC_IOCTL_STRING_SIZE];
359 } ec_ioctl_slave_sdo_t;
365 uint16_t slave_position;
367 uint8_t sdo_entry_subindex;
374 int8_t description[EC_IOCTL_STRING_SIZE];
375 } ec_ioctl_slave_sdo_entry_t;
381 uint16_t slave_position;
383 uint8_t sdo_entry_subindex;
390 } ec_ioctl_slave_sdo_upload_t;
396 uint16_t slave_position;
398 uint8_t sdo_entry_subindex;
399 uint8_t complete_access;
405 } ec_ioctl_slave_sdo_download_t;
411 uint16_t slave_position;
415 } ec_ioctl_slave_sii_t;
421 uint16_t slave_position;
426 } ec_ioctl_slave_reg_t;
432 uint16_t slave_position;
442 } ec_ioctl_slave_foe_t;
448 uint16_t slave_position;
457 } ec_ioctl_slave_soe_read_t;
463 uint16_t slave_position;
471 } ec_ioctl_slave_soe_write_t;
477 uint32_t config_index;
483 uint32_t product_code;
490 uint16_t watchdog_divider;
491 uint16_t watchdog_intervals;
495 int32_t slave_position;
496 uint16_t dc_assign_activate;
504 uint32_t config_index;
511 int8_t name[EC_IOCTL_STRING_SIZE];
512 } ec_ioctl_config_pdo_t;
518 uint32_t config_index;
527 int8_t name[EC_IOCTL_STRING_SIZE];
528 } ec_ioctl_config_pdo_entry_t;
535 #define EC_MAX_SDO_DATA_SIZE 1024 539 uint32_t config_index;
546 uint8_t data[EC_MAX_SDO_DATA_SIZE];
547 uint8_t complete_access;
548 } ec_ioctl_config_sdo_t;
555 #define EC_MAX_IDN_DATA_SIZE 1024 559 uint32_t config_index;
567 uint8_t data[EC_MAX_IDN_DATA_SIZE];
568 } ec_ioctl_config_idn_t;
574 #define EC_MAX_FLAG_KEY_SIZE 128 578 uint32_t config_index;
582 char key[EC_MAX_FLAG_KEY_SIZE];
584 } ec_ioctl_config_flag_t;
596 uint16_t slave_position;
602 uint32_t tx_queued_frames;
603 uint32_t tx_queue_size;
604 } ec_ioctl_eoe_handler_t;
613 size_t process_data_size;
614 } ec_ioctl_master_activate_t;
620 uint32_t config_index;
622 uint16_t entry_index;
623 uint8_t entry_subindex;
624 uint8_t entry_bit_length;
625 } ec_ioctl_add_pdo_entry_t;
631 uint32_t config_index;
632 uint16_t entry_index;
633 uint8_t entry_subindex;
634 uint32_t domain_index;
637 unsigned int bit_position;
638 } ec_ioctl_reg_pdo_entry_t;
644 uint32_t config_index;
648 uint32_t domain_index;
651 unsigned int bit_position;
652 } ec_ioctl_reg_pdo_pos_t;
658 uint32_t config_index;
663 uint8_t complete_access;
670 uint32_t config_index;
676 } ec_ioctl_sc_emerg_t;
682 uint32_t config_index;
686 } ec_ioctl_sc_state_t;
692 uint32_t config_index;
704 uint32_t config_index;
708 } ec_ioctl_sc_flag_t;
714 uint32_t domain_index;
718 } ec_ioctl_domain_state_t;
724 uint32_t config_index;
727 uint32_t request_index;
729 uint8_t sdo_subindex;
734 } ec_ioctl_sdo_request_t;
740 uint32_t config_index;
743 uint32_t request_index;
750 } ec_ioctl_soe_request_t;
756 uint32_t config_index;
760 uint32_t request_index;
765 size_t transfer_size;
766 } ec_ioctl_reg_request_t;
772 uint32_t config_index;
777 uint16_t *vendor_type;
791 } ec_ioctl_link_state_t;
800 unsigned int writable;
801 unsigned int requested;
802 uint8_t *process_data;
803 size_t process_data_size;
804 } ec_ioctl_context_t;
806 long ec_ioctl(
ec_master_t *, ec_ioctl_context_t *,
unsigned int,
811 long ec_ioctl_rtdm(
ec_master_t *, ec_ioctl_context_t *,
unsigned int,
Slave information interface general flags.
#define EC_DATAGRAM_NAME_SIZE
Size of the datagram description string.
ec_watchdog_mode_t
Watchdog mode for sync manager configuration.
ec_slave_port_desc_t
EtherCAT slave port descriptor.
ec_al_state_t
Application-layer state.
#define EC_RATE_COUNT
Number of statistic rate intervals to maintain.
EtherCAT slave port information.
Global definitions and macros.
Slave configuration state.
Slave information interface CANopen over EtherCAT details flags.
static unsigned int master_count
Number of masters.
ec_direction_t
Direction type for PDO assignment functions.
ec_slave_dc_range_t
EtherCAT slave distributed clocks range.
int ec_rtdm_mmap(ec_ioctl_context_t *ioctl_ctx, void **user_address)
Memory-map process data to user space.
#define EC_MAX_PORTS
Maximum number of slave ports.
EtherCAT slave sync signal configuration.
ec_request_state_t
Request state.
#define EC_MAX_SYNC_MANAGERS
Maximum number of sync managers per slave.
#define EC_SYNC_SIGNAL_COUNT
Number of DC sync signals.