Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ lcec-objs := \
lcec_deasda.o \
lcec_dems300.o \
lcec_omrg5.o \
lcec_ph3lm2rm.o

lcec_ph3lm2rm.o \
lcec_epocat.o
1 change: 1 addition & 0 deletions src/lcec.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ do { \
#define LCEC_DELTA_VID 0x000001dd
#define LCEC_MODUSOFT_VID 0x00000907
#define LCEC_OMRON_VID 0x00000083
#define LCEC_ABET_VID 0x0000079A

// State update period (ns)
#define LCEC_STATE_UPDATE_PERIOD 1000000000LL
Expand Down
3 changes: 3 additions & 0 deletions src/lcec_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ static const LCEC_CONF_TYPELIST_T slaveTypes[] = {
// modusoft PH3LM2RM converter
{ "Ph3LM2RM", lcecSlaveTypePh3LM2RM, NULL },

// AB&T EpoCAT FR4000
{ "EpoCAT", lcecSlaveTypeEpoCAT, NULL },

{ NULL }
};

Expand Down
3 changes: 2 additions & 1 deletion src/lcec_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ typedef enum {
lcecSlaveTypeOmrG5_KN50F,
lcecSlaveTypeOmrG5_KN75F,
lcecSlaveTypeOmrG5_KN150F,
lcecSlaveTypePh3LM2RM
lcecSlaveTypePh3LM2RM,
lcecSlaveTypeEpoCAT
} LCEC_SLAVE_TYPE_T;

typedef struct {
Expand Down
768 changes: 768 additions & 0 deletions src/lcec_epocat.c

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions src/lcec_epocat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// Copyright (C) 2014 Sascha Ittner <sascha.ittner@modusoft.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
#ifndef _LCEC_EPOCAT_H_
#define _LCEC_EPOCAT_H_

#include "lcec.h"

#define LCEC_EPOCAT_PID 0x00decade

#define LCEC_EPOCAT_PDOS 15

int lcec_epocat_init(int comp_id, struct lcec_slave *slave, ec_pdo_entry_reg_t *pdo_entry_regs);

#endif

4 changes: 4 additions & 0 deletions src/lcec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#include "lcec_dems300.h"
#include "lcec_omrg5.h"
#include "lcec_ph3lm2rm.h"
#include "lcec_epocat.h"

#include "rtapi_app.h"

Expand Down Expand Up @@ -264,6 +265,9 @@ static const lcec_typelist_t types[] = {
// modusoft PH3LM2RM converter
{ lcecSlaveTypePh3LM2RM, LCEC_PH3LM2RM_VID, LCEC_PH3LM2RM_PID, LCEC_PH3LM2RM_PDOS, 0, NULL, lcec_ph3lm2rm_init},

// AB&T EpoCAT FR4000
{ lcecSlaveTypeEpoCAT, LCEC_ABET_VID, LCEC_EPOCAT_PID, LCEC_EPOCAT_PDOS, 0, NULL, lcec_epocat_init },

{ lcecSlaveTypeInvalid }
};

Expand Down
40 changes: 32 additions & 8 deletions src/realtime.mk
Original file line number Diff line number Diff line change
@@ -1,24 +1,48 @@
include ../config.mk
include Kbuild

include $(MODINC)
cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
> /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)

.PHONY: all clean install

ifeq ($(BUILDSYS),kbuild)

# dirty workaround to get the RTAI directory
RTAIINCDIR = $(subst /rtai.h,,$(firstword $(wildcard $(foreach i,$(subst -I,,$(filter -I%,$(RTFLAGS))), $(i)/rtai.h))))
ifneq ($(RTAIINCDIR),)
RTAIDIR = $(realpath $(RTAIINCDIR)/..)
module = $(patsubst %.o,%.ko,$(obj-m))

ifeq (,$(findstring -Wframe-larger-than=,$(EXTRA_CFLAGS)))
EXTRA_CFLAGS += $(call cc-option,-Wframe-larger-than=2560)
endif

all:
$(module):
$(MAKE) EXTRA_CFLAGS="$(EXTRA_CFLAGS)" KBUILD_EXTRA_SYMBOLS="$(RTLIBDIR)/Module.symvers $(RTAIDIR)/modules/ethercat/Module.symvers" -C $(KERNELDIR) SUBDIRS=`pwd` CC=$(CC) V=0 modules

clean::
rm -f $(obj-m)
rm -f *.mod.c .*.cmd
rm -f modules.order Module.symvers
rm -rf .tmp_versions

else

LDFLAGS += -Wl,-rpath,$(LIBDIR) -L$(LIBDIR) -llinuxcnchal -lethercat
module = $(patsubst %.o,%.so,$(obj-m))

EXTRA_CFLAGS := $(filter-out -Wframe-larger-than=%,$(EXTRA_CFLAGS))

all: modules
$(module): $(lcec-objs)
$(CC) -shared -o $@ $(lcec-objs) -Wl,-rpath,$(LIBDIR) -L$(LIBDIR) -llinuxcnchal -lethercat -lrt

%.o: %.c
$(CC) -o $@ $(EXTRA_CFLAGS) -Os -c $<

endif

all: $(module)

clean::
rm -f $(module)
rm -f $(lcec-objs)

install: $(module)
mkdir -p $(DESTDIR)$(RTLIBDIR)
cp $(module) $(DESTDIR)$(RTLIBDIR)/