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 37 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) 78 #define EC_IOCTL_SLAVE_EOE_IP_PARAM EC_IOW(0x18, ec_ioctl_eoe_ip_t) 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) 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) 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) 132 #define EC_IOCTL_SC_EOE_IP_PARAM EC_IOW(0x48, ec_ioctl_eoe_ip_t) 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) 167 #define EC_IOCTL_STRING_SIZE 64 172 uint32_t ioctl_version_magic;
179 uint32_t slave_count;
181 uint32_t config_count;
182 uint32_t domain_count;
183 uint32_t eoe_handler_count;
187 struct ec_ioctl_device {
200 } devices[EC_MAX_NUM_DEVICES];
201 uint32_t num_devices;
212 uint64_t dc_ref_time;
223 unsigned int device_index;
225 uint32_t product_code;
226 uint32_t revision_number;
227 uint32_t serial_number;
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;
241 int16_t current_on_ebus;
245 uint32_t receive_time;
247 uint32_t delay_to_next_dc;
250 uint8_t dc_supported;
252 uint8_t has_dc_system_time;
253 uint32_t transmission_delay;
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];
269 uint16_t slave_position;
273 uint16_t physical_start_address;
274 uint16_t default_size;
275 uint8_t control_register;
278 } ec_ioctl_slave_sync_t;
284 uint16_t slave_position;
291 int8_t name[EC_IOCTL_STRING_SIZE];
292 } ec_ioctl_slave_sync_pdo_t;
298 uint16_t slave_position;
307 int8_t name[EC_IOCTL_STRING_SIZE];
308 } ec_ioctl_slave_sync_pdo_entry_t;
318 uint32_t logical_base_address;
319 uint16_t working_counter[EC_MAX_NUM_DEVICES];
320 uint16_t expected_working_counter;
328 uint32_t domain_index;
332 uint16_t slave_config_alias;
333 uint16_t slave_config_position;
336 uint32_t logical_address;
338 } ec_ioctl_domain_fmmu_t;
344 uint32_t domain_index;
347 } ec_ioctl_domain_data_t;
353 uint16_t slave_position;
355 } ec_ioctl_slave_state_t;
361 uint16_t slave_position;
362 uint16_t sdo_position;
366 uint8_t max_subindex;
367 int8_t name[EC_IOCTL_STRING_SIZE];
368 } ec_ioctl_slave_sdo_t;
374 uint16_t slave_position;
376 uint8_t sdo_entry_subindex;
383 int8_t description[EC_IOCTL_STRING_SIZE];
384 } ec_ioctl_slave_sdo_entry_t;
390 uint16_t slave_position;
392 uint8_t sdo_entry_subindex;
399 } ec_ioctl_slave_sdo_upload_t;
405 uint16_t slave_position;
407 uint8_t sdo_entry_subindex;
408 uint8_t complete_access;
414 } ec_ioctl_slave_sdo_download_t;
420 uint16_t slave_position;
424 } ec_ioctl_slave_sii_t;
430 uint16_t slave_position;
435 } ec_ioctl_slave_reg_t;
441 uint16_t slave_position;
451 } ec_ioctl_slave_foe_t;
457 uint16_t slave_position;
466 } ec_ioctl_slave_soe_read_t;
472 uint16_t slave_position;
480 } ec_ioctl_slave_soe_write_t;
486 uint32_t config_index;
492 uint32_t product_code;
499 uint16_t watchdog_divider;
500 uint16_t watchdog_intervals;
504 int32_t slave_position;
505 uint16_t dc_assign_activate;
513 uint32_t config_index;
520 int8_t name[EC_IOCTL_STRING_SIZE];
521 } ec_ioctl_config_pdo_t;
527 uint32_t config_index;
536 int8_t name[EC_IOCTL_STRING_SIZE];
537 } ec_ioctl_config_pdo_entry_t;
544 #define EC_MAX_SDO_DATA_SIZE 1024 548 uint32_t config_index;
555 uint8_t data[EC_MAX_SDO_DATA_SIZE];
556 uint8_t complete_access;
557 } ec_ioctl_config_sdo_t;
564 #define EC_MAX_IDN_DATA_SIZE 1024 568 uint32_t config_index;
576 uint8_t data[EC_MAX_IDN_DATA_SIZE];
577 } ec_ioctl_config_idn_t;
583 #define EC_MAX_FLAG_KEY_SIZE 128 587 uint32_t config_index;
591 char key[EC_MAX_FLAG_KEY_SIZE];
593 } ec_ioctl_config_flag_t;
605 uint16_t slave_position;
611 uint32_t tx_queued_frames;
612 uint32_t tx_queue_size;
613 } ec_ioctl_eoe_handler_t;
619 #define EC_ETH_ALEN 6 621 #if ETH_ALEN != EC_ETH_ALEN 622 #error Ethernet address length mismatch 628 uint16_t slave_position;
629 uint16_t config_index;
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;
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;
654 size_t process_data_size;
655 } ec_ioctl_master_activate_t;
661 uint32_t config_index;
663 uint16_t entry_index;
664 uint8_t entry_subindex;
665 uint8_t entry_bit_length;
666 } ec_ioctl_add_pdo_entry_t;
672 uint32_t config_index;
673 uint16_t entry_index;
674 uint8_t entry_subindex;
675 uint32_t domain_index;
678 unsigned int bit_position;
679 } ec_ioctl_reg_pdo_entry_t;
685 uint32_t config_index;
689 uint32_t domain_index;
692 unsigned int bit_position;
693 } ec_ioctl_reg_pdo_pos_t;
699 uint32_t config_index;
704 uint8_t complete_access;
711 uint32_t config_index;
717 } ec_ioctl_sc_emerg_t;
723 uint32_t config_index;
727 } ec_ioctl_sc_state_t;
733 uint32_t config_index;
745 uint32_t config_index;
749 } ec_ioctl_sc_flag_t;
755 uint32_t config_index;
759 } ec_ioctl_sc_state_timeout_t;
765 uint32_t domain_index;
769 } ec_ioctl_domain_state_t;
775 uint32_t config_index;
778 uint32_t request_index;
780 uint8_t sdo_subindex;
785 } ec_ioctl_sdo_request_t;
791 uint32_t config_index;
794 uint32_t request_index;
801 } ec_ioctl_soe_request_t;
807 uint32_t config_index;
811 uint32_t request_index;
816 size_t transfer_size;
817 } ec_ioctl_reg_request_t;
823 uint32_t config_index;
828 uint16_t *vendor_type;
842 } ec_ioctl_link_state_t;
851 unsigned int writable;
852 unsigned int requested;
853 uint8_t *process_data;
854 size_t process_data_size;
855 } ec_ioctl_context_t;
862 long ec_ioctl_rtdm_rt(
ec_master_t *, ec_ioctl_context_t *,
unsigned int,
864 long ec_ioctl_rtdm_nrt(
ec_master_t *, ec_ioctl_context_t *,
unsigned int,
867 #ifndef EC_RTDM_XENOMAI_V3 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.
#define EC_MAX_HOSTNAME_SIZE
Maximum hostname size.
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.
long ec_ioctl(ec_master_t *master, ec_ioctl_context_t *ctx, unsigned int cmd, void *arg)
Called when an ioctl() command is issued.
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.