diff -r 5cff10efb927 -r 0d4119024f55 master/master.h --- a/master/master.h Mon Apr 24 10:47:03 2006 +0000 +++ b/master/master.h Mon May 29 09:08:56 2006 +0000 @@ -8,7 +8,8 @@ * * 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; version 2 of the 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 @@ -19,6 +20,15 @@ * 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. + * *****************************************************************************/ /** @@ -37,6 +47,7 @@ #include "device.h" #include "domain.h" +#include "fsm.h" /*****************************************************************************/ @@ -64,7 +75,6 @@ unsigned int delayed; /**< delayed commands */ unsigned int corrupted; /**< corrupted frames */ unsigned int unmatched; /**< unmatched commands */ - unsigned int eoe_errors; /**< Ethernet-over-EtherCAT errors */ cycles_t t_last; /**< time of last output */ } ec_stats_t; @@ -78,32 +88,46 @@ struct ec_master { - struct list_head list; /**< list item */ + struct list_head list; /**< list item for module's master list */ + unsigned int reserved; /**< non-zero, if the master is reserved for RT */ + unsigned int index; /**< master index */ + struct kobject kobj; /**< kobject */ - unsigned int index; /**< master index */ + struct list_head slaves; /**< list of slaves on the bus */ unsigned int slave_count; /**< number of slaves on the bus */ + ec_device_t *device; /**< EtherCAT device */ + struct list_head command_queue; /**< command queue */ uint8_t command_index; /**< current command index */ + struct list_head domains; /**< list of domains */ + ec_command_t simple_command; /**< command structure for initialization */ - ec_command_t watch_command; /**< command for watching the slaves */ - unsigned int slaves_responding; /**< number of responding slaves */ - ec_slave_state_t slave_states; /**< states of the responding slaves */ + unsigned int timeout; /**< timeout in synchronous IO */ + int debug_level; /**< master debug level */ ec_stats_t stats; /**< cyclic statistics */ - unsigned int timeout; /**< timeout in synchronous IO */ - struct list_head eoe_slaves; /**< Ethernet-over-EtherCAT slaves */ - unsigned int reserved; /**< true, if the master is reserved for RT */ - struct timer_list freerun_timer; /**< timer object for free run mode */ + + struct workqueue_struct *workqueue; /**< master workqueue */ + struct work_struct freerun_work; /**< free run work object */ + ec_fsm_t fsm; /**< master state machine */ ec_master_mode_t mode; /**< master mode */ + + struct timer_list eoe_timer; /** EoE timer object */ + unsigned int eoe_running; /**< non-zero, if EoE processing is active. */ + struct list_head eoe_handlers; /**< Ethernet-over-EtherCAT handlers */ + spinlock_t internal_lock; /**< spinlock used in freerun mode */ + int (*request_cb)(void *); /**< lock request callback */ + void (*release_cb)(void *); /**< lock release callback */ + void *cb_data; /**< data parameter of locking callbacks */ }; /*****************************************************************************/ // master creation and deletion -int ec_master_init(ec_master_t *, unsigned int); +int ec_master_init(ec_master_t *, unsigned int, unsigned int); void ec_master_clear(struct kobject *); void ec_master_reset(ec_master_t *); @@ -111,6 +135,10 @@ void ec_master_freerun_start(ec_master_t *); void ec_master_freerun_stop(ec_master_t *); +// EoE +void ec_master_eoe_start(ec_master_t *); +void ec_master_eoe_stop(ec_master_t *); + // IO void ec_master_receive(ec_master_t *, const uint8_t *, size_t); void ec_master_queue_command(ec_master_t *, ec_command_t *); @@ -120,8 +148,11 @@ int ec_master_bus_scan(ec_master_t *); // misc. +void ec_master_clear_slaves(ec_master_t *); +void ec_sync_config(const ec_sync_t *, uint8_t *); +void ec_eeprom_sync_config(const ec_eeprom_sync_t *, uint8_t *); +void ec_fmmu_config(const ec_fmmu_t *, uint8_t *); void ec_master_output_stats(ec_master_t *); -void ec_master_run_eoe(ec_master_t *); /*****************************************************************************/