fp@436: /****************************************************************************** fp@436: * fp@436: * $Id$ fp@436: * fp@436: * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH fp@436: * fp@436: * This file is part of the IgH EtherCAT Master. fp@436: * fp@436: * The IgH EtherCAT Master is free software; you can redistribute it fp@436: * and/or modify it under the terms of the GNU General Public License fp@436: * as published by the Free Software Foundation; either version 2 of the fp@436: * License, or (at your option) any later version. fp@436: * fp@436: * The IgH EtherCAT Master is distributed in the hope that it will be fp@436: * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of fp@436: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the fp@436: * GNU General Public License for more details. fp@436: * fp@436: * You should have received a copy of the GNU General Public License fp@436: * along 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@436: * The right to use EtherCAT Technology is granted and comes free of fp@436: * charge under condition of compatibility of product made by fp@436: * Licensee. People intending to distribute/sell products based on the fp@436: * code, have to sign an agreement to guarantee that products using fp@436: * software based on IgH EtherCAT master stay compatible with the actual fp@436: * EtherCAT specification (which are released themselves as an open fp@436: * standard) as the (only) precondition to have the right to use EtherCAT fp@436: * Technology, IP and trade marks. 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@436: #ifndef __EC_FSM_COE__ fp@436: #define __EC_FSM_COE__ fp@436: fp@436: #include "globals.h" fp@436: #include "../include/ecrt.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@825: /** 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@436: ec_datagram_t *datagram; /**< datagram used in the state machine */ fp@505: unsigned int retries; /**< retries upon datagram timeout */ fp@436: fp@436: void (*state)(ec_fsm_coe_t *); /**< CoE state function */ fp@814: ec_sdo_data_t *sdodata; /**< input/output: Sdo data object */ fp@436: cycles_t cycles_start; /**< CoE timestamp */ fp@814: ec_sdo_t *sdo; /**< current Sdo */ fp@436: uint8_t subindex; /**< current subindex */ fp@814: ec_sdo_request_t *request; /**< Sdo request */ fp@436: uint8_t toggle; /**< toggle bit for segment commands */ fp@436: }; fp@436: fp@436: /*****************************************************************************/ fp@436: fp@436: void ec_fsm_coe_init(ec_fsm_coe_t *, ec_datagram_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@436: void ec_fsm_coe_download(ec_fsm_coe_t *, ec_slave_t *, ec_sdo_data_t *); fp@436: void ec_fsm_coe_upload(ec_fsm_coe_t *, ec_slave_t *, ec_sdo_request_t *); fp@436: fp@436: int ec_fsm_coe_exec(ec_fsm_coe_t *); fp@436: int ec_fsm_coe_success(ec_fsm_coe_t *); fp@436: fp@436: /*****************************************************************************/ fp@436: fp@436: #endif