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