-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
linuxcnc
committed
Jan 28, 2015
1 parent
eaccd00
commit ba0b6e6
Showing
48 changed files
with
9,014 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
all: | ||
$(MAKE) -C src all | ||
|
||
clean: | ||
$(MAKE) -C src realclean | ||
|
||
install: | ||
$(MAKE) -C src install-rt install-user | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- (Re-)testing/Documentation of all devices | ||
- option --enable-ethercat for configure script | ||
- DOC: don't use EL9010 | ||
- Debug EL5151/EL5152/EL2521 Subindex does not exist | ||
- DOC: Parameter A60/A61 Stoeber |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
linuxcnc-ethercat (0.9.0-1) unstable; urgency=low | ||
|
||
* Initial release | ||
|
||
-- Sascha Ittner <sascha.ittner@modusoft.de> Mon, 12 Jan 2015 10:19:04 +0100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Source: linuxcnc-ethercat | ||
Section: unknown | ||
Priority: extra | ||
Maintainer: linuxcnc <linuxcnc@localhost.localdomain> | ||
Build-Depends: debhelper (>= 8.0.0), linuxcnc-dev, etherlabmaster-dev | ||
Standards-Version: 3.9.3 | ||
|
||
Package: linuxcnc-ethercat | ||
Architecture: any | ||
Depends: ${shlibs:Depends}, ${misc:Depends}, linuxcnc, etherlabmaster | ||
Description: LinuxCNC EtherCAT HAL driver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||
Upstream-Name: linuxcnc-ethercat | ||
Source: <https://github.com/sittner/linuxcnc-ethercat> | ||
|
||
Files: * | ||
Copyright: 2015 Sascha Ittner <sascha.ittner@modusoft.de> | ||
License: GPL-2.0+ | ||
|
||
Files: debian/* | ||
Copyright: 2015 Sascha Ittner <sascha.ittner@modusoft.de> | ||
License: GPL-2.0+ | ||
|
||
License: GPL-2.0+ | ||
This package 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 package 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, see <http://www.gnu.org/licenses/> | ||
. | ||
On Debian systems, the complete text of the GNU General | ||
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". | ||
|
||
# Please also look if there are files or directories which have a | ||
# different copyright/license attached and list them here. | ||
# Please avoid to pick license terms that are more restrictive than the | ||
# packaged work, as it may make Debian's contributions unacceptable upstream. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/make -f | ||
# -*- makefile -*- | ||
# Sample debian/rules that uses debhelper. | ||
# This file was originally written by Joey Hess and Craig Small. | ||
# As a special exception, when this file is copied by dh-make into a | ||
# dh-make output file, you may use that output file without restriction. | ||
# This special exception was added by Craig Small in version 0.37 of dh-make. | ||
|
||
# Uncomment this to turn on verbose mode. | ||
#export DH_VERBOSE=1 | ||
|
||
%: | ||
dh $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
MODINC=$(shell comp --print-modinc) | ||
|
||
all: rt user | ||
|
||
realclean: | ||
rm -f rm *.ko *.mod.c *.o .*.cmd | ||
rm -f modules.order Module.symvers | ||
rm -rf .tmp_versions | ||
rm -f lcec_conf | ||
|
||
obj-m += lcec.o | ||
lcec-objs := \ | ||
lcec_main.o \ | ||
lcec_generic.o \ | ||
lcec_el1xxx.o \ | ||
lcec_el2521.o \ | ||
lcec_el2xxx.o \ | ||
lcec_el31x2.o \ | ||
lcec_el40x1.o \ | ||
lcec_el40x2.o \ | ||
lcec_el41x2.o \ | ||
lcec_el5101.o \ | ||
lcec_el5151.o \ | ||
lcec_el5152.o \ | ||
lcec_el7342.o \ | ||
lcec_el95xx.o \ | ||
lcec_em7004.o \ | ||
lcec_stmds5k.o \ | ||
lcec_deasda.o \ | ||
$(MATHSTUB) | ||
|
||
include $(MODINC) | ||
|
||
user: lcec_conf | ||
|
||
lcec_conf: lcec_conf.c | ||
gcc $(EXTRA_CFLAGS) -Wframe-larger-than=16384 -URTAPI -U__MODULE__ -DULAPI -Os -o $@ $< -Wl,-rpath,$(LIBDIR) -L$(LIBDIR) -llinuxcnchal -lexpat | ||
|
||
install-user: | ||
mkdir -p $(DESTDIR)$(EMC2_HOME)/bin | ||
cp lcec_conf $(DESTDIR)$(EMC2_HOME)/bin | ||
|
||
rt: | ||
$(MAKE) KBUILD_EXTRA_SYMBOLS="$(RTLIBDIR)/Module.symvers $(RTLIBDIR)/../ethercat/Module.symvers" -C $(KERNELDIR) SUBDIRS=`pwd` CC=$(CC) V=0 modules | ||
|
||
install-rt: | ||
mkdir -p $(DESTDIR)$(RTLIBDIR) | ||
$(MAKE) install | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
// | ||
// Copyright (C) 2011 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_H_ | ||
#define _LCEC_H_ | ||
|
||
#include "lcnc_rtapi.h" | ||
|
||
#include "hal.h" | ||
|
||
#include "rtapi.h" | ||
#include "rtapi_ctype.h" | ||
#include "rtapi_app.h" | ||
#include "rtapi_string.h" | ||
#include "rtapi_math.h" | ||
|
||
#include "ecrt.h" | ||
#include "lcec_conf.h" | ||
|
||
// list macros | ||
#define LCEC_LIST_APPEND(first, last, item) \ | ||
do { \ | ||
(item)->prev = (last); \ | ||
if ((item)->prev != NULL) { \ | ||
(item)->prev->next = (item); \ | ||
} else { \ | ||
(first) = (item); \ | ||
} \ | ||
(last) = (item); \ | ||
} while (0); \ | ||
|
||
// pdo macros | ||
#define LCEC_PDO_INIT(pdo, pos, vid, pid, idx, sidx, off, bpos) \ | ||
do { \ | ||
pdo->position = pos; \ | ||
pdo->vendor_id = vid; \ | ||
pdo->product_code = pid; \ | ||
pdo->index = idx; \ | ||
pdo->subindex = sidx; \ | ||
pdo->offset = off; \ | ||
pdo->bit_position = bpos; \ | ||
pdo++; \ | ||
} while (0); \ | ||
|
||
#define LCEC_MSG_PFX "LCEC: " | ||
|
||
// vendor ids | ||
#define LCEC_BECKHOFF_VID 0x00000002 | ||
#define LCEC_STOEBER_VID 0x000000b9 | ||
#define LCEC_DELTA_VID 0x000001dd | ||
|
||
// SDO request timeout (ms) | ||
#define LCEC_SDO_REQ_TIMEOUT 1000 | ||
|
||
struct lcec_master; | ||
struct lcec_slave; | ||
|
||
typedef int (*lcec_slave_init_t) (int comp_id, struct lcec_slave *slave, ec_pdo_entry_reg_t *pdo_entry_regs); | ||
typedef void (*lcec_slave_cleanup_t) (struct lcec_slave *slave); | ||
typedef void (*lcec_slave_rw_t) (struct lcec_slave *slave, long period); | ||
|
||
typedef struct lcec_master_data { | ||
hal_u32_t *slaves_responding; | ||
hal_bit_t *state_init; | ||
hal_bit_t *state_preop; | ||
hal_bit_t *state_safeop; | ||
hal_bit_t *state_op; | ||
hal_bit_t *link_up; | ||
hal_bit_t *all_op; | ||
} lcec_master_data_t; | ||
|
||
typedef struct lcec_slave_state { | ||
hal_bit_t *online; | ||
hal_bit_t *operational; | ||
hal_bit_t *state_init; | ||
hal_bit_t *state_preop; | ||
hal_bit_t *state_safeop; | ||
hal_bit_t *state_op; | ||
} lcec_slave_state_t; | ||
|
||
typedef struct lcec_master { | ||
struct lcec_master *prev; | ||
struct lcec_master *next; | ||
int index; | ||
char name[LCEC_CONF_STR_MAXLEN]; | ||
ec_master_t *master; | ||
unsigned long mutex; | ||
int pdo_entry_count; | ||
ec_pdo_entry_reg_t *pdo_entry_regs; | ||
ec_domain_t *domain; | ||
uint8_t *process_data; | ||
int process_data_len; | ||
struct lcec_slave *first_slave; | ||
struct lcec_slave *last_slave; | ||
lcec_master_data_t *hal_data; | ||
uint64_t app_time; | ||
uint32_t app_time_period; | ||
int sync_ref_cnt; | ||
int sync_ref_cycles; | ||
} lcec_master_t; | ||
|
||
typedef struct { | ||
uint16_t assignActivate; | ||
uint32_t sync0Cycle; | ||
uint32_t sync0Shift; | ||
uint32_t sync1Cycle; | ||
uint32_t sync1Shift; | ||
} lcec_slave_dc_t; | ||
|
||
typedef struct { | ||
uint16_t divider; | ||
uint16_t intervals; | ||
} lcec_slave_watchdog_t; | ||
|
||
typedef struct { | ||
uint16_t index; | ||
int16_t subindex; | ||
size_t length; | ||
uint8_t data[]; | ||
} lcec_slave_sdoconf_t; | ||
|
||
typedef struct lcec_slave { | ||
struct lcec_slave *prev; | ||
struct lcec_slave *next; | ||
struct lcec_master *master; | ||
int index; | ||
char name[LCEC_CONF_STR_MAXLEN]; | ||
uint32_t vid; | ||
uint32_t pid; | ||
int pdo_entry_count; | ||
ec_sync_info_t *sync_info; | ||
ec_slave_config_t *config; | ||
ec_slave_config_state_t state; | ||
lcec_slave_dc_t *dc_conf; | ||
lcec_slave_watchdog_t *wd_conf; | ||
lcec_slave_init_t proc_init; | ||
lcec_slave_cleanup_t proc_cleanup; | ||
lcec_slave_rw_t proc_read; | ||
lcec_slave_rw_t proc_write; | ||
lcec_slave_state_t *hal_state_data; | ||
void *hal_data; | ||
ec_pdo_entry_info_t *generic_pdo_entries; | ||
ec_pdo_info_t *generic_pdos; | ||
ec_sync_info_t *generic_sync_managers; | ||
lcec_slave_sdoconf_t *sdo_config; | ||
} lcec_slave_t; | ||
|
||
ec_sdo_request_t *lcec_read_sdo(struct lcec_slave *slave, uint16_t index, uint8_t subindex, size_t size); | ||
|
||
#endif | ||
|
Oops, something went wrong.