martin@1583: /****************************************************************************** martin@1583: * martin@1583: * $Id$ martin@1583: * fp@2589: * Copyright (C) 2006-2012 Florian Pose, Ingenieurgemeinschaft IgH martin@1583: * martin@1583: * This file is part of the IgH EtherCAT Master. martin@1583: * martin@1583: * The IgH EtherCAT Master is free software; you can redistribute it and/or martin@1583: * modify it under the terms of the GNU General Public License version 2, as martin@1583: * published by the Free Software Foundation. martin@1583: * martin@1583: * The IgH EtherCAT Master is distributed in the hope that it will be useful, martin@1583: * but WITHOUT ANY WARRANTY; without even the implied warranty of martin@1583: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General martin@1583: * Public License for more details. martin@1583: * martin@1583: * You should have received a copy of the GNU General Public License along martin@1583: * with the IgH EtherCAT Master; if not, write to the Free Software martin@1583: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA martin@1583: * martin@1583: * --- martin@1583: * martin@1583: * The license mentioned above concerns the source code only. Using the martin@1583: * EtherCAT technology and brand is only permitted in compliance with the martin@1583: * industrial property and similar rights of Beckhoff Automation GmbH. martin@1583: * martin@1583: *****************************************************************************/ martin@1583: martin@1583: /** martin@1583: \file fp@2589: EtherCAT slave request state machine. martin@1583: */ martin@1583: martin@1583: /*****************************************************************************/ fp@2589: martin@1583: #ifndef __EC_FSM_SLAVE_H__ martin@1583: #define __EC_FSM_SLAVE_H__ martin@1583: martin@1583: #include "globals.h" martin@1583: #include "datagram.h" martin@1583: #include "sdo_request.h" fp@2589: #include "reg_request.h" fp@2597: #include "eoe_request.h" martin@1583: #include "fsm_coe.h" martin@1597: #include "fsm_foe.h" fp@1831: #include "fsm_soe.h" fp@2597: #include "fsm_eoe.h" fp@2589: fp@2589: /*****************************************************************************/ martin@1583: martin@1583: typedef struct ec_fsm_slave ec_fsm_slave_t; /**< \see ec_fsm_slave */ martin@1583: martin@1583: /** Finite state machine of an EtherCAT slave. martin@1583: */ martin@1583: struct ec_fsm_slave { martin@1583: ec_slave_t *slave; /**< slave the FSM runs on */ fp@2589: struct list_head list; /**< Used for execution list. */ martin@1583: fp@2589: void (*state)(ec_fsm_slave_t *, ec_datagram_t *); /**< State function. */ fp@2589: ec_datagram_t *datagram; /**< Previous state datagram. */ fp@2589: ec_sdo_request_t *sdo_request; /**< SDO request to process. */ fp@2589: ec_reg_request_t *reg_request; /**< Register request to process. */ fp@2589: ec_foe_request_t *foe_request; /**< FoE request to process. */ fp@2589: off_t foe_index; /**< Index to FoE write request data. */ fp@2589: ec_soe_request_t *soe_request; /**< SoE request to process. */ fp@2597: ec_eoe_request_t *eoe_request; /**< SoE request to process. */ martin@1583: fp@2589: ec_fsm_coe_t fsm_coe; /**< CoE state machine. */ fp@2589: ec_fsm_foe_t fsm_foe; /**< FoE state machine. */ fp@2589: ec_fsm_soe_t fsm_soe; /**< SoE state machine. */ fp@2597: ec_fsm_eoe_t fsm_eoe; /**< EoE state machine. */ martin@1583: }; martin@1583: martin@1583: /*****************************************************************************/ martin@1583: fp@2589: void ec_fsm_slave_init(ec_fsm_slave_t *, ec_slave_t *); martin@1583: void ec_fsm_slave_clear(ec_fsm_slave_t *); martin@1583: fp@2589: int ec_fsm_slave_exec(ec_fsm_slave_t *, ec_datagram_t *); fp@2589: void ec_fsm_slave_set_ready(ec_fsm_slave_t *); fp@2589: int ec_fsm_slave_is_ready(const ec_fsm_slave_t *); martin@1583: martin@1583: /*****************************************************************************/ martin@1583: martin@1583: martin@1583: #endif // __EC_FSM_SLAVE_H__