00001 /****************************************************************************** 00002 * 00003 * $Id: globals.h 682 2006-11-07 12:13:30Z fp $ 00004 * 00005 * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH 00006 * 00007 * This file is part of the IgH EtherCAT Master. 00008 * 00009 * The IgH EtherCAT Master is free software; you can redistribute it 00010 * and/or modify it under the terms of the GNU General Public License 00011 * as published by the Free Software Foundation; either version 2 of the 00012 * License, or (at your option) any later version. 00013 * 00014 * The IgH EtherCAT Master is distributed in the hope that it will be 00015 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with the IgH EtherCAT Master; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00022 * 00023 * The right to use EtherCAT Technology is granted and comes free of 00024 * charge under condition of compatibility of product made by 00025 * Licensee. People intending to distribute/sell products based on the 00026 * code, have to sign an agreement to guarantee that products using 00027 * software based on IgH EtherCAT master stay compatible with the actual 00028 * EtherCAT specification (which are released themselves as an open 00029 * standard) as the (only) precondition to have the right to use EtherCAT 00030 * Technology, IP and trade marks. 00031 * 00032 *****************************************************************************/ 00033 00039 /*****************************************************************************/ 00040 00041 #ifndef _EC_MASTER_GLOBALS_ 00042 #define _EC_MASTER_GLOBALS_ 00043 00044 #include <linux/types.h> 00045 00046 #include "../globals.h" 00047 00048 /****************************************************************************** 00049 * EtherCAT master 00050 *****************************************************************************/ 00051 00053 #define EC_MAX_FMMUS 16 00054 00056 #define EC_EOE_TX_QUEUE_SIZE 100 00057 00059 #define EC_EOE_FREQUENCY 1000 00060 00062 #define EC_IO_TIMEOUT 500 00063 00066 #define EC_WAIT_SDO_DICT 3 00067 00069 #define EC_STATE_STRING_SIZE 32 00070 00071 /****************************************************************************** 00072 * EtherCAT protocol 00073 *****************************************************************************/ 00074 00076 #define EC_FRAME_HEADER_SIZE 2 00077 00079 #define EC_DATAGRAM_HEADER_SIZE 10 00080 00082 #define EC_DATAGRAM_FOOTER_SIZE 2 00083 00085 #define EC_SYNC_SIZE 8 00086 00088 #define EC_FMMU_SIZE 16 00089 00091 #define EC_MAX_DATA_SIZE (ETH_DATA_LEN - EC_FRAME_HEADER_SIZE \ 00092 - EC_DATAGRAM_HEADER_SIZE - EC_DATAGRAM_FOOTER_SIZE) 00093 00094 /*****************************************************************************/ 00095 00103 #define EC_INFO(fmt, args...) \ 00104 printk(KERN_INFO "EtherCAT: " fmt, ##args) 00105 00113 #define EC_ERR(fmt, args...) \ 00114 printk(KERN_ERR "EtherCAT ERROR: " fmt, ##args) 00115 00123 #define EC_WARN(fmt, args...) \ 00124 printk(KERN_WARNING "EtherCAT WARNING: " fmt, ##args) 00125 00133 #define EC_DBG(fmt, args...) \ 00134 printk(KERN_DEBUG "EtherCAT DEBUG: " fmt, ##args) 00135 00143 #define EC_SYSFS_READ_ATTR(NAME) \ 00144 static struct attribute attr_##NAME = { \ 00145 .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO \ 00146 } 00147 00155 #define EC_SYSFS_READ_WRITE_ATTR(NAME) \ 00156 static struct attribute attr_##NAME = { \ 00157 .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO | S_IWUSR \ 00158 } 00159 00160 /*****************************************************************************/ 00161 00162 extern char *ec_master_version_str; 00163 00164 /*****************************************************************************/ 00165 00166 void ec_print_data(const uint8_t *, size_t); 00167 void ec_print_data_diff(const uint8_t *, const uint8_t *, size_t); 00168 size_t ec_state_string(uint8_t, char *); 00169 00170 /*****************************************************************************/ 00171 00178 typedef struct 00179 { 00180 uint32_t code; 00181 const char *message; 00182 } 00183 ec_code_msg_t; 00184 00185 /*****************************************************************************/ 00186 00187 #endif
1.4.4