Wilhelms Änderungen übernommen.
This commit is contained in:
parent
201a0b3790
commit
7dd6184f07
|
|
@ -109,7 +109,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#define DRV_NAME "8139too-ecat"
|
||||
#define DRV_NAME "8139too_ecat"
|
||||
#define DRV_VERSION "0.9.27"
|
||||
|
||||
|
||||
|
|
@ -200,8 +200,6 @@ static int ec_device_index = -1;
|
|||
|
||||
EtherCAT_device_t rtl_ecat_dev;
|
||||
|
||||
EXPORT_SYMBOL(rtl_ecat_dev);
|
||||
|
||||
/* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
|
||||
/*
|
||||
|
|
@ -1450,6 +1448,7 @@ static int rtl8139_open (struct net_device *dev)
|
|||
|
||||
/* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
|
||||
//FIXME muß das hier raus ??
|
||||
if (netif_msg_ifup(tp))
|
||||
printk(KERN_DEBUG "%s: rtl8139_open() ioaddr %#lx IRQ %d"
|
||||
" GP Pins %2.2x %s-duplex.\n",
|
||||
|
|
@ -1885,9 +1884,10 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
if (dev != rtl_ecat_dev.dev) //CHANGED HM spinlock falsch
|
||||
spin_lock_irq(&tp->lock);
|
||||
|
||||
spin_lock_irq(&tp->lock);
|
||||
/* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
RTL_W32_F (TxStatus0 + (entry * sizeof (u32)),
|
||||
tp->tx_flag | max(len, (unsigned int)ETH_ZLEN));
|
||||
|
||||
|
|
@ -1932,6 +1932,7 @@ static void rtl8139_tx_interrupt (struct net_device *dev,
|
|||
if (dev == rtl_ecat_dev.dev)
|
||||
{
|
||||
rtl_ecat_dev.tx_intr_cnt++;
|
||||
//printk("ECAT tx interrupt\n"); // HM
|
||||
rdtscl(rtl_ecat_dev.tx_time); // Get CPU cycles
|
||||
}
|
||||
|
||||
|
|
@ -2155,14 +2156,15 @@ static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp,
|
|||
/* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
|
||||
if (dev == rtl_ecat_dev.dev)
|
||||
{
|
||||
rtl_ecat_dev.rx_intr_cnt++;
|
||||
rdtscl(rtl_ecat_dev.rx_time); // Get CPU cycles
|
||||
{
|
||||
rtl_ecat_dev.rx_intr_cnt++;
|
||||
rdtscl(rtl_ecat_dev.rx_time); // Get CPU cycles
|
||||
}
|
||||
|
||||
/* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
|
||||
while (netif_running(dev) && received < budget
|
||||
while ((dev == rtl_ecat_dev.dev || netif_running(dev)) //HM
|
||||
&& received < budget
|
||||
&& (RTL_R8 (ChipCmd) & RxBufEmpty) == 0) {
|
||||
u32 ring_offset = cur_rx % RX_BUF_LEN;
|
||||
u32 rx_status;
|
||||
|
|
@ -2179,9 +2181,9 @@ static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp,
|
|||
/* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
|
||||
if (dev != rtl_ecat_dev.dev && netif_msg_rx_status(tp))
|
||||
printk(KERN_DEBUG "%s: rtl8139_rx() status %4.4x, size %4.4x,"
|
||||
" cur %4.4x.\n", dev->name, rx_status,
|
||||
rx_size, cur_rx);
|
||||
printk(KERN_DEBUG "%s: rtl8139_rx() status %4.4x, size %4.4x,"
|
||||
" cur %4.4x.\n", dev->name, rx_status,
|
||||
rx_size, cur_rx);
|
||||
|
||||
/* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
|
||||
|
|
@ -2387,10 +2389,16 @@ int rtl8139_poll(struct net_device *dev, int *budget)
|
|||
* Order is important since data can get interrupted
|
||||
* again when we think we are done.
|
||||
*/
|
||||
/* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
if (dev != rtl_ecat_dev.dev) {
|
||||
/* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
local_irq_disable();
|
||||
RTL_W16_F(IntrMask, rtl8139_intr_mask);
|
||||
RTL_W16_F(IntrMask, rtl8139_intr_mask); //Interrupts werden nicht enabled ?? HM
|
||||
__netif_rx_complete(dev);
|
||||
local_irq_enable();
|
||||
}
|
||||
// else
|
||||
|
||||
}
|
||||
spin_unlock(&tp->rx_lock);
|
||||
|
||||
|
|
@ -2414,6 +2422,7 @@ irqreturn_t rtl8139_interrupt (int irq, void *dev_instance,
|
|||
if (dev == rtl_ecat_dev.dev)
|
||||
{
|
||||
rtl_ecat_dev.intr_cnt++;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2425,8 +2434,11 @@ irqreturn_t rtl8139_interrupt (int irq, void *dev_instance,
|
|||
status = RTL_R16 (IntrStatus);
|
||||
|
||||
/* shared irq? */
|
||||
if (unlikely((status & rtl8139_intr_mask) == 0))
|
||||
/* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
if (dev != rtl_ecat_dev.dev)
|
||||
if (unlikely((status & rtl8139_intr_mask) == 0))
|
||||
goto out;
|
||||
/* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
|
||||
handled = 1;
|
||||
|
||||
|
|
@ -2435,27 +2447,39 @@ irqreturn_t rtl8139_interrupt (int irq, void *dev_instance,
|
|||
goto out;
|
||||
|
||||
/* close possible race's with dev_close */
|
||||
if (unlikely(!netif_running(dev))) {
|
||||
/* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
if (dev != rtl_ecat_dev.dev) {
|
||||
if (unlikely(!netif_running(dev))) {
|
||||
RTL_W16 (IntrMask, 0);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
/* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
/* Acknowledge all of the current interrupt sources ASAP, but
|
||||
an first get an additional status bit from CSCR. */
|
||||
if (unlikely(status & RxUnderrun))
|
||||
link_changed = RTL_R16 (CSCR) & CSCR_LinkChangeBit;
|
||||
|
||||
ackstat = status & ~(RxAckBits | TxErr);
|
||||
if (ackstat)
|
||||
if (ackstat) {
|
||||
RTL_W16 (IntrStatus, ackstat);
|
||||
//printk("ECAT-NIC ack\n"); //HM
|
||||
}
|
||||
|
||||
/* Receive packets are processed by poll routine.
|
||||
If not running start it now. */
|
||||
|
||||
/* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
if (status & RxAckBits){
|
||||
// printk("ECAT-NIC RX-Intr Flag\n"); // HM
|
||||
if (dev != rtl_ecat_dev.dev) {
|
||||
if (netif_rx_schedule_prep(dev)) {
|
||||
RTL_W16_F (IntrMask, rtl8139_norx_intr_mask);
|
||||
__netif_rx_schedule (dev);
|
||||
RTL_W16_F (IntrMask, rtl8139_norx_intr_mask);
|
||||
__netif_rx_schedule (dev);
|
||||
}
|
||||
}
|
||||
// else
|
||||
|
||||
}
|
||||
|
||||
/* Check uncommon events with one test. */
|
||||
|
|
@ -2508,20 +2532,17 @@ static int rtl8139_close (struct net_device *dev)
|
|||
if (dev != rtl_ecat_dev.dev)
|
||||
{
|
||||
netif_stop_queue(dev);
|
||||
}
|
||||
|
||||
/* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
|
||||
if (tp->thr_pid >= 0) {
|
||||
if (tp->thr_pid >= 0) {
|
||||
tp->time_to_die = 1;
|
||||
wmb();
|
||||
ret = kill_proc (tp->thr_pid, SIGTERM, 1);
|
||||
if (ret) {
|
||||
printk (KERN_ERR "%s: unable to signal thread\n", dev->name);
|
||||
return ret;
|
||||
printk (KERN_ERR "%s: unable to signal thread\n", dev->name);
|
||||
return ret;
|
||||
}
|
||||
wait_for_completion (&tp->thr_exited);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
|
||||
|
|
@ -2534,7 +2555,10 @@ static int rtl8139_close (struct net_device *dev)
|
|||
|
||||
/* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
|
||||
spin_lock_irqsave (&tp->lock, flags);
|
||||
/* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
if (dev != rtl_ecat_dev.dev)
|
||||
/* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
spin_lock_irqsave (&tp->lock, flags);
|
||||
|
||||
/* Stop the chip's Tx and Rx DMA processes. */
|
||||
RTL_W8 (ChipCmd, 0);
|
||||
|
|
@ -2546,7 +2570,10 @@ static int rtl8139_close (struct net_device *dev)
|
|||
tp->stats.rx_missed_errors += RTL_R32 (RxMissed);
|
||||
RTL_W32 (RxMissed, 0);
|
||||
|
||||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
/* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
if (dev != rtl_ecat_dev.dev)
|
||||
/* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
spin_unlock_irqrestore (&tp->lock, flags);
|
||||
|
||||
/* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
|
||||
|
|
@ -2974,3 +3001,5 @@ static void __exit rtl8139_cleanup_module (void)
|
|||
|
||||
module_init(rtl8139_init_module);
|
||||
module_exit(rtl8139_cleanup_module);
|
||||
|
||||
EXPORT_SYMBOL(rtl_ecat_dev);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
*
|
||||
***************************************************************/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/netdevice.h>
|
||||
|
|
@ -159,8 +160,6 @@ int EtherCAT_device_open(EtherCAT_device_t *ecd)
|
|||
return ecd->dev->open(ecd->dev);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(EtherCAT_device_open);
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
/**
|
||||
|
|
@ -189,8 +188,6 @@ int EtherCAT_device_close(EtherCAT_device_t *ecd)
|
|||
return ecd->dev->stop(ecd->dev);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(EtherCAT_device_close);
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
/**
|
||||
|
|
@ -301,13 +298,16 @@ void EtherCAT_device_call_isr(EtherCAT_device_t *ecd)
|
|||
budget = 1; /* Einen Frame empfangen */
|
||||
|
||||
rtl8139_interrupt(0, ecd->dev, NULL);
|
||||
ecd->dev->quota = 1;
|
||||
rtl8139_poll(ecd->dev, &budget);
|
||||
|
||||
/* HM
|
||||
if (budget != 0)
|
||||
{
|
||||
EC_DBG(KERN_ERR "EtherCAT: Warning - Budget is %d!\n",
|
||||
budget);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
|
|
@ -346,6 +346,10 @@ void EtherCAT_device_debug(EtherCAT_device_t *ecd)
|
|||
EC_DBG(KERN_DEBUG "---EtherCAT device information end---\n");
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
EXPORT_SYMBOL(EtherCAT_device_open);
|
||||
EXPORT_SYMBOL(EtherCAT_device_close);
|
||||
EXPORT_SYMBOL(EtherCAT_device_clear);
|
||||
EXPORT_SYMBOL(EtherCAT_device_debug);
|
||||
|
||||
/***************************************************************/
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
*
|
||||
***************************************************************/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/slab.h>
|
||||
|
|
@ -52,8 +53,6 @@ int EtherCAT_master_init(EtherCAT_master_t *master,
|
|||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(EtherCAT_master_init);
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
/**
|
||||
|
|
@ -79,8 +78,6 @@ void EtherCAT_master_clear(EtherCAT_master_t *master)
|
|||
master->process_data_length = 0;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(EtherCAT_master_clear);
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
/**
|
||||
|
|
@ -98,20 +95,30 @@ int EtherCAT_simple_send_receive(EtherCAT_master_t *master,
|
|||
{
|
||||
unsigned int tries_left;
|
||||
|
||||
// EC_DBG("ECAT send...\n"); //HM
|
||||
|
||||
if (EtherCAT_simple_send(master, cmd) < 0) return -1;
|
||||
|
||||
// EC_DBG("ECAT call isr \n"); //HM
|
||||
udelay(3); //FIXME nur zum Test HM
|
||||
|
||||
EtherCAT_device_call_isr(master->dev);
|
||||
|
||||
tries_left = 1000;
|
||||
tries_left = 100;
|
||||
while (master->dev->state == ECAT_DS_SENT && tries_left)
|
||||
{
|
||||
udelay(1);
|
||||
// EC_DBG("ECAT call isr \n"); //HM
|
||||
EtherCAT_device_call_isr(master->dev);
|
||||
tries_left--;
|
||||
}
|
||||
|
||||
// EC_DBG("ECAT recieve \n"); //HM
|
||||
|
||||
if (EtherCAT_simple_receive(master, cmd) < 0) return -1;
|
||||
|
||||
// EC_DBG("ECAT recieve done\n"); //HM
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -502,8 +509,6 @@ int EtherCAT_check_slaves(EtherCAT_master_t *master,
|
|||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(EtherCAT_check_slaves);
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
/**
|
||||
|
|
@ -635,7 +640,11 @@ int EtherCAT_state_change(EtherCAT_master_t *master,
|
|||
|
||||
if (cmd.working_counter != 1)
|
||||
{
|
||||
EC_DBG(KERN_ERR "EtherCAT: Could not set state %02X - Device did not respond!\n", state_and_ack);
|
||||
EC_DBG(KERN_ERR "EtherCAT: Could not set state %02X - Device \"%s %s\" (%d) did not respond!\n",
|
||||
state_and_ack,
|
||||
slave->desc->vendor_name,
|
||||
slave->desc->product_name,
|
||||
slave->ring_position*(-1));
|
||||
return -3;
|
||||
}
|
||||
|
||||
|
|
@ -928,8 +937,6 @@ int EtherCAT_activate_all_slaves(EtherCAT_master_t *master)
|
|||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(EtherCAT_activate_all_slaves);
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
/**
|
||||
|
|
@ -958,8 +965,6 @@ int EtherCAT_deactivate_all_slaves(EtherCAT_master_t *master)
|
|||
return ret;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(EtherCAT_deactivate_all_slaves);
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
/**
|
||||
|
|
@ -988,8 +993,6 @@ int EtherCAT_write_process_data(EtherCAT_master_t *master)
|
|||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(EtherCAT_write_process_data);
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
/**
|
||||
|
|
@ -1010,7 +1013,7 @@ int EtherCAT_read_process_data(EtherCAT_master_t *master)
|
|||
|
||||
EtherCAT_device_call_isr(master->dev);
|
||||
|
||||
tries_left = 1000;
|
||||
tries_left = 100;
|
||||
while (master->dev->state == ECAT_DS_SENT && tries_left)
|
||||
{
|
||||
udelay(1);
|
||||
|
|
@ -1043,8 +1046,6 @@ int EtherCAT_read_process_data(EtherCAT_master_t *master)
|
|||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(EtherCAT_read_process_data);
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
/**
|
||||
|
|
@ -1059,8 +1060,6 @@ void EtherCAT_clear_process_data(EtherCAT_master_t *master)
|
|||
master->dev->state = ECAT_DS_READY;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(EtherCAT_clear_process_data);
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
/**
|
||||
|
|
@ -1097,3 +1096,12 @@ void output_debug_data(const EtherCAT_master_t *master)
|
|||
}
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
EXPORT_SYMBOL(EtherCAT_master_init);
|
||||
EXPORT_SYMBOL(EtherCAT_master_clear);
|
||||
EXPORT_SYMBOL(EtherCAT_read_process_data);
|
||||
EXPORT_SYMBOL(EtherCAT_write_process_data);
|
||||
EXPORT_SYMBOL(EtherCAT_check_slaves);
|
||||
EXPORT_SYMBOL(EtherCAT_activate_all_slaves);
|
||||
EXPORT_SYMBOL(EtherCAT_clear_process_data);
|
||||
EXPORT_SYMBOL(EtherCAT_deactivate_all_slaves);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
***************************************************************/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#include "ec_globals.h"
|
||||
#include "ec_slave.h"
|
||||
|
|
@ -112,8 +112,6 @@ int EtherCAT_read_value(EtherCAT_slave_t *slave,
|
|||
return slave->desc->read(slave->process_data, channel);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(EtherCAT_read_value);
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
/**
|
||||
|
|
@ -164,6 +162,7 @@ void EtherCAT_write_value(EtherCAT_slave_t *slave,
|
|||
slave->desc->write(slave->process_data, channel, value);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(EtherCAT_write_value);
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
EXPORT_SYMBOL(EtherCAT_write_value);
|
||||
EXPORT_SYMBOL(EtherCAT_read_value);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
*
|
||||
***************************************************************/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
||||
#include "ec_globals.h"
|
||||
#include "ec_types.h"
|
||||
|
||||
|
|
@ -78,7 +80,6 @@ EtherCAT_slave_desc_t Beckhoff_EK1100[] =
|
|||
0, 0,
|
||||
NULL, NULL
|
||||
}};
|
||||
EXPORT_SYMBOL(Beckhoff_EK1100);
|
||||
|
||||
EtherCAT_slave_desc_t Beckhoff_EL1014[] =
|
||||
{{
|
||||
|
|
@ -89,7 +90,6 @@ EtherCAT_slave_desc_t Beckhoff_EL1014[] =
|
|||
1, 4,
|
||||
read_1014, NULL
|
||||
}};
|
||||
EXPORT_SYMBOL(Beckhoff_EL1014);
|
||||
|
||||
EtherCAT_slave_desc_t Beckhoff_EL2004[] =
|
||||
{{
|
||||
|
|
@ -100,7 +100,6 @@ EtherCAT_slave_desc_t Beckhoff_EL2004[] =
|
|||
1, 4,
|
||||
NULL, write_2004
|
||||
}};
|
||||
EXPORT_SYMBOL(Beckhoff_EL2004);
|
||||
|
||||
EtherCAT_slave_desc_t Beckhoff_EL3102[] =
|
||||
{{
|
||||
|
|
@ -111,7 +110,6 @@ EtherCAT_slave_desc_t Beckhoff_EL3102[] =
|
|||
6, 2,
|
||||
read_31xx, NULL
|
||||
}};
|
||||
EXPORT_SYMBOL(Beckhoff_EL3102);
|
||||
|
||||
EtherCAT_slave_desc_t Beckhoff_EL3162[] =
|
||||
{{
|
||||
|
|
@ -122,7 +120,6 @@ EtherCAT_slave_desc_t Beckhoff_EL3162[] =
|
|||
6, 2,
|
||||
read_31xx, NULL
|
||||
}};
|
||||
EXPORT_SYMBOL(Beckhoff_EL3162);
|
||||
|
||||
EtherCAT_slave_desc_t Beckhoff_EL4102[] =
|
||||
{{
|
||||
|
|
@ -133,7 +130,6 @@ EtherCAT_slave_desc_t Beckhoff_EL4102[] =
|
|||
4, 2,
|
||||
NULL, write_4102
|
||||
}};
|
||||
EXPORT_SYMBOL(Beckhoff_EL4102);
|
||||
|
||||
EtherCAT_slave_desc_t Beckhoff_EL5001[] =
|
||||
{{
|
||||
|
|
@ -144,7 +140,6 @@ EtherCAT_slave_desc_t Beckhoff_EL5001[] =
|
|||
0, 0,
|
||||
NULL, NULL
|
||||
}};
|
||||
EXPORT_SYMBOL(Beckhoff_EL5001);
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
|
|
@ -162,3 +157,11 @@ struct slave_ident slave_idents[] =
|
|||
};
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
EXPORT_SYMBOL(Beckhoff_EK1100);
|
||||
EXPORT_SYMBOL(Beckhoff_EL1014);
|
||||
EXPORT_SYMBOL(Beckhoff_EL2004);
|
||||
EXPORT_SYMBOL(Beckhoff_EL3102);
|
||||
EXPORT_SYMBOL(Beckhoff_EL3162);
|
||||
EXPORT_SYMBOL(Beckhoff_EL4102);
|
||||
EXPORT_SYMBOL(Beckhoff_EL5001);
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@
|
|||
*
|
||||
***************************************************************/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
||||
#ifndef _EC_TYPES_H_
|
||||
#define _EC_TYPES_H_
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ else
|
|||
CONFIG_FILE = ../ethercat.conf
|
||||
PWD = $(shell pwd)
|
||||
|
||||
|
||||
include $(CONFIG_FILE) # Für KERNELDIR
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include <linux/module.h>
|
||||
//#include <linux/slab.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/timer.h>
|
||||
|
||||
#include "../drivers/ec_master.h"
|
||||
|
|
@ -44,22 +46,21 @@ static EtherCAT_slave_t ecat_slaves[] =
|
|||
ECAT_INIT_SLAVE(Beckhoff_EL4102),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL3162),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL1014),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL2004),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL3102),
|
||||
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL4102),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL4102),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL4102),
|
||||
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL3162),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL3162),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL3162),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL3102),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL3102),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL2004),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL2004),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL2004),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL2004),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL3102),
|
||||
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
// Block 2
|
||||
ECAT_INIT_SLAVE(Beckhoff_EK1100),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL4102),
|
||||
|
|
@ -67,6 +68,11 @@ static EtherCAT_slave_t ecat_slaves[] =
|
|||
ECAT_INIT_SLAVE(Beckhoff_EL3162),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL2004),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL3102),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL2004),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL2004),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL2004),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL2004),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL2004),
|
||||
|
||||
// Block 3
|
||||
ECAT_INIT_SLAVE(Beckhoff_EK1100),
|
||||
|
|
@ -82,6 +88,7 @@ static EtherCAT_slave_t ecat_slaves[] =
|
|||
ECAT_INIT_SLAVE(Beckhoff_EL1014),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL1014),
|
||||
ECAT_INIT_SLAVE(Beckhoff_EL1014)
|
||||
#endif
|
||||
};
|
||||
|
||||
#define ECAT_SLAVES_COUNT (sizeof(ecat_slaves) / sizeof(EtherCAT_slave_t))
|
||||
|
|
@ -92,6 +99,7 @@ static EtherCAT_slave_t ecat_slaves[] =
|
|||
|
||||
#ifdef ECAT_CYCLIC_DATA
|
||||
|
||||
int value;
|
||||
int dig1;
|
||||
|
||||
struct timer_list timer;
|
||||
|
|
@ -152,7 +160,7 @@ static void run(unsigned long data)
|
|||
static unsigned long int k = 0;
|
||||
static int firstrun = 1;
|
||||
|
||||
static int klemme = 12;
|
||||
static int klemme = 0;
|
||||
static int kanal = 0;
|
||||
static int up_down = 0;
|
||||
int wrap = 0;
|
||||
|
|
@ -174,14 +182,15 @@ static void run(unsigned long data)
|
|||
// Prozessdaten lesen
|
||||
if (!firstrun)
|
||||
{
|
||||
klemme = next2004(&wrap);
|
||||
|
||||
EtherCAT_read_process_data(ecat_master);
|
||||
|
||||
// Daten lesen und skalieren
|
||||
//value = EtherCAT_read_value(&ecat_master->slaves[5], 0) / 3276.7;
|
||||
dig1 = EtherCAT_read_value(&ecat_master->slaves[3], 0);
|
||||
// value = EtherCAT_read_value(&ecat_master->slaves[5], 0) / 3276; //.7; FIXME kein FP im Kernel ohne Schutz !!
|
||||
// dig1 = EtherCAT_read_value(&ecat_master->slaves[3], 0);
|
||||
}
|
||||
else
|
||||
klemme = next2004(&wrap);
|
||||
|
||||
|
||||
#if 0
|
||||
// Daten schreiben
|
||||
|
|
@ -208,8 +217,10 @@ static void run(unsigned long data)
|
|||
}
|
||||
}
|
||||
|
||||
if (klemme >= 0)
|
||||
if (klemme >= 0) {
|
||||
EtherCAT_write_value(&ecat_master->slaves[klemme], kanal,up_down);
|
||||
//printk("ECAT write: Klemme: %d, Kanal: %d, Wert: %d\n",klemme,kanal,up_down);
|
||||
}
|
||||
|
||||
#if 0
|
||||
EtherCAT_write_value(&ecat_master->slaves[13], 1, ms > 500 ? 0 : 1);
|
||||
|
|
@ -223,7 +234,7 @@ static void run(unsigned long data)
|
|||
firstrun = 0;
|
||||
#endif
|
||||
|
||||
timer.expires += HZ / 100;
|
||||
timer.expires += HZ / 1000;
|
||||
add_timer(&timer);
|
||||
}
|
||||
|
||||
|
|
@ -308,11 +319,14 @@ int __init init_module()
|
|||
#ifdef ECAT_CYCLIC_DATA
|
||||
EC_DBG("Starting cyclic sample thread.\n");
|
||||
|
||||
schedule();
|
||||
mdelay(1000);
|
||||
schedule();
|
||||
init_timer(&timer);
|
||||
|
||||
timer.function = run;
|
||||
timer.data = 0;
|
||||
timer.expires = jiffies; // Das erste Mal sofort feuern
|
||||
timer.expires = jiffies+10; // Das erste Mal sofort feuern
|
||||
last_start_jiffies = timer.expires;
|
||||
add_timer(&timer);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue