globals.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  *  $Id: globals.h 517 2006-08-09 15:14:29Z 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   1
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 
00069 #define EC_IO_TIMEOUT 500
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 
00141 #define EC_LIT(X) #X
00142 
00148 #define EC_STR(X) EC_LIT(X)
00149 
00157 #define EC_SYSFS_READ_ATTR(NAME) \
00158     static struct attribute attr_##NAME = { \
00159         .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO \
00160     }
00161 
00169 #define EC_SYSFS_READ_WRITE_ATTR(NAME) \
00170     static struct attribute attr_##NAME = { \
00171         .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO | S_IWUSR \
00172     }
00173 
00174 /*****************************************************************************/
00175 
00176 void ec_print_data(const uint8_t *, size_t);
00177 void ec_print_data_diff(const uint8_t *, const uint8_t *, size_t);
00178 size_t ec_state_string(uint8_t, char *);
00179 
00180 /*****************************************************************************/
00181 
00188 typedef struct
00189 {
00190     uint32_t code; 
00191     const char *message; 
00192 }
00193 ec_code_msg_t;
00194 
00195 /*****************************************************************************/
00196 
00197 #endif

Generated on Fri Sep 1 14:56:56 2006 for IgH EtherCAT master by  doxygen 1.4.6