master/coe_emerg_ring.h
branchstable-1.5
changeset 2438 9c3e629a220c
child 2522 ec403cf308eb
equal deleted inserted replaced
2437:7b8078c1ad36 2438:9c3e629a220c
       
     1 /******************************************************************************
       
     2  *
       
     3  *  $Id$
       
     4  *
       
     5  *  Copyright (C) 2012  Florian Pose, Ingenieurgemeinschaft IgH
       
     6  *
       
     7  *  This file is part of the IgH EtherCAT Master.
       
     8  *
       
     9  *  The IgH EtherCAT Master is free software; you can redistribute it and/or
       
    10  *  modify it under the terms of the GNU General Public License version 2, as
       
    11  *  published by the Free Software Foundation.
       
    12  *
       
    13  *  The IgH EtherCAT Master is distributed in the hope that it will be useful,
       
    14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
       
    16  *  Public License for more details.
       
    17  *
       
    18  *  You should have received a copy of the GNU General Public License along
       
    19  *  with the IgH EtherCAT Master; if not, write to the Free Software
       
    20  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
       
    21  *
       
    22  *  ---
       
    23  *
       
    24  *  The license mentioned above concerns the source code only. Using the
       
    25  *  EtherCAT technology and brand is only permitted in compliance with the
       
    26  *  industrial property and similar rights of Beckhoff Automation GmbH.
       
    27  *
       
    28  *****************************************************************************/
       
    29 
       
    30 /**
       
    31    \file
       
    32    EtherCAT CoE emergency ring buffer structure.
       
    33 */
       
    34 
       
    35 /*****************************************************************************/
       
    36 
       
    37 #ifndef __EC_COE_EMERG_RING_H__
       
    38 #define __EC_COE_EMERG_RING_H__
       
    39 
       
    40 #include "globals.h"
       
    41 
       
    42 /*****************************************************************************/
       
    43 
       
    44 /** EtherCAT CoE emergency message record.
       
    45  */
       
    46 typedef struct {
       
    47     u8 data[EC_COE_EMERGENCY_MSG_SIZE];
       
    48 } ec_coe_emerg_msg_t;
       
    49 
       
    50 /*****************************************************************************/
       
    51 
       
    52 /** EtherCAT CoE emergency ring buffer.
       
    53  */
       
    54 typedef struct {
       
    55     ec_slave_config_t *sc; /**< Slave configuration  owning the ring. */
       
    56 
       
    57     ec_coe_emerg_msg_t *msgs;
       
    58     size_t size;
       
    59 
       
    60     unsigned int read_index;
       
    61     unsigned int write_index;
       
    62     unsigned int overruns;
       
    63 } ec_coe_emerg_ring_t;
       
    64 
       
    65 /*****************************************************************************/
       
    66 
       
    67 void ec_coe_emerg_ring_init(ec_coe_emerg_ring_t *, ec_slave_config_t *);
       
    68 void ec_coe_emerg_ring_clear(ec_coe_emerg_ring_t *);
       
    69 
       
    70 int ec_coe_emerg_ring_size(ec_coe_emerg_ring_t *, size_t);
       
    71 void ec_coe_emerg_ring_push(ec_coe_emerg_ring_t *, const u8 *);
       
    72 int ec_coe_emerg_ring_pop(ec_coe_emerg_ring_t *, u8 *);
       
    73 int ec_coe_emerg_ring_clear_ring(ec_coe_emerg_ring_t *);
       
    74 int ec_coe_emerg_ring_overruns(ec_coe_emerg_ring_t *);
       
    75 
       
    76 /*****************************************************************************/
       
    77 
       
    78 #endif