00001 /****************************************************************************** 00002 * 00003 * $Id$ 00004 * 00005 * Copyright (C) 2006-2008 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 and/or 00010 * modify it under the terms of the GNU General Public License version 2, as 00011 * published by the Free Software Foundation. 00012 * 00013 * The IgH EtherCAT Master is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 00016 * Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License along 00019 * with the IgH EtherCAT Master; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00021 * 00022 * --- 00023 * 00024 * The license mentioned above concerns the source code only. Using the 00025 * EtherCAT technology and brand is only permitted in compliance with the 00026 * industrial property and similar rights of Beckhoff Automation GmbH. 00027 * 00028 *****************************************************************************/ 00029 00035 /*****************************************************************************/ 00036 00037 #ifndef __EC_ETHERNET_H__ 00038 #define __EC_ETHERNET_H__ 00039 00040 #include <linux/list.h> 00041 #include <linux/netdevice.h> 00042 00043 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) 00044 #include <linux/semaphore.h> 00045 #else 00046 #include <asm/semaphore.h> 00047 #endif 00048 00049 #include "globals.h" 00050 #include "slave.h" 00051 #include "datagram.h" 00052 00053 /*****************************************************************************/ 00054 00059 typedef struct 00060 { 00061 struct list_head queue; 00062 struct sk_buff *skb; 00063 } 00064 ec_eoe_frame_t; 00065 00066 /*****************************************************************************/ 00067 00068 typedef struct ec_eoe ec_eoe_t; 00076 struct ec_eoe 00077 { 00078 struct list_head list; 00079 ec_slave_t *slave; 00080 ec_datagram_t datagram; 00081 unsigned int queue_datagram; 00082 void (*state)(ec_eoe_t *); 00083 struct net_device *dev; 00084 struct net_device_stats stats; 00085 unsigned int opened; 00086 unsigned long rate_jiffies; 00088 struct sk_buff *rx_skb; 00089 off_t rx_skb_offset; 00090 size_t rx_skb_size; 00091 uint8_t rx_expected_fragment; 00092 uint32_t rx_counter; 00093 uint32_t rx_rate; 00094 unsigned int rx_idle; 00096 struct list_head tx_queue; 00097 unsigned int tx_queue_size; 00098 unsigned int tx_queue_active; 00099 unsigned int tx_queued_frames; 00100 struct semaphore tx_queue_sem; 00101 ec_eoe_frame_t *tx_frame; 00102 uint8_t tx_frame_number; 00103 uint8_t tx_fragment_number; 00104 size_t tx_offset; 00105 uint32_t tx_counter; 00106 uint32_t tx_rate; 00107 unsigned int tx_idle; 00109 unsigned int tries; 00110 }; 00111 00112 /*****************************************************************************/ 00113 00114 int ec_eoe_init(ec_eoe_t *, ec_slave_t *); 00115 void ec_eoe_clear(ec_eoe_t *); 00116 void ec_eoe_run(ec_eoe_t *); 00117 void ec_eoe_queue(ec_eoe_t *); 00118 int ec_eoe_is_open(const ec_eoe_t *); 00119 int ec_eoe_is_idle(const ec_eoe_t *); 00120 00121 /*****************************************************************************/ 00122 00123 #endif 00124 00125 /*****************************************************************************/
1.5.6