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