master/slave_config.c
author Florian Pose <fp@igh-essen.com>
Tue, 09 Mar 2010 11:43:43 +0100
changeset 1858 4d4aa4c0fc1e
parent 1844 b6bd88d4806b
child 1873 219be3742274
permissions -rw-r--r--
Improved frame statistics output again.
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
 *
1326
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
     5
 *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
792
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
 *
1326
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it and/or
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
    10
 *  modify it under the terms of the GNU General Public License version 2, as
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
    11
 *  published by the Free Software Foundation.
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
    12
 *
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
    13
 *  The IgH EtherCAT Master is distributed in the hope that it will be useful,
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
    16
 *  Public License for more details.
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
    17
 *
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
    18
 *  You should have received a copy of the GNU General Public License along
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1313
diff changeset
    19
 *  with the IgH EtherCAT Master; if not, write to the Free Software
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
 *  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
    21
 *
1363
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1351
diff changeset
    22
 *  ---
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1351
diff changeset
    23
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1351
diff changeset
    24
 *  The license mentioned above concerns the source code only. Using the
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1351
diff changeset
    25
 *  EtherCAT technology and brand is only permitted in compliance with the
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1351
diff changeset
    26
 *  industrial property and similar rights of Beckhoff Automation GmbH.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 *****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
/**
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
   \file
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
   EtherCAT slave configuration methods.
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
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
995
54149a703c47 Removed kobject from slave_config.
Florian Pose <fp@igh-essen.com>
parents: 990
diff changeset
    37
#include <linux/slab.h>
792
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
#include "globals.h"
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
#include "master.h"
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
    41
#include "voe_handler.h"
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
#include "slave_config.h"
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
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
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
/** Slave configuration constructor.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
 * See ecrt_master_slave_config() for the usage of the \a alias and \a
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
 * position parameters.
995
54149a703c47 Removed kobject from slave_config.
Florian Pose <fp@igh-essen.com>
parents: 990
diff changeset
    51
 */
54149a703c47 Removed kobject from slave_config.
Florian Pose <fp@igh-essen.com>
parents: 990
diff changeset
    52
void ec_slave_config_init(
54149a703c47 Removed kobject from slave_config.
Florian Pose <fp@igh-essen.com>
parents: 990
diff changeset
    53
        ec_slave_config_t *sc, /**< Slave configuration. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
        ec_master_t *master, /**< EtherCAT master. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
        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
    56
        uint16_t position, /**< Slave position. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
        uint32_t vendor_id, /**< Expected vendor ID. */
1010
6672b86e7b10 Reverted revision number checking from r1228.
Florian Pose <fp@igh-essen.com>
parents: 1009
diff changeset
    58
        uint32_t product_code /**< Expected product code. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
        )
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    60
{
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
    61
    unsigned int i;
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    63
    sc->master = master;
1392
8fcc1d0987c1 DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    64
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
    sc->alias = alias;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
    sc->position = position;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
    sc->vendor_id = vendor_id;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    68
    sc->product_code = product_code;
1509
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
    69
    sc->watchdog_divider = 0; // use default
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
    70
    sc->watchdog_intervals = 0; // use default
1392
8fcc1d0987c1 DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    71
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
    sc->slave = NULL;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1075
diff changeset
    74
    for (i = 0; i < EC_MAX_SYNC_MANAGERS; i++)
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
    75
        ec_sync_config_init(&sc->sync_configs[i]);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    76
1392
8fcc1d0987c1 DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    77
    sc->used_fmmus = 0;
1798
e7733f825982 Domain datagram working counter calculation bugfix: increment expected wc for a given slave & direction just once for each datagram
Dominik Staubli <ch1010252@ch10pc423>
parents: 1543
diff changeset
    78
    sc->used_for_fmmu_datagram[EC_DIR_INPUT] = 0;
e7733f825982 Domain datagram working counter calculation bugfix: increment expected wc for a given slave & direction just once for each datagram
Dominik Staubli <ch1010252@ch10pc423>
parents: 1543
diff changeset
    79
    sc->used_for_fmmu_datagram[EC_DIR_OUTPUT] = 0;
1507
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
    80
    sc->dc_assign_activate = 0x0000;
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
    81
    sc->dc_sync[0].cycle_time = 0x00000000;
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
    82
    sc->dc_sync[1].cycle_time = 0x00000000;
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
    83
    sc->dc_sync[0].shift_time = 0x00000000;
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
    84
    sc->dc_sync[1].shift_time = 0x00000000;
1392
8fcc1d0987c1 DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    85
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    86
    INIT_LIST_HEAD(&sc->sdo_configs);
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
    87
    INIT_LIST_HEAD(&sc->sdo_requests);
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
    88
    INIT_LIST_HEAD(&sc->voe_handlers);
1844
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
    89
    INIT_LIST_HEAD(&sc->soe_configs);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    90
}
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    91
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    92
/*****************************************************************************/
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
/** Slave configuration destructor.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    95
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    96
 * Clears and frees a slave configuration object.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    97
 */
995
54149a703c47 Removed kobject from slave_config.
Florian Pose <fp@igh-essen.com>
parents: 990
diff changeset
    98
void ec_slave_config_clear(
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    99
        ec_slave_config_t *sc /**< Slave configuration. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   100
        )
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   101
{
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   102
    unsigned int i;
854
f4f53be425ac Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents: 844
diff changeset
   103
    ec_sdo_request_t *req, *next_req;
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   104
    ec_voe_handler_t *voe, *next_voe;
1844
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   105
    ec_soe_request_t *soe, *next_soe;
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   106
995
54149a703c47 Removed kobject from slave_config.
Florian Pose <fp@igh-essen.com>
parents: 990
diff changeset
   107
    ec_slave_config_detach(sc);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   108
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   109
    // Free sync managers
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1075
diff changeset
   110
    for (i = 0; i < EC_MAX_SYNC_MANAGERS; i++)
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   111
        ec_sync_config_clear(&sc->sync_configs[i]);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   112
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   113
    // free all SDO configurations
854
f4f53be425ac Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents: 844
diff changeset
   114
    list_for_each_entry_safe(req, next_req, &sc->sdo_configs, list) {
f4f53be425ac Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents: 844
diff changeset
   115
        list_del(&req->list);
f4f53be425ac Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents: 844
diff changeset
   116
        ec_sdo_request_clear(req);
f4f53be425ac Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents: 844
diff changeset
   117
        kfree(req);
f4f53be425ac Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents: 844
diff changeset
   118
    }
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   119
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   120
    // free all SDO requests
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   121
    list_for_each_entry_safe(req, next_req, &sc->sdo_requests, list) {
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   122
        list_del(&req->list);
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   123
        ec_sdo_request_clear(req);
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   124
        kfree(req);
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   125
    }
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   126
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   127
    // free all VoE handlers
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   128
    list_for_each_entry_safe(voe, next_voe, &sc->voe_handlers, list) {
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   129
        list_del(&voe->list);
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   130
        ec_voe_handler_clear(voe);
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   131
        kfree(voe);
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   132
    }
1844
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   133
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   134
    // free all SoE configurations
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   135
    list_for_each_entry_safe(soe, next_soe, &sc->soe_configs, list) {
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   136
        list_del(&soe->list);
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   137
        ec_soe_request_clear(soe);
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   138
        kfree(soe);
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   139
    }
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   140
}
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   141
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   142
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   143
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   144
/** Prepares an FMMU configuration.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   145
 *
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   146
 * Configuration data for the FMMU is saved in the slave config structure and
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   147
 * is written to the slave during the configuration. The FMMU configuration
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   148
 * is done in a way, that the complete data range of the corresponding sync
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   149
 * manager is covered. Seperate FMMUs are configured for each domain. If the
916
db73994fbdac Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents: 893
diff changeset
   150
 * FMMU configuration is already prepared, the function does nothing and
db73994fbdac Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents: 893
diff changeset
   151
 * returns with success.
db73994fbdac Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents: 893
diff changeset
   152
 *
db73994fbdac Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents: 893
diff changeset
   153
 * \retval >=0 Success, logical offset byte address.
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   154
 * \retval  <0 Error code.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   155
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   156
int ec_slave_config_prepare_fmmu(
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   157
        ec_slave_config_t *sc, /**< Slave configuration. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   158
        ec_domain_t *domain, /**< Domain. */
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   159
        uint8_t sync_index, /**< Sync manager index. */
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   160
        ec_direction_t dir /**< PDO direction. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   161
        )
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   162
{
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   163
    unsigned int i;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   164
    ec_fmmu_config_t *fmmu;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   165
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   166
    // FMMU configuration already prepared?
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   167
    for (i = 0; i < sc->used_fmmus; i++) {
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   168
        fmmu = &sc->fmmu_configs[i];
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   169
        if (fmmu->domain == domain && fmmu->sync_index == sync_index)
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   170
            return fmmu->logical_start_address;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   171
    }
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   172
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   173
    if (sc->used_fmmus == EC_MAX_FMMUS) {
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   174
        EC_ERR("FMMU limit reached for slave configuration %u:%u!\n",
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   175
                sc->alias, sc->position);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   176
        return -EOVERFLOW;
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   177
    }
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   178
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   179
    fmmu = &sc->fmmu_configs[sc->used_fmmus++];
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   180
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   181
    down(&sc->master->master_sem);
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   182
    ec_fmmu_config_init(fmmu, sc, domain, sync_index, dir);
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   183
    up(&sc->master->master_sem);
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   184
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   185
    return fmmu->logical_start_address;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   186
}
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   187
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   188
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   189
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   190
/** Attaches the configuration to the addressed slave object.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   191
 *
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   192
 * \retval  0 Success.
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   193
 * \retval <0 Error code.
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   194
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   195
int ec_slave_config_attach(
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   196
        ec_slave_config_t *sc /**< Slave configuration. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   197
        )
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   198
{
1507
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   199
    ec_slave_t *slave;
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   200
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   201
    if (sc->slave)
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   202
        return 0; // already attached
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   203
927
ffb7d1876ce0 Introduced ec_master_find_slave().
Florian Pose <fp@igh-essen.com>
parents: 926
diff changeset
   204
    if (!(slave = ec_master_find_slave(
ffb7d1876ce0 Introduced ec_master_find_slave().
Florian Pose <fp@igh-essen.com>
parents: 926
diff changeset
   205
                    sc->master, sc->alias, sc->position))) {
1025
ae175095f09a Output attachment failure messages only when debugging.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   206
        if (sc->master->debug_level)
ae175095f09a Output attachment failure messages only when debugging.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   207
            EC_DBG("Failed to find slave for configuration %u:%u.\n",
ae175095f09a Output attachment failure messages only when debugging.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   208
                    sc->alias, sc->position);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   209
        return -ENOENT;
927
ffb7d1876ce0 Introduced ec_master_find_slave().
Florian Pose <fp@igh-essen.com>
parents: 926
diff changeset
   210
    }
ffb7d1876ce0 Introduced ec_master_find_slave().
Florian Pose <fp@igh-essen.com>
parents: 926
diff changeset
   211
1507
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   212
    if (slave->config) {
1025
ae175095f09a Output attachment failure messages only when debugging.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   213
        if (sc->master->debug_level)
ae175095f09a Output attachment failure messages only when debugging.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   214
            EC_DBG("Failed to attach slave configuration %u:%u. Slave %u"
ae175095f09a Output attachment failure messages only when debugging.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   215
                    " already has a configuration!\n", sc->alias,
ae175095f09a Output attachment failure messages only when debugging.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   216
                    sc->position, slave->ring_position);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   217
        return -EEXIST;
1025
ae175095f09a Output attachment failure messages only when debugging.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   218
    }
1145
133cf4631fcc Force reconfiguration after attachment.
Florian Pose <fp@igh-essen.com>
parents: 1115
diff changeset
   219
1025
ae175095f09a Output attachment failure messages only when debugging.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   220
    if (slave->sii.vendor_id != sc->vendor_id
ae175095f09a Output attachment failure messages only when debugging.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   221
            || slave->sii.product_code != sc->product_code) {
ae175095f09a Output attachment failure messages only when debugging.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   222
        if (sc->master->debug_level)
ae175095f09a Output attachment failure messages only when debugging.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   223
            EC_DBG("Slave %u has an invalid type (0x%08X/0x%08X) for"
ae175095f09a Output attachment failure messages only when debugging.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   224
                    " configuration %u:%u (0x%08X/0x%08X).\n",
ae175095f09a Output attachment failure messages only when debugging.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   225
                    slave->ring_position, slave->sii.vendor_id,
ae175095f09a Output attachment failure messages only when debugging.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   226
                    slave->sii.product_code, sc->alias, sc->position,
ae175095f09a Output attachment failure messages only when debugging.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   227
                    sc->vendor_id, sc->product_code);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   228
        return -EINVAL;
1507
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   229
    }
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   230
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   231
    // attach slave
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   232
    slave->config = sc;
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   233
    sc->slave = slave;
1145
133cf4631fcc Force reconfiguration after attachment.
Florian Pose <fp@igh-essen.com>
parents: 1115
diff changeset
   234
1025
ae175095f09a Output attachment failure messages only when debugging.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   235
    ec_slave_request_state(slave, EC_SLAVE_STATE_OP);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   236
929
64de138e6a54 Added debugging.
Florian Pose <fp@igh-essen.com>
parents: 927
diff changeset
   237
    if (sc->master->debug_level)
64de138e6a54 Added debugging.
Florian Pose <fp@igh-essen.com>
parents: 927
diff changeset
   238
        EC_DBG("Attached slave %u to config %u:%u.\n",
64de138e6a54 Added debugging.
Florian Pose <fp@igh-essen.com>
parents: 927
diff changeset
   239
                slave->ring_position, sc->alias, sc->position);
64de138e6a54 Added debugging.
Florian Pose <fp@igh-essen.com>
parents: 927
diff changeset
   240
1507
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   241
    return 0;
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   242
}
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   243
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   244
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   245
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   246
/** Detaches the configuration from a slave object.
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   247
 */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   248
void ec_slave_config_detach(
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   249
        ec_slave_config_t *sc /**< Slave configuration. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   250
        )
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   251
{
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   252
    if (sc->slave) {
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   253
        sc->slave->config = NULL;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   254
        sc->slave = NULL;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   255
    }
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   256
}
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   257
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   258
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   259
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   260
/** Loads the default PDO assignment from the slave object.
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   261
 */
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   262
void ec_slave_config_load_default_sync_config(ec_slave_config_t *sc)
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   263
{
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   264
    uint8_t sync_index;
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   265
    ec_sync_config_t *sync_config;
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   266
    const ec_sync_t *sync;
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   267
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   268
    if (!sc->slave)
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   269
        return;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   270
    
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1075
diff changeset
   271
    for (sync_index = 0; sync_index < EC_MAX_SYNC_MANAGERS; sync_index++) {
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   272
        sync_config = &sc->sync_configs[sync_index];
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   273
        if ((sync = ec_slave_get_sync(sc->slave, sync_index))) {
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   274
            sync_config->dir = ec_sync_default_direction(sync);
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   275
            if (sync_config->dir == EC_DIR_INVALID)
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   276
                EC_WARN("SM%u of slave %u has an invalid direction field!\n",
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   277
                        sync_index, sc->slave->ring_position);
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   278
            ec_pdo_list_copy(&sync_config->pdos, &sync->pdos);
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   279
        }
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   280
    }
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   281
}
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   282
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   283
/*****************************************************************************/
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   284
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   285
/** Loads the default mapping for a PDO from the slave object.
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   286
 */
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   287
void ec_slave_config_load_default_mapping(
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   288
        const ec_slave_config_t *sc,
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   289
        ec_pdo_t *pdo
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   290
        )
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   291
{
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   292
    unsigned int i;
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   293
    const ec_sync_t *sync;
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   294
    const ec_pdo_t *default_pdo;
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   295
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   296
    if (!sc->slave)
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   297
        return;
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   298
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   299
    if (sc->master->debug_level)
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   300
        EC_DBG("Loading default mapping for PDO 0x%04X in config %u:%u.\n",
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   301
                pdo->index, sc->alias, sc->position);
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   302
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   303
    // find PDO in any sync manager (it could be reassigned later)
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   304
    for (i = 0; i < sc->slave->sii.sync_count; i++) {
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   305
        sync = &sc->slave->sii.syncs[i];
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   306
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   307
        list_for_each_entry(default_pdo, &sync->pdos.list, list) {
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   308
            if (default_pdo->index != pdo->index)
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   309
                continue;
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   310
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   311
            if (default_pdo->name) {
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   312
                if (sc->master->debug_level)
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   313
                    EC_DBG("Found PDO name \"%s\".\n", default_pdo->name);
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   314
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   315
                // take PDO name from assigned one
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   316
                ec_pdo_set_name(pdo, default_pdo->name);
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   317
            }
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   318
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   319
            // copy entries (= default PDO mapping)
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   320
            if (ec_pdo_copy_entries(pdo, default_pdo))
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   321
                return;
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   322
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   323
            if (sc->master->debug_level) {
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   324
                const ec_pdo_entry_t *entry;
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   325
                list_for_each_entry(entry, &pdo->entries, list) {
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   326
                    EC_DBG("Entry 0x%04X:%02X.\n",
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   327
                            entry->index, entry->subindex);
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   328
                }
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   329
            }
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   330
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   331
            return;
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   332
        }
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   333
    }
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   334
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   335
    if (sc->master->debug_level)
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   336
        EC_DBG("No default mapping found.\n");
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   337
}
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   338
990
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   339
/*****************************************************************************/
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   340
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   341
/** Get the number of SDO configurations.
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   342
 *
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   343
 * \return Number of SDO configurations.
1092
69393cf60399 Improved source code doc.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   344
 */
990
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   345
unsigned int ec_slave_config_sdo_count(
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   346
        const ec_slave_config_t *sc /**< Slave configuration. */
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   347
        )
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   348
{
1507
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   349
    const ec_sdo_request_t *req;
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   350
    unsigned int count = 0;
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   351
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   352
    list_for_each_entry(req, &sc->sdo_configs, list) {
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   353
        count++;
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   354
    }
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   355
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   356
    return count;
990
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   357
}
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   358
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   359
/*****************************************************************************/
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   360
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   361
/** Finds an SDO configuration via its position in the list.
990
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   362
 *
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   363
 * Const version.
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   364
 */
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   365
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: 941
diff changeset
   366
        const ec_slave_config_t *sc, /**< Slave configuration. */
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   367
        unsigned int pos /**< Position in the list. */
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   368
        )
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   369
{
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   370
    const ec_sdo_request_t *req;
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   371
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   372
    list_for_each_entry(req, &sc->sdo_configs, list) {
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   373
        if (pos--)
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   374
            continue;
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   375
        return req;
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   376
    }
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   377
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   378
    return NULL;
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   379
}
4f223f3df05a Bus configuration via 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 941
diff changeset
   380
1263
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   381
/*****************************************************************************/
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   382
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   383
/** Finds a VoE handler via its position in the list.
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   384
 */
1351
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   385
ec_sdo_request_t *ec_slave_config_find_sdo_request(
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   386
        ec_slave_config_t *sc, /**< Slave configuration. */
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   387
        unsigned int pos /**< Position in the list. */
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   388
        )
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   389
{
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   390
    ec_sdo_request_t *req;
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   391
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   392
    list_for_each_entry(req, &sc->sdo_requests, list) {
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   393
        if (pos--)
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   394
            continue;
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   395
        return req;
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   396
    }
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   397
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   398
    return NULL;
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   399
}
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   400
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   401
/*****************************************************************************/
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   402
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   403
/** Finds a VoE handler via its position in the list.
cf8f08631c8e Added ec_slave_config_find_sdo_request().
Florian Pose <fp@igh-essen.com>
parents: 1332
diff changeset
   404
 */
1263
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   405
ec_voe_handler_t *ec_slave_config_find_voe_handler(
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   406
        ec_slave_config_t *sc, /**< Slave configuration. */
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   407
        unsigned int pos /**< Position in the list. */
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   408
        )
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   409
{
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   410
    ec_voe_handler_t *voe;
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   411
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   412
    list_for_each_entry(voe, &sc->voe_handlers, list) {
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   413
        if (pos--)
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   414
            continue;
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   415
        return voe;
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   416
    }
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   417
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   418
    return NULL;
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   419
}
f44720defbc5 Added ec_slave_config_find_voe_handler().
Florian Pose <fp@igh-essen.com>
parents: 1215
diff changeset
   420
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   421
/******************************************************************************
1392
8fcc1d0987c1 DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
   422
 *  Application interface
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   423
 *****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   424
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   425
int ecrt_slave_config_sync_manager(ec_slave_config_t *sc, uint8_t sync_index,
1509
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
   426
        ec_direction_t dir, ec_watchdog_mode_t watchdog_mode)
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   427
{
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   428
    ec_sync_config_t *sync_config;
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   429
    
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   430
    if (sc->master->debug_level)
1543
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   431
        EC_DBG("ecrt_slave_config_sync_manager(sc = 0x%p, sync_index = %u, "
1509
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
   432
                "dir = %i, watchdog_mode = %i)\n",
1543
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   433
                 sc, sync_index, dir, watchdog_mode);
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   434
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1075
diff changeset
   435
    if (sync_index >= EC_MAX_SYNC_MANAGERS) {
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   436
        EC_ERR("Invalid sync manager index %u!\n", sync_index);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   437
        return -ENOENT;
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   438
    }
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   439
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   440
    if (dir != EC_DIR_OUTPUT && dir != EC_DIR_INPUT) {
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   441
        EC_ERR("Invalid direction %u!\n", (u32) dir);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   442
        return -EINVAL;
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   443
    }
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   444
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   445
    sync_config = &sc->sync_configs[sync_index];
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   446
    sync_config->dir = dir;
1509
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
   447
    sync_config->watchdog_mode = watchdog_mode;
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   448
    return 0;
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   449
}
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   450
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   451
/*****************************************************************************/
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   452
1509
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
   453
void ecrt_slave_config_watchdog(ec_slave_config_t *sc,
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
   454
        uint16_t divider, uint16_t intervals)
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
   455
{
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
   456
    if (sc->master->debug_level)
1543
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   457
        EC_DBG("%s(sc = 0x%p, divider = %u, intervals = %u)\n",
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   458
                __func__, sc, divider, intervals);
1509
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
   459
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
   460
    sc->watchdog_divider = divider;
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
   461
    sc->watchdog_intervals = intervals;
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
   462
}
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
   463
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
   464
/*****************************************************************************/
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
   465
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   466
int ecrt_slave_config_pdo_assign_add(ec_slave_config_t *sc,
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   467
        uint8_t sync_index, uint16_t pdo_index)
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   468
{
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   469
    ec_pdo_t *pdo;
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   470
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   471
    if (sc->master->debug_level)
1543
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   472
        EC_DBG("ecrt_slave_config_pdo_assign_add(sc = 0x%p, sync_index = %u, "
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   473
                "pdo_index = 0x%04X)\n", sc, sync_index, pdo_index);
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   474
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1075
diff changeset
   475
    if (sync_index >= EC_MAX_SYNC_MANAGERS) {
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   476
        EC_ERR("Invalid sync manager index %u!\n", sync_index);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   477
        return -EINVAL;
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   478
    }
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   479
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   480
    down(&sc->master->master_sem);
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   481
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   482
    pdo = ec_pdo_list_add_pdo(&sc->sync_configs[sync_index].pdos, pdo_index);
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   483
    if (IS_ERR(pdo)) {
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   484
        up(&sc->master->master_sem);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   485
        return PTR_ERR(pdo);
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   486
    }
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   487
    pdo->sync_index = sync_index;
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   488
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   489
    ec_slave_config_load_default_mapping(sc, pdo);
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   490
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   491
    up(&sc->master->master_sem);
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   492
    return 0;
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   493
}
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   494
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   495
/*****************************************************************************/
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   496
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   497
void ecrt_slave_config_pdo_assign_clear(ec_slave_config_t *sc,
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   498
        uint8_t sync_index)
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   499
{
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   500
    if (sc->master->debug_level)
1543
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   501
        EC_DBG("ecrt_slave_config_pdo_assign_clear(sc = 0x%p, "
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   502
                "sync_index = %u)\n", sc, sync_index);
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   503
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1075
diff changeset
   504
    if (sync_index >= EC_MAX_SYNC_MANAGERS) {
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   505
        EC_ERR("Invalid sync manager index %u!\n", sync_index);
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   506
        return;
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   507
    }
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   508
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   509
    down(&sc->master->master_sem);
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   510
    ec_pdo_list_clear_pdos(&sc->sync_configs[sync_index].pdos);
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   511
    up(&sc->master->master_sem);
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   512
}
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   513
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   514
/*****************************************************************************/
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   515
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   516
int ecrt_slave_config_pdo_mapping_add(ec_slave_config_t *sc,
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   517
        uint16_t pdo_index, uint16_t entry_index, uint8_t entry_subindex,
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   518
        uint8_t entry_bit_length)
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   519
{
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   520
    uint8_t sync_index;
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   521
    ec_pdo_t *pdo = NULL;
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   522
    ec_pdo_entry_t *entry;
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   523
    int retval = 0;
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   524
    
843
b6bddb663755 Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents: 842
diff changeset
   525
    if (sc->master->debug_level)
1543
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   526
        EC_DBG("ecrt_slave_config_pdo_mapping_add(sc = 0x%p, "
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   527
                "pdo_index = 0x%04X, entry_index = 0x%04X, "
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   528
                "entry_subindex = 0x%02X, entry_bit_length = %u)\n",
1543
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   529
                sc, pdo_index, entry_index, entry_subindex,
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   530
                entry_bit_length);
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   531
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1075
diff changeset
   532
    for (sync_index = 0; sync_index < EC_MAX_SYNC_MANAGERS; sync_index++)
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   533
        if ((pdo = ec_pdo_list_find_pdo(
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   534
                        &sc->sync_configs[sync_index].pdos, pdo_index)))
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   535
            break;
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   536
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   537
    if (pdo) {
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   538
        down(&sc->master->master_sem);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   539
        entry = ec_pdo_add_entry(pdo, entry_index, entry_subindex,
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   540
                entry_bit_length);
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   541
        up(&sc->master->master_sem);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   542
        if (IS_ERR(entry))
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   543
            retval = PTR_ERR(entry);
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   544
    } else {
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   545
        EC_ERR("PDO 0x%04X is not assigned in config %u:%u.\n",
843
b6bddb663755 Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents: 842
diff changeset
   546
                pdo_index, sc->alias, sc->position);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   547
        retval = -ENOENT; 
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   548
    }
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   549
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   550
    return retval;
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   551
}
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   552
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   553
/*****************************************************************************/
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   554
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   555
void ecrt_slave_config_pdo_mapping_clear(ec_slave_config_t *sc,
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   556
        uint16_t pdo_index)
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   557
{
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   558
    uint8_t sync_index;
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   559
    ec_pdo_t *pdo = NULL;
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   560
    
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   561
    if (sc->master->debug_level)
1543
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   562
        EC_DBG("ecrt_slave_config_pdo_mapping_clear(sc = 0x%p, "
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   563
                "pdo_index = 0x%04X)\n", sc, pdo_index);
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   564
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1075
diff changeset
   565
    for (sync_index = 0; sync_index < EC_MAX_SYNC_MANAGERS; sync_index++)
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   566
        if ((pdo = ec_pdo_list_find_pdo(
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   567
                        &sc->sync_configs[sync_index].pdos, pdo_index)))
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   568
            break;
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   569
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   570
    if (pdo) {
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   571
        down(&sc->master->master_sem);
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   572
        ec_pdo_clear_entries(pdo);
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   573
        up(&sc->master->master_sem);
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   574
    } else {
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   575
        EC_WARN("PDO 0x%04X is not assigned in config %u:%u.\n",
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   576
                pdo_index, sc->alias, sc->position);
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   577
    }
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   578
}
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   579
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   580
/*****************************************************************************/
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   581
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1075
diff changeset
   582
int ecrt_slave_config_pdos(ec_slave_config_t *sc,
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   583
        unsigned int n_syncs, const ec_sync_info_t syncs[])
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   584
{
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   585
    int ret;
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   586
    unsigned int i, j, k;
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   587
    const ec_sync_info_t *sync_info;
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   588
    const ec_pdo_info_t *pdo_info;
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   589
    const ec_pdo_entry_info_t *entry_info;
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   590
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   591
    if (sc->master->debug_level)
1543
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   592
        EC_DBG("ecrt_slave_config_pdos(sc = 0x%p, n_syncs = %u, "
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   593
                "syncs = 0x%p)\n", sc, n_syncs, syncs);
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   594
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   595
    if (!syncs)
1054
4c16fe64b403 Return out of ecrt_slave_config_pdos() when pdo_infos == NULL
Richard Hacker <ha@igh-essen.com>
parents: 1025
diff changeset
   596
        return 0;
4c16fe64b403 Return out of ecrt_slave_config_pdos() when pdo_infos == NULL
Richard Hacker <ha@igh-essen.com>
parents: 1025
diff changeset
   597
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   598
    for (i = 0; i < n_syncs; i++) {
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   599
        sync_info = &syncs[i];
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   600
1097
f974ced181f3 Using EC_END.
Florian Pose <fp@igh-essen.com>
parents: 1092
diff changeset
   601
        if (sync_info->index == (uint8_t) EC_END)
878
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 859
diff changeset
   602
            break;
40c379697ebf Introduced EC_MAP_END.
Florian Pose <fp@igh-essen.com>
parents: 859
diff changeset
   603
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1075
diff changeset
   604
        if (sync_info->index >= EC_MAX_SYNC_MANAGERS) {
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   605
            EC_ERR("Invalid sync manager index %u!\n", sync_info->index);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   606
            return -ENOENT;
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   607
        }
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   608
1509
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
   609
        ret = ecrt_slave_config_sync_manager(sc, sync_info->index,
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
   610
                sync_info->dir, sync_info->watchdog_mode);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   611
        if (ret)
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   612
            return ret;
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   613
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   614
        if (sync_info->n_pdos && sync_info->pdos) {
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   615
            ecrt_slave_config_pdo_assign_clear(sc, sync_info->index);
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   616
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   617
            for (j = 0; j < sync_info->n_pdos; j++) {
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   618
                pdo_info = &sync_info->pdos[j];
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   619
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   620
                ret = ecrt_slave_config_pdo_assign_add(
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   621
                        sc, sync_info->index, pdo_info->index);
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   622
                if (ret)
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   623
                    return ret;
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   624
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   625
                if (pdo_info->n_entries && pdo_info->entries) {
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   626
                    ecrt_slave_config_pdo_mapping_clear(sc, pdo_info->index);
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   627
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   628
                    for (k = 0; k < pdo_info->n_entries; k++) {
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   629
                        entry_info = &pdo_info->entries[k];
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   630
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   631
                        ret = ecrt_slave_config_pdo_mapping_add(sc,
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   632
                                pdo_info->index, entry_info->index,
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   633
                                entry_info->subindex,
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   634
                                entry_info->bit_length);
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   635
                        if (ret)
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   636
                            return ret;
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   637
                    }
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   638
                }
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   639
            }
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   640
        }
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   641
    }
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   642
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   643
    return 0;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   644
}
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   645
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   646
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   647
807
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 797
diff changeset
   648
int ecrt_slave_config_reg_pdo_entry(
923
a6b51990e7e6 Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents: 916
diff changeset
   649
        ec_slave_config_t *sc,
a6b51990e7e6 Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents: 916
diff changeset
   650
        uint16_t index,
a6b51990e7e6 Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents: 916
diff changeset
   651
        uint8_t subindex,
a6b51990e7e6 Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents: 916
diff changeset
   652
        ec_domain_t *domain,
925
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 924
diff changeset
   653
        unsigned int *bit_position
916
db73994fbdac Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents: 893
diff changeset
   654
        )
db73994fbdac Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents: 893
diff changeset
   655
{
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   656
    uint8_t sync_index;
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   657
    const ec_sync_config_t *sync_config;
925
939f3e9bba1e Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents: 924
diff changeset
   658
    unsigned int bit_offset, bit_pos;
807
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 797
diff changeset
   659
    ec_pdo_t *pdo;
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 797
diff changeset
   660
    ec_pdo_entry_t *entry;
923
a6b51990e7e6 Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents: 916
diff changeset
   661
    int sync_offset;
807
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 797
diff changeset
   662
941
41a993738383 Added debugging for ecrt_slave_config_reg_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 929
diff changeset
   663
    if (sc->master->debug_level)
1543
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   664
        EC_DBG("ecrt_slave_config_reg_pdo_entry(sc = 0x%p, index = 0x%04X, "
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   665
                "subindex = 0x%02X, domain = 0x%p, bit_position = 0x%p)\n",
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   666
                sc, index, subindex, domain, bit_position);
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   667
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1075
diff changeset
   668
    for (sync_index = 0; sync_index < EC_MAX_SYNC_MANAGERS; sync_index++) {
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   669
        sync_config = &sc->sync_configs[sync_index];
807
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 797
diff changeset
   670
        bit_offset = 0;
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   671
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   672
        list_for_each_entry(pdo, &sync_config->pdos.list, list) {
807
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 797
diff changeset
   673
            list_for_each_entry(entry, &pdo->entries, list) {
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 797
diff changeset
   674
                if (entry->index != index || entry->subindex != subindex) {
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 797
diff changeset
   675
                    bit_offset += entry->bit_length;
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 797
diff changeset
   676
                } else {
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   677
                    bit_pos = bit_offset % 8;
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   678
                    if (bit_position) {
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   679
                        *bit_position = bit_pos;
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   680
                    } else if (bit_pos) {
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   681
                        EC_ERR("PDO entry 0x%04X:%02X does not byte-align "
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   682
                                "in config %u:%u.\n", index, subindex,
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   683
                                sc->alias, sc->position);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   684
                        return -EFAULT;
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   685
                    }
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   686
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   687
                    sync_offset = ec_slave_config_prepare_fmmu(
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   688
                            sc, domain, sync_index, sync_config->dir);
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   689
                    if (sync_offset < 0)
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   690
                        return sync_offset;
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   691
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
   692
                    return sync_offset + bit_offset / 8;
807
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 797
diff changeset
   693
                }
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 797
diff changeset
   694
            }
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 797
diff changeset
   695
        }
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 797
diff changeset
   696
    }
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 797
diff changeset
   697
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   698
    EC_ERR("PDO entry 0x%04X:%02X is not mapped in slave config %u:%u.\n",
807
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 797
diff changeset
   699
           index, subindex, sc->alias, sc->position);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   700
    return -ENOENT;
924
d8d9a1056afa Fixed missing right brace
Richard Hacker <ha@igh-essen.com>
parents: 923
diff changeset
   701
}
923
a6b51990e7e6 Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents: 916
diff changeset
   702
1392
8fcc1d0987c1 DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
   703
/*****************************************************************************/
8fcc1d0987c1 DC cyclic operation and slave configuration. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
   704
1448
d7ba0c408a07 Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents: 1438
diff changeset
   705
void ecrt_slave_config_dc(ec_slave_config_t *sc, uint16_t assign_activate,
1438
1d30b96bb04f Replaced ecrt_slave_config_dc_cycle_times() and ecrt_slave_config_dc_shift_times() by ecrt_slave_config_dc_sync_signals().
Florian Pose <fp@igh-essen.com>
parents: 1412
diff changeset
   706
        uint32_t sync0_cycle_time, uint32_t sync0_shift_time,
1d30b96bb04f Replaced ecrt_slave_config_dc_cycle_times() and ecrt_slave_config_dc_shift_times() by ecrt_slave_config_dc_sync_signals().
Florian Pose <fp@igh-essen.com>
parents: 1412
diff changeset
   707
        uint32_t sync1_cycle_time, uint32_t sync1_shift_time)
1d30b96bb04f Replaced ecrt_slave_config_dc_cycle_times() and ecrt_slave_config_dc_shift_times() by ecrt_slave_config_dc_sync_signals().
Florian Pose <fp@igh-essen.com>
parents: 1412
diff changeset
   708
{
1507
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   709
    sc->dc_assign_activate = assign_activate;
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   710
    sc->dc_sync[0].cycle_time = sync0_cycle_time;
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   711
    sc->dc_sync[0].shift_time = sync0_shift_time;
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   712
    sc->dc_sync[1].cycle_time = sync1_cycle_time;
68e89abadd19 Removed unwanted tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   713
    sc->dc_sync[1].shift_time = sync1_shift_time;
1412
8f7bbbd3b7ac DC shift time working.
Florian Pose <fp@igh-essen.com>
parents: 1392
diff changeset
   714
}
8f7bbbd3b7ac DC shift time working.
Florian Pose <fp@igh-essen.com>
parents: 1392
diff changeset
   715
8f7bbbd3b7ac DC shift time working.
Florian Pose <fp@igh-essen.com>
parents: 1392
diff changeset
   716
/*****************************************************************************/
8f7bbbd3b7ac DC shift time working.
Florian Pose <fp@igh-essen.com>
parents: 1392
diff changeset
   717
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   718
int ecrt_slave_config_sdo(ec_slave_config_t *sc, uint16_t index,
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   719
        uint8_t subindex, const uint8_t *data, size_t size)
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   720
{
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   721
    ec_slave_t *slave = sc->slave;
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   722
    ec_sdo_request_t *req;
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   723
    int ret;
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   724
1115
b7b965ab94cd Sdo configuration debugging.
Florian Pose <fp@igh-essen.com>
parents: 1097
diff changeset
   725
    if (sc->master->debug_level)
1543
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   726
        EC_DBG("ecrt_slave_config_sdo(sc = 0x%p, index = 0x%04X, "
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   727
                "subindex = 0x%02X, data = 0x%p, size = %zu)\n", sc,
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   728
                index, subindex, data, size);
1115
b7b965ab94cd Sdo configuration debugging.
Florian Pose <fp@igh-essen.com>
parents: 1097
diff changeset
   729
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   730
    if (slave && !(slave->sii.mailbox_protocols & EC_MBOX_COE)) {
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   731
        EC_ERR("Slave %u does not support CoE!\n", slave->ring_position);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   732
        return -EPROTONOSUPPORT; // protocol not supported
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   733
    }
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   734
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   735
    if (!(req = (ec_sdo_request_t *)
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   736
          kmalloc(sizeof(ec_sdo_request_t), GFP_KERNEL))) {
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   737
        EC_ERR("Failed to allocate memory for SDO configuration!\n");
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   738
        return -ENOMEM;
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   739
    }
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   740
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   741
    ec_sdo_request_init(req);
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   742
    ec_sdo_request_address(req, index, subindex);
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   743
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   744
    ret = ec_sdo_request_copy_data(req, data, size);
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   745
    if (ret < 0) {
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   746
        ec_sdo_request_clear(req);
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   747
        kfree(req);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1312
diff changeset
   748
        return ret;
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   749
    }
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   750
        
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   751
    down(&sc->master->master_sem);
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   752
    list_add_tail(&req->list, &sc->sdo_configs);
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   753
    up(&sc->master->master_sem);
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   754
    return 0;
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   755
}
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   756
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   757
/*****************************************************************************/
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   758
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   759
int ecrt_slave_config_sdo8(ec_slave_config_t *sc, uint16_t index,
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   760
        uint8_t subindex, uint8_t value)
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   761
{
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   762
    uint8_t data[1];
1115
b7b965ab94cd Sdo configuration debugging.
Florian Pose <fp@igh-essen.com>
parents: 1097
diff changeset
   763
b7b965ab94cd Sdo configuration debugging.
Florian Pose <fp@igh-essen.com>
parents: 1097
diff changeset
   764
    if (sc->master->debug_level)
1543
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   765
        EC_DBG("ecrt_slave_config_sdo8(sc = 0x%p, index = 0x%04X, "
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   766
                "subindex = 0x%02X, value = %u)\n", sc,
1115
b7b965ab94cd Sdo configuration debugging.
Florian Pose <fp@igh-essen.com>
parents: 1097
diff changeset
   767
                index, subindex, (u32) value);
b7b965ab94cd Sdo configuration debugging.
Florian Pose <fp@igh-essen.com>
parents: 1097
diff changeset
   768
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   769
    EC_WRITE_U8(data, value);
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   770
    return ecrt_slave_config_sdo(sc, index, subindex, data, 1);
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   771
}
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   772
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   773
/*****************************************************************************/
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   774
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   775
int ecrt_slave_config_sdo16(ec_slave_config_t *sc, uint16_t index,
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   776
        uint8_t subindex, uint16_t value)
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   777
{
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   778
    uint8_t data[2];
1115
b7b965ab94cd Sdo configuration debugging.
Florian Pose <fp@igh-essen.com>
parents: 1097
diff changeset
   779
b7b965ab94cd Sdo configuration debugging.
Florian Pose <fp@igh-essen.com>
parents: 1097
diff changeset
   780
    if (sc->master->debug_level)
1543
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   781
        EC_DBG("ecrt_slave_config_sdo16(sc = 0x%p, index = 0x%04X, "
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   782
                "subindex = 0x%02X, value = %u)\n", sc,
1115
b7b965ab94cd Sdo configuration debugging.
Florian Pose <fp@igh-essen.com>
parents: 1097
diff changeset
   783
                index, subindex, value);
b7b965ab94cd Sdo configuration debugging.
Florian Pose <fp@igh-essen.com>
parents: 1097
diff changeset
   784
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   785
    EC_WRITE_U16(data, value);
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   786
    return ecrt_slave_config_sdo(sc, index, subindex, data, 2);
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   787
}
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   788
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   789
/*****************************************************************************/
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   790
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   791
int ecrt_slave_config_sdo32(ec_slave_config_t *sc, uint16_t index,
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   792
        uint8_t subindex, uint32_t value)
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   793
{
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   794
    uint8_t data[4];
1115
b7b965ab94cd Sdo configuration debugging.
Florian Pose <fp@igh-essen.com>
parents: 1097
diff changeset
   795
b7b965ab94cd Sdo configuration debugging.
Florian Pose <fp@igh-essen.com>
parents: 1097
diff changeset
   796
    if (sc->master->debug_level)
1543
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   797
        EC_DBG("ecrt_slave_config_sdo32(sc = 0x%p, index = 0x%04X, "
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   798
                "subindex = 0x%02X, value = %u)\n", sc,
1115
b7b965ab94cd Sdo configuration debugging.
Florian Pose <fp@igh-essen.com>
parents: 1097
diff changeset
   799
                index, subindex, value);
b7b965ab94cd Sdo configuration debugging.
Florian Pose <fp@igh-essen.com>
parents: 1097
diff changeset
   800
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   801
    EC_WRITE_U32(data, value);
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
   802
    return ecrt_slave_config_sdo(sc, index, subindex, data, 4);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   803
}
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   804
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   805
/*****************************************************************************/
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   806
1526
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   807
int ecrt_slave_config_complete_sdo(ec_slave_config_t *sc, uint16_t index,
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   808
        const uint8_t *data, size_t size)
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   809
{
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   810
    ec_slave_t *slave = sc->slave;
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   811
    ec_sdo_request_t *req;
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   812
    int ret;
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   813
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   814
    if (sc->master->debug_level)
1543
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   815
        EC_DBG("ecrt_slave_config_complete_sdo(sc = 0x%p, index = 0x%04X, "
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   816
                "data = 0x%p, size = %zu)\n", sc, index, data, size);
1526
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   817
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   818
    if (slave && !(slave->sii.mailbox_protocols & EC_MBOX_COE)) {
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   819
        EC_ERR("Slave %u does not support CoE!\n", slave->ring_position);
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   820
        return -EPROTONOSUPPORT; // protocol not supported
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   821
    }
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   822
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   823
    if (!(req = (ec_sdo_request_t *)
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   824
          kmalloc(sizeof(ec_sdo_request_t), GFP_KERNEL))) {
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   825
        EC_ERR("Failed to allocate memory for SDO configuration!\n");
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   826
        return -ENOMEM;
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   827
    }
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   828
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   829
    ec_sdo_request_init(req);
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   830
    ec_sdo_request_address(req, index, 0);
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   831
    req->complete_access = 1;
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   832
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   833
    ret = ec_sdo_request_copy_data(req, data, size);
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   834
    if (ret < 0) {
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   835
        ec_sdo_request_clear(req);
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   836
        kfree(req);
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   837
        return ret;
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   838
    }
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   839
        
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   840
    down(&sc->master->master_sem);
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   841
    list_add_tail(&req->list, &sc->sdo_configs);
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   842
    up(&sc->master->master_sem);
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   843
    return 0;
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   844
}
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   845
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   846
/*****************************************************************************/
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   847
1332
d62633fea8ed merge -c1610 branches/stable-1.4: Added missing doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   848
/** Same as ecrt_slave_config_create_sdo_request(), but with ERR_PTR() return
d62633fea8ed merge -c1610 branches/stable-1.4: Added missing doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   849
 * value.
d62633fea8ed merge -c1610 branches/stable-1.4: Added missing doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   850
 */
1312
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   851
ec_sdo_request_t *ecrt_slave_config_create_sdo_request_err(
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   852
        ec_slave_config_t *sc, uint16_t index, uint8_t subindex, size_t size)
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   853
{
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   854
    ec_sdo_request_t *req;
1312
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   855
    int ret;
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   856
1181
9e5954a2a46e Added debugging for configuration function of the application interface.
Florian Pose <fp@igh-essen.com>
parents: 1178
diff changeset
   857
    if (sc->master->debug_level)
1543
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   858
        EC_DBG("ecrt_slave_config_create_sdo_request(sc = 0x%p, "
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   859
                "index = 0x%04X, subindex = 0x%02X, size = %zu)\n", sc,
1181
9e5954a2a46e Added debugging for configuration function of the application interface.
Florian Pose <fp@igh-essen.com>
parents: 1178
diff changeset
   860
                index, subindex, size);
9e5954a2a46e Added debugging for configuration function of the application interface.
Florian Pose <fp@igh-essen.com>
parents: 1178
diff changeset
   861
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   862
    if (!(req = (ec_sdo_request_t *)
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   863
                kmalloc(sizeof(ec_sdo_request_t), GFP_KERNEL))) {
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   864
        EC_ERR("Failed to allocate SDO request memory!\n");
1312
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   865
        return ERR_PTR(-ENOMEM);
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   866
    }
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   867
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   868
    ec_sdo_request_init(req);
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   869
    ec_sdo_request_address(req, index, subindex);
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   870
1312
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   871
    ret = ec_sdo_request_alloc(req, size);
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   872
    if (ret < 0) {
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   873
        ec_sdo_request_clear(req);
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   874
        kfree(req);
1312
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   875
        return ERR_PTR(ret);
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   876
    }
859
233e32f428e1 Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   877
233e32f428e1 Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   878
    // prepare data for optional writing
233e32f428e1 Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   879
    memset(req->data, 0x00, size);
233e32f428e1 Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   880
    req->data_size = size;
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   881
    
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   882
    down(&sc->master->master_sem);
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   883
    list_add_tail(&req->list, &sc->sdo_requests);
1075
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   884
    up(&sc->master->master_sem);
94c6e36e0f8d Implemented master semaphore to secure concurrent access from ioctls, state machine and realtime interface.
Florian Pose <fp@igh-essen.com>
parents: 1059
diff changeset
   885
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   886
    return req; 
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   887
}
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   888
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   889
/*****************************************************************************/
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
   890
1312
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   891
ec_sdo_request_t *ecrt_slave_config_create_sdo_request(
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   892
        ec_slave_config_t *sc, uint16_t index, uint8_t subindex, size_t size)
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   893
{
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   894
    ec_sdo_request_t *s = ecrt_slave_config_create_sdo_request_err(sc, index,
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   895
            subindex, size);
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   896
    return IS_ERR(s) ? NULL : s;
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   897
}
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   898
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   899
/*****************************************************************************/
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   900
1332
d62633fea8ed merge -c1610 branches/stable-1.4: Added missing doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   901
/** Same as ecrt_slave_config_create_voe_handler(), but with ERR_PTR() return
d62633fea8ed merge -c1610 branches/stable-1.4: Added missing doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   902
 * value.
d62633fea8ed merge -c1610 branches/stable-1.4: Added missing doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   903
 */
1312
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   904
ec_voe_handler_t *ecrt_slave_config_create_voe_handler_err(
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   905
        ec_slave_config_t *sc, size_t size)
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   906
{
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   907
    ec_voe_handler_t *voe;
1312
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   908
    int ret;
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   909
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   910
    if (sc->master->debug_level)
1543
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   911
        EC_DBG("ecrt_slave_config_create_voe_handler(sc = 0x%p, size = %zu)\n",
373cd456dc26 Avoid warnings on x86_64 platform. Thanks to Thomas Elste.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   912
                sc, size);
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   913
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   914
    if (!(voe = (ec_voe_handler_t *)
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   915
                kmalloc(sizeof(ec_voe_handler_t), GFP_KERNEL))) {
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   916
        EC_ERR("Failed to allocate VoE request memory!\n");
1312
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   917
        return ERR_PTR(-ENOMEM);
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   918
    }
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   919
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   920
    ret = ec_voe_handler_init(voe, sc, size);
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   921
    if (ret < 0) {
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   922
        kfree(voe);
1312
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   923
        return ERR_PTR(ret);
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   924
    }
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   925
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   926
    down(&sc->master->master_sem);
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   927
    list_add_tail(&voe->list, &sc->voe_handlers);
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   928
    up(&sc->master->master_sem);
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   929
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   930
    return voe; 
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   931
}
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   932
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   933
/*****************************************************************************/
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents: 1181
diff changeset
   934
1312
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   935
ec_voe_handler_t *ecrt_slave_config_create_voe_handler(
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   936
        ec_slave_config_t *sc, size_t size)
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   937
{
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   938
    ec_voe_handler_t *voe = ecrt_slave_config_create_voe_handler_err(sc,
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   939
            size);
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   940
    return IS_ERR(voe) ? NULL : voe;
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   941
}
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   942
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   943
/*****************************************************************************/
74853e018898 Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents: 1277
diff changeset
   944
1022
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   945
void ecrt_slave_config_state(const ec_slave_config_t *sc,
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   946
        ec_slave_config_state_t *state)
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   947
{
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   948
    state->online = sc->slave ? 1 : 0;
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   949
    if (state->online) {
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   950
        state->operational =
1277
1189e040fe12 merge -c1521 branches/stable-1.4: Fixed race concerning ec_slave_config_state->operational.
Florian Pose <fp@igh-essen.com>
parents: 1263
diff changeset
   951
            sc->slave->current_state == EC_SLAVE_STATE_OP
1189e040fe12 merge -c1521 branches/stable-1.4: Fixed race concerning ec_slave_config_state->operational.
Florian Pose <fp@igh-essen.com>
parents: 1263
diff changeset
   952
            && !sc->slave->force_config;
1022
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   953
        state->al_state = sc->slave->current_state;
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   954
    } else {
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   955
        state->operational = 0;
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   956
        state->al_state = EC_SLAVE_STATE_UNKNOWN;
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   957
    }
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   958
}
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   959
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   960
/*****************************************************************************/
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
   961
1844
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   962
int ecrt_slave_config_idn(ec_slave_config_t *sc, uint16_t idn,
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   963
		const uint8_t *data, size_t size)
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   964
{
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   965
    ec_slave_t *slave = sc->slave;
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   966
    ec_soe_request_t *req;
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   967
    int ret;
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   968
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   969
    if (sc->master->debug_level)
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   970
        EC_DBG("ecrt_slave_config_idn(sc = 0x%p, idn = 0x%04X, "
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   971
                "data = 0x%p, size = %zu)\n", sc, idn, data, size);
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   972
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   973
    if (slave && !(slave->sii.mailbox_protocols & EC_MBOX_SOE)) {
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   974
        EC_ERR("Slave %u does not support SoE!\n", slave->ring_position);
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   975
        return -EPROTONOSUPPORT; // protocol not supported
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   976
    }
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   977
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   978
    if (!(req = (ec_soe_request_t *)
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   979
          kmalloc(sizeof(ec_soe_request_t), GFP_KERNEL))) {
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   980
        EC_ERR("Failed to allocate memory for IDN configuration!\n");
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   981
        return -ENOMEM;
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   982
    }
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   983
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   984
    ec_soe_request_init(req);
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   985
    ec_soe_request_set_idn(req, idn);
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   986
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   987
    ret = ec_soe_request_copy_data(req, data, size);
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   988
    if (ret < 0) {
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   989
        ec_soe_request_clear(req);
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   990
        kfree(req);
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   991
        return ret;
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   992
    }
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   993
        
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   994
    down(&sc->master->master_sem);
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   995
    list_add_tail(&req->list, &sc->soe_configs);
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   996
    up(&sc->master->master_sem);
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   997
    return 0;
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   998
}
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
   999
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
  1000
/*****************************************************************************/
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
  1001
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1002
/** \cond */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1003
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1054
diff changeset
  1004
EXPORT_SYMBOL(ecrt_slave_config_sync_manager);
1509
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1507
diff changeset
  1005
EXPORT_SYMBOL(ecrt_slave_config_watchdog);
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
  1006
EXPORT_SYMBOL(ecrt_slave_config_pdo_assign_add);
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
  1007
EXPORT_SYMBOL(ecrt_slave_config_pdo_assign_clear);
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
  1008
EXPORT_SYMBOL(ecrt_slave_config_pdo_mapping_add);
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
  1009
EXPORT_SYMBOL(ecrt_slave_config_pdo_mapping_clear);
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1075
diff changeset
  1010
EXPORT_SYMBOL(ecrt_slave_config_pdos);
807
f8bca95ab75d Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents: 797
diff changeset
  1011
EXPORT_SYMBOL(ecrt_slave_config_reg_pdo_entry);
1448
d7ba0c408a07 Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents: 1438
diff changeset
  1012
EXPORT_SYMBOL(ecrt_slave_config_dc);
893
d921fff3d6e2 Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents: 879
diff changeset
  1013
EXPORT_SYMBOL(ecrt_slave_config_sdo);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1014
EXPORT_SYMBOL(ecrt_slave_config_sdo8);
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1015
EXPORT_SYMBOL(ecrt_slave_config_sdo16);
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1016
EXPORT_SYMBOL(ecrt_slave_config_sdo32);
1526
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
  1017
EXPORT_SYMBOL(ecrt_slave_config_complete_sdo);
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 854
diff changeset
  1018
EXPORT_SYMBOL(ecrt_slave_config_create_sdo_request);
1215
3bedd338ff76 Added missing export.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
  1019
EXPORT_SYMBOL(ecrt_slave_config_create_voe_handler);
1022
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 1010
diff changeset
  1020
EXPORT_SYMBOL(ecrt_slave_config_state);
1844
b6bd88d4806b Added ecrt_slave_config_idn() method to store SoE IDN configurations.
Florian Pose <fp@igh-essen.com>
parents: 1798
diff changeset
  1021
EXPORT_SYMBOL(ecrt_slave_config_idn);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1022
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1023
/** \endcond */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1024
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1025
/*****************************************************************************/