master/mailbox.h
author "Dave Page <dave.page@gleeble.com>"
Wed, 05 Mar 2014 06:36:18 +1300
changeset 2607 b59d6aecdbaa
parent 2596 d71acfbd7319
permissions -rw-r--r--
Fix fsm_foe timeout regression
145
11a82e4fd31b Mailbox-Interface ausgelagert, erster EOE-Ansatz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
11a82e4fd31b Mailbox-Interface ausgelagert, erster EOE-Ansatz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
11a82e4fd31b Mailbox-Interface ausgelagert, erster EOE-Ansatz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
11a82e4fd31b Mailbox-Interface ausgelagert, erster EOE-Ansatz.
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: 883
diff changeset
     5
 *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
197
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
 *
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: 883
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: 883
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: 883
diff changeset
    11
 *  published by the Free Software Foundation.
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
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: 883
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: 883
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: 883
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: 883
diff changeset
    16
 *  Public License for more details.
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
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: 883
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: 883
diff changeset
    19
 *  with the IgH EtherCAT Master; if not, write to the Free Software
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    20
 *  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
    21
 *
1363
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
    22
 *  ---
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
    23
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1326
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: 1326
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: 1326
diff changeset
    26
 *  industrial property and similar rights of Beckhoff Automation GmbH.
246
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
    27
 *
145
11a82e4fd31b Mailbox-Interface ausgelagert, erster EOE-Ansatz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 *****************************************************************************/
11a82e4fd31b Mailbox-Interface ausgelagert, erster EOE-Ansatz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    30
/**
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    31
   \file
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    32
   Mailbox functionality.
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    33
*/
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
/*****************************************************************************/
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    36
883
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 390
diff changeset
    37
#ifndef __EC_MAILBOX_H__
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 390
diff changeset
    38
#define __EC_MAILBOX_H__
145
11a82e4fd31b Mailbox-Interface ausgelagert, erster EOE-Ansatz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2094
diff changeset
    40
#include "slave.h"
145
11a82e4fd31b Mailbox-Interface ausgelagert, erster EOE-Ansatz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
11a82e4fd31b Mailbox-Interface ausgelagert, erster EOE-Ansatz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
/*****************************************************************************/
11a82e4fd31b Mailbox-Interface ausgelagert, erster EOE-Ansatz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
1907
dd276ae226b4 Added missing code documentation.
Florian Pose <fp@igh-essen.com>
parents: 1563
diff changeset
    44
/** Size of the mailbox header.
dd276ae226b4 Added missing code documentation.
Florian Pose <fp@igh-essen.com>
parents: 1563
diff changeset
    45
 */
1563
ddedb71b3a85 Introduced mailbox/CoE defines; avoided duplicate code in CoE segmented
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    46
#define EC_MBOX_HEADER_SIZE 6
ddedb71b3a85 Introduced mailbox/CoE defines; avoided duplicate code in CoE segmented
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    47
2591
23b360e4a530 Centrally defined mailbox types.
Florian Pose <fp@igh-essen.com>
parents: 2589
diff changeset
    48
/** Mailbox types.
2596
d71acfbd7319 Removed obsolete mailbox type name and clarified documentation.
Florian Pose <fp@igh-essen.com>
parents: 2591
diff changeset
    49
 *
d71acfbd7319 Removed obsolete mailbox type name and clarified documentation.
Florian Pose <fp@igh-essen.com>
parents: 2591
diff changeset
    50
 * These are used in the 'Type' field of the mailbox header.
2591
23b360e4a530 Centrally defined mailbox types.
Florian Pose <fp@igh-essen.com>
parents: 2589
diff changeset
    51
 */
2596
d71acfbd7319 Removed obsolete mailbox type name and clarified documentation.
Florian Pose <fp@igh-essen.com>
parents: 2591
diff changeset
    52
enum {
2591
23b360e4a530 Centrally defined mailbox types.
Florian Pose <fp@igh-essen.com>
parents: 2589
diff changeset
    53
    EC_MBOX_TYPE_EOE = 0x02,
23b360e4a530 Centrally defined mailbox types.
Florian Pose <fp@igh-essen.com>
parents: 2589
diff changeset
    54
    EC_MBOX_TYPE_COE = 0x03,
23b360e4a530 Centrally defined mailbox types.
Florian Pose <fp@igh-essen.com>
parents: 2589
diff changeset
    55
    EC_MBOX_TYPE_FOE = 0x04,
23b360e4a530 Centrally defined mailbox types.
Florian Pose <fp@igh-essen.com>
parents: 2589
diff changeset
    56
    EC_MBOX_TYPE_SOE = 0x05,
23b360e4a530 Centrally defined mailbox types.
Florian Pose <fp@igh-essen.com>
parents: 2589
diff changeset
    57
    EC_MBOX_TYPE_VOE = 0x0f,
23b360e4a530 Centrally defined mailbox types.
Florian Pose <fp@igh-essen.com>
parents: 2589
diff changeset
    58
};
23b360e4a530 Centrally defined mailbox types.
Florian Pose <fp@igh-essen.com>
parents: 2589
diff changeset
    59
1563
ddedb71b3a85 Introduced mailbox/CoE defines; avoided duplicate code in CoE segmented
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    60
/*****************************************************************************/
ddedb71b3a85 Introduced mailbox/CoE defines; avoided duplicate code in CoE segmented
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    61
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2094
diff changeset
    62
uint8_t *ec_slave_mbox_prepare_send(const ec_slave_t *, ec_datagram_t *,
279
12f48c1cb143 Removed mbox_command out of slave.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    63
                                    uint8_t, size_t);
2589
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2094
diff changeset
    64
int      ec_slave_mbox_prepare_check(const ec_slave_t *, ec_datagram_t *);
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2094
diff changeset
    65
int      ec_slave_mbox_check(const ec_datagram_t *);
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2094
diff changeset
    66
int      ec_slave_mbox_prepare_fetch(const ec_slave_t *, ec_datagram_t *);
2b9c78543663 Reverted default branch to stable-1.5.
Florian Pose <fp@igh-essen.com>
parents: 2094
diff changeset
    67
uint8_t *ec_slave_mbox_fetch(const ec_slave_t *, const ec_datagram_t *,
390
685c267d80d8 Fixed mailbox bug, added mailbox error codes.
Florian Pose <fp@igh-essen.com>
parents: 328
diff changeset
    68
                             uint8_t *, size_t *);
145
11a82e4fd31b Mailbox-Interface ausgelagert, erster EOE-Ansatz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    69
11a82e4fd31b Mailbox-Interface ausgelagert, erster EOE-Ansatz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    70
/*****************************************************************************/
11a82e4fd31b Mailbox-Interface ausgelagert, erster EOE-Ansatz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    71
11a82e4fd31b Mailbox-Interface ausgelagert, erster EOE-Ansatz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
#endif