master/datagram.c
author Florian Pose <fp@igh-essen.com>
Tue, 31 Oct 2006 11:12:50 +0000
changeset 469 a9c7991dca6b
parent 446 8fede404c01f
child 511 73fb3c35e53d
permissions -rw-r--r--
Fixed state change FSM again.
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     5
 *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     6
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     8
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    10
 *  and/or modify it under the terms of the GNU General Public License
246
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 237
diff changeset
    11
 *  as published by the Free Software Foundation; either version 2 of the
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 237
diff changeset
    12
 *  License, or (at your option) any later version.
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    13
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    14
 *  The IgH EtherCAT Master is distributed in the hope that it will be
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    15
 *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    17
 *  GNU General Public License for more details.
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    18
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    19
 *  You should have received a copy of the GNU General Public License
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    20
 *  along with the IgH EtherCAT Master; if not, write to the Free Software
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    22
 *
246
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 237
diff changeset
    23
 *  The right to use EtherCAT Technology is granted and comes free of
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 237
diff changeset
    24
 *  charge under condition of compatibility of product made by
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 237
diff changeset
    25
 *  Licensee. People intending to distribute/sell products based on the
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 237
diff changeset
    26
 *  code, have to sign an agreement to guarantee that products using
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 237
diff changeset
    27
 *  software based on IgH EtherCAT master stay compatible with the actual
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 237
diff changeset
    28
 *  EtherCAT specification (which are released themselves as an open
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 237
diff changeset
    29
 *  standard) as the (only) precondition to have the right to use EtherCAT
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 237
diff changeset
    30
 *  Technology, IP and trade marks.
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 237
diff changeset
    31
 *
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
 *****************************************************************************/
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    34
/**
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    35
   \file
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    36
   Methods of an EtherCAT datagram.
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    37
*/
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    38
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    39
/*****************************************************************************/
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    40
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
#include <linux/slab.h>
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    43
#include "datagram.h"
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
#include "master.h"
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
/*****************************************************************************/
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    48
/** \cond */
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    49
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
#define EC_FUNC_HEADER \
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    51
    if (unlikely(ec_datagram_prealloc(datagram, data_size))) \
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
    52
        return -1; \
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    53
    datagram->index = 0; \
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    54
    datagram->working_counter = 0; \
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
    55
    datagram->state = EC_DATAGRAM_INIT;
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
    57
#define EC_FUNC_FOOTER \
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    58
    datagram->data_size = data_size; \
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    59
    memset(datagram->data, 0x00, data_size); \
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
    60
    return 0;
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
    61
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    62
/** \endcond */
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    63
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
    64
/*****************************************************************************/
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
    65
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
    66
/**
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    67
   Datagram constructor.
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    68
*/
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    69
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    70
void ec_datagram_init(ec_datagram_t *datagram /**< EtherCAT datagram */)
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    71
{
446
8fede404c01f Persistent slave lists.
Florian Pose <fp@igh-essen.com>
parents: 398
diff changeset
    72
    INIT_LIST_HEAD(&datagram->queue); // mark as unqueued
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
    73
    datagram->type = EC_DATAGRAM_NONE;
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    74
    datagram->address.logical = 0x00000000;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    75
    datagram->data = NULL;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    76
    datagram->mem_size = 0;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    77
    datagram->data_size = 0;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    78
    datagram->index = 0x00;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    79
    datagram->working_counter = 0x00;
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
    80
    datagram->state = EC_DATAGRAM_INIT;
398
ff37601361a8 Fixed serveral races while starting up under high CPU load.
Florian Pose <fp@igh-essen.com>
parents: 397
diff changeset
    81
    datagram->cycles_queued = 0;
344
5d8281f1aa2a Replaced longer cycle timestamps with jiffies.
Florian Pose <fp@igh-essen.com>
parents: 325
diff changeset
    82
    datagram->cycles_sent = 0;
398
ff37601361a8 Fixed serveral races while starting up under high CPU load.
Florian Pose <fp@igh-essen.com>
parents: 397
diff changeset
    83
    datagram->jiffies_sent = 0;
ff37601361a8 Fixed serveral races while starting up under high CPU load.
Florian Pose <fp@igh-essen.com>
parents: 397
diff changeset
    84
    datagram->cycles_received = 0;
ff37601361a8 Fixed serveral races while starting up under high CPU load.
Florian Pose <fp@igh-essen.com>
parents: 397
diff changeset
    85
    datagram->jiffies_received = 0;
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    86
}
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    87
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    88
/*****************************************************************************/
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    89
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    90
/**
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    91
   Datagram destructor.
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    92
*/
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    93
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    94
void ec_datagram_clear(ec_datagram_t *datagram /**< EtherCAT datagram */)
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    95
{
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    96
    if (datagram->data) kfree(datagram->data);
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    97
}
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    98
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    99
/*****************************************************************************/
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   100
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   101
/**
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   102
   Allocates datagram data memory.
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
   103
   If the allocated memory is already larger than requested, nothing ist done.
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
   104
   \return 0 in case of success, else < 0
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
   105
*/
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
   106
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   107
int ec_datagram_prealloc(ec_datagram_t *datagram, /**< EtherCAT datagram */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   108
                         size_t size /**< New size in bytes */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   109
                         )
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   110
{
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   111
    if (size <= datagram->mem_size) return 0;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   112
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   113
    if (datagram->data) {
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   114
        kfree(datagram->data);
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   115
        datagram->data = NULL;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   116
        datagram->mem_size = 0;
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   117
    }
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   118
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   119
    if (!(datagram->data = kmalloc(size, GFP_KERNEL))) {
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   120
        EC_ERR("Failed to allocate %i bytes of datagram memory!\n", size);
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   121
        return -1;
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   122
    }
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   123
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   124
    datagram->mem_size = size;
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   125
    return 0;
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   126
}
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   127
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   128
/*****************************************************************************/
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   129
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   130
/**
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   131
   Initializes an EtherCAT NPRD datagram.
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   132
   Node-adressed physical read.
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 144
diff changeset
   133
   \return 0 in case of success, else < 0
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   134
*/
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   135
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   136
int ec_datagram_nprd(ec_datagram_t *datagram,
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   137
                     /**< EtherCAT datagram */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   138
                     uint16_t node_address,
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   139
                     /**< configured station address */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   140
                     uint16_t offset,
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   141
                     /**< physical memory address */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   142
                     size_t data_size
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   143
                     /**< number of bytes to read */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   144
                     )
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   145
{
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   146
    if (unlikely(node_address == 0x0000))
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   147
        EC_WARN("Using node address 0x0000!\n");
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   148
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   149
    EC_FUNC_HEADER;
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
   150
    datagram->type = EC_DATAGRAM_NPRD;
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   151
    datagram->address.physical.slave = node_address;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   152
    datagram->address.physical.mem = offset;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   153
    EC_FUNC_FOOTER;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   154
}
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   155
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   156
/*****************************************************************************/
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   157
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   158
/**
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   159
   Initializes an EtherCAT NPWR datagram.
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   160
   Node-adressed physical write.
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   161
   \return 0 in case of success, else < 0
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   162
*/
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   163
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   164
int ec_datagram_npwr(ec_datagram_t *datagram,
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   165
                     /**< EtherCAT datagram */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   166
                     uint16_t node_address,
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   167
                     /**< configured station address */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   168
                     uint16_t offset,
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   169
                     /**< physical memory address */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   170
                     size_t data_size
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   171
                     /**< number of bytes to write */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   172
                     )
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   173
{
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   174
    if (unlikely(node_address == 0x0000))
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   175
        EC_WARN("Using node address 0x0000!\n");
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   176
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   177
    EC_FUNC_HEADER;
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
   178
    datagram->type = EC_DATAGRAM_NPWR;
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   179
    datagram->address.physical.slave = node_address;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   180
    datagram->address.physical.mem = offset;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   181
    EC_FUNC_FOOTER;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   182
}
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   183
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   184
/*****************************************************************************/
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   185
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   186
/**
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   187
   Initializes an EtherCAT APRD datagram.
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   188
   Autoincrement physical read.
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   189
   \return 0 in case of success, else < 0
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   190
*/
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   191
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   192
int ec_datagram_aprd(ec_datagram_t *datagram,
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   193
                     /**< EtherCAT datagram */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   194
                     uint16_t ring_position,
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   195
                     /**< auto-increment position */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   196
                     uint16_t offset,
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   197
                     /**< physical memory address */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   198
                     size_t data_size
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   199
                     /**< number of bytes to read */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   200
                     )
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   201
{
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   202
    EC_FUNC_HEADER;
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
   203
    datagram->type = EC_DATAGRAM_APRD;
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   204
    datagram->address.physical.slave = (int16_t) ring_position * (-1);
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   205
    datagram->address.physical.mem = offset;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   206
    EC_FUNC_FOOTER;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   207
}
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   208
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   209
/*****************************************************************************/
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   210
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   211
/**
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   212
   Initializes an EtherCAT APWR datagram.
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   213
   Autoincrement physical write.
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   214
   \return 0 in case of success, else < 0
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   215
*/
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   216
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   217
int ec_datagram_apwr(ec_datagram_t *datagram,
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   218
                     /**< EtherCAT datagram */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   219
                     uint16_t ring_position,
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   220
                     /**< auto-increment position */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   221
                     uint16_t offset,
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   222
                     /**< physical memory address */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   223
                     size_t data_size
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   224
                     /**< number of bytes to write */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   225
                     )
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   226
{
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   227
    EC_FUNC_HEADER;
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
   228
    datagram->type = EC_DATAGRAM_APWR;
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   229
    datagram->address.physical.slave = (int16_t) ring_position * (-1);
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   230
    datagram->address.physical.mem = offset;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   231
    EC_FUNC_FOOTER;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   232
}
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   233
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   234
/*****************************************************************************/
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   235
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   236
/**
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   237
   Initializes an EtherCAT BRD datagram.
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   238
   Broadcast read.
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   239
   \return 0 in case of success, else < 0
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   240
*/
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   241
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   242
int ec_datagram_brd(ec_datagram_t *datagram,
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   243
                    /**< EtherCAT datagram */
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 144
diff changeset
   244
                    uint16_t offset,
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 144
diff changeset
   245
                    /**< physical memory address */
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 144
diff changeset
   246
                    size_t data_size
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 144
diff changeset
   247
                    /**< number of bytes to read */
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   248
                    )
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   249
{
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   250
    EC_FUNC_HEADER;
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
   251
    datagram->type = EC_DATAGRAM_BRD;
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   252
    datagram->address.physical.slave = 0x0000;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   253
    datagram->address.physical.mem = offset;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   254
    EC_FUNC_FOOTER;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   255
}
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   256
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   257
/*****************************************************************************/
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   258
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   259
/**
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   260
   Initializes an EtherCAT BWR datagram.
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   261
   Broadcast write.
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   262
   \return 0 in case of success, else < 0
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   263
*/
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   264
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   265
int ec_datagram_bwr(ec_datagram_t *datagram,
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   266
                    /**< EtherCAT datagram */
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 144
diff changeset
   267
                    uint16_t offset,
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 144
diff changeset
   268
                    /**< physical memory address */
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 144
diff changeset
   269
                    size_t data_size
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 144
diff changeset
   270
                    /**< number of bytes to write */
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   271
                    )
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   272
{
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   273
    EC_FUNC_HEADER;
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
   274
    datagram->type = EC_DATAGRAM_BWR;
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   275
    datagram->address.physical.slave = 0x0000;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   276
    datagram->address.physical.mem = offset;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   277
    EC_FUNC_FOOTER;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   278
}
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   279
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   280
/*****************************************************************************/
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   281
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   282
/**
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   283
   Initializes an EtherCAT LRW datagram.
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   284
   Logical read write.
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   285
   \return 0 in case of success, else < 0
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   286
*/
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   287
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   288
int ec_datagram_lrw(ec_datagram_t *datagram,
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   289
                    /**< EtherCAT datagram */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   290
                    uint32_t offset,
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   291
                    /**< logical address */
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 144
diff changeset
   292
                    size_t data_size
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   293
                    /**< number of bytes to read/write */
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   294
                    )
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   295
{
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   296
    EC_FUNC_HEADER;
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
   297
    datagram->type = EC_DATAGRAM_LRW;
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   298
    datagram->address.logical = offset;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   299
    EC_FUNC_FOOTER;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   300
}
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   301
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   302
/*****************************************************************************/