00001 /****************************************************************************** 00002 * 00003 * $Id: globals.h 490 2006-08-02 12:25:25Z 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_GLOBALS_ 00042 #define _EC_GLOBALS_ 00043 00044 #include <linux/types.h> 00045 00046 /****************************************************************************** 00047 * EtherCAT master 00048 *****************************************************************************/ 00049 00051 #define EC_MASTER_VERSION_MAIN 1 00052 00054 #define EC_MASTER_VERSION_SUB 0 00055 00057 #define EC_MASTER_VERSION_EXTRA "stable" 00058 00060 #define EC_MAX_FMMUS 16 00061 00063 #define EC_EOE_TX_QUEUE_SIZE 100 00064 00066 #define EC_EOE_FREQUENCY 1000 00067 00068 /****************************************************************************** 00069 * EtherCAT protocol 00070 *****************************************************************************/ 00071 00073 #define EC_FRAME_HEADER_SIZE 2 00074 00076 #define EC_DATAGRAM_HEADER_SIZE 10 00077 00079 #define EC_DATAGRAM_FOOTER_SIZE 2 00080 00082 #define EC_SYNC_SIZE 8 00083 00085 #define EC_FMMU_SIZE 16 00086 00088 #define EC_MAX_DATA_SIZE (ETH_DATA_LEN - EC_FRAME_HEADER_SIZE \ 00089 - EC_DATAGRAM_HEADER_SIZE - EC_DATAGRAM_FOOTER_SIZE) 00090 00091 /*****************************************************************************/ 00092 00100 #define EC_INFO(fmt, args...) \ 00101 printk(KERN_INFO "EtherCAT: " fmt, ##args) 00102 00110 #define EC_ERR(fmt, args...) \ 00111 printk(KERN_ERR "EtherCAT ERROR: " fmt, ##args) 00112 00120 #define EC_WARN(fmt, args...) \ 00121 printk(KERN_WARNING "EtherCAT WARNING: " fmt, ##args) 00122 00130 #define EC_DBG(fmt, args...) \ 00131 printk(KERN_DEBUG "EtherCAT DEBUG: " fmt, ##args) 00132 00138 #define EC_LIT(X) #X 00139 00145 #define EC_STR(X) EC_LIT(X) 00146 00154 #define EC_SYSFS_READ_ATTR(NAME) \ 00155 static struct attribute attr_##NAME = { \ 00156 .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO \ 00157 } 00158 00166 #define EC_SYSFS_READ_WRITE_ATTR(NAME) \ 00167 static struct attribute attr_##NAME = { \ 00168 .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO | S_IWUSR \ 00169 } 00170 00171 /*****************************************************************************/ 00172 00173 extern void ec_print_data(const uint8_t *, size_t); 00174 extern void ec_print_data_diff(const uint8_t *, const uint8_t *, size_t); 00175 extern void ec_print_states(uint8_t); 00176 00177 /*****************************************************************************/ 00178 00185 typedef struct 00186 { 00187 uint32_t code; 00188 const char *message; 00189 } 00190 ec_code_msg_t; 00191 00192 /*****************************************************************************/ 00193 00194 #endif 00195
1.4.6