00001 /****************************************************************************** 00002 * 00003 * $Id$ 00004 * 00005 * Copyright (C) 2006-2012 Florian Pose, Ingenieurgemeinschaft IgH 00006 * 00007 * This file is part of the IgH EtherCAT Master. 00008 * 00009 * The IgH EtherCAT Master is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License version 2, as 00011 * published by the Free Software Foundation. 00012 * 00013 * The IgH EtherCAT Master is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 00016 * Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License along 00019 * with the IgH EtherCAT Master; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00021 * 00022 * --- 00023 * 00024 * The license mentioned above concerns the source code only. Using the 00025 * EtherCAT technology and brand is only permitted in compliance with the 00026 * industrial property and similar rights of Beckhoff Automation GmbH. 00027 * 00028 *****************************************************************************/ 00029 00035 /*****************************************************************************/ 00036 00037 #ifndef __EC_FSM_MASTER_H__ 00038 #define __EC_FSM_MASTER_H__ 00039 00040 #include "globals.h" 00041 #include "datagram.h" 00042 #include "foe_request.h" 00043 #include "sdo_request.h" 00044 #include "soe_request.h" 00045 #include "fsm_slave_config.h" 00046 #include "fsm_slave_scan.h" 00047 #include "fsm_pdo.h" 00048 00049 /*****************************************************************************/ 00050 00053 typedef struct { 00054 struct list_head list; 00055 ec_slave_t *slave; 00056 uint16_t offset; 00057 size_t nwords; 00058 const uint16_t *words; 00059 ec_internal_request_state_t state; 00060 } ec_sii_write_request_t; 00061 00062 /*****************************************************************************/ 00063 00064 typedef struct ec_fsm_master ec_fsm_master_t; 00068 struct ec_fsm_master { 00069 ec_master_t *master; 00070 ec_datagram_t *datagram; 00071 unsigned int retries; 00073 void (*state)(ec_fsm_master_t *); 00074 ec_device_index_t dev_idx; 00076 int idle; 00077 unsigned long scan_jiffies; 00078 uint8_t link_state[EC_MAX_NUM_DEVICES]; 00080 unsigned int slaves_responding[EC_MAX_NUM_DEVICES]; 00083 unsigned int rescan_required; 00084 ec_slave_state_t slave_states[EC_MAX_NUM_DEVICES]; 00087 ec_slave_t *slave; 00088 ec_sii_write_request_t *sii_request; 00089 off_t sii_index; 00090 ec_sdo_request_t *sdo_request; 00092 ec_fsm_coe_t fsm_coe; 00093 ec_fsm_soe_t fsm_soe; 00094 ec_fsm_pdo_t fsm_pdo; 00095 ec_fsm_change_t fsm_change; 00096 ec_fsm_slave_config_t fsm_slave_config; 00097 ec_fsm_slave_scan_t fsm_slave_scan; 00098 ec_fsm_sii_t fsm_sii; 00099 }; 00100 00101 /*****************************************************************************/ 00102 00103 void ec_fsm_master_init(ec_fsm_master_t *, ec_master_t *, ec_datagram_t *); 00104 void ec_fsm_master_clear(ec_fsm_master_t *); 00105 00106 void ec_fsm_master_reset(ec_fsm_master_t *); 00107 00108 int ec_fsm_master_exec(ec_fsm_master_t *); 00109 int ec_fsm_master_idle(const ec_fsm_master_t *); 00110 00111 /*****************************************************************************/ 00112 00113 #endif
1.5.6