fp@922: /****************************************************************************** fp@922: * fp@922: * $Id$ fp@922: * fp@922: * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH fp@922: * fp@922: * This file is part of the IgH EtherCAT Master. fp@922: * fp@922: * The IgH EtherCAT Master is free software; you can redistribute it fp@922: * and/or modify it under the terms of the GNU General Public License fp@922: * as published by the Free Software Foundation; either version 2 of the fp@922: * License, or (at your option) any later version. fp@922: * fp@922: * The IgH EtherCAT Master is distributed in the hope that it will be fp@922: * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of fp@922: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the fp@922: * GNU General Public License for more details. fp@922: * fp@922: * You should have received a copy of the GNU General Public License fp@922: * along with the IgH EtherCAT Master; if not, write to the Free Software fp@922: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA fp@922: * fp@922: * The right to use EtherCAT Technology is granted and comes free of fp@922: * charge under condition of compatibility of product made by fp@922: * Licensee. People intending to distribute/sell products based on the fp@922: * code, have to sign an agreement to guarantee that products using fp@922: * software based on IgH EtherCAT master stay compatible with the actual fp@922: * EtherCAT specification (which are released themselves as an open fp@922: * standard) as the (only) precondition to have the right to use EtherCAT fp@922: * Technology, IP and trade marks. fp@922: * fp@922: *****************************************************************************/ fp@922: fp@922: /** fp@922: \file fp@922: EtherCAT master character device IOCTL commands. fp@922: */ fp@922: fp@922: /*****************************************************************************/ fp@922: fp@922: #ifndef __EC_IOCTL_H__ fp@922: #define __EC_IOCTL_H__ fp@922: fp@971: #include fp@971: fp@989: #include "globals.h" fp@989: fp@971: /*****************************************************************************/ fp@971: fp@1082: /** \cond */ fp@1082: fp@1079: #define EC_IOCTL_TYPE 0xa4 fp@1079: fp@1079: #define EC_IO(nr) _IO(EC_IOCTL_TYPE, nr) fp@1079: #define EC_IOR(nr, type) _IOR(EC_IOCTL_TYPE, nr, type) fp@1079: #define EC_IOW(nr, type) _IOW(EC_IOCTL_TYPE, nr, type) fp@1079: #define EC_IOWR(nr, type) _IOWR(EC_IOCTL_TYPE, nr, type) fp@1079: fp@1079: #define EC_IOCTL_MASTER EC_IOR(0x00, ec_ioctl_master_t) fp@1079: #define EC_IOCTL_SLAVE EC_IOWR(0x01, ec_ioctl_slave_t) fp@1079: #define EC_IOCTL_SLAVE_SYNC EC_IOWR(0x02, ec_ioctl_slave_sync_t) fp@1079: #define EC_IOCTL_SLAVE_SYNC_PDO EC_IOWR(0x03, ec_ioctl_slave_sync_pdo_t) fp@1079: #define EC_IOCTL_SLAVE_SYNC_PDO_ENTRY EC_IOWR(0x04, ec_ioctl_slave_sync_pdo_entry_t) fp@1079: #define EC_IOCTL_DOMAIN EC_IOWR(0x05, ec_ioctl_domain_t) fp@1079: #define EC_IOCTL_DOMAIN_FMMU EC_IOWR(0x06, ec_ioctl_domain_fmmu_t) fp@1079: #define EC_IOCTL_DOMAIN_DATA EC_IOWR(0x07, ec_ioctl_domain_data_t) fp@1079: #define EC_IOCTL_MASTER_DEBUG EC_IO(0x08) fp@1079: #define EC_IOCTL_SLAVE_STATE EC_IOW(0x09, ec_ioctl_slave_state_t) fp@1079: #define EC_IOCTL_SLAVE_SDO EC_IOWR(0x0a, ec_ioctl_slave_sdo_t) fp@1079: #define EC_IOCTL_SLAVE_SDO_ENTRY EC_IOWR(0x0b, ec_ioctl_slave_sdo_entry_t) fp@1079: #define EC_IOCTL_SLAVE_SDO_UPLOAD EC_IOWR(0x0c, ec_ioctl_slave_sdo_upload_t) fp@1079: #define EC_IOCTL_SLAVE_SDO_DOWNLOAD EC_IOWR(0x0d, ec_ioctl_slave_sdo_download_t) fp@1079: #define EC_IOCTL_SLAVE_SII_READ EC_IOWR(0x0e, ec_ioctl_slave_sii_t) fp@1079: #define EC_IOCTL_SLAVE_SII_WRITE EC_IOW(0x0f, ec_ioctl_slave_sii_t) fp@1200: #define EC_IOCTL_SLAVE_PHY_READ EC_IOWR(0x10, ec_ioctl_slave_phy_t) fp@1200: #define EC_IOCTL_SLAVE_PHY_WRITE EC_IOW(0x11, ec_ioctl_slave_phy_t) fp@1200: #define EC_IOCTL_CONFIG EC_IOWR(0x12, ec_ioctl_config_t) fp@1200: #define EC_IOCTL_CONFIG_PDO EC_IOWR(0x13, ec_ioctl_config_pdo_t) fp@1200: #define EC_IOCTL_CONFIG_PDO_ENTRY EC_IOWR(0x14, ec_ioctl_config_pdo_entry_t) fp@1200: #define EC_IOCTL_CONFIG_SDO EC_IOWR(0x15, ec_ioctl_config_sdo_t) fp@1242: #define EC_IOCTL_REQUEST EC_IOR(0x16, ec_ioctl_request_t) fp@990: fp@990: #define EC_IOCTL_STRING_SIZE 64 fp@978: fp@978: /*****************************************************************************/ fp@978: fp@978: typedef struct { fp@978: uint32_t slave_count; fp@990: uint32_t config_count; fp@1001: uint32_t domain_count; fp@1029: uint8_t phase; fp@957: struct { fp@957: uint8_t address[6]; fp@957: uint8_t attached; fp@978: uint32_t tx_count; fp@978: uint32_t rx_count; fp@957: } devices[2]; fp@957: } ec_ioctl_master_t; fp@957: fp@957: /*****************************************************************************/ fp@957: fp@935: typedef struct { fp@935: // input fp@935: uint16_t position; fp@935: fp@935: // outputs fp@922: uint32_t vendor_id; fp@922: uint32_t product_code; fp@938: uint32_t revision_number; fp@938: uint32_t serial_number; fp@922: uint16_t alias; fp@989: uint16_t rx_mailbox_offset; fp@989: uint16_t rx_mailbox_size; fp@989: uint16_t tx_mailbox_offset; fp@989: uint16_t tx_mailbox_size; fp@989: uint16_t mailbox_protocols; fp@989: uint8_t has_general_category; fp@989: ec_sii_coe_details_t coe_details; fp@989: ec_sii_general_flags_t general_flags; fp@989: int16_t current_on_ebus; fp@1148: uint8_t al_state; fp@987: uint8_t error_flag; fp@935: uint8_t sync_count; fp@965: uint16_t sdo_count; fp@978: uint32_t sii_nwords; fp@1109: char group[EC_IOCTL_STRING_SIZE]; fp@1109: char image[EC_IOCTL_STRING_SIZE]; fp@1109: char order[EC_IOCTL_STRING_SIZE]; fp@990: char name[EC_IOCTL_STRING_SIZE]; fp@935: } ec_ioctl_slave_t; fp@935: fp@935: /*****************************************************************************/ fp@935: fp@935: typedef struct { fp@935: // inputs fp@935: uint16_t slave_position; fp@978: uint32_t sync_index; fp@935: fp@935: // outputs fp@935: uint16_t physical_start_address; fp@935: uint16_t default_size; fp@935: uint8_t control_register; fp@935: uint8_t enable; fp@935: uint8_t pdo_count; fp@1079: } ec_ioctl_slave_sync_t; fp@935: fp@935: /*****************************************************************************/ fp@935: fp@935: typedef struct { fp@935: // inputs fp@935: uint16_t slave_position; fp@978: uint32_t sync_index; fp@978: uint32_t pdo_pos; fp@935: fp@935: // outputs fp@935: uint16_t index; fp@935: uint8_t entry_count; fp@990: int8_t name[EC_IOCTL_STRING_SIZE]; fp@1079: } ec_ioctl_slave_sync_pdo_t; fp@935: fp@935: /*****************************************************************************/ fp@935: fp@935: typedef struct { fp@935: // inputs fp@935: uint16_t slave_position; fp@978: uint32_t sync_index; fp@978: uint32_t pdo_pos; fp@978: uint32_t entry_pos; fp@935: fp@935: // outputs fp@935: uint16_t index; fp@935: uint8_t subindex; fp@935: uint8_t bit_length; fp@990: int8_t name[EC_IOCTL_STRING_SIZE]; fp@1079: } ec_ioctl_slave_sync_pdo_entry_t; fp@922: fp@922: /*****************************************************************************/ fp@922: fp@948: typedef struct { fp@948: // inputs fp@978: uint32_t index; fp@978: fp@978: // outputs fp@978: uint32_t data_size; fp@948: uint32_t logical_base_address; fp@948: uint16_t working_counter; fp@948: uint16_t expected_working_counter; fp@978: uint32_t fmmu_count; fp@948: } ec_ioctl_domain_t; fp@948: fp@948: /*****************************************************************************/ fp@948: fp@949: typedef struct { fp@949: // inputs fp@978: uint32_t domain_index; fp@978: uint32_t fmmu_index; fp@950: fp@950: // outputs fp@950: uint16_t slave_config_alias; fp@950: uint16_t slave_config_position; fp@1055: uint8_t sync_index; fp@1055: ec_direction_t dir; fp@950: uint32_t logical_address; fp@978: uint32_t data_size; fp@950: } ec_ioctl_domain_fmmu_t; fp@950: fp@950: /*****************************************************************************/ fp@950: fp@950: typedef struct { fp@950: // inputs fp@978: uint32_t domain_index; fp@978: uint32_t data_size; fp@990: uint8_t *target; fp@1079: } ec_ioctl_domain_data_t; fp@949: fp@949: /*****************************************************************************/ fp@949: fp@960: typedef struct { fp@960: // inputs fp@960: uint16_t slave_position; fp@1148: uint8_t al_state; fp@960: } ec_ioctl_slave_state_t; fp@960: fp@960: /*****************************************************************************/ fp@960: fp@965: typedef struct { fp@965: // inputs fp@965: uint16_t slave_position; fp@965: uint16_t sdo_position; fp@965: fp@965: // outputs fp@965: uint16_t sdo_index; fp@965: uint8_t max_subindex; fp@990: int8_t name[EC_IOCTL_STRING_SIZE]; fp@1079: } ec_ioctl_slave_sdo_t; fp@965: fp@965: /*****************************************************************************/ fp@965: fp@965: typedef struct { fp@965: // inputs fp@965: uint16_t slave_position; fp@968: int sdo_spec; // positive: index, negative: list position fp@965: uint8_t sdo_entry_subindex; fp@965: fp@965: // outputs fp@965: uint16_t data_type; fp@965: uint16_t bit_length; fp@990: int8_t description[EC_IOCTL_STRING_SIZE]; fp@1079: } ec_ioctl_slave_sdo_entry_t; fp@965: fp@965: /*****************************************************************************/ fp@965: fp@968: typedef struct { fp@968: // inputs fp@968: uint16_t slave_position; fp@968: uint16_t sdo_index; fp@968: uint8_t sdo_entry_subindex; fp@978: uint32_t target_size; fp@968: uint8_t *target; fp@968: fp@968: // outputs fp@978: uint32_t data_size; fp@1037: uint32_t abort_code; fp@1079: } ec_ioctl_slave_sdo_upload_t; fp@968: fp@968: /*****************************************************************************/ fp@968: fp@974: typedef struct { fp@974: // inputs fp@974: uint16_t slave_position; fp@974: uint16_t sdo_index; fp@974: uint8_t sdo_entry_subindex; fp@978: uint32_t data_size; fp@974: uint8_t *data; fp@1037: fp@1037: // outputs fp@1037: uint32_t abort_code; fp@1079: } ec_ioctl_slave_sdo_download_t; fp@974: fp@974: /*****************************************************************************/ fp@974: fp@978: typedef struct { fp@978: // inputs fp@978: uint16_t slave_position; fp@978: uint16_t offset; fp@978: uint32_t nwords; fp@978: uint16_t *words; fp@1079: } ec_ioctl_slave_sii_t; fp@978: fp@978: /*****************************************************************************/ fp@978: fp@990: typedef struct { fp@990: // inputs fp@1200: uint16_t slave_position; fp@1200: uint16_t offset; fp@1200: uint16_t length; fp@1200: uint8_t *data; fp@1200: } ec_ioctl_slave_phy_t; fp@1200: fp@1200: /*****************************************************************************/ fp@1200: fp@1200: typedef struct { fp@1200: // inputs fp@990: uint32_t config_index; fp@990: fp@990: // outputs fp@990: uint16_t alias; fp@990: uint16_t position; fp@990: uint32_t vendor_id; fp@990: uint32_t product_code; fp@1055: struct { fp@1055: ec_direction_t dir; fp@1055: uint32_t pdo_count; fp@1082: } syncs[EC_MAX_SYNC_MANAGERS]; fp@990: uint32_t sdo_count; fp@1147: int32_t slave_position; fp@990: } ec_ioctl_config_t; fp@990: fp@990: /*****************************************************************************/ fp@990: fp@990: typedef struct { fp@990: // inputs fp@990: uint32_t config_index; fp@1055: uint8_t sync_index; fp@1055: uint16_t pdo_pos; fp@990: fp@990: // outputs fp@990: uint16_t index; fp@990: uint8_t entry_count; fp@990: int8_t name[EC_IOCTL_STRING_SIZE]; fp@990: } ec_ioctl_config_pdo_t; fp@990: fp@990: /*****************************************************************************/ fp@990: fp@990: typedef struct { fp@990: // inputs fp@990: uint32_t config_index; fp@1055: uint8_t sync_index; fp@1055: uint16_t pdo_pos; fp@1055: uint8_t entry_pos; fp@990: fp@990: // outputs fp@990: uint16_t index; fp@990: uint8_t subindex; fp@990: uint8_t bit_length; fp@990: int8_t name[EC_IOCTL_STRING_SIZE]; fp@990: } ec_ioctl_config_pdo_entry_t; fp@990: fp@990: /*****************************************************************************/ fp@990: fp@990: typedef struct { fp@990: // inputs fp@990: uint32_t config_index; fp@990: uint32_t sdo_pos; fp@990: fp@990: // outputs fp@990: uint16_t index; fp@990: uint8_t subindex; fp@990: uint32_t size; fp@990: uint8_t data[4]; fp@990: } ec_ioctl_config_sdo_t; fp@990: fp@990: /*****************************************************************************/ fp@990: fp@1242: typedef struct { fp@1242: ec_master_t *handle; fp@1242: } ec_ioctl_request_t; fp@1242: fp@1242: /*****************************************************************************/ fp@1242: fp@1082: /** \endcond */ fp@1082: fp@922: #endif