Using kernel Ethernet constants.
This commit is contained in:
parent
83220ba14f
commit
94c930a5bb
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in New Issue