--- a/devices/ccat/module.h Thu Jun 09 13:52:22 2016 +0200
+++ b/devices/ccat/module.h Fri Jan 13 16:47:27 2017 +0100
@@ -29,7 +29,7 @@
#include "../ecdev.h"
#define DRV_EXTRAVERSION "-ec"
-#define DRV_VERSION "0.14" DRV_EXTRAVERSION
+#define DRV_VERSION "0.15" DRV_EXTRAVERSION
#define DRV_DESCRIPTION "Beckhoff CCAT Ethernet/EtherCAT Network Driver"
#undef pr_fmt
--- a/devices/ccat/netdev.c Thu Jun 09 13:52:22 2016 +0200
+++ b/devices/ccat/netdev.c Fri Jan 13 16:47:27 2017 +0100
@@ -291,7 +291,7 @@
iowrite32((u32) phys | ((phys_hi) > 0), ioaddr);
iowrite32(phys_hi, ioaddr + 4);
- pr_debug
+ pr_info
("DMA%llu mem initialized\n base: 0x%p\n start: 0x%p\n phys: 0x%09llx\n pci addr: 0x%01x%08x\n size: %llu |%llx bytes.\n",
(u64) channel, dma->base, fifo->dma.start, (u64) dma->phys,
ioread32(ioaddr + 4), ioread32(ioaddr),
@@ -749,12 +749,14 @@
static void poll_rx(struct ccat_eth_priv *const priv)
{
struct ccat_eth_fifo *const fifo = &priv->rx_fifo;
- const size_t len = fifo->ops->ready(fifo);
-
- if (len) {
+ size_t rx_per_poll = FIFO_LENGTH / 2;
+ size_t len = fifo->ops->ready(fifo);
+
+ while (len && --rx_per_poll) {
priv->receive(priv, len);
fifo->ops->add(fifo);
ccat_eth_fifo_inc(fifo);
+ len = fifo->ops->ready(fifo);
}
}
--- a/devices/generic.c Thu Jun 09 13:52:22 2016 +0200
+++ b/devices/generic.c Fri Jan 13 16:47:27 2017 +0100
@@ -212,8 +212,13 @@
return -ENOMEM;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+ ret = sock_create_kern(&init_net, PF_PACKET, SOCK_RAW,
+ htons(ETH_P_ETHERCAT), &dev->socket);
+#else
ret = sock_create_kern(PF_PACKET, SOCK_RAW, htons(ETH_P_ETHERCAT),
&dev->socket);
+#endif
if (ret) {
printk(KERN_ERR PFX "Failed to create socket (ret = %i).\n", ret);
return ret;
--- a/lib/slave_config.c Thu Jun 09 13:52:22 2016 +0200
+++ b/lib/slave_config.c Fri Jan 13 16:47:27 2017 +0100
@@ -232,8 +232,9 @@
if (ret)
return ret;
+ ecrt_slave_config_pdo_assign_clear(sc, sync_info->index);
+
if (sync_info->n_pdos && sync_info->pdos) {
- ecrt_slave_config_pdo_assign_clear(sc, sync_info->index);
for (j = 0; j < sync_info->n_pdos; j++) {
pdo_info = &sync_info->pdos[j];
@@ -243,9 +244,9 @@
if (ret)
return ret;
+ ecrt_slave_config_pdo_mapping_clear(sc, pdo_info->index);
+
if (pdo_info->n_entries && pdo_info->entries) {
- ecrt_slave_config_pdo_mapping_clear(sc, pdo_info->index);
-
for (k = 0; k < pdo_info->n_entries; k++) {
entry_info = &pdo_info->entries[k];
--- a/master/fsm_slave_config.c Thu Jun 09 13:52:22 2016 +0200
+++ b/master/fsm_slave_config.c Fri Jan 13 16:47:27 2017 +0100
@@ -1365,6 +1365,7 @@
uint32_t abs_sync_diff;
unsigned long diff_ms;
ec_sync_signal_t *sync0 = &config->dc_sync[0];
+ ec_sync_signal_t *sync1 = &config->dc_sync[1];
u64 start_time;
if (!config) { // config removed in the meantime
@@ -1420,19 +1421,19 @@
// find correct phase
if (master->has_app_time) {
u64 diff, start;
- u32 remainder;
+ u32 remainder, cycle;
diff = start_time - master->app_start_time;
- remainder = do_div(diff, sync0->cycle_time);
-
- start = start_time +
- sync0->cycle_time - remainder + sync0->shift_time;
+ cycle = sync0->cycle_time + sync1->cycle_time;
+ remainder = do_div(diff, cycle);
+
+ start = start_time + cycle - remainder + sync0->shift_time;
EC_SLAVE_DBG(slave, 1, "app_start_time=%llu\n",
master->app_start_time);
EC_SLAVE_DBG(slave, 1, " app_time=%llu\n", master->app_time);
EC_SLAVE_DBG(slave, 1, " start_time=%llu\n", start_time);
- EC_SLAVE_DBG(slave, 1, " cycle_time=%u\n", sync0->cycle_time);
+ EC_SLAVE_DBG(slave, 1, " cycle=%u\n", cycle);
EC_SLAVE_DBG(slave, 1, " shift_time=%i\n", sync0->shift_time);
EC_SLAVE_DBG(slave, 1, " remainder=%u\n", remainder);
EC_SLAVE_DBG(slave, 1, " start=%llu\n", start);
--- a/master/slave_config.c Thu Jun 09 13:52:22 2016 +0200
+++ b/master/slave_config.c Fri Jan 13 16:47:27 2017 +0100
@@ -702,8 +702,9 @@
if (ret)
return ret;
+ ecrt_slave_config_pdo_assign_clear(sc, sync_info->index);
+
if (sync_info->n_pdos && sync_info->pdos) {
- ecrt_slave_config_pdo_assign_clear(sc, sync_info->index);
for (j = 0; j < sync_info->n_pdos; j++) {
pdo_info = &sync_info->pdos[j];
@@ -713,9 +714,9 @@
if (ret)
return ret;
+ ecrt_slave_config_pdo_mapping_clear(sc, pdo_info->index);
+
if (pdo_info->n_entries && pdo_info->entries) {
- ecrt_slave_config_pdo_mapping_clear(sc, pdo_info->index);
-
for (k = 0; k < pdo_info->n_entries; k++) {
entry_info = &pdo_info->entries[k];
--- a/tty/module.c Thu Jun 09 13:52:22 2016 +0200
+++ b/tty/module.c Fri Jan 13 16:47:27 2017 +0100
@@ -337,7 +337,11 @@
to_recv = ec_tty_rx_size(tty);
if (to_recv && tty->tty) {
unsigned char *cbuf;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
+ int space = tty_prepare_flip_string(tty->tty->port, &cbuf, to_recv);
+#else
int space = tty_prepare_flip_string(tty->tty, &cbuf, to_recv);
+#endif
if (space < to_recv) {
printk(KERN_WARNING PFX "Insufficient space to_recv=%d space=%d\n",
@@ -362,7 +366,11 @@
tty->rx_read_idx =
(tty->rx_read_idx + 1) % EC_TTY_RX_BUFFER_SIZE;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
+ tty_flip_buffer_push(tty->tty->port);
+#else
tty_flip_buffer_push(tty->tty);
+#endif
}
}