fp@433: /****************************************************************************** fp@433: * fp@433: * $Id$ fp@433: * fp@1685: * Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH fp@433: * fp@433: * This file is part of the IgH EtherCAT Master. fp@433: * fp@1685: * The IgH EtherCAT Master is free software; you can redistribute it and/or fp@1685: * modify it under the terms of the GNU General Public License version 2, as fp@1685: * published by the Free Software Foundation. fp@433: * fp@1685: * The IgH EtherCAT Master is distributed in the hope that it will be useful, fp@1685: * but WITHOUT ANY WARRANTY; without even the implied warranty of fp@1685: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General fp@1685: * Public License for more details. fp@433: * fp@1685: * You should have received a copy of the GNU General Public License along fp@1685: * with the IgH EtherCAT Master; if not, write to the Free Software fp@433: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA fp@433: * fp@1685: * Using the EtherCAT technology and brand is permitted in compliance with fp@1685: * the industrial property and similar rights of Beckhoff Automation GmbH. fp@433: * fp@433: *****************************************************************************/ fp@433: fp@433: /** fp@433: \file fp@433: EtherCAT slave information interface FSM structure. fp@433: */ fp@433: fp@433: /*****************************************************************************/ fp@433: fp@883: #ifndef __EC_FSM_SII_H__ fp@883: #define __EC_FSM_SII_H__ fp@433: fp@433: #include "globals.h" fp@433: #include "../include/ecrt.h" fp@433: #include "datagram.h" fp@433: #include "slave.h" fp@433: fp@433: /*****************************************************************************/ fp@433: fp@815: /** SII access addressing mode. fp@758: */ fp@815: typedef enum { fp@815: EC_FSM_SII_USE_INCREMENT_ADDRESS, /**< Use auto-increment addressing. */ fp@815: EC_FSM_SII_USE_CONFIGURED_ADDRESS /**< Use configured addresses. */ fp@815: } ec_fsm_sii_addressing_t; fp@433: fp@433: /*****************************************************************************/ fp@433: fp@433: typedef struct ec_fsm_sii ec_fsm_sii_t; /**< \see ec_fsm_sii */ fp@433: fp@433: /** fp@433: Slave information interface FSM. fp@433: */ fp@433: fp@433: struct ec_fsm_sii fp@433: { fp@433: ec_slave_t *slave; /**< slave the FSM runs on */ fp@433: ec_datagram_t *datagram; /**< datagram used in the state machine */ fp@505: unsigned int retries; /**< retries upon datagram timeout */ fp@433: fp@433: void (*state)(ec_fsm_sii_t *); /**< SII state function */ fp@755: uint16_t word_offset; /**< input: word offset in SII */ fp@433: ec_fsm_sii_addressing_t mode; /**< reading via APRD or NPRD */ fp@433: uint8_t value[4]; /**< raw SII value (32bit) */ fp@1039: unsigned long jiffies_start; /**< Start timestamp. */ fp@433: uint8_t check_once_more; /**< one more try after timeout */ fp@433: }; fp@433: fp@433: /*****************************************************************************/ fp@433: fp@433: void ec_fsm_sii_init(ec_fsm_sii_t *, ec_datagram_t *); fp@433: void ec_fsm_sii_clear(ec_fsm_sii_t *); fp@433: fp@433: void ec_fsm_sii_read(ec_fsm_sii_t *, ec_slave_t *, fp@433: uint16_t, ec_fsm_sii_addressing_t); fp@600: void ec_fsm_sii_write(ec_fsm_sii_t *, ec_slave_t *, uint16_t, fp@979: const uint16_t *, ec_fsm_sii_addressing_t); fp@433: fp@435: int ec_fsm_sii_exec(ec_fsm_sii_t *); fp@433: int ec_fsm_sii_success(ec_fsm_sii_t *); fp@433: fp@433: /*****************************************************************************/ fp@433: fp@433: #endif