master/voe_handler.h
author Florian Pose <fp@igh-essen.com>
Fri, 16 Sep 2011 14:10:23 +0200
changeset 2117 afb40fd6018e
parent 2045 ff2a13a4603c
child 2589 2b9c78543663
permissions -rw-r--r--
Removed allow_config flag and obsolete request to OP.
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. */
2045
ff2a13a4603c Reduced frame size when sending to mailbox, uses 2 datagrams. Enabled with configure option --enable-mboxframesize
Martin Troxler <ch1010277@ch10pc446>
parents: 1363
diff changeset
    53
    ec_mailbox_t mbox; /**< State machine mailbox. */
1218
6f3a973fc29e Introduced VoE header.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    54
    uint32_t vendor_id; /**< Vendor ID for the header. */
6f3a973fc29e Introduced VoE header.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    55
    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
    56
    size_t data_size; /**< Size of VoE data. */
1209
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
    ec_direction_t dir; /**< Direction. EC_DIR_OUTPUT means writing to
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
                          the slave, EC_DIR_INPUT means reading from the
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
                          slave. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    60
    void (*state)(ec_voe_handler_t *); /**< State function */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    61
    ec_internal_request_state_t request_state; /**< Handler state. */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
    unsigned int retries; /**< retries upon datagram timeout */
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    63
    unsigned long jiffies_start; /**< Timestamp for timeout calculation. */
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
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    68
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
    69
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
    70
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
    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
8be462afb7f4 Added VoE handler.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    74
#endif