mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-02-07 04:11:50 +08:00
Merge branch 'devel-1.6' into prepare-1.6
This commit is contained in:
@@ -15,6 +15,12 @@ build:
|
||||
- ./configure --with-linux-dir=/usr/src/linux-obj/$(uname -i)/default --enable-tty --with-devices=2 --enable-ccat
|
||||
- make -j8 all modules
|
||||
- make DISTCHECK_CONFIGURE_FLAGS="--with-linux-dir=/usr/src/linux-obj/$(uname -i)/default" distcheck
|
||||
- make dist
|
||||
- mkdir test_dist && cd test_dist && tar xzf ../ethercat-*.tar.gz && cd ethercat-*/
|
||||
- mkdir build && cd build
|
||||
- ../configure --with-linux-dir=/usr/src/linux-obj/$(uname -i)/default --disable-8139too --enable-tty --with-devices=2 --enable-ccat
|
||||
- make -j8 all modules
|
||||
|
||||
|
||||
# Build ethercat tool subcommand help output for documentation
|
||||
commands:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# ```
|
||||
# include $(top_srcdir)/Makefile.kbuild
|
||||
# ```
|
||||
KBUILD = $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="$(abs_srcdir)" INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)"
|
||||
KBUILD = $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="$(abs_builddir)" INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)"
|
||||
|
||||
|
||||
modules:
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
src := @abs_srcdir@
|
||||
ccflags-y := -I@abs_top_builddir@
|
||||
|
||||
REV := $(shell if test -s $(src)/../revision; then \
|
||||
cat $(src)/../revision; \
|
||||
else \
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
src := @abs_srcdir@
|
||||
ccflags-y := -I@abs_top_builddir@
|
||||
|
||||
TOPDIR := $(src)/../..
|
||||
|
||||
ifeq (@ENABLE_CCAT@,1)
|
||||
|
||||
@@ -23,8 +23,14 @@
|
||||
include $(top_srcdir)/Makefile.kbuild
|
||||
|
||||
EXTRA_DIST = \
|
||||
gpio.c \
|
||||
module.c \
|
||||
module.h \
|
||||
netdev.c \
|
||||
netdev.h \
|
||||
update.h
|
||||
sram.c \
|
||||
update.h \
|
||||
update.c
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
src := @abs_srcdir@
|
||||
ccflags-y := -I@abs_top_builddir@
|
||||
|
||||
TOPDIR := $(src)/../..
|
||||
|
||||
REV := $(shell if test -s $(TOPDIR)/revision; then \
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
src := @abs_srcdir@
|
||||
ccflags-y := -I@abs_top_builddir@
|
||||
|
||||
TOPDIR := $(src)/../..
|
||||
|
||||
REV := $(shell if test -s $(TOPDIR)/revision; then \
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
src := @abs_srcdir@
|
||||
ccflags-y := -I@abs_top_builddir@
|
||||
|
||||
TOPDIR := $(src)/../..
|
||||
|
||||
REV := $(shell if test -s $(TOPDIR)/revision; then \
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
src := @abs_srcdir@
|
||||
ccflags-y := -I@abs_top_builddir@
|
||||
|
||||
obj-m := ec_dc_rtai_sample.o
|
||||
|
||||
ec_dc_rtai_sample-objs := dc_rtai_sample.o
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
src := @abs_srcdir@
|
||||
|
||||
obj-m := ec_mini.o
|
||||
|
||||
ec_mini-objs := mini.o
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
src := @abs_srcdir@
|
||||
ccflags-y := -I@abs_top_builddir@
|
||||
|
||||
obj-m := ec_rtai_sample.o
|
||||
|
||||
ec_rtai_sample-objs := rtai_sample.o
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
src := @abs_srcdir@
|
||||
ccflags-y := -I@abs_top_builddir@
|
||||
|
||||
obj-m := ec_tty_example.o
|
||||
|
||||
ec_tty_example-objs := \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006-2023 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
* Copyright (C) 2006-2024 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
* This file is part of the IgH EtherCAT master userspace library.
|
||||
*
|
||||
@@ -42,6 +42,12 @@
|
||||
* e.g. in RTAI/Xenomai Real-Time tasks or in atomic/softirq/tasklet
|
||||
* context in kernel modules. You have been warned.
|
||||
*
|
||||
* Changes in version 1.6.0:
|
||||
*
|
||||
* - Added the ecrt_master_scan_progress() method, the
|
||||
* ec_master_scan_progress_t structure and the EC_HAVE_SCAN_PROGRESS
|
||||
* definition to check for its existence.
|
||||
*
|
||||
* Changes since version 1.5.2:
|
||||
*
|
||||
* - Added the ecrt_slave_config_flag() method and the EC_HAVE_FLAGS
|
||||
@@ -232,6 +238,11 @@
|
||||
*/
|
||||
#define EC_HAVE_SOE_REQUESTS
|
||||
|
||||
/** Defined, if the method ecrt_master_scan_progress() and the
|
||||
* ec_master_scan_progress_t sttucture are available.
|
||||
*/
|
||||
#define EC_HAVE_SCAN_PROGRESS
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Symbol visibility control macro.
|
||||
@@ -394,6 +405,21 @@ typedef struct {
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Master scan progress information.
|
||||
*
|
||||
* This is used as an output parameter of ecrt_master_scan_progress().
|
||||
*
|
||||
* \see ecrt_master_scan_progress().
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int slave_count; /**< Number of slaves detected. */
|
||||
unsigned int scan_index; /**< Index of the slave that is currently scanned.
|
||||
If it is less than the \a slave_count, the
|
||||
network scan is in progress. */
|
||||
} ec_master_scan_progress_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** EtherCAT slave port descriptor.
|
||||
*/
|
||||
typedef enum {
|
||||
@@ -789,6 +815,20 @@ EC_PUBLIC_API int ecrt_master(
|
||||
information */
|
||||
);
|
||||
|
||||
/** Obtains network scan progress information.
|
||||
*
|
||||
* No memory is allocated on the heap in this function.
|
||||
*
|
||||
* \attention The pointer to this structure must point to a valid variable.
|
||||
*
|
||||
* \return 0 in case of success, else < 0
|
||||
*/
|
||||
int ecrt_master_scan_progress(
|
||||
ec_master_t *master, /**< EtherCAT master */
|
||||
ec_master_scan_progress_t *progress /**< Structure that will output
|
||||
the progress information. */
|
||||
);
|
||||
|
||||
/** Obtains slave information.
|
||||
*
|
||||
* Tries to find the slave with the given ring position. The obtained
|
||||
|
||||
20
lib/master.c
20
lib/master.c
@@ -245,6 +245,26 @@ int ecrt_master(ec_master_t *master, ec_master_info_t *master_info)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int ecrt_master_scan_progress(ec_master_t *master,
|
||||
ec_master_scan_progress_t *progress)
|
||||
{
|
||||
ec_ioctl_master_t data;
|
||||
int ret;
|
||||
|
||||
ret = ioctl(master->fd, EC_IOCTL_MASTER, &data);
|
||||
if (EC_IOCTL_IS_ERROR(ret)) {
|
||||
fprintf(stderr, "Failed to get master info: %s\n",
|
||||
strerror(EC_IOCTL_ERRNO(ret)));
|
||||
return -EC_IOCTL_ERRNO(ret);
|
||||
}
|
||||
|
||||
progress->slave_count = data.slave_count;
|
||||
progress->scan_index = data.scan_index;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int ecrt_master_get_slave(ec_master_t *master, uint16_t slave_position,
|
||||
ec_slave_info_t *slave_info)
|
||||
{
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
src := @abs_srcdir@
|
||||
ccflags-y := -I@abs_top_builddir@
|
||||
|
||||
obj-m := ec_master.o
|
||||
|
||||
ec_master-objs := \
|
||||
|
||||
@@ -33,6 +33,7 @@ noinst_HEADERS = \
|
||||
domain.c domain.h \
|
||||
doxygen.c \
|
||||
ethernet.c ethernet.h \
|
||||
flag.c flag.h \
|
||||
fmmu_config.c fmmu_config.h \
|
||||
foe.h \
|
||||
foe_request.c foe_request.h \
|
||||
|
||||
@@ -333,6 +333,7 @@ void ec_fsm_master_state_broadcast(
|
||||
ec_device_index_t dev_idx;
|
||||
|
||||
master->scan_busy = 1;
|
||||
master->scan_index = 0;
|
||||
up(&master->scan_sem);
|
||||
|
||||
// clear all slaves and scan the bus
|
||||
@@ -836,6 +837,7 @@ void ec_fsm_master_state_clear_addresses(
|
||||
ec_device_names[fsm->dev_idx != 0]);
|
||||
ec_datagram_print_state(datagram);
|
||||
master->scan_busy = 0;
|
||||
master->scan_index = master->slave_count;
|
||||
wake_up_interruptible(&master->scan_queue);
|
||||
ec_fsm_master_restart(fsm);
|
||||
return;
|
||||
@@ -879,6 +881,7 @@ void ec_fsm_master_state_dc_measure_delays(
|
||||
" on %s link: ", ec_device_names[fsm->dev_idx != 0]);
|
||||
ec_datagram_print_state(datagram);
|
||||
master->scan_busy = 0;
|
||||
master->scan_index = master->slave_count;
|
||||
wake_up_interruptible(&master->scan_queue);
|
||||
ec_fsm_master_restart(fsm);
|
||||
return;
|
||||
@@ -901,6 +904,7 @@ void ec_fsm_master_state_dc_measure_delays(
|
||||
|
||||
// begin scanning of slaves
|
||||
fsm->slave = master->slaves;
|
||||
master->scan_index = 0;
|
||||
EC_MASTER_DBG(master, 1, "Scanning slave %u on %s link.\n",
|
||||
fsm->slave->ring_position,
|
||||
ec_device_names[fsm->slave->device_index != 0]);
|
||||
@@ -946,6 +950,7 @@ void ec_fsm_master_state_scan_slave(
|
||||
|
||||
// another slave to fetch?
|
||||
fsm->slave++;
|
||||
master->scan_index++;
|
||||
if (fsm->slave < master->slaves + master->slave_count) {
|
||||
EC_MASTER_DBG(master, 1, "Scanning slave %u on %s link.\n",
|
||||
fsm->slave->ring_position,
|
||||
@@ -960,6 +965,7 @@ void ec_fsm_master_state_scan_slave(
|
||||
(jiffies - fsm->scan_jiffies) * 1000 / HZ);
|
||||
|
||||
master->scan_busy = 0;
|
||||
master->scan_index = master->slave_count;
|
||||
wake_up_interruptible(&master->scan_queue);
|
||||
|
||||
ec_master_calc_dc(master);
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*/
|
||||
|
||||
/** \file
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* ---
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -120,6 +118,7 @@ static ATTRIBUTES int ec_ioctl_master(
|
||||
}
|
||||
|
||||
io.slave_count = master->slave_count;
|
||||
io.scan_index = master->scan_index;
|
||||
io.config_count = ec_master_config_count(master);
|
||||
io.domain_count = ec_master_domain_count(master);
|
||||
#ifdef EC_EOE
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
*
|
||||
* Increment this when changing the ioctl interface!
|
||||
*/
|
||||
#define EC_IOCTL_VERSION_MAGIC 33
|
||||
#define EC_IOCTL_VERSION_MAGIC 34
|
||||
|
||||
// Command-line tool
|
||||
#define EC_IOCTL_MODULE EC_IOR(0x00, ec_ioctl_module_t)
|
||||
@@ -169,6 +169,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
uint32_t slave_count;
|
||||
uint32_t scan_index;
|
||||
uint32_t config_count;
|
||||
uint32_t domain_count;
|
||||
uint32_t eoe_handler_count;
|
||||
|
||||
@@ -186,6 +186,7 @@ int ec_master_init(ec_master_t *master, /**< EtherCAT master */
|
||||
master->dc_ref_time = 0ULL;
|
||||
|
||||
master->scan_busy = 0;
|
||||
master->scan_index = 0;
|
||||
master->allow_scan = 1;
|
||||
sema_init(&master->scan_sem, 1);
|
||||
init_waitqueue_head(&master->scan_queue);
|
||||
@@ -2629,6 +2630,19 @@ int ecrt_master(ec_master_t *master, ec_master_info_t *master_info)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int ecrt_master_scan_progress(ec_master_t *master,
|
||||
ec_master_scan_progress_t *progress)
|
||||
{
|
||||
EC_MASTER_DBG(master, 1, "ecrt_master_scan_progress(master = 0x%p,"
|
||||
" progress = 0x%p)\n", master, progress);
|
||||
|
||||
progress->slave_count = master->slave_count;
|
||||
progress->scan_index = master->scan_index;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int ecrt_master_get_slave(ec_master_t *master, uint16_t slave_position,
|
||||
ec_slave_info_t *slave_info)
|
||||
{
|
||||
@@ -3252,6 +3266,7 @@ EXPORT_SYMBOL(ecrt_master_send_ext);
|
||||
EXPORT_SYMBOL(ecrt_master_receive);
|
||||
EXPORT_SYMBOL(ecrt_master_callbacks);
|
||||
EXPORT_SYMBOL(ecrt_master);
|
||||
EXPORT_SYMBOL(ecrt_master_scan_progress);
|
||||
EXPORT_SYMBOL(ecrt_master_get_slave);
|
||||
EXPORT_SYMBOL(ecrt_master_slave_config);
|
||||
EXPORT_SYMBOL(ecrt_master_select_reference_clock);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006-2012 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
* Copyright (C) 2006-2024 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
* This file is part of the IgH EtherCAT Master.
|
||||
*
|
||||
@@ -36,9 +34,7 @@
|
||||
#include <linux/timer.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/kthread.h>
|
||||
|
||||
#include <linux/rtmutex.h>
|
||||
#include <linux/semaphore.h>
|
||||
|
||||
#include "device.h"
|
||||
#include "domain.h"
|
||||
@@ -235,6 +231,7 @@ struct ec_master {
|
||||
ec_slave_t *dc_ref_clock; /**< DC reference clock slave. */
|
||||
|
||||
unsigned int scan_busy; /**< Current scan state. */
|
||||
unsigned int scan_index; /**< Index of slave currently scanned. */
|
||||
unsigned int allow_scan; /**< \a True, if slave scanning is allowed. */
|
||||
struct semaphore scan_sem; /**< Semaphore protecting the \a scan_busy
|
||||
variable and the \a allow_scan flag. */
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
src := @abs_srcdir@
|
||||
ccflags-y := -I@abs_top_builddir@
|
||||
|
||||
obj-m := ec_tty.o
|
||||
|
||||
ec_tty-objs := \
|
||||
|
||||
Reference in New Issue
Block a user