fp@1732: /****************************************************************************** fp@1732: * fp@1732: * $Id$ fp@1732: * fp@1732: * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH fp@1732: * fp@1732: * This file is part of the IgH EtherCAT Master. fp@1732: * fp@1732: * The IgH EtherCAT Master is free software; you can redistribute it fp@1732: * and/or modify it under the terms of the GNU General Public License fp@1732: * as published by the Free Software Foundation; either version 2 of the fp@1732: * License, or (at your option) any later version. fp@1732: * fp@1732: * The IgH EtherCAT Master is distributed in the hope that it will be fp@1732: * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of fp@1732: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the fp@1732: * GNU General Public License for more details. fp@1732: * fp@1732: * You should have received a copy of the GNU General Public License fp@1732: * along with the IgH EtherCAT Master; if not, write to the Free Software fp@1732: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA fp@1732: * fp@1732: * The right to use EtherCAT Technology is granted and comes free of fp@1732: * charge under condition of compatibility of product made by fp@1732: * Licensee. People intending to distribute/sell products based on the fp@1732: * code, have to sign an agreement to guarantee that products using fp@1732: * software based on IgH EtherCAT master stay compatible with the actual fp@1732: * EtherCAT specification (which are released themselves as an open fp@1732: * standard) as the (only) precondition to have the right to use EtherCAT fp@1732: * Technology, IP and trade marks. fp@1732: * fp@1732: *****************************************************************************/ fp@1732: fp@1732: /** fp@1732: \file fp@1732: EtherCAT slave information interface FSM structure. fp@1732: */ fp@1732: fp@1732: /*****************************************************************************/ fp@1732: fp@1732: #ifndef __EC_FSM_SII__ fp@1732: #define __EC_FSM_SII__ fp@1732: fp@1732: #include "globals.h" fp@1732: #include "../include/ecrt.h" fp@1732: #include "datagram.h" fp@1732: #include "slave.h" fp@1732: fp@1732: /*****************************************************************************/ fp@1732: fp@1746: /** fp@1746: * SII access addressing mode. fp@1746: */ fp@1732: typedef enum fp@1732: { fp@1732: EC_FSM_SII_POSITION, fp@1732: EC_FSM_SII_NODE fp@1732: } fp@1732: ec_fsm_sii_addressing_t; fp@1732: fp@1732: /*****************************************************************************/ fp@1732: fp@1732: typedef struct ec_fsm_sii ec_fsm_sii_t; /**< \see ec_fsm_sii */ fp@1732: fp@1732: /** fp@1732: Slave information interface FSM. fp@1732: */ fp@1732: fp@1732: struct ec_fsm_sii fp@1732: { fp@1732: ec_slave_t *slave; /**< slave the FSM runs on */ fp@1732: ec_datagram_t *datagram; /**< datagram used in the state machine */ fp@1739: unsigned int retries; /**< retries upon datagram timeout */ fp@1732: fp@1732: void (*state)(ec_fsm_sii_t *); /**< SII state function */ fp@1746: uint16_t word_offset; /**< input: word offset in SII */ fp@1732: ec_fsm_sii_addressing_t mode; /**< reading via APRD or NPRD */ fp@1732: uint8_t value[4]; /**< raw SII value (32bit) */ fp@1732: cycles_t cycles_start; /**< start timestamp */ fp@1732: uint8_t check_once_more; /**< one more try after timeout */ fp@1732: }; fp@1732: fp@1732: /*****************************************************************************/ fp@1732: fp@1732: void ec_fsm_sii_init(ec_fsm_sii_t *, ec_datagram_t *); fp@1732: void ec_fsm_sii_clear(ec_fsm_sii_t *); fp@1732: fp@1732: void ec_fsm_sii_read(ec_fsm_sii_t *, ec_slave_t *, fp@1732: uint16_t, ec_fsm_sii_addressing_t); fp@1744: void ec_fsm_sii_write(ec_fsm_sii_t *, ec_slave_t *, uint16_t, fp@1746: const uint8_t *, ec_fsm_sii_addressing_t); fp@1732: fp@1732: int ec_fsm_sii_exec(ec_fsm_sii_t *); fp@1732: int ec_fsm_sii_success(ec_fsm_sii_t *); fp@1732: fp@1732: /*****************************************************************************/ fp@1732: fp@1732: #endif