Debug interfaces not compiled by default.
This commit is contained in:
parent
57dbce8626
commit
d916522200
|
|
@ -3,5 +3,6 @@
|
|||
set -x
|
||||
mkdir -p autoconf
|
||||
aclocal -I autoconf
|
||||
autoheader
|
||||
automake --add-missing
|
||||
autoconf
|
||||
|
|
|
|||
32
configure.ac
32
configure.ac
|
|
@ -2,10 +2,13 @@
|
|||
# $Id$
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT([ethercat],[1.1],[fp@igh-essen.com])
|
||||
AC_CONFIG_AUX_DIR([autoconf])
|
||||
AC_PREFIX_DEFAULT([/opt/etherlab])
|
||||
AM_INIT_AUTOMAKE([-Wall -Werror foreign dist-bzip2])
|
||||
AC_PREFIX_DEFAULT([/opt/etherlab])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_SRCDIR([config.h.in])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Linux sources
|
||||
|
|
@ -48,12 +51,33 @@ if test -z "$DEPMOD"; then
|
|||
AC_MSG_WARN([depmod was not found!]);
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Debug interface
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE([debug-if],
|
||||
AS_HELP_STRING([--enable-dbg-if],
|
||||
[Create a debug interface for each master @<:@NO@:>@]),
|
||||
[case "${enableval}" in
|
||||
yes) dbg=1
|
||||
AC_DEFINE([EC_DBG_IF], [1], [Debug interfaces enabled])
|
||||
;;
|
||||
no) dbg=0
|
||||
;;
|
||||
*) AC_MSG_ERROR([Invalid value for --enable-dbg-if])
|
||||
;;
|
||||
esac],
|
||||
[dbg=0]
|
||||
)
|
||||
AM_CONDITIONAL(EC_DBG_IF, test "x$dbg" = x1)
|
||||
AC_SUBST([EC_DBG_IF],${dbg})
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
master/Makefile
|
||||
devices/Makefile
|
||||
Makefile
|
||||
master/Makefile
|
||||
devices/Makefile
|
||||
script/Makefile
|
||||
include/Makefile
|
||||
examples/mini/Makefile
|
||||
|
|
|
|||
|
|
@ -38,7 +38,11 @@
|
|||
obj-m := ec_master.o
|
||||
|
||||
ec_master-objs := module.o master.o device.o slave.o datagram.o \
|
||||
domain.o mailbox.o ethernet.o debug.o fsm.o xmldev.o
|
||||
domain.o mailbox.o ethernet.o fsm.o xmldev.o
|
||||
|
||||
ifeq ($(EC_DBG_IF),1)
|
||||
ec_master-objs += debug.o
|
||||
endif
|
||||
|
||||
REV := $(shell if test -s $(src)/../svnrevision; then \
|
||||
cat $(src)/../svnrevision; \
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ EXTRA_DIST = \
|
|||
xmldev.c xmldev.h
|
||||
|
||||
all:
|
||||
$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules
|
||||
$(MAKE) -C "$(LINUX_SOURCE_DIR)" \
|
||||
M="@abs_srcdir@" EC_DBG_IF="$(EC_DBG_IF)" modules
|
||||
|
||||
clean-local:
|
||||
$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
|
||||
|
|
|
|||
|
|
@ -71,14 +71,20 @@ int ec_device_init(ec_device_t *device, /**< EtherCAT device */
|
|||
device->open = 0;
|
||||
device->link_state = 0; // down
|
||||
|
||||
#ifdef EC_DBG_IF
|
||||
if (ec_debug_init(&device->dbg)) {
|
||||
EC_ERR("Failed to init debug device!\n");
|
||||
goto out_return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!(device->tx_skb = dev_alloc_skb(ETH_FRAME_LEN))) {
|
||||
EC_ERR("Error allocating device socket buffer!\n");
|
||||
#ifdef EC_DBG_IF
|
||||
goto out_debug;
|
||||
#else
|
||||
goto out_return;
|
||||
#endif
|
||||
}
|
||||
|
||||
device->tx_skb->dev = net_dev;
|
||||
|
|
@ -92,8 +98,10 @@ int ec_device_init(ec_device_t *device, /**< EtherCAT device */
|
|||
|
||||
return 0;
|
||||
|
||||
#ifdef EC_DBG_IF
|
||||
out_debug:
|
||||
ec_debug_clear(&device->dbg);
|
||||
#endif
|
||||
out_return:
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -108,7 +116,9 @@ void ec_device_clear(ec_device_t *device /**< EtherCAT device */)
|
|||
{
|
||||
if (device->open) ec_device_close(device);
|
||||
if (device->tx_skb) dev_kfree_skb(device->tx_skb);
|
||||
#ifdef EC_DBG_IF
|
||||
ec_debug_clear(&device->dbg);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -201,7 +211,9 @@ void ec_device_send(ec_device_t *device, /**< EtherCAT device */
|
|||
ec_print_data(device->tx_skb->data + ETH_HLEN, size);
|
||||
}
|
||||
|
||||
#ifdef EC_DBG_IF
|
||||
ec_debug_send(&device->dbg, device->tx_skb->data, ETH_HLEN + size);
|
||||
#endif
|
||||
|
||||
// start sending
|
||||
device->dev->hard_start_xmit(device->tx_skb, device->dev);
|
||||
|
|
@ -243,7 +255,9 @@ void ecdev_receive(ec_device_t *device, /**< EtherCAT device */
|
|||
data + ETH_HLEN, size - ETH_HLEN);
|
||||
}
|
||||
|
||||
#ifdef EC_DBG_IF
|
||||
ec_debug_send(&device->dbg, data, size);
|
||||
#endif
|
||||
|
||||
ec_master_receive_datagrams(device->master,
|
||||
data + ETH_HLEN,
|
||||
|
|
|
|||
|
|
@ -46,7 +46,10 @@
|
|||
#include "../include/ecrt.h"
|
||||
#include "../devices/ecdev.h"
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef EC_DBG_IF
|
||||
#include "debug.h"
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -65,7 +68,9 @@ struct ec_device
|
|||
ec_isr_t isr; /**< pointer to the device's interrupt service routine */
|
||||
struct module *module; /**< pointer to the device's owning module */
|
||||
uint8_t link_state; /**< device link state */
|
||||
#ifdef EC_DBG_IF
|
||||
ec_debug_t dbg; /**< debug device */
|
||||
#endif
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@
|
|||
|
||||
#include <linux/types.h>
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
/******************************************************************************
|
||||
* EtherCAT master
|
||||
*****************************************************************************/
|
||||
|
|
|
|||
Loading…
Reference in New Issue