master/voe_handler.h
author Florian Pose <fp@igh-essen.com>
Thu, 06 Dec 2012 18:43:56 +0100
branchstable-1.5
changeset 2487 ccafdf1e261f
parent 1363 11c0b2caa253
child 2045 ff2a13a4603c
permissions -rw-r--r--
Fixed some warnings on 64 bit systems.
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
1326
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1264
diff changeset
     5
 *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
 *
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
 *
1326
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1264
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it and/or
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1264
diff changeset
    10
 *  modify it under the terms of the GNU General Public License version 2, as
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1264
diff changeset
    11
 *  published by the Free Software Foundation.
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
 *
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: 1264
diff changeset
    13
 *  The IgH EtherCAT Master is distributed in the hope that it will be useful,
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1264
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1264
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1264
diff changeset
    16
 *  Public License for more details.
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
 *
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: 1264
diff changeset
    18
 *  You should have received a copy of the GNU General Public License along
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1264
diff changeset
    19
 *  with the IgH EtherCAT Master; if not, write to the Free Software
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
 *
1363
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
    22
 *  ---
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
    23
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
    24
 *  The license mentioned above concerns the source code only. Using the
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
    25
 *  EtherCAT technology and brand is only permitted in compliance with the
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
    26
 *  industrial property and similar rights of Beckhoff Automation GmbH.
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
 *
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 *****************************************************************************/
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
/**
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
   \file
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
    32
   Vendor specific over EtherCAT protocol handler.
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
*/
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
/*****************************************************************************/
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
#ifndef __EC_VOE_HANDLER_H__
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
#define __EC_VOE_HANDLER_H__
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
#include <linux/list.h>
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
#include "globals.h"
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
#include "datagram.h"
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
/*****************************************************************************/
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
    47
/** Vendor specific over EtherCAT handler.
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
 */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
struct ec_voe_handler {
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
    struct list_head list; /**< List item. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
    ec_slave_config_t *config; /**< Parent slave configuration. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
    ec_datagram_t datagram; /**< State machine datagram. */
1218
6f3a973fc29e Introduced VoE header.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    53
    uint32_t vendor_id; /**< Vendor ID for the header. */
6f3a973fc29e Introduced VoE header.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    54
    uint16_t vendor_type; /**< Vendor type for the header. */
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
    55
    size_t data_size; /**< Size of VoE data. */
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
    ec_direction_t dir; /**< Direction. EC_DIR_OUTPUT means writing to
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
                          the slave, EC_DIR_INPUT means reading from the
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
                          slave. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
    void (*state)(ec_voe_handler_t *); /**< State function */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    60
    ec_internal_request_state_t request_state; /**< Handler state. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    61
    unsigned int retries; /**< retries upon datagram timeout */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
    unsigned long jiffies_start; /**< Timestamp for timeout calculation. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    63
};
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    64
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
/*****************************************************************************/
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
int ec_voe_handler_init(ec_voe_handler_t *, ec_slave_config_t *, size_t);
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    68
void ec_voe_handler_clear(ec_voe_handler_t *);
1264
e7882f246d7a Implemented VoE handler in userspace.
Florian Pose <fp@igh-essen.com>
parents: 1218
diff changeset
    69
size_t ec_voe_handler_mem_size(const ec_voe_handler_t *);
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    70
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    71
/*****************************************************************************/
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
#endif