fp@436: /****************************************************************************** fp@436: * fp@436: * $Id$ fp@436: * fp@1326: * Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH fp@436: * fp@436: * This file is part of the IgH EtherCAT Master. fp@436: * fp@1326: * The IgH EtherCAT Master is free software; you can redistribute it and/or fp@1326: * modify it under the terms of the GNU General Public License version 2, as fp@1326: * published by the Free Software Foundation. fp@436: * fp@1326: * The IgH EtherCAT Master is distributed in the hope that it will be useful, fp@1326: * but WITHOUT ANY WARRANTY; without even the implied warranty of fp@1326: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General fp@1326: * Public License for more details. fp@436: * fp@1326: * You should have received a copy of the GNU General Public License along fp@1326: * with the IgH EtherCAT Master; if not, write to the Free Software fp@436: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA fp@436: * fp@1363: * --- fp@1363: * fp@1363: * The license mentioned above concerns the source code only. Using the fp@1363: * EtherCAT technology and brand is only permitted in compliance with the fp@1363: * industrial property and similar rights of Beckhoff Automation GmbH. fp@436: * fp@436: *****************************************************************************/ fp@436: fp@436: /** fp@436: \file fp@436: EtherCAT CoE state machines. fp@436: */ fp@436: fp@436: /*****************************************************************************/ fp@436: fp@883: #ifndef __EC_FSM_COE_H__ fp@883: #define __EC_FSM_COE_H__ fp@436: fp@436: #include "globals.h" fp@436: #include "datagram.h" fp@436: #include "slave.h" fp@847: #include "sdo.h" fp@847: #include "sdo_request.h" fp@436: fp@436: /*****************************************************************************/ fp@436: fp@436: typedef struct ec_fsm_coe ec_fsm_coe_t; /**< \see ec_fsm_coe */ fp@436: fp@1327: /** Finite state machines for the CANopen over EtherCAT protocol. fp@825: */ fp@825: struct ec_fsm_coe { fp@436: ec_slave_t *slave; /**< slave the FSM runs on */ fp@505: unsigned int retries; /**< retries upon datagram timeout */ fp@436: fp@2498: void (*state)(ec_fsm_coe_t *, ec_datagram_t *); /**< CoE state function */ fp@2498: ec_datagram_t *datagram; /**< Datagram used in last step. */ fp@1038: unsigned long jiffies_start; /**< CoE timestamp. */ fp@1327: ec_sdo_t *sdo; /**< current SDO */ fp@436: uint8_t subindex; /**< current subindex */ fp@1327: ec_sdo_request_t *request; /**< SDO request */ fp@1339: uint32_t complete_size; /**< Used when segmenting. */ fp@436: uint8_t toggle; /**< toggle bit for segment commands */ fp@1562: uint32_t offset; /**< Data offset during segmented download. */ fp@1562: uint32_t remaining; /**< Remaining bytes during segmented download. */ fp@2498: size_t segment_size; /**< Current segment size. */ fp@436: }; fp@436: fp@436: /*****************************************************************************/ fp@436: fp@2498: void ec_fsm_coe_init(ec_fsm_coe_t *); fp@436: void ec_fsm_coe_clear(ec_fsm_coe_t *); fp@436: fp@436: void ec_fsm_coe_dictionary(ec_fsm_coe_t *, ec_slave_t *); fp@859: void ec_fsm_coe_transfer(ec_fsm_coe_t *, ec_slave_t *, ec_sdo_request_t *); fp@436: fp@2498: int ec_fsm_coe_exec(ec_fsm_coe_t *, ec_datagram_t *); fp@2498: int ec_fsm_coe_success(const ec_fsm_coe_t *); fp@436: fp@436: /*****************************************************************************/ fp@436: fp@436: #endif