Skip to content
Snippets Groups Projects
Commit 766b9892 authored by Florian Pose's avatar Florian Pose
Browse files

Added --enable-dummy; renamed EC_DBG_IF to EC_DEBUG_IF, ENABLE_DEBUG_IF

conditional.
parent f82f6324
No related branches found
No related tags found
No related merge requests found
......@@ -346,25 +346,48 @@ fi
# Debug interface
#------------------------------------------------------------------------------
AC_ARG_ENABLE([dbg-if],
AS_HELP_STRING([--enable-dbg-if],
AC_ARG_ENABLE([debug-if],
AS_HELP_STRING([--enable-debug-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])
*) AC_MSG_ERROR([Invalid value for --enable-debug-if])
;;
esac
],
[dbg=0]
)
AM_CONDITIONAL(EC_DBG_IF, test "x$dbg" = "x1")
AC_SUBST([EC_DBG_IF],${dbg})
if test "x${dbg}" = "x1"; then
AC_DEFINE([EC_DEBUG_IF], [1], [Debug interfaces enabled])
fi
AM_CONDITIONAL(ENABLE_DEBUG_IF, test "x$dbg" = "x1")
#------------------------------------------------------------------------------
# Dummy master module
#------------------------------------------------------------------------------
AC_ARG_ENABLE([dummy],
AS_HELP_STRING([--enable-dummy],
[Build the dummy master module @<:@NO@:>@]),
[
case "${enableval}" in
yes) dummy=1
;;
no) dummy=0
;;
*) AC_MSG_ERROR([Invalid value for --enable-dummy])
;;
esac
],
[dummy=0]
)
AM_CONDITIONAL(ENABLE_DUMMY, test "x$dummy" = "x1")
#------------------------------------------------------------------------------
......@@ -374,7 +397,7 @@ echo configure: creating config.kbuild...
cat > config.kbuild <<EOF
# config.kbuild - created by configure
EC_DBG_IF := ${dbg}
EC_DEBUG_IF := ${dbg}
EC_ENABLE_8139TOO := ${enable8139too}
EC_8139TOO_KERNEL := ${kernel8139too}
EC_ENABLE_E100 := ${enablee100}
......@@ -385,6 +408,7 @@ EC_ENABLE_E1000 := ${enablee1000}
EC_E1000_KERNEL := ${kernele1000}
EC_RTAI_DIR := "${rtaidir}"
EC_MSR_DIR := "${msrdir}"
EC_DUMMY := ${dummy}
EOF
#------------------------------------------------------------------------------
......
......@@ -33,16 +33,16 @@
include $(src)/../config.kbuild
obj-m := ec_dummy.o
ec_dummy-objs := module.o master.o slave.o domain.o
REV := $(shell if test -s $(src)/../svnrevision; then \
cat $(src)/../svnrevision; \
else \
svnversion $(src) 2>/dev/null || echo "unknown"; \
fi)
CFLAGS_dummy.o := -DSVNREV=$(REV)
ifeq ($(EC_DUMMY),1)
obj-m := ec_dummy.o
ec_dummy-objs := module.o master.o slave.o domain.o
CFLAGS_dummy.o := -DSVNREV=$(REV)
endif
#------------------------------------------------------------------------------
......@@ -39,11 +39,13 @@ EXTRA_DIST = \
domain.c
modules:
$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_top_srcdir@" modules
$(MAKE) -C "@abs_top_srcdir@" modules
modules_install:
mkdir -p $(DESTDIR)$(LINUX_MOD_PATH)
if ENABLE_DUMMY
cp $(srcdir)/ec_dummy.ko $(DESTDIR)$(LINUX_MOD_PATH)
endif
clean-local:
$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
......
......@@ -39,7 +39,7 @@ ec_master-objs := module.o master.o device.o pdo.o sync.o fmmu.o slave.o \
datagram.o domain.o mailbox.o canopen.o ethernet.o fsm_sii.o fsm_change.o \
fsm_coe.o fsm_mapping.o fsm_slave.o fsm_master.o xmldev.o
ifeq ($(EC_DBG_IF),1)
ifeq ($(ENABLE_DEBUG_IF),1)
ec_master-objs += debug.o
endif
......
......@@ -59,7 +59,7 @@ int ec_device_init(ec_device_t *device, /**< EtherCAT device */
{
device->master = master;
#ifdef EC_DBG_IF
#ifdef EC_DEBUG_IF
if (ec_debug_init(&device->dbg)) {
EC_ERR("Failed to init debug device!\n");
goto out_return;
......@@ -68,7 +68,7 @@ int ec_device_init(ec_device_t *device, /**< EtherCAT device */
if (!(device->tx_skb = dev_alloc_skb(ETH_FRAME_LEN))) {
EC_ERR("Error allocating device socket buffer!\n");
#ifdef EC_DBG_IF
#ifdef EC_DEBUG_IF
goto out_debug;
#else
goto out_return;
......@@ -84,7 +84,7 @@ int ec_device_init(ec_device_t *device, /**< EtherCAT device */
ec_device_detach(device); // resets remaining fields
return 0;
#ifdef EC_DBG_IF
#ifdef EC_DEBUG_IF
out_debug:
ec_debug_clear(&device->dbg);
#endif
......@@ -102,7 +102,7 @@ void ec_device_clear(ec_device_t *device /**< EtherCAT device */)
{
if (device->open) ec_device_close(device);
dev_kfree_skb(device->tx_skb);
#ifdef EC_DBG_IF
#ifdef EC_DEBUG_IF
ec_debug_clear(&device->dbg);
#endif
}
......@@ -234,7 +234,7 @@ void ec_device_send(ec_device_t *device, /**< EtherCAT device */
ec_print_data(device->tx_skb->data + ETH_HLEN, size);
}
#ifdef EC_DBG_IF
#ifdef EC_DEBUG_IF
ec_debug_send(&device->dbg, device->tx_skb->data, ETH_HLEN + size);
#endif
......@@ -283,7 +283,7 @@ void ecdev_receive(ec_device_t *device, /**< EtherCAT device */
data + ETH_HLEN, size - ETH_HLEN);
}
#ifdef EC_DBG_IF
#ifdef EC_DEBUG_IF
ec_debug_send(&device->dbg, data, size);
#endif
......
......@@ -47,7 +47,7 @@
#include "../devices/ecdev.h"
#include "globals.h"
#ifdef EC_DBG_IF
#ifdef EC_DEBUG_IF
#include "debug.h"
#endif
......@@ -73,7 +73,7 @@ struct ec_device
unsigned long jiffies_poll; /**< jiffies of last poll */
unsigned int tx_count; /**< number of frames sent */
unsigned int rx_count; /**< number of frames received */
#ifdef EC_DBG_IF
#ifdef EC_DEBUG_IF
ec_debug_t dbg; /**< debug device */
#endif
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment