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