master/pdo.h
author Florian Pose <fp@igh-essen.com>
Fri, 30 May 2008 10:49:51 +0000
changeset 928 7fbc0b943c65
parent 883 4963e22a267a
child 933 618ab9e03321
permissions -rw-r--r--
Removed deprecated ec_slave_validate().
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     5
 *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
 *
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
 *
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    10
 *  and/or modify it under the terms of the GNU General Public License
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    11
 *  as published by the Free Software Foundation; either version 2 of the
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
 *  License, or (at your option) any later version.
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    13
 *
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    14
 *  The IgH EtherCAT Master is distributed in the hope that it will be
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    15
 *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
 *  GNU General Public License for more details.
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    18
 *
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    19
 *  You should have received a copy of the GNU General Public License
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
 *  along with the IgH EtherCAT Master; if not, write to the Free Software
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    22
 *
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    23
 *  The right to use EtherCAT Technology is granted and comes free of
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    24
 *  charge under condition of compatibility of product made by
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
 *  Licensee. People intending to distribute/sell products based on the
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
 *  code, have to sign an agreement to guarantee that products using
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
 *  software based on IgH EtherCAT master stay compatible with the actual
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 *  EtherCAT specification (which are released themselves as an open
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
 *  standard) as the (only) precondition to have the right to use EtherCAT
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
 *  Technology, IP and trade marks.
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
 *
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
 *****************************************************************************/
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
/**
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
   \file
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
   EtherCAT Process data object structure.
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
*/
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
/*****************************************************************************/
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
883
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 842
diff changeset
    41
#ifndef __EC_PDO_H__
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 842
diff changeset
    42
#define __EC_PDO_H__
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
#include <linux/list.h>
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    46
#include "../include/ecrt.h"
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    47
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
#include "globals.h"
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
/*****************************************************************************/
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
814
a51f857b1b2d Renamed [PS]DO to [PS]do.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
    52
/** Pdo description.
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    53
 */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    54
typedef struct {
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    55
    struct list_head list; /**< List item. */
814
a51f857b1b2d Renamed [PS]DO to [PS]do.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
    56
    ec_direction_t dir; /**< Pdo direction. */
a51f857b1b2d Renamed [PS]DO to [PS]do.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
    57
    uint16_t index; /**< Pdo index. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    58
    int8_t sync_index; /**< Assigned sync manager. */
814
a51f857b1b2d Renamed [PS]DO to [PS]do.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
    59
    char *name; /**< Pdo name. */
a51f857b1b2d Renamed [PS]DO to [PS]do.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
    60
    struct list_head entries; /**< List of Pdo entries. */
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
    61
    unsigned int default_config; /**< The entries contain the default Pdo
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
    62
                                   configuration. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    63
} ec_pdo_t;
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    64
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
/*****************************************************************************/
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
814
a51f857b1b2d Renamed [PS]DO to [PS]do.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
    67
/** Pdo entry description.
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    68
 */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    69
typedef struct {
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    70
    struct list_head list; /**< list item */
814
a51f857b1b2d Renamed [PS]DO to [PS]do.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
    71
    uint16_t index; /**< Pdo entry index */
a51f857b1b2d Renamed [PS]DO to [PS]do.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
    72
    uint8_t subindex; /**< Pdo entry subindex */
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
    char *name; /**< entry name */
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    74
    uint8_t bit_length; /**< entry length in bit */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    75
} ec_pdo_entry_t;
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    76
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    77
/*****************************************************************************/
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    78
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    79
void ec_pdo_init(ec_pdo_t *);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    80
int ec_pdo_init_copy(ec_pdo_t *, const ec_pdo_t *);
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    81
void ec_pdo_clear(ec_pdo_t *);
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
    82
void ec_pdo_clear_entries(ec_pdo_t *);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    83
int ec_pdo_set_name(ec_pdo_t *, const char *);
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
    84
ec_pdo_entry_t *ec_pdo_add_entry(ec_pdo_t *, uint16_t, uint8_t, uint8_t);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    85
int ec_pdo_copy_entries(ec_pdo_t *, const ec_pdo_t *);
799
068a58b96965 Pdo configuration.
Florian Pose <fp@igh-essen.com>
parents: 792
diff changeset
    86
int ec_pdo_equal_entries(const ec_pdo_t *, const ec_pdo_t *);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    87
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    88
void ec_pdo_entry_init(ec_pdo_entry_t *);
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    89
int ec_pdo_entry_init_copy(ec_pdo_entry_t *, const ec_pdo_entry_t *);
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    90
void ec_pdo_entry_clear(ec_pdo_entry_t *);
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    91
int ec_pdo_entry_set_name(ec_pdo_entry_t *, const char *);
799
068a58b96965 Pdo configuration.
Florian Pose <fp@igh-essen.com>
parents: 792
diff changeset
    92
int ec_pdo_entry_equal(const ec_pdo_entry_t *, const ec_pdo_entry_t *);
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    93
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    94
/*****************************************************************************/
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    95
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    96
#endif