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@922: /*****************************************************************************/ fp@922: fp@922: enum { fp@957: EC_IOCTL_MASTER, fp@935: EC_IOCTL_SLAVE, fp@935: EC_IOCTL_SYNC, fp@935: EC_IOCTL_PDO, fp@935: EC_IOCTL_PDO_ENTRY, fp@948: EC_IOCTL_DOMAIN_COUNT, fp@949: EC_IOCTL_DOMAIN, fp@950: EC_IOCTL_DOMAIN_FMMU, fp@956: EC_IOCTL_DATA, fp@957: EC_IOCTL_SET_DEBUG, fp@960: EC_IOCTL_SLAVE_STATE, fp@965: EC_IOCTL_SDO, fp@965: EC_IOCTL_SDO_ENTRY, fp@968: EC_IOCTL_SDO_UPLOAD, fp@922: }; fp@922: fp@922: /*****************************************************************************/ fp@922: fp@957: typedef struct { fp@957: unsigned int slave_count; fp@957: uint8_t mode; fp@957: struct { fp@957: uint8_t address[6]; fp@957: uint8_t attached; fp@957: unsigned int tx_count; fp@957: unsigned int rx_count; fp@957: } devices[2]; fp@957: } ec_ioctl_master_t; fp@957: fp@957: /*****************************************************************************/ fp@957: fp@965: #define EC_IOCTL_SLAVE_NAME_SIZE 104 fp@922: 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@922: uint8_t state; fp@935: uint8_t sync_count; fp@965: uint16_t sdo_count; fp@935: char name[EC_IOCTL_SLAVE_NAME_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@935: unsigned int 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 assign_source; fp@935: uint8_t pdo_count; fp@935: } ec_ioctl_sync_t; fp@935: fp@935: /*****************************************************************************/ fp@935: fp@935: #define EC_IOCTL_PDO_NAME_SIZE 114 fp@935: fp@935: typedef struct { fp@935: // inputs fp@935: uint16_t slave_position; fp@935: unsigned int sync_index; fp@935: unsigned int pdo_pos; fp@935: fp@935: // outputs fp@935: uint8_t dir; fp@935: uint16_t index; fp@935: uint8_t entry_count; fp@935: char name[EC_IOCTL_PDO_NAME_SIZE]; fp@935: } ec_ioctl_pdo_t; fp@935: fp@935: /*****************************************************************************/ fp@935: fp@935: #define EC_IOCTL_PDO_ENTRY_NAME_SIZE 110 fp@935: fp@935: typedef struct { fp@935: // inputs fp@935: uint16_t slave_position; fp@935: unsigned int sync_index; fp@935: unsigned int pdo_pos; fp@935: unsigned int entry_pos; fp@935: fp@935: // outputs fp@935: uint16_t index; fp@935: uint8_t subindex; fp@935: uint8_t bit_length; fp@935: char name[EC_IOCTL_PDO_NAME_SIZE]; fp@935: } ec_ioctl_pdo_entry_t; fp@922: fp@922: /*****************************************************************************/ fp@922: fp@948: typedef struct { fp@948: // inputs fp@948: unsigned int index; fp@948: fp@948: // outputs fp@948: unsigned int data_size; fp@948: uint32_t logical_base_address; fp@948: uint16_t working_counter; fp@948: uint16_t expected_working_counter; fp@950: unsigned int fmmu_count; fp@948: } ec_ioctl_domain_t; fp@948: fp@948: /*****************************************************************************/ fp@948: fp@949: typedef struct { fp@949: // inputs fp@949: unsigned int domain_index; fp@950: unsigned int fmmu_index; fp@950: fp@950: // outputs fp@950: uint16_t slave_config_alias; fp@950: uint16_t slave_config_position; fp@950: uint8_t fmmu_dir; fp@950: uint32_t logical_address; fp@950: unsigned int data_size; fp@950: } ec_ioctl_domain_fmmu_t; fp@950: fp@950: /*****************************************************************************/ fp@950: fp@950: typedef struct { fp@950: // inputs fp@950: unsigned int domain_index; fp@949: unsigned int data_size; fp@949: unsigned char *target; fp@949: } ec_ioctl_data_t; fp@949: fp@949: /*****************************************************************************/ fp@949: fp@960: typedef struct { fp@960: // inputs fp@960: uint16_t slave_position; fp@960: uint8_t requested_state; fp@960: } ec_ioctl_slave_state_t; fp@960: fp@960: /*****************************************************************************/ fp@960: fp@965: #define EC_IOCTL_SDO_NAME_SIZE 121 fp@965: 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@965: char name[EC_IOCTL_SDO_NAME_SIZE]; fp@965: } ec_ioctl_sdo_t; fp@965: fp@965: /*****************************************************************************/ fp@965: fp@965: #define EC_IOCTL_SDO_ENTRY_DESCRIPTION_SIZE 120 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@965: char description[EC_IOCTL_SDO_ENTRY_DESCRIPTION_SIZE]; fp@965: } ec_ioctl_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@968: unsigned int target_size; fp@968: uint8_t *target; fp@968: fp@968: // outputs fp@968: unsigned int data_size; fp@968: } ec_ioctl_sdo_upload_t; fp@968: fp@968: /*****************************************************************************/ fp@968: fp@922: #endif