fp@830: /****************************************************************************** fp@830: * fp@830: * $Id$ fp@830: * fp@830: * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH fp@830: * fp@830: * This file is part of the IgH EtherCAT Master. fp@830: * fp@830: * The IgH EtherCAT Master is free software; you can redistribute it fp@830: * and/or modify it under the terms of the GNU General Public License fp@830: * as published by the Free Software Foundation; either version 2 of the fp@830: * License, or (at your option) any later version. fp@830: * fp@830: * The IgH EtherCAT Master is distributed in the hope that it will be fp@830: * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of fp@830: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the fp@830: * GNU General Public License for more details. fp@830: * fp@830: * You should have received a copy of the GNU General Public License fp@830: * along with the IgH EtherCAT Master; if not, write to the Free Software fp@830: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA fp@830: * fp@830: * The right to use EtherCAT Technology is granted and comes free of fp@830: * charge under condition of compatibility of product made by fp@830: * Licensee. People intending to distribute/sell products based on the fp@830: * code, have to sign an agreement to guarantee that products using fp@830: * software based on IgH EtherCAT master stay compatible with the actual fp@830: * EtherCAT specification (which are released themselves as an open fp@830: * standard) as the (only) precondition to have the right to use EtherCAT fp@830: * Technology, IP and trade marks. fp@830: * fp@830: *****************************************************************************/ fp@830: fp@830: /** fp@830: \file fp@830: EtherCAT slave scanning state machine. fp@830: */ fp@830: fp@830: /*****************************************************************************/ fp@830: fp@830: #ifndef __EC_FSM_SLAVE_SCAN__ fp@830: #define __EC_FSM_SLAVE_SCAN__ fp@830: fp@830: #include "../include/ecrt.h" fp@830: fp@830: #include "globals.h" fp@830: #include "datagram.h" fp@830: #include "slave.h" fp@830: #include "fsm_sii.h" fp@830: #include "fsm_change.h" fp@830: #include "fsm_coe.h" fp@830: #include "fsm_pdo_mapping.h" fp@830: #include "fsm_pdo_config.h" fp@830: fp@830: /*****************************************************************************/ fp@830: fp@830: /** \see ec_fsm_slave_scan */ fp@830: typedef struct ec_fsm_slave_scan ec_fsm_slave_scan_t; fp@830: fp@830: /** Finite state machine for scanning an EtherCAT slave. fp@830: */ fp@830: struct ec_fsm_slave_scan fp@830: { fp@830: ec_slave_t *slave; /**< Slave the FSM runs on. */ fp@830: ec_datagram_t *datagram; /**< Datagram used in the state machine. */ fp@830: unsigned int retries; /**< Retries on datagram timeout. */ fp@830: fp@830: void (*state)(ec_fsm_slave_scan_t *); /**< State function. */ fp@830: uint16_t sii_offset; /**< SII offset in words. */ fp@830: fp@830: ec_fsm_sii_t fsm_sii; /**< SII state machine. */ fp@830: }; fp@830: fp@830: /*****************************************************************************/ fp@830: fp@830: void ec_fsm_slave_scan_init(ec_fsm_slave_scan_t *, ec_datagram_t *); fp@830: void ec_fsm_slave_scan_clear(ec_fsm_slave_scan_t *); fp@830: fp@830: void ec_fsm_slave_scan_start(ec_fsm_slave_scan_t *, ec_slave_t *); fp@830: fp@830: int ec_fsm_slave_scan_exec(ec_fsm_slave_scan_t *); fp@830: int ec_fsm_slave_scan_success(const ec_fsm_slave_scan_t *); fp@830: fp@830: /*****************************************************************************/ fp@830: fp@830: #endif