From 257e5cd173ab5c68f5158aecc0d072d5154b1ad1 Mon Sep 17 00:00:00 2001 From: Florian Pose <fp@igh-essen.com> Date: Wed, 3 May 2006 07:19:19 +0000 Subject: [PATCH] Using kernel Ethernet constants. --- master/device.c | 2 +- master/globals.h | 8 +------- master/master.c | 4 ++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/master/device.c b/master/device.c index 948b0f59..1a3377c5 100644 --- a/master/device.c +++ b/master/device.c @@ -61,7 +61,7 @@ int ec_device_init(ec_device_t *device, /**< EtherCAT device */ device->open = 0; device->link_state = 0; // down - if (!(device->tx_skb = dev_alloc_skb(ETH_HLEN + EC_MAX_FRAME_SIZE))) { + if (!(device->tx_skb = dev_alloc_skb(ETH_FRAME_LEN))) { EC_ERR("Error allocating device socket buffer!\n"); return -1; } diff --git a/master/globals.h b/master/globals.h index 420d7aa0..37c12b8b 100644 --- a/master/globals.h +++ b/master/globals.h @@ -53,12 +53,6 @@ * EtherCAT protocol *****************************************************************************/ -/** maximum size of an EtherCAT frame (without header and CRC) */ -#define EC_MAX_FRAME_SIZE 1500 - -/** minimum size of an EtherCAT frame (without header and CRC) */ -#define EC_MIN_FRAME_SIZE 46 - /** size of an EtherCAT frame header */ #define EC_FRAME_HEADER_SIZE 2 @@ -75,7 +69,7 @@ #define EC_FMMU_SIZE 16 /** resulting maximum data size of a single command in a frame */ -#define EC_MAX_DATA_SIZE (EC_MAX_FRAME_SIZE - EC_FRAME_HEADER_SIZE \ +#define EC_MAX_DATA_SIZE (ETH_DATA_LEN - EC_FRAME_HEADER_SIZE \ - EC_COMMAND_HEADER_SIZE - EC_COMMAND_FOOTER_SIZE) /*****************************************************************************/ diff --git a/master/master.c b/master/master.c index d3740480..f3b24173 100644 --- a/master/master.c +++ b/master/master.c @@ -287,7 +287,7 @@ void ec_master_send_commands(ec_master_t *master /**< EtherCAT master */) // does the current command fit in the frame? command_size = EC_COMMAND_HEADER_SIZE + command->data_size + EC_COMMAND_FOOTER_SIZE; - if (cur_data - frame_data + command_size > EC_MAX_FRAME_SIZE) { + if (cur_data - frame_data + command_size > ETH_DATA_LEN) { more_commands_waiting = 1; break; } @@ -332,7 +332,7 @@ void ec_master_send_commands(ec_master_t *master /**< EtherCAT master */) - EC_FRAME_HEADER_SIZE) & 0x7FF) | 0x1000); // pad frame - while (cur_data - frame_data < EC_MIN_FRAME_SIZE) + while (cur_data - frame_data < ETH_ZLEN - ETH_HLEN) EC_WRITE_U8(cur_data++, 0x00); if (unlikely(master->debug_level > 0)) -- GitLab