lib/slave_config.c
author Martin Troxler <ch1010277@ch10pc446>
Mon, 22 Nov 2010 09:09:23 +0100
changeset 2000 c76c01572f00
parent 1995 7d748d9cf9e8
child 2025 2d7e29d82e9a
permissions -rw-r--r--
Idle thread considers fsm step prepared by Op-thread (Otherwise some state changes may get lost)
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
1266
dd1f501c4070 Added LGPL licence headers to userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1264
diff changeset
     2
 *  
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
     3
 *  $Id$
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
     4
 *  
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-2009  Florian Pose, Ingenieurgemeinschaft IgH
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
     6
 *  
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
     7
 *  This file is part of the IgH EtherCAT master userspace library.
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
     8
 *  
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 userspace library is free software; you can
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
 *  redistribute it and/or modify it under the terms of the GNU Lesser 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
    11
 *  Public License as published by the Free Software Foundation; version 2.1
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
 *  of the License.
1287
cc7b679c74e9 Improved LGPL headers.
Florian Pose <fp@igh-essen.com>
parents: 1266
diff changeset
    13
 *
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
    14
 *  The IgH EtherCAT master userspace library is distributed in the hope that
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
 *  it will be useful, but WITHOUT ANY WARRANTY; without even the implied
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
 *  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
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
 *  GNU Lesser General Public License for more details.
1287
cc7b679c74e9 Improved LGPL headers.
Florian Pose <fp@igh-essen.com>
parents: 1266
diff changeset
    18
 *
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
    19
 *  You should have received a copy of the GNU Lesser General Public License
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
    20
 *  along with the IgH EtherCAT master userspace library. If not, see
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
    21
 *  <http://www.gnu.org/licenses/>.
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
    22
 *  
1363
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1352
diff changeset
    23
 *  ---
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1352
diff changeset
    24
 *  
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1352
diff changeset
    25
 *  The license mentioned above concerns the source code only. Using the
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1352
diff changeset
    26
 *  EtherCAT technology and brand is only permitted in compliance with the
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1352
diff changeset
    27
 *  industrial property and similar rights of Beckhoff Automation GmbH.
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 *
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
 *****************************************************************************/
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
#include <stdlib.h>
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
#include <sys/ioctl.h>
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
#include <stdio.h>
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
#include <errno.h>
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
#include <string.h>
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
#include "slave_config.h"
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
#include "domain.h"
1352
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
    39
#include "sdo_request.h"
1264
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
    40
#include "voe_handler.h"
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
#include "master.h"
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
#include "master/ioctl.h"
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
/*****************************************************************************/
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
1959
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    46
void ec_slave_config_clear(ec_slave_config_t *sc)
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    47
{
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    48
    ec_sdo_request_t *r, *next_r;
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    49
    ec_voe_handler_t *v, *next_v;
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    50
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    51
    r = sc->first_sdo_request;
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    52
    while (r) {
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    53
        next_r = r->next;
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    54
        ec_sdo_request_clear(r);
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    55
        r = next_r;
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    56
    }
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    57
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    58
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    59
    v = sc->first_voe_handler;
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    60
    while (v) {
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    61
        next_v = v->next;
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    62
        ec_voe_handler_clear(v);
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    63
        v = next_v;
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    64
    }
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    65
}
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    66
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    67
/*****************************************************************************/
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
    68
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    69
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: 1508
diff changeset
    70
        ec_direction_t dir, ec_watchdog_mode_t watchdog_mode)
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    71
{
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
    ec_ioctl_config_t data;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
    unsigned int i;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    74
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    75
    if (sync_index >= EC_MAX_SYNC_MANAGERS)
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
    76
        return -ENOENT;
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    77
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    78
    memset(&data, 0x00, sizeof(ec_ioctl_config_t));
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    79
    data.config_index = sc->index;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    80
    data.syncs[sync_index].dir = dir;
1509
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
    81
    data.syncs[sync_index].watchdog_mode = watchdog_mode;
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
    82
    data.syncs[sync_index].config_this = 1;
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    83
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    84
    if (ioctl(sc->master->fd, EC_IOCTL_SC_SYNC, &data) == -1) {
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    85
        fprintf(stderr, "Failed to config sync manager: %s\n",
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    86
                strerror(errno));
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
    87
        return -1; // FIXME
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    88
    }
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    89
    
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    90
    return 0;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    91
}
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    92
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    93
/*****************************************************************************/
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    94
1509
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
    95
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: 1508
diff changeset
    96
        uint16_t divider, uint16_t intervals)
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
    97
{
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
    98
    ec_ioctl_config_t data;
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
    99
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
   100
    memset(&data, 0x00, sizeof(ec_ioctl_config_t));
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
   101
    data.config_index = sc->index;
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
   102
    data.watchdog_divider = divider;
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
   103
    data.watchdog_intervals = intervals;
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
   104
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
   105
    if (ioctl(sc->master->fd, EC_IOCTL_SC_WATCHDOG, &data) == -1) {
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
   106
        fprintf(stderr, "Failed to config watchdog: %s\n",
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
   107
                strerror(errno));
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
   108
    }
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
   109
}
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
   110
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
   111
/*****************************************************************************/
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
   112
1981
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1862
diff changeset
   113
void ecrt_slave_config_overlapping_pdos(ec_slave_config_t *sc,
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1862
diff changeset
   114
        uint8_t allow_overlapping_pdos)
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1862
diff changeset
   115
{
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1862
diff changeset
   116
    ec_ioctl_config_t data;
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1862
diff changeset
   117
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1862
diff changeset
   118
    memset(&data, 0x00, sizeof(ec_ioctl_config_t));
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1862
diff changeset
   119
    data.config_index = sc->index;
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1862
diff changeset
   120
    data.allow_overlapping_pdos = allow_overlapping_pdos;
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1862
diff changeset
   121
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1862
diff changeset
   122
    if (ioctl(sc->master->fd, EC_IOCTL_SC_OVERLAPPING_IO, &data) == -1) {
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1862
diff changeset
   123
        fprintf(stderr, "Failed to config overlapping PDOs: %s\n",
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1862
diff changeset
   124
                strerror(errno));
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1862
diff changeset
   125
    }
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1862
diff changeset
   126
}
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1862
diff changeset
   127
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1862
diff changeset
   128
/*****************************************************************************/
c14b6bb14fdf Inplace I/O: let input Pdos use the same bus space as Output Pdos
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1862
diff changeset
   129
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   130
int ecrt_slave_config_pdo_assign_add(ec_slave_config_t *sc,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   131
        uint8_t sync_index, uint16_t pdo_index)
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   132
{
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   133
    ec_ioctl_config_pdo_t data;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   134
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   135
    data.config_index = sc->index;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   136
    data.sync_index = sync_index;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   137
    data.index = pdo_index;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   138
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   139
    if (ioctl(sc->master->fd, EC_IOCTL_SC_ADD_PDO, &data) == -1) {
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   140
        fprintf(stderr, "Failed to add PDO: %s\n",
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   141
                strerror(errno));
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   142
        return -1;  // FIXME
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   143
    }
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   144
    
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   145
    return 0;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   146
}
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   147
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   148
/*****************************************************************************/
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   149
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   150
void ecrt_slave_config_pdo_assign_clear(ec_slave_config_t *sc,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   151
        uint8_t sync_index)
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   152
{
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   153
    ec_ioctl_config_pdo_t data;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   154
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   155
    data.config_index = sc->index;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   156
    data.sync_index = sync_index;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   157
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   158
    if (ioctl(sc->master->fd, EC_IOCTL_SC_CLEAR_PDOS, &data) == -1) {
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   159
        fprintf(stderr, "Failed to clear PDOs: %s\n",
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   160
                strerror(errno));
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   161
    }
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   162
}
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   163
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   164
/*****************************************************************************/
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   165
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   166
int ecrt_slave_config_pdo_mapping_add(ec_slave_config_t *sc,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   167
        uint16_t pdo_index, uint16_t entry_index, uint8_t entry_subindex,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   168
        uint8_t entry_bit_length)
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   169
{
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   170
    ec_ioctl_add_pdo_entry_t data;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   171
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   172
    data.config_index = sc->index;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   173
    data.pdo_index = pdo_index;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   174
    data.entry_index = entry_index;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   175
    data.entry_subindex = entry_subindex;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   176
    data.entry_bit_length = entry_bit_length;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   177
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   178
    if (ioctl(sc->master->fd, EC_IOCTL_SC_ADD_ENTRY, &data) == -1) {
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   179
        fprintf(stderr, "Failed to add PDO entry: %s\n",
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   180
                strerror(errno));
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   181
        return -1;  // FIXME
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   182
    }
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   183
    
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   184
    return 0;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   185
}
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   186
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   187
/*****************************************************************************/
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   188
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   189
void ecrt_slave_config_pdo_mapping_clear(ec_slave_config_t *sc,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   190
        uint16_t pdo_index)
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   191
{
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   192
    ec_ioctl_config_pdo_t data;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   193
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   194
    data.config_index = sc->index;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   195
    data.index = pdo_index;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   196
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   197
    if (ioctl(sc->master->fd, EC_IOCTL_SC_CLEAR_ENTRIES, &data) == -1) {
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   198
        fprintf(stderr, "Failed to clear PDO entries: %s\n",
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   199
                strerror(errno));
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   200
    }
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   201
}
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   202
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   203
/*****************************************************************************/
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   204
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   205
int ecrt_slave_config_pdos(ec_slave_config_t *sc,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   206
        unsigned int n_syncs, const ec_sync_info_t syncs[])
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   207
{
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   208
    int ret;
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   209
    unsigned int i, j, k;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   210
    const ec_sync_info_t *sync_info;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   211
    const ec_pdo_info_t *pdo_info;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   212
    const ec_pdo_entry_info_t *entry_info;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   213
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   214
    if (!syncs)
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   215
        return 0;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   216
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   217
    for (i = 0; i < n_syncs; i++) {
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   218
        sync_info = &syncs[i];
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   219
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   220
        if (sync_info->index == (uint8_t) EC_END)
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   221
            break;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   222
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   223
        if (sync_info->index >= EC_MAX_SYNC_MANAGERS) {
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   224
            fprintf(stderr, "Invalid sync manager index %u!\n",
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   225
                    sync_info->index);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   226
            return -ENOENT;
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   227
        }
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   228
1509
a864688e7de5 Added watchdog configuration via application interface (thanks to J. Mohre).
Florian Pose <fp@igh-essen.com>
parents: 1508
diff changeset
   229
        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: 1508
diff changeset
   230
                sync_info->dir, sync_info->watchdog_mode);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   231
        if (ret)
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   232
            return ret;
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   233
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   234
        if (sync_info->n_pdos && sync_info->pdos) {
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   235
            ecrt_slave_config_pdo_assign_clear(sc, sync_info->index);
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   236
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   237
            for (j = 0; j < sync_info->n_pdos; j++) {
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   238
                pdo_info = &sync_info->pdos[j];
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   239
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   240
                ret = ecrt_slave_config_pdo_assign_add(
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   241
                        sc, sync_info->index, pdo_info->index);
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   242
                if (ret)
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   243
                    return ret;
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   244
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   245
                if (pdo_info->n_entries && pdo_info->entries) {
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   246
                    ecrt_slave_config_pdo_mapping_clear(sc, pdo_info->index);
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   247
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   248
                    for (k = 0; k < pdo_info->n_entries; k++) {
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   249
                        entry_info = &pdo_info->entries[k];
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   250
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   251
                        ret = ecrt_slave_config_pdo_mapping_add(sc,
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   252
                                pdo_info->index, entry_info->index,
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   253
                                entry_info->subindex,
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   254
                                entry_info->bit_length);
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   255
                        if (ret)
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   256
                            return ret;
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   257
                    }
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   258
                }
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   259
            }
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   260
        }
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   261
    }
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   262
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   263
    return 0;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   264
}
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   265
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   266
/*****************************************************************************/
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   267
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   268
int ecrt_slave_config_reg_pdo_entry(
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   269
        ec_slave_config_t *sc,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   270
        uint16_t index,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   271
        uint8_t subindex,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   272
        ec_domain_t *domain,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   273
        unsigned int *bit_position
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   274
        )
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   275
{
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   276
    ec_ioctl_reg_pdo_entry_t data;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   277
    int ret;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   278
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   279
    data.config_index = sc->index;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   280
    data.entry_index = index;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   281
    data.entry_subindex = subindex;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   282
    data.domain_index = domain->index;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   283
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   284
    ret = ioctl(sc->master->fd, EC_IOCTL_SC_REG_PDO_ENTRY, &data);
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   285
    if (ret == -1) {
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   286
        fprintf(stderr, "Failed to register PDO entry: %s\n",
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   287
                strerror(errno));
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   288
        return -2; // FIXME
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   289
    }
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   290
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   291
    if (bit_position) {
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   292
        *bit_position = data.bit_position;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   293
    } else {
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   294
        if (data.bit_position) {
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   295
            fprintf(stderr, "PDO entry 0x%04X:%02X does not byte-align "
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   296
                    "in config %u:%u.\n", index, subindex,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   297
                    sc->alias, sc->position);
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   298
            return -3; // FIXME
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   299
        }
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   300
    }
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   301
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   302
    return ret;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   303
}
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   304
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   305
/*****************************************************************************/
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   306
1448
d7ba0c408a07 Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents: 1438
diff changeset
   307
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: 1413
diff changeset
   308
        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: 1413
diff changeset
   309
        uint32_t sync1_cycle_time, uint32_t sync1_shift_time)
1413
44c2b7c0ae1a Userspace library implementation of DC functions.
Florian Pose <fp@igh-essen.com>
parents: 1371
diff changeset
   310
{
1455
aa18fcfe0fd1 Output DC config in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   311
    ec_ioctl_config_t data;
aa18fcfe0fd1 Output DC config in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   312
aa18fcfe0fd1 Output DC config in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   313
    data.config_index = sc->index;
aa18fcfe0fd1 Output DC config in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents: 1448
diff changeset
   314
    data.dc_assign_activate = assign_activate;
1508
60a116ed3897 Removed more tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1455
diff changeset
   315
    data.dc_sync[0].cycle_time = sync0_cycle_time;
60a116ed3897 Removed more tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1455
diff changeset
   316
    data.dc_sync[0].shift_time = sync0_shift_time;
60a116ed3897 Removed more tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1455
diff changeset
   317
    data.dc_sync[1].cycle_time = sync1_cycle_time;
60a116ed3897 Removed more tabulators.
Florian Pose <fp@igh-essen.com>
parents: 1455
diff changeset
   318
    data.dc_sync[1].shift_time = sync1_shift_time;
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: 1413
diff changeset
   319
1448
d7ba0c408a07 Merged ecrt_slave_config_dc_assign_activate() and
Florian Pose <fp@igh-essen.com>
parents: 1438
diff changeset
   320
    if (ioctl(sc->master->fd, EC_IOCTL_SC_DC, &data) == -1) {
1413
44c2b7c0ae1a Userspace library implementation of DC functions.
Florian Pose <fp@igh-essen.com>
parents: 1371
diff changeset
   321
        fprintf(stderr, "Failed to set assign_activate word.\n");
44c2b7c0ae1a Userspace library implementation of DC functions.
Florian Pose <fp@igh-essen.com>
parents: 1371
diff changeset
   322
    }
44c2b7c0ae1a Userspace library implementation of DC functions.
Florian Pose <fp@igh-essen.com>
parents: 1371
diff changeset
   323
}
44c2b7c0ae1a Userspace library implementation of DC functions.
Florian Pose <fp@igh-essen.com>
parents: 1371
diff changeset
   324
44c2b7c0ae1a Userspace library implementation of DC functions.
Florian Pose <fp@igh-essen.com>
parents: 1371
diff changeset
   325
/*****************************************************************************/
44c2b7c0ae1a Userspace library implementation of DC functions.
Florian Pose <fp@igh-essen.com>
parents: 1371
diff changeset
   326
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   327
int ecrt_slave_config_sdo(ec_slave_config_t *sc, uint16_t index,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   328
        uint8_t subindex, const uint8_t *sdo_data, size_t size)
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   329
{
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   330
    ec_ioctl_sc_sdo_t data;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   331
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   332
    data.config_index = sc->index;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   333
    data.index = index;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   334
    data.subindex = subindex;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   335
    data.data = sdo_data;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   336
    data.size = size;
1526
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   337
    data.complete_access = 0;
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   338
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   339
    if (ioctl(sc->master->fd, EC_IOCTL_SC_SDO, &data) == -1) {
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   340
        fprintf(stderr, "Failed to configure SDO.\n");
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   341
        return -1; // FIXME
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   342
    }
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   343
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   344
    return 0;
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   345
}
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   346
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   347
/*****************************************************************************/
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   348
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   349
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
   350
        const uint8_t *sdo_data, size_t size)
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   351
{
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   352
    ec_ioctl_sc_sdo_t data;
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   353
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   354
    data.config_index = sc->index;
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   355
    data.index = index;
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   356
    data.subindex = 0;
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   357
    data.data = sdo_data;
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   358
    data.size = size;
66edd310830c Implemented CompleteAccess for SDO downloads.
Florian Pose <fp@igh-essen.com>
parents: 1509
diff changeset
   359
    data.complete_access = 1;
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   360
1371
00e2975dc17b Fixed SDO configuration via library.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
   361
    if (ioctl(sc->master->fd, EC_IOCTL_SC_SDO, &data) == -1) {
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   362
        fprintf(stderr, "Failed to configure SDO.\n");
1313
ed15eef57d5c Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents: 1287
diff changeset
   363
        return -1; // FIXME
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   364
    }
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   365
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   366
    return 0;
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   367
}
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   368
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   369
/*****************************************************************************/
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   370
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   371
int ecrt_slave_config_sdo8(ec_slave_config_t *sc, uint16_t index,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   372
        uint8_t subindex, uint8_t value)
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   373
{
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   374
    uint8_t data[1];
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   375
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   376
    EC_WRITE_U8(data, value);
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   377
    return ecrt_slave_config_sdo(sc, index, subindex, data, 1);
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   378
}
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   379
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   380
/*****************************************************************************/
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   381
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   382
int ecrt_slave_config_sdo16(ec_slave_config_t *sc, uint16_t index,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   383
        uint8_t subindex, uint16_t value)
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   384
{
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   385
    uint8_t data[2];
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   386
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   387
    EC_WRITE_U16(data, value);
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   388
    return ecrt_slave_config_sdo(sc, index, subindex, data, 2);
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   389
}
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   390
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   391
/*****************************************************************************/
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   392
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   393
int ecrt_slave_config_sdo32(ec_slave_config_t *sc, uint16_t index,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   394
        uint8_t subindex, uint32_t value)
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   395
{
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   396
    uint8_t data[4];
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   397
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   398
    EC_WRITE_U32(data, value);
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   399
    return ecrt_slave_config_sdo(sc, index, subindex, data, 4);
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   400
}
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   401
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   402
/*****************************************************************************/
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   403
1959
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   404
void ec_slave_config_add_sdo_request(ec_slave_config_t *sc,
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   405
        ec_sdo_request_t *req)
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   406
{
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   407
    if (sc->first_sdo_request) {
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   408
        ec_sdo_request_t *r = sc->first_sdo_request;
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   409
        while (r->next) {
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   410
            r = r->next;
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   411
        }
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   412
        r->next = req;
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   413
    } else {
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   414
        sc->first_sdo_request = req;
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   415
    }
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   416
}
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   417
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   418
/*****************************************************************************/
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   419
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   420
ec_sdo_request_t *ecrt_slave_config_create_sdo_request(ec_slave_config_t *sc,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   421
        uint16_t index, uint8_t subindex, size_t size)
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   422
{
1352
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   423
    ec_ioctl_sdo_request_t data;
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   424
    ec_sdo_request_t *req;
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   425
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   426
    req = malloc(sizeof(ec_sdo_request_t));
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   427
    if (!req) {
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   428
        fprintf(stderr, "Failed to allocate memory.\n");
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   429
        return 0;
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   430
    }
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   431
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   432
    if (size) {
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   433
        req->data = malloc(size);
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   434
        if (!req->data) {
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   435
            fprintf(stderr, "Failed to allocate %u bytes of SDO data"
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   436
                    " memory.\n", size);
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   437
            free(req);
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   438
            return 0;
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   439
        }
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   440
    } else {
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   441
        req->data = NULL;
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   442
    }
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   443
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   444
    data.config_index = sc->index;
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   445
    data.sdo_index = index;
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   446
    data.sdo_subindex = subindex;
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   447
    data.size = size;
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   448
    
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   449
    if (ioctl(sc->master->fd, EC_IOCTL_SC_SDO_REQUEST, &data) == -1) {
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   450
        fprintf(stderr, "Failed to create SDO request: %s\n",
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   451
                strerror(errno));
1959
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   452
        ec_sdo_request_clear(req);
1352
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   453
        free(req);
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   454
        return NULL; 
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   455
    }
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   456
1959
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   457
    req->next = NULL;
1352
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   458
    req->config = sc;
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   459
    req->index = data.request_index;
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   460
    req->sdo_index = data.sdo_index;
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   461
    req->sdo_subindex = data.sdo_subindex;
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   462
    req->data_size = size;
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   463
    req->mem_size = size;
1959
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   464
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   465
    ec_slave_config_add_sdo_request(sc, req);
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   466
1352
275d2fdeab48 Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   467
    return req;
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   468
}
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   469
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   470
/*****************************************************************************/
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   471
1959
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   472
void ec_slave_config_add_voe_handler(ec_slave_config_t *sc,
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   473
        ec_voe_handler_t *voe)
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   474
{
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   475
    if (sc->first_voe_handler) {
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   476
        ec_voe_handler_t *v = sc->first_voe_handler;
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   477
        while (v->next) {
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   478
            v = v->next;
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   479
        }
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   480
        v->next = voe;
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   481
    } else {
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   482
        sc->first_voe_handler = voe;
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   483
    }
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   484
}
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   485
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   486
/*****************************************************************************/
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   487
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   488
ec_voe_handler_t *ecrt_slave_config_create_voe_handler(ec_slave_config_t *sc,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   489
        size_t size)
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   490
{
1264
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   491
    ec_ioctl_voe_t data;
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   492
    ec_voe_handler_t *voe;
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   493
    unsigned int index;
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   494
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   495
    voe = malloc(sizeof(ec_voe_handler_t));
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   496
    if (!voe) {
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   497
        fprintf(stderr, "Failed to allocate memory.\n");
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   498
        return 0;
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   499
    }
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   500
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   501
    if (size) {
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   502
        voe->data = malloc(size);
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   503
        if (!voe->data) {
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   504
            fprintf(stderr, "Failed to allocate %u bytes of VoE data"
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   505
                    " memory.\n", size);
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   506
            free(voe);
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   507
            return 0;
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   508
        }
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   509
    } else {
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   510
        voe->data = NULL;
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   511
    }
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   512
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   513
    data.config_index = sc->index;
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   514
    data.size = size;
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   515
    
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   516
    if (ioctl(sc->master->fd, EC_IOCTL_SC_VOE, &data) == -1) {
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   517
        fprintf(stderr, "Failed to create VoE handler: %s\n",
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   518
                strerror(errno));
1959
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   519
        ec_voe_handler_clear(voe);
1264
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   520
        free(voe);
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   521
        return NULL; 
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   522
    }
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   523
1959
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   524
    voe->next = NULL;
1264
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   525
    voe->config = sc;
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   526
    voe->index = data.voe_index;
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   527
    voe->data_size = size;
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   528
    voe->mem_size = size;
1959
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   529
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   530
    ec_slave_config_add_voe_handler(sc, voe);
656f114153c2 Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   531
1264
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1259
diff changeset
   532
    return voe;
1255
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   533
}
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   534
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   535
/*****************************************************************************/
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   536
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   537
void ecrt_slave_config_state(const ec_slave_config_t *sc,
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   538
        ec_slave_config_state_t *state)
38b7e05b20c1 Added some slave configuration methods.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   539
{
1259
5f9d1abbee71 Added state functions; writing of process data works.
Florian Pose <fp@igh-essen.com>
parents: 1255
diff changeset
   540
    ec_ioctl_sc_state_t data;
5f9d1abbee71 Added state functions; writing of process data works.
Florian Pose <fp@igh-essen.com>
parents: 1255
diff changeset
   541
5f9d1abbee71 Added state functions; writing of process data works.
Florian Pose <fp@igh-essen.com>
parents: 1255
diff changeset
   542
    data.config_index = sc->index;
5f9d1abbee71 Added state functions; writing of process data works.
Florian Pose <fp@igh-essen.com>
parents: 1255
diff changeset
   543
    data.state = state;
5f9d1abbee71 Added state functions; writing of process data works.
Florian Pose <fp@igh-essen.com>
parents: 1255
diff changeset
   544
    
5f9d1abbee71 Added state functions; writing of process data works.
Florian Pose <fp@igh-essen.com>
parents: 1255
diff changeset
   545
    if (ioctl(sc->master->fd, EC_IOCTL_SC_STATE, &data) == -1) {
5f9d1abbee71 Added state functions; writing of process data works.
Florian Pose <fp@igh-essen.com>
parents: 1255
diff changeset
   546
        fprintf(stderr, "Failed to get slave configuration state: %s\n",
5f9d1abbee71 Added state functions; writing of process data works.
Florian Pose <fp@igh-essen.com>
parents: 1255
diff changeset
   547
                strerror(errno));
5f9d1abbee71 Added state functions; writing of process data works.
Florian Pose <fp@igh-essen.com>
parents: 1255
diff changeset
   548
    }
5f9d1abbee71 Added state functions; writing of process data works.
Florian Pose <fp@igh-essen.com>
parents: 1255
diff changeset
   549
}
5f9d1abbee71 Added state functions; writing of process data works.
Florian Pose <fp@igh-essen.com>
parents: 1255
diff changeset
   550
5f9d1abbee71 Added state functions; writing of process data works.
Florian Pose <fp@igh-essen.com>
parents: 1255
diff changeset
   551
/*****************************************************************************/
1862
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   552
1952
7d9fb723fc4b Added drive_no parameter to SoE layer.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   553
int ecrt_slave_config_idn(ec_slave_config_t *sc, uint8_t drive_no,
7d9fb723fc4b Added drive_no parameter to SoE layer.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   554
        uint16_t idn, ec_al_state_t al_state, const uint8_t *data, size_t size)
1862
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   555
{
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   556
    ec_ioctl_sc_idn_t io;
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   557
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   558
    io.config_index = sc->index;
1952
7d9fb723fc4b Added drive_no parameter to SoE layer.
Florian Pose <fp@igh-essen.com>
parents: 1945
diff changeset
   559
    io.drive_no = drive_no;
1862
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   560
    io.idn = idn;
1945
f9204699e799 Incremented ioctl interface version; Minor changes.
Florian Pose <fp@igh-essen.com>
parents: 1944
diff changeset
   561
    io.al_state = al_state;
1862
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   562
    io.data = data;
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   563
    io.size = size;
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   564
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   565
    if (ioctl(sc->master->fd, EC_IOCTL_SC_IDN, &io) == -1) {
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   566
        fprintf(stderr, "Failed to configure IDN.\n");
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   567
        return -1; // FIXME
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   568
    }
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   569
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   570
    return 0;
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   571
}
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   572
05d224a66270 Implemented ecrt_slave_config_idn() for user-space library.
Florian Pose <fp@igh-essen.com>
parents: 1526
diff changeset
   573
/*****************************************************************************/