fp@2438: /****************************************************************************** fp@2438: * fp@2438: * $Id$ fp@2438: * fp@2438: * Copyright (C) 2012 Florian Pose, Ingenieurgemeinschaft IgH fp@2438: * fp@2438: * This file is part of the IgH EtherCAT Master. fp@2438: * fp@2438: * The IgH EtherCAT Master is free software; you can redistribute it and/or fp@2438: * modify it under the terms of the GNU General Public License version 2, as fp@2438: * published by the Free Software Foundation. fp@2438: * fp@2438: * The IgH EtherCAT Master is distributed in the hope that it will be useful, fp@2438: * but WITHOUT ANY WARRANTY; without even the implied warranty of fp@2438: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General fp@2438: * Public License for more details. fp@2438: * fp@2438: * You should have received a copy of the GNU General Public License along fp@2438: * with the IgH EtherCAT Master; if not, write to the Free Software fp@2438: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA fp@2438: * fp@2438: * --- fp@2438: * fp@2438: * The license mentioned above concerns the source code only. Using the fp@2438: * EtherCAT technology and brand is only permitted in compliance with the fp@2438: * industrial property and similar rights of Beckhoff Automation GmbH. fp@2438: * fp@2438: *****************************************************************************/ fp@2438: fp@2438: /** fp@2438: \file fp@2438: EtherCAT CoE emergency ring buffer structure. fp@2438: */ fp@2438: fp@2438: /*****************************************************************************/ fp@2438: fp@2438: #ifndef __EC_COE_EMERG_RING_H__ fp@2438: #define __EC_COE_EMERG_RING_H__ fp@2438: fp@2438: #include "globals.h" fp@2438: fp@2438: /*****************************************************************************/ fp@2438: fp@2438: /** EtherCAT CoE emergency message record. fp@2438: */ fp@2438: typedef struct { fp@2522: u8 data[EC_COE_EMERGENCY_MSG_SIZE]; /**< Message data. */ fp@2438: } ec_coe_emerg_msg_t; fp@2438: fp@2438: /*****************************************************************************/ fp@2438: fp@2438: /** EtherCAT CoE emergency ring buffer. fp@2438: */ fp@2438: typedef struct { fp@2438: ec_slave_config_t *sc; /**< Slave configuration owning the ring. */ fp@2438: fp@2522: ec_coe_emerg_msg_t *msgs; /**< Message ring. */ fp@2522: size_t size; /**< Ring size. */ fp@2438: fp@2522: unsigned int read_index; /**< Read index. */ fp@2522: unsigned int write_index; /**< Write index. */ fp@2522: unsigned int overruns; /**< Number of overruns since last reset. */ fp@2438: } ec_coe_emerg_ring_t; fp@2438: fp@2438: /*****************************************************************************/ fp@2438: fp@2438: void ec_coe_emerg_ring_init(ec_coe_emerg_ring_t *, ec_slave_config_t *); fp@2438: void ec_coe_emerg_ring_clear(ec_coe_emerg_ring_t *); fp@2438: fp@2438: int ec_coe_emerg_ring_size(ec_coe_emerg_ring_t *, size_t); fp@2438: void ec_coe_emerg_ring_push(ec_coe_emerg_ring_t *, const u8 *); fp@2438: int ec_coe_emerg_ring_pop(ec_coe_emerg_ring_t *, u8 *); fp@2438: int ec_coe_emerg_ring_clear_ring(ec_coe_emerg_ring_t *); fp@2438: int ec_coe_emerg_ring_overruns(ec_coe_emerg_ring_t *); fp@2438: fp@2438: /*****************************************************************************/ fp@2438: fp@2438: #endif