fp@1707: /****************************************************************************** fp@1707: * fp@1707: * $Id:$ fp@1707: * fp@1707: * Copyright (C) 2008 Olav Zarges, imc Meßsysteme GmbH fp@1707: * fp@1707: * This file is part of the IgH EtherCAT Master. fp@1707: * fp@1707: * The IgH EtherCAT Master is free software; you can redistribute it fp@1707: * and/or modify it under the terms of the GNU General Public License fp@1707: * as published by the Free Software Foundation; either version 2 of the fp@1707: * License, or (at your option) any later version. fp@1707: * fp@1707: * The IgH EtherCAT Master is distributed in the hope that it will be fp@1707: * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of fp@1707: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the fp@1707: * GNU General Public License for more details. fp@1707: * fp@1707: * You should have received a copy of the GNU General Public License fp@1707: * along with the IgH EtherCAT Master; if not, write to the Free Software fp@1707: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA fp@1707: * fp@1707: * The right to use EtherCAT Technology is granted and comes free of fp@1707: * charge under condition of compatibility of product made by fp@1707: * Licensee. People intending to distribute/sell products based on the fp@1707: * code, have to sign an agreement to guarantee that products using fp@1707: * software based on IgH EtherCAT master stay compatible with the actual fp@1707: * EtherCAT specification (which are released themselves as an open fp@1707: * standard) as the (only) precondition to have the right to use EtherCAT fp@1707: * Technology, IP and trade marks. fp@1707: * fp@1707: *****************************************************************************/ fp@1707: fp@1707: /** fp@1707: \file fp@1707: EtherCAT FoE request structure. fp@1707: */ fp@1707: fp@1707: /*****************************************************************************/ fp@1707: fp@1707: #ifndef __EC_FOE_REQUEST_H__ fp@1707: #define __EC_FOE_REQUEST_H__ fp@1707: fp@1707: #include fp@1707: fp@1707: #include "../include/ecrt.h" fp@1707: fp@1707: #include "globals.h" fp@1707: fp@1707: /*****************************************************************************/ fp@1707: fp@1707: /** FoE request. fp@1707: */ fp@1707: typedef struct { fp@1707: uint8_t *buffer; /**< Pointer to FoE data. */ fp@1707: size_t buffer_size; /**< Size of FoE data memory. */ fp@1707: size_t data_size; /**< Size of FoE data. */ fp@1707: fp@1707: uint32_t issue_timeout; /**< Maximum time in ms, the processing of the fp@1707: request may take. */ fp@1707: uint32_t response_timeout; /**< Maximum time in ms, the transfer is fp@1707: retried, if the slave does not respond. */ fp@1707: ec_direction_t dir; /**< Direction. EC_DIR_OUTPUT means downloading to fp@1707: the slave, EC_DIR_INPUT means uploading from the fp@1707: slave. */ fp@1707: ec_request_state_t state; /**< FoE request state. */ fp@1707: unsigned long jiffies_start; /**< Jiffies, when the request was issued. */ fp@1707: unsigned long jiffies_sent; /**< Jiffies, when the upload/download fp@1707: request was sent. */ fp@1707: uint8_t *file_name; /**< Pointer to the filename. */ fp@1707: uint32_t abort_code; /**< FoE request abort code. Zero on success. */ fp@1707: } ec_foe_request_t; fp@1707: fp@1707: /*****************************************************************************/ fp@1707: fp@1707: void ec_foe_request_init(ec_foe_request_t *, uint8_t* file_name); fp@1707: void ec_foe_request_clear(ec_foe_request_t *); fp@1707: fp@1707: void ec_foe_request_address(ec_foe_request_t *, uint16_t, uint8_t); fp@1707: int ec_foe_request_alloc(ec_foe_request_t *, size_t); fp@1707: int ec_foe_request_copy_data(ec_foe_request_t *, const uint8_t *, size_t); fp@1707: int ec_foe_request_timed_out(const ec_foe_request_t *); fp@1707: fp@1707: void ec_foe_request_write(ec_foe_request_t *); fp@1707: void ec_foe_request_read(ec_foe_request_t *); fp@1707: fp@1707: /*****************************************************************************/ fp@1707: fp@1707: #endif