fp@1831: /****************************************************************************** fp@1831: * fp@1831: * $Id$ fp@1831: * fp@1831: * Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH fp@1831: * fp@1831: * This file is part of the IgH EtherCAT Master. fp@1831: * fp@1831: * The IgH EtherCAT Master is free software; you can redistribute it and/or fp@1831: * modify it under the terms of the GNU General Public License version 2, as fp@1831: * published by the Free Software Foundation. fp@1831: * fp@1831: * The IgH EtherCAT Master is distributed in the hope that it will be useful, fp@1831: * but WITHOUT ANY WARRANTY; without even the implied warranty of fp@1831: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General fp@1831: * Public License for more details. fp@1831: * fp@1831: * You should have received a copy of the GNU General Public License along fp@1831: * with the IgH EtherCAT Master; if not, write to the Free Software fp@1831: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA fp@1831: * fp@1831: * --- fp@1831: * fp@1831: * The license mentioned above concerns the source code only. Using the fp@1831: * EtherCAT technology and brand is only permitted in compliance with the fp@1831: * industrial property and similar rights of Beckhoff Automation GmbH. fp@1831: * fp@1831: *****************************************************************************/ fp@1831: fp@1831: /** fp@1831: \file fp@1831: EtherCAT CoE state machines. fp@1831: */ fp@1831: fp@1831: /*****************************************************************************/ fp@1831: fp@1831: #ifndef __EC_FSM_SOE_H__ fp@1831: #define __EC_FSM_SOE_H__ fp@1831: fp@1831: #include "globals.h" fp@1831: #include "datagram.h" fp@1831: #include "slave.h" fp@1831: #include "soe_request.h" fp@1831: fp@1831: /*****************************************************************************/ fp@1831: fp@1831: typedef struct ec_fsm_soe ec_fsm_soe_t; /**< \see ec_fsm_soe */ fp@1831: fp@1831: /** Finite state machines for the Sercos over EtherCAT protocol. fp@1831: */ fp@1831: struct ec_fsm_soe { fp@1831: ec_slave_t *slave; /**< slave the FSM runs on */ fp@1831: unsigned int retries; /**< retries upon datagram timeout */ fp@1831: fp@2498: void (*state)(ec_fsm_soe_t *, ec_datagram_t *); /**< CoE state function */ fp@2498: ec_datagram_t *datagram; /**< Datagram used in the previous step. */ fp@2498: unsigned long jiffies_start; /**< Timestamp. */ fp@1831: ec_soe_request_t *request; /**< SoE request */ fp@1865: off_t offset; /**< IDN data offset during fragmented write. */ fp@2498: size_t fragment_size; /**< Size of the current fragment. */ fp@1831: }; fp@1831: fp@1831: /*****************************************************************************/ fp@1831: fp@2498: void ec_fsm_soe_init(ec_fsm_soe_t *); fp@1831: void ec_fsm_soe_clear(ec_fsm_soe_t *); fp@1831: fp@1831: void ec_fsm_soe_transfer(ec_fsm_soe_t *, ec_slave_t *, ec_soe_request_t *); fp@1831: fp@2498: int ec_fsm_soe_exec(ec_fsm_soe_t *, ec_datagram_t *); fp@2498: int ec_fsm_soe_success(const ec_fsm_soe_t *); fp@1831: fp@1831: /*****************************************************************************/ fp@1831: fp@1831: #endif