fp@1744: /****************************************************************************** fp@1744: * fp@1744: * $Id$ fp@1744: * fp@1744: * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH fp@1744: * fp@1744: * This file is part of the IgH EtherCAT Master. fp@1744: * fp@1744: * The IgH EtherCAT Master is free software; you can redistribute it fp@1744: * and/or modify it under the terms of the GNU General Public License fp@1744: * as published by the Free Software Foundation; either version 2 of the fp@1744: * License, or (at your option) any later version. fp@1744: * fp@1744: * The IgH EtherCAT Master is distributed in the hope that it will be fp@1744: * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of fp@1744: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the fp@1744: * GNU General Public License for more details. fp@1744: * fp@1744: * You should have received a copy of the GNU General Public License fp@1744: * along with the IgH EtherCAT Master; if not, write to the Free Software fp@1744: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA fp@1744: * fp@1744: * The right to use EtherCAT Technology is granted and comes free of fp@1744: * charge under condition of compatibility of product made by fp@1744: * Licensee. People intending to distribute/sell products based on the fp@1744: * code, have to sign an agreement to guarantee that products using fp@1744: * software based on IgH EtherCAT master stay compatible with the actual fp@1744: * EtherCAT specification (which are released themselves as an open fp@1744: * standard) as the (only) precondition to have the right to use EtherCAT fp@1744: * Technology, IP and trade marks. fp@1744: * fp@1744: *****************************************************************************/ fp@1744: fp@1744: /** fp@1744: \file fp@1744: Dummy EtherCAT master driver module. fp@1744: */ fp@1744: fp@1744: /*****************************************************************************/ fp@1744: fp@1744: #include fp@1744: //#include fp@1744: //#include fp@1744: fp@1744: #include "../master/globals.h" fp@1744: #include "../include/ecrt.h" fp@1744: fp@1744: /*****************************************************************************/ fp@1744: fp@1744: int __init ec_init_module(void); fp@1744: void __exit ec_cleanup_module(void); fp@1744: fp@1744: char *ec_master_version_str = EC_MASTER_VERSION; fp@1744: fp@1744: /*****************************************************************************/ fp@1744: fp@1744: /** \cond */ fp@1744: fp@1744: MODULE_AUTHOR("Florian Pose "); fp@1744: MODULE_DESCRIPTION("DUMMY EtherCAT master driver module"); fp@1744: MODULE_LICENSE("GPL"); fp@1744: MODULE_VERSION(EC_MASTER_VERSION); fp@1744: fp@1744: /** \endcond */ fp@1744: fp@1744: /*****************************************************************************/ fp@1744: fp@1744: #define DUMMY_SIZE (PAGE_SIZE * 8) fp@1744: fp@1744: uint8_t dummy_data[DUMMY_SIZE]; fp@1744: off_t dummy_off = 0; fp@1744: fp@1744: uint8_t *get_dummy_data(void) fp@1744: { fp@1744: off_t cur = dummy_off; fp@1744: fp@1744: dummy_off += 64; fp@1744: dummy_off %= DUMMY_SIZE; fp@1744: fp@1744: return dummy_data + cur; fp@1744: } fp@1744: fp@1744: /*****************************************************************************/ fp@1744: fp@1744: /** fp@1744: * Module initialization. fp@1744: * Initializes \a ec_master_count masters. fp@1744: * \return 0 on success, else < 0 fp@1744: */ fp@1744: fp@1744: int __init ec_init_module(void) fp@1744: { fp@1744: EC_INFO("Master DUMMY driver %s\n", EC_MASTER_VERSION); fp@1744: fp@1744: memset(dummy_data, 0x00, DUMMY_SIZE); fp@1744: fp@1744: return 0; fp@1744: } fp@1744: fp@1744: /*****************************************************************************/ fp@1744: fp@1744: /** fp@1744: Module cleanup. fp@1744: Clears all master instances. fp@1744: */ fp@1744: fp@1744: void __exit ec_cleanup_module(void) fp@1744: { fp@1744: EC_INFO("Master DUMMY module cleaned up.\n"); fp@1744: } fp@1744: fp@1744: /****************************************************************************** fp@1744: * Realtime interface fp@1744: *****************************************************************************/ fp@1744: fp@1744: unsigned int ecrt_version_magic(void) fp@1744: { fp@1744: return ECRT_VERSION_MAGIC; fp@1744: } fp@1744: fp@1744: /*****************************************************************************/ fp@1744: fp@1744: ec_master_t *ecrt_request_master(unsigned int master_index fp@1744: /**< master index */ fp@1744: ) fp@1744: { fp@1744: EC_INFO("Requesting DUMMY master %u...\n", master_index); fp@1744: return (void *) master_index + 1; fp@1744: } fp@1744: fp@1744: /*****************************************************************************/ fp@1744: fp@1744: /** fp@1744: Releases a reserved EtherCAT master. fp@1744: \ingroup RealtimeInterface fp@1744: */ fp@1744: fp@1744: void ecrt_release_master(ec_master_t *master /**< EtherCAT master */) fp@1744: { fp@1744: EC_INFO("Released DUMMY master %u.\n", (unsigned int) master - 1); fp@1744: } fp@1744: fp@1744: /*****************************************************************************/ fp@1744: fp@1744: /** \cond */ fp@1744: fp@1744: module_init(ec_init_module); fp@1744: module_exit(ec_cleanup_module); fp@1744: fp@1744: EXPORT_SYMBOL(ecrt_request_master); fp@1744: EXPORT_SYMBOL(ecrt_release_master); fp@1744: EXPORT_SYMBOL(ecrt_version_magic); fp@1744: fp@1744: /** \endcond */ fp@1744: fp@1744: /*****************************************************************************/