master/slave_config.h
author Florian Pose <fp@igh-essen.com>
Wed, 01 Oct 2008 08:45:16 +0000
changeset 1238 02711963a059
parent 1209 8be462afb7f4
child 1263 f44720defbc5
permissions -rw-r--r--
Added missing header.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     5
 *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    10
 *  and/or modify it under the terms of the GNU General Public License
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    11
 *  as published by the Free Software Foundation; either version 2 of the
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
 *  License, or (at your option) any later version.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    13
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    14
 *  The IgH EtherCAT Master is distributed in the hope that it will be
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    15
 *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
 *  GNU General Public License for more details.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    18
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    19
 *  You should have received a copy of the GNU General Public License
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
 *  along with the IgH EtherCAT Master; if not, write to the Free Software
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    22
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    23
 *  The right to use EtherCAT Technology is granted and comes free of
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    24
 *  charge under condition of compatibility of product made by
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
 *  Licensee. People intending to distribute/sell products based on the
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
 *  code, have to sign an agreement to guarantee that products using
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
 *  software based on IgH EtherCAT master stay compatible with the actual
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 *  EtherCAT specification (which are released themselves as an open
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
 *  standard) as the (only) precondition to have the right to use EtherCAT
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
 *  Technology, IP and trade marks.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
 *****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
/**
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
   \file
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
   EtherCAT slave configuration structure.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
*/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
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: 879
diff changeset
    41
#ifndef __EC_SLAVE_CONFIG_H__
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
    42
#define __EC_SLAVE_CONFIG_H__
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
#include <linux/list.h>
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
#include "globals.h"
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
#include "slave.h"
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
    48
#include "sync_config.h"
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
#include "fmmu_config.h"
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    53
/** EtherCAT slave configuration.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
struct ec_slave_config {
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
    struct list_head list; /**< List item. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
    ec_master_t *master; /**< Master owning the slave configuration. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
    uint16_t alias; /**< Slave alias. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    60
    uint16_t position; /**< Index after alias. If alias is zero, this is the
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    61
                         ring position. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
    uint32_t vendor_id; /**< Slave vendor ID. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    63
    uint32_t product_code; /**< Slave product code. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    64
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
    ec_slave_t *slave; /**< Slave pointer. This is \a NULL, if the slave is
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
                         offline. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1055
diff changeset
    68
    ec_sync_config_t sync_configs[EC_MAX_SYNC_MANAGERS]; /**< Sync manager
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
    69
                                                   configurations. */
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
    70
    ec_fmmu_config_t fmmu_configs[EC_MAX_FMMUS]; /**< FMMU configurations. */
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
    71
    uint8_t used_fmmus; /**< Number of FMMUs used. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 842
diff changeset
    73
    struct list_head sdo_configs; /**< List of Sdo configurations. */
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 842
diff changeset
    74
    struct list_head sdo_requests; /**< List of Sdo requests. */
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
    75
    struct list_head voe_handlers; /**< List of VoE handlers. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    76
};
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    77
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    78
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    79
995
54149a703c47 Removed kobject from slave_config.
Florian Pose <fp@igh-essen.com>
parents: 990
diff changeset
    80
void ec_slave_config_init(ec_slave_config_t *, ec_master_t *, uint16_t,
1010
6672b86e7b10 Reverted revision number checking from r1228.
Florian Pose <fp@igh-essen.com>
parents: 1009
diff changeset
    81
        uint16_t, uint32_t, uint32_t);
995
54149a703c47 Removed kobject from slave_config.
Florian Pose <fp@igh-essen.com>
parents: 990
diff changeset
    82
void ec_slave_config_clear(ec_slave_config_t *);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    83
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    84
int ec_slave_config_attach(ec_slave_config_t *);
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    85
void ec_slave_config_detach(ec_slave_config_t *);
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    86
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
    87
void ec_slave_config_load_default_sync_config(ec_slave_config_t *);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    88
990
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    89
unsigned int ec_slave_config_sdo_count(const ec_slave_config_t *);
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    90
const ec_sdo_request_t *ec_slave_config_get_sdo_by_pos_const(
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    91
        const ec_slave_config_t *, unsigned int);
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    92
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    93
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    94
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    95
#endif