# HG changeset patch # User Florian Pose # Date 1212049702 0 # Node ID d30959d74f54b49d3c79e62961985a1481d9eb85 # Parent 251e1e0d272cbff3eb9ec1efa01f8e9c8085634a Removed xmldev. diff -r 251e1e0d272c -r d30959d74f54 TODO --- a/TODO Thu May 29 08:22:27 2008 +0000 +++ b/TODO Thu May 29 08:28:22 2008 +0000 @@ -8,7 +8,6 @@ Version 1.4.0: -* Remove the xmldev files. * Replace Sysfs interface with cdev and a user space program to replace lsec; move a few sysfs attributes to proc. * Remove the end state of the master state machine. diff -r 251e1e0d272c -r d30959d74f54 master/Kbuild.in --- a/master/Kbuild.in Thu May 29 08:22:27 2008 +0000 +++ b/master/Kbuild.in Thu May 29 08:28:22 2008 +0000 @@ -59,8 +59,7 @@ sdo_request.o \ slave.o \ slave_config.o \ - sync.o \ - xmldev.o + sync.o ifeq (@ENABLE_EOE@,1) ec_master-objs += ethernet.o diff -r 251e1e0d272c -r d30959d74f54 master/module.c --- a/master/module.c Thu May 29 08:22:27 2008 +0000 +++ b/master/module.c Thu May 29 08:28:22 2008 +0000 @@ -44,7 +44,6 @@ #include "globals.h" #include "master.h" #include "device.h" -#include "xmldev.h" /*****************************************************************************/ @@ -71,9 +70,6 @@ static uint8_t macs[MAX_MASTERS][2][ETH_ALEN]; /**< MAC addresses. */ -static dev_t device_number; /**< XML character device number. */ -ec_xmldev_t xmldev; /**< XML character device. */ - char *ec_master_version_str = EC_MASTER_VERSION; /**< Version string. */ /*****************************************************************************/ @@ -123,12 +119,6 @@ goto out_put; } - if (alloc_chrdev_region(&device_number, 0, 1, "EtherCAT")) { - EC_ERR("Failed to obtain device number!\n"); - ret = -EBUSY; - goto out_del; - } - // zero MAC addresses memset(macs, 0x00, sizeof(uint8_t) * MAX_MASTERS * 2 * ETH_ALEN); @@ -136,12 +126,12 @@ for (i = 0; i < master_count; i++) { if (ec_mac_parse(macs[i][0], main_devices[i], 0)) { ret = -EINVAL; - goto out_cdev; + goto out_del; } if (i < backup_count && ec_mac_parse(macs[i][1], backup_devices[i], 1)) { ret = -EINVAL; - goto out_cdev; + goto out_del; } } @@ -150,7 +140,7 @@ GFP_KERNEL))) { EC_ERR("Failed to allocate memory for EtherCAT masters.\n"); ret = -ENOMEM; - goto out_cdev; + goto out_del; } } @@ -168,8 +158,6 @@ out_free_masters: for (i--; i >= 0; i--) ec_master_clear(&masters[i]); kfree(masters); -out_cdev: - unregister_chrdev_region(device_number, 1); out_del: kobject_del(&kobj); out_put: @@ -193,7 +181,6 @@ if (master_count) kfree(masters); - unregister_chrdev_region(device_number, 1); kobject_del(&kobj); kobject_put(&kobj); diff -r 251e1e0d272c -r d30959d74f54 master/xmldev.c --- a/master/xmldev.c Thu May 29 08:22:27 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/****************************************************************************** - * - * $Id$ - * - * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH - * - * This file is part of the IgH EtherCAT Master. - * - * The IgH EtherCAT Master 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. - * - * The IgH EtherCAT Master 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 the IgH EtherCAT Master; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * The right to use EtherCAT Technology is granted and comes free of - * charge under condition of compatibility of product made by - * Licensee. People intending to distribute/sell products based on the - * code, have to sign an agreement to guarantee that products using - * software based on IgH EtherCAT master stay compatible with the actual - * EtherCAT specification (which are released themselves as an open - * standard) as the (only) precondition to have the right to use EtherCAT - * Technology, IP and trade marks. - * - *****************************************************************************/ - -/** - \file - EtherCAT XML device. -*/ - -/*****************************************************************************/ - -#include - -#include "master.h" -#include "xmldev.h" - -/*****************************************************************************/ - -/** \cond */ - -static char *test_str = "hello world!\n"; - -int ecxmldev_open(struct inode *, struct file *); -int ecxmldev_release(struct inode *, struct file *); -ssize_t ecxmldev_read(struct file *, char __user *, size_t, loff_t *); -ssize_t ecxmldev_write(struct file *, const char __user *, size_t, loff_t *); - -/*****************************************************************************/ - -/** \cond */ - -static struct file_operations fops = { - .owner = THIS_MODULE, - .open = ecxmldev_open, - .release = ecxmldev_release, - .read = ecxmldev_read, - .write = ecxmldev_write -}; - -/** \endcond */ - -/*****************************************************************************/ - -/** - XML device constructor. - \return 0 in case of success, else < 0 -*/ - -int ec_xmldev_init(ec_xmldev_t *xmldev, /**< EtherCAT XML device */ - ec_master_t *master, /**< EtherCAT master */ - dev_t dev_num /**< device number */ - ) -{ - atomic_set(&xmldev->available, 1); - cdev_init(&xmldev->cdev, &fops); - xmldev->cdev.owner = THIS_MODULE; - if (cdev_add(&xmldev->cdev, - MKDEV(MAJOR(dev_num), master->index), 1)) { - EC_ERR("Failed to add character device!\n"); - return -1; - } - return 0; -} - -/*****************************************************************************/ - -/** - XML device destructor. -*/ - -void ec_xmldev_clear(ec_xmldev_t *xmldev /**< EtherCAT XML device */) -{ - cdev_del(&xmldev->cdev); -} - -/*****************************************************************************/ - -int ec_xmldev_request(ec_xmldev_t *xmldev, - uint32_t vendor_id, - uint32_t product_code - ) -{ - return 1; -} - -/****************************************************************************** - * file_operations - *****************************************************************************/ - -int ecxmldev_open(struct inode *inode, struct file *filp) -{ - ec_xmldev_t *xmldev; - - xmldev = container_of(inode->i_cdev, ec_xmldev_t, cdev); - - if (!atomic_dec_and_test(&xmldev->available)) { - atomic_inc(&xmldev->available); - return -EBUSY; - } - - filp->private_data = xmldev; - - EC_DBG("File opened.\n"); - - return 0; -} - -/*****************************************************************************/ - -int ecxmldev_release(struct inode *inode, struct file *filp) -{ - ec_xmldev_t *xmldev = container_of(inode->i_cdev, ec_xmldev_t, cdev); - atomic_inc(&xmldev->available); - EC_DBG("File closed.\n"); - return 0; -} - -/*****************************************************************************/ - -ssize_t ecxmldev_read(struct file *filp, char __user *buf, - size_t count, loff_t *f_pos) -{ - size_t len = strlen(test_str); - - if (*f_pos >= len) return 0; - if (*f_pos + count > len) count = len - *f_pos; - - if (copy_to_user(buf, test_str + *f_pos, count)) return -EFAULT; - - *f_pos += count; - - return count; -} - -/*****************************************************************************/ - -ssize_t ecxmldev_write(struct file *filp, - const char __user *buf, - size_t count, - loff_t *f_pos) -{ - return -EFAULT; -} - -/** \endcond */ - -/*****************************************************************************/ diff -r 251e1e0d272c -r d30959d74f54 master/xmldev.h --- a/master/xmldev.h Thu May 29 08:22:27 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/****************************************************************************** - * - * $Id$ - * - * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH - * - * This file is part of the IgH EtherCAT Master. - * - * The IgH EtherCAT Master 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. - * - * The IgH EtherCAT Master 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 the IgH EtherCAT Master; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * The right to use EtherCAT Technology is granted and comes free of - * charge under condition of compatibility of product made by - * Licensee. People intending to distribute/sell products based on the - * code, have to sign an agreement to guarantee that products using - * software based on IgH EtherCAT master stay compatible with the actual - * EtherCAT specification (which are released themselves as an open - * standard) as the (only) precondition to have the right to use EtherCAT - * Technology, IP and trade marks. - * - *****************************************************************************/ - -/** - \file - EtherCAT XML device. -*/ - -/*****************************************************************************/ - -#ifndef __EC_XMLDEV_H__ -#define __EC_XMLDEV_H__ - -#include -#include - -#include "globals.h" -#include "../include/ecrt.h" - -/*****************************************************************************/ - -/** - EtherCAT XML character device. -*/ - -typedef struct -{ - ec_master_t *master; /**< master owning the device */ - struct cdev cdev; /**< character device */ - atomic_t available; /**< allow only one open() */ -} -ec_xmldev_t; - -/*****************************************************************************/ - -/** \cond */ - -int ec_xmldev_init(ec_xmldev_t *, ec_master_t *, dev_t); -void ec_xmldev_clear(ec_xmldev_t *); - -int ec_xmldev_request(ec_xmldev_t *, uint32_t, uint32_t); - -/** \endcond */ - -/*****************************************************************************/ - -#endif diff -r 251e1e0d272c -r d30959d74f54 xmldaemon/Makefile --- a/xmldaemon/Makefile Thu May 29 08:22:27 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Makefile -# -# IgH EtherCAT master module -# -# $Id$ -# -# Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH -# -# This file is part of the IgH EtherCAT Master. -# -# The IgH EtherCAT Master 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. -# -# The IgH EtherCAT Master 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 the IgH EtherCAT Master; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# The right to use EtherCAT Technology is granted and comes free of -# charge under condition of compatibility of product made by -# Licensee. People intending to distribute/sell products based on the -# code, have to sign an agreement to guarantee that products using -# software based on IgH EtherCAT master stay compatible with the actual -# EtherCAT specification (which are released themselves as an open -# standard) as the (only) precondition to have the right to use EtherCAT -# Technology, IP and trade marks. -# -#------------------------------------------------------------------------------ - -INC := $(shell xml2-config --cflags) -LIB := $(shell xml2-config --libs) -EXE := ecxmld - -SVNREV := $(shell svnversion . || echo "unknown") -CFLAGS += -Wall -DSVNREV="$(SVNREV)" -LDFLAGS += -Wall -CC := g++ - -OBJ := pdo_entry.o pdo.o sync_manager.o slave_device.o main.o - -#------------------------------------------------------------------------------ - -all: .depend $(EXE) - -$(EXE): $(OBJ) - $(CC) $(LDFLAGS) $(OBJ) $(LIB) -o $(EXE) - -doc: - doxygen Doxyfile - -%.o: %.cpp - $(CC) -c $(CFLAGS) $(INC) $< -o $@ - -.depend depend dep: - (for file in *.cpp; do $(CC) -M $(INC) $$file; done) > .depend - -clean: - @rm -f *.o *~ $(EXE) .depend core - -#------------------------------------------------------------------------------ - -ifneq ($(wildcard .depend),) -include .depend -endif - -#------------------------------------------------------------------------------ \ No newline at end of file diff -r 251e1e0d272c -r d30959d74f54 xmldaemon/main.cpp --- a/xmldaemon/main.cpp Thu May 29 08:22:27 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,312 +0,0 @@ -/****************************************************************************** - * - * $Id$ - * - * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH - * - * This file is part of the IgH EtherCAT Master. - * - * The IgH EtherCAT Master 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. - * - * The IgH EtherCAT Master 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 the IgH EtherCAT Master; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * The right to use EtherCAT Technology is granted and comes free of - * charge under condition of compatibility of product made by - * Licensee. People intending to distribute/sell products based on the - * code, have to sign an agreement to guarantee that products using - * software based on IgH EtherCAT master stay compatible with the actual - * EtherCAT specification (which are released themselves as an open - * standard) as the (only) precondition to have the right to use EtherCAT - * Technology, IP and trade marks. - * - *****************************************************************************/ - -/** - \file - EtherCAT XML Daemon. -*/ - -/*****************************************************************************/ - -#include -#include -#include -#include - -#include - -#include -#include -using namespace std; - -#include "slave_device.hpp" - -/*****************************************************************************/ - -unsigned int sig_int_term = 0; -unsigned int sig_hangup = 0; -string xml_dir; -bool become_daemon = true; - -list slaveDevices; - -/*****************************************************************************/ - -void parse_xml_file(const char *); -void parse_info(xmlDocPtr, xmlNodePtr); -void parse_descriptions(xmlDocPtr, xmlNodePtr); -void parse_devices(xmlDocPtr, xmlNodePtr); - -void read_xml_dir(); -void set_signal_handlers(); -void get_options(int, char *[]); -void print_usage(); -void signal_handler(int); -void init_daemon(); - -/*****************************************************************************/ - -int main(int argc, char *argv[]) -{ - set_signal_handlers(); - get_options(argc, argv); - - read_xml_dir(); - - if (become_daemon) init_daemon(); - - openlog("ecxmld", LOG_PID, LOG_DAEMON); - syslog(LOG_INFO, "EtherCAT XML daemon starting up."); - - return 0; -} - -/*****************************************************************************/ - -void read_xml_dir() -{ - DIR *dir; - struct dirent *dir_ent; - string entry; - - if (!(dir = opendir(xml_dir.c_str()))) { - cerr << "ERROR: Failed to open XML directory \"" << xml_dir << "\"!" - << endl; - exit(1); - } - - while ((dir_ent = readdir(dir))) { - entry = dir_ent->d_name; - if (entry.size() < 4 - || entry.substr(entry.size() - 4) != ".xml") continue; - - parse_xml_file((xml_dir + "/" + entry).c_str()); - } - - // Verzeichnis schliessen - closedir(dir); -} - -/*****************************************************************************/ - -void parse_xml_file(const char *xml_file) -{ - xmlDocPtr doc; - xmlNodePtr cur; - - cout << xml_file << endl; - - if (!(doc = xmlParseFile(xml_file))) { - cerr << "ERROR: Parse error in document!" << endl; - return; - } - - if (!(cur = xmlDocGetRootElement(doc))) { - cout << "Empty document!" << endl; - xmlFreeDoc(doc); - return; - } - - if (xmlStrcmp(cur->name, (const xmlChar *) "EtherCATInfo")) { - cerr << "Document of the wrong type!" << endl; - xmlFreeDoc(doc); - return; - } - - parse_info(doc, cur); - xmlFreeDoc(doc); -} - -/*****************************************************************************/ - -void parse_info(xmlDocPtr doc, xmlNodePtr cur) -{ - cout << "info" << endl; - cur = cur->xmlChildrenNode; - - while (cur) { - if ((!xmlStrcmp(cur->name, (const xmlChar *) "Descriptions"))) { - parse_descriptions(doc, cur); - } - cur = cur->next; - } -} - -/*****************************************************************************/ - -void parse_descriptions(xmlDocPtr doc, xmlNodePtr cur) -{ - cout << "desc" << endl; - cur = cur->xmlChildrenNode; - - while (cur) { - if ((!xmlStrcmp(cur->name, (const xmlChar *) "Devices"))) { - parse_devices(doc, cur); - } - cur = cur->next; - } -} - -/*****************************************************************************/ - -void parse_devices(xmlDocPtr doc, xmlNodePtr cur) -{ - cout << "devices" << endl; - cur = cur->xmlChildrenNode; - - while (cur) { - if ((!xmlStrcmp(cur->name, (const xmlChar *) "Device"))) { - slaveDevices.push_back(SlaveDevice()); - slaveDevices.back().fromXml(doc, cur); - } - cur = cur->next; - } -} - -/*****************************************************************************/ - -void get_options(int argc, char *argv[]) -{ - int c; - - while (1) { - if ((c = getopt(argc, argv, "d:kh")) == -1) break; - - switch (c) { - case 'd': - xml_dir = optarg; - break; - - case 'k': - become_daemon = false; - break; - - case 'h': - print_usage(); - exit(0); - - default: - print_usage(); - exit(1); - } - } - - if (optind < argc) { - cerr << "ERROR: Too many arguments!" << endl; - print_usage(); - exit(1); - } - - if (xml_dir == "") { - cerr << "ERROR: XML directory not set!" << endl; - print_usage(); - exit(1); - } -} - -/*****************************************************************************/ - -void print_usage() -{ - cout << "Usage: ecxmld [OPTIONS]" << endl - << " -d DIR Set XML directory (MANDATORY)." << endl - << " -k Do not detach from console." << endl - << " -h Show this help." << endl; -} - -/*****************************************************************************/ - -void signal_handler(int sig) -{ - if (sig == SIGHUP) { - sig_hangup++; - } - else if (sig == SIGINT || sig == SIGTERM) { - sig_int_term++; - } -} - -/*****************************************************************************/ - -void set_signal_handlers() -{ - struct sigaction action; - - action.sa_handler = signal_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = 0; - - sigaction(SIGHUP, &action, 0); - sigaction(SIGINT, &action, 0); - sigaction(SIGTERM, &action, 0); -} - -/*****************************************************************************/ - -void init_daemon() -{ - pid_t pid; - - if ((pid = fork()) < 0) { - cerr << endl << "ERROR: fork() failed!" << endl << endl; - exit(1); - } - - if (pid) exit(0); - - if (setsid() == -1) { - cerr << "ERROR: Failed to become session leader!" << endl; - exit(1); - } - - if (chdir("/") < 0) { - cerr << "ERROR: Failed to change to file root!" << endl; - exit(1); - } - - umask(0); - - if (close(0) < 0) { - cerr << "WARNING: Failed to close STDIN!" << endl; - } - - if (close(1) < 0) { - cerr << "WARNING: Failed to close STDOUT!" << endl; - } - - if (close(2) < 0) { - cerr << "WARNING: Failed to close STDERR!" << endl; - } -} - -/*****************************************************************************/ diff -r 251e1e0d272c -r d30959d74f54 xmldaemon/pdo.cpp --- a/xmldaemon/pdo.cpp Thu May 29 08:22:27 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/****************************************************************************** - * - * $Id$ - * - * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH - * - * This file is part of the IgH EtherCAT Master. - * - * The IgH EtherCAT Master 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. - * - * The IgH EtherCAT Master 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 the IgH EtherCAT Master; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * The right to use EtherCAT Technology is granted and comes free of - * charge under condition of compatibility of product made by - * Licensee. People intending to distribute/sell products based on the - * code, have to sign an agreement to guarantee that products using - * software based on IgH EtherCAT master stay compatible with the actual - * EtherCAT specification (which are released themselves as an open - * standard) as the (only) precondition to have the right to use EtherCAT - * Technology, IP and trade marks. - * - *****************************************************************************/ - -/** - \file -*/ - -/*****************************************************************************/ - -#include -using namespace std; - -#include "pdo.hpp" - -/*****************************************************************************/ - -Pdo::Pdo() -{ -} - -/*****************************************************************************/ - -Pdo::~Pdo() -{ -} - -/*****************************************************************************/ - -void Pdo::fromXml(xmlDocPtr doc, xmlNodePtr cur) -{ - xmlChar *str; - - cout << "txpdo" << endl; - cur = cur->xmlChildrenNode; - - while (cur) { - if ((!xmlStrcmp(cur->name, (const xmlChar *) "Name"))) { - str = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); - cout << "Name: " << str << endl; - xmlFree(str); - } - else if ((!xmlStrcmp(cur->name, (const xmlChar *) "Entry"))) { - entries.push_back(PdoEntry()); - entries.back().fromXml(doc, cur); - } - cur = cur->next; - } -} - -/*****************************************************************************/ diff -r 251e1e0d272c -r d30959d74f54 xmldaemon/pdo.hpp --- a/xmldaemon/pdo.hpp Thu May 29 08:22:27 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/****************************************************************************** - * - * $Id$ - * - * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH - * - * This file is part of the IgH EtherCAT Master. - * - * The IgH EtherCAT Master 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. - * - * The IgH EtherCAT Master 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 the IgH EtherCAT Master; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * The right to use EtherCAT Technology is granted and comes free of - * charge under condition of compatibility of product made by - * Licensee. People intending to distribute/sell products based on the - * code, have to sign an agreement to guarantee that products using - * software based on IgH EtherCAT master stay compatible with the actual - * EtherCAT specification (which are released themselves as an open - * standard) as the (only) precondition to have the right to use EtherCAT - * Technology, IP and trade marks. - * - *****************************************************************************/ - -/** - \file - Slave Type. -*/ - -/*****************************************************************************/ - -#include - -#include - -#include -using namespace std; - -#include "pdo_entry.hpp" - -/*****************************************************************************/ - -class Pdo -{ - enum {Tx, Rx}; - -public: - Pdo(); - ~Pdo(); - - void fromXml(xmlDocPtr, xmlNodePtr); - -private: - int type; - string name; - uint16_t index; - list entries; -}; - -/*****************************************************************************/ diff -r 251e1e0d272c -r d30959d74f54 xmldaemon/pdo_entry.cpp --- a/xmldaemon/pdo_entry.cpp Thu May 29 08:22:27 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/****************************************************************************** - * - * $Id$ - * - * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH - * - * This file is part of the IgH EtherCAT Master. - * - * The IgH EtherCAT Master 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. - * - * The IgH EtherCAT Master 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 the IgH EtherCAT Master; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * The right to use EtherCAT Technology is granted and comes free of - * charge under condition of compatibility of product made by - * Licensee. People intending to distribute/sell products based on the - * code, have to sign an agreement to guarantee that products using - * software based on IgH EtherCAT master stay compatible with the actual - * EtherCAT specification (which are released themselves as an open - * standard) as the (only) precondition to have the right to use EtherCAT - * Technology, IP and trade marks. - * - *****************************************************************************/ - -/** - \file -*/ - -/*****************************************************************************/ - -#include -using namespace std; - -#include "pdo_entry.hpp" - -/*****************************************************************************/ - -PdoEntry::PdoEntry() -{ -} - -/*****************************************************************************/ - -PdoEntry::~PdoEntry() -{ -} - -/*****************************************************************************/ - -void PdoEntry::fromXml(xmlDocPtr doc, xmlNodePtr cur) -{ - xmlChar *str; - - cout << "entry" << endl; - cur = cur->xmlChildrenNode; - - while (cur) { - if ((!xmlStrcmp(cur->name, (const xmlChar *) "Name"))) { - str = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); - cout << "Name: " << str << endl; - xmlFree(str); - } - cur = cur->next; - } -} - -/*****************************************************************************/ diff -r 251e1e0d272c -r d30959d74f54 xmldaemon/pdo_entry.hpp --- a/xmldaemon/pdo_entry.hpp Thu May 29 08:22:27 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/****************************************************************************** - * - * $Id$ - * - * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH - * - * This file is part of the IgH EtherCAT Master. - * - * The IgH EtherCAT Master 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. - * - * The IgH EtherCAT Master 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 the IgH EtherCAT Master; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * The right to use EtherCAT Technology is granted and comes free of - * charge under condition of compatibility of product made by - * Licensee. People intending to distribute/sell products based on the - * code, have to sign an agreement to guarantee that products using - * software based on IgH EtherCAT master stay compatible with the actual - * EtherCAT specification (which are released themselves as an open - * standard) as the (only) precondition to have the right to use EtherCAT - * Technology, IP and trade marks. - * - *****************************************************************************/ - -/** - \file - Slave Type. -*/ - -/*****************************************************************************/ - -#include - -#include -using namespace std; - -#include - -/*****************************************************************************/ - -class PdoEntry -{ -public: - PdoEntry(); - ~PdoEntry(); - - void fromXml(xmlDocPtr, xmlNodePtr); - -private: - uint16_t index; - uint8_t subIndex; - uint16_t bitLength; - string name; -}; - -/*****************************************************************************/ diff -r 251e1e0d272c -r d30959d74f54 xmldaemon/slave_device.cpp --- a/xmldaemon/slave_device.cpp Thu May 29 08:22:27 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/****************************************************************************** - * - * $Id$ - * - * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH - * - * This file is part of the IgH EtherCAT Master. - * - * The IgH EtherCAT Master 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. - * - * The IgH EtherCAT Master 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 the IgH EtherCAT Master; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * The right to use EtherCAT Technology is granted and comes free of - * charge under condition of compatibility of product made by - * Licensee. People intending to distribute/sell products based on the - * code, have to sign an agreement to guarantee that products using - * software based on IgH EtherCAT master stay compatible with the actual - * EtherCAT specification (which are released themselves as an open - * standard) as the (only) precondition to have the right to use EtherCAT - * Technology, IP and trade marks. - * - *****************************************************************************/ - -/** - \file - Slave Type. -*/ - -/*****************************************************************************/ - -#include "slave_device.hpp" - -/*****************************************************************************/ - -SlaveDevice::SlaveDevice() -{ -} - -/*****************************************************************************/ - -SlaveDevice::~SlaveDevice() -{ -} - -/*****************************************************************************/ - -void SlaveDevice::fromXml(xmlDocPtr doc, xmlNodePtr cur) -{ - xmlChar *str; - - cout << "device" << endl; - cur = cur->xmlChildrenNode; - - while (cur) { - if ((!xmlStrcmp(cur->name, (const xmlChar *) "Type"))) { - str = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); - cout << "Type: " << str << endl; - xmlFree(str); - str = xmlGetProp(cur, (const xmlChar *) "ProductRevision"); - cout << "ProductRevision: " << str << endl; - xmlFree(str); - } - else if ((!xmlStrcmp(cur->name, (const xmlChar *) "Name"))) { - str = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); - cout << "Name: " << str << endl; - xmlFree(str); - } - else if ((!xmlStrcmp(cur->name, (const xmlChar *) "TxPdo"))) { - pdos.push_back(Pdo()); - pdos.back().fromXml(doc, cur); - } - else if ((!xmlStrcmp(cur->name, (const xmlChar *) "Sm"))) { - str = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); - cout << "Sm: " << str << endl; - xmlFree(str); - } - cur = cur->next; - } -} - -/*****************************************************************************/ diff -r 251e1e0d272c -r d30959d74f54 xmldaemon/slave_device.hpp --- a/xmldaemon/slave_device.hpp Thu May 29 08:22:27 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/****************************************************************************** - * - * $Id$ - * - * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH - * - * This file is part of the IgH EtherCAT Master. - * - * The IgH EtherCAT Master 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. - * - * The IgH EtherCAT Master 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 the IgH EtherCAT Master; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * The right to use EtherCAT Technology is granted and comes free of - * charge under condition of compatibility of product made by - * Licensee. People intending to distribute/sell products based on the - * code, have to sign an agreement to guarantee that products using - * software based on IgH EtherCAT master stay compatible with the actual - * EtherCAT specification (which are released themselves as an open - * standard) as the (only) precondition to have the right to use EtherCAT - * Technology, IP and trade marks. - * - *****************************************************************************/ - -/** - \file - Slave Type. -*/ - -/*****************************************************************************/ - -#include - -#include - -#include -#include -using namespace std; - -/*****************************************************************************/ - -#include "sync_manager.hpp" -#include "pdo.hpp" - -/*****************************************************************************/ - -class SlaveDevice -{ -public: - SlaveDevice(); - ~SlaveDevice(); - - void fromXml(xmlDocPtr, xmlNodePtr); - -private: - uint32_t vendorId; - uint32_t productCode; - string name; - string description; - list syncManagers; - list pdos; -}; - -/*****************************************************************************/ diff -r 251e1e0d272c -r d30959d74f54 xmldaemon/sync_manager.cpp --- a/xmldaemon/sync_manager.cpp Thu May 29 08:22:27 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/****************************************************************************** - * - * $Id$ - * - * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH - * - * This file is part of the IgH EtherCAT Master. - * - * The IgH EtherCAT Master 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. - * - * The IgH EtherCAT Master 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 the IgH EtherCAT Master; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * The right to use EtherCAT Technology is granted and comes free of - * charge under condition of compatibility of product made by - * Licensee. People intending to distribute/sell products based on the - * code, have to sign an agreement to guarantee that products using - * software based on IgH EtherCAT master stay compatible with the actual - * EtherCAT specification (which are released themselves as an open - * standard) as the (only) precondition to have the right to use EtherCAT - * Technology, IP and trade marks. - * - *****************************************************************************/ - -/** - \file -*/ - -/*****************************************************************************/ - -#include "sync_manager.hpp" - -/*****************************************************************************/ - -SyncManager::SyncManager() -{ -} - -/*****************************************************************************/ - -SyncManager::~SyncManager() -{ -} - -/*****************************************************************************/ diff -r 251e1e0d272c -r d30959d74f54 xmldaemon/sync_manager.hpp --- a/xmldaemon/sync_manager.hpp Thu May 29 08:22:27 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/****************************************************************************** - * - * $Id$ - * - * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH - * - * This file is part of the IgH EtherCAT Master. - * - * The IgH EtherCAT Master 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. - * - * The IgH EtherCAT Master 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 the IgH EtherCAT Master; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * The right to use EtherCAT Technology is granted and comes free of - * charge under condition of compatibility of product made by - * Licensee. People intending to distribute/sell products based on the - * code, have to sign an agreement to guarantee that products using - * software based on IgH EtherCAT master stay compatible with the actual - * EtherCAT specification (which are released themselves as an open - * standard) as the (only) precondition to have the right to use EtherCAT - * Technology, IP and trade marks. - * - *****************************************************************************/ - -/** - \file - Slave Type. -*/ - -/*****************************************************************************/ - -#include - -/*****************************************************************************/ - -class SyncManager -{ -public: - SyncManager(); - ~SyncManager(); - - uint16_t defaultSize; - uint16_t startAddress; - uint8_t controlByte; - bool enable; -}; - -/*****************************************************************************/