IgH EtherCAT Master  1.7.0
mailbox.h
Go to the documentation of this file.
1/*****************************************************************************
2 *
3 * Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH
4 *
5 * This file is part of the IgH EtherCAT Master.
6 *
7 * The IgH EtherCAT Master is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License version 2, as
9 * published by the Free Software Foundation.
10 *
11 * The IgH EtherCAT Master is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14 * Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with the IgH EtherCAT Master; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 ****************************************************************************/
21
26
27/****************************************************************************/
28
29#ifndef __EC_MAILBOX_H__
30#define __EC_MAILBOX_H__
31
32#include "globals.h"
33#include "datagram.h"
34#include "smp.h"
35
36/****************************************************************************/
37
40#define EC_MBOX_HEADER_SIZE 6
41
46enum {
47 EC_MBOX_TYPE_EOE = 0x02,
48 EC_MBOX_TYPE_COE = 0x03,
49 EC_MBOX_TYPE_FOE = 0x04,
50 EC_MBOX_TYPE_SOE = 0x05,
51 EC_MBOX_TYPE_VOE = 0x0f,
52};
53
54/****************************************************************************/
55
58typedef struct {
59 uint8_t *data;
60 size_t data_size;
61 size_t payload_size;
63
64/****************************************************************************/
65
68
71 uint8_t, size_t);
77 uint8_t *, size_t *);
78
79/****************************************************************************/
80
81#endif
EtherCAT datagram structure.
Global definitions and macros.
struct ec_slave ec_slave_t
Definition globals.h:315
void ec_mbox_data_init(ec_mbox_data_t *mbox_data)
Initialize mailbox response data.
Definition mailbox.c:40
uint8_t * ec_slave_mbox_fetch(const ec_slave_t *slave, ec_mbox_data_t *response_data, uint8_t *type, size_t *size)
Processes received mailbox data.
Definition mailbox.c:290
int ec_slave_mbox_prepare_check(const ec_slave_t *slave, ec_datagram_t *datagram)
Prepares a datagram for checking the mailbox state.
Definition mailbox.c:188
int ec_slave_mbox_prepare_fetch(const ec_slave_t *slave, ec_datagram_t *datagram)
Prepares a datagram to fetch mailbox data.
Definition mailbox.c:219
void ec_mbox_data_clear(ec_mbox_data_t *mbox_data)
Free internal memory for mailbox response data.
Definition mailbox.c:53
void ec_slave_mbox_prealloc(ec_slave_t *slave)
Allocates the mailbox response buffers of a slave.
Definition mailbox.c:100
void ec_slave_mbox_take_error(ec_mbox_data_t *mbox_data, const ec_datagram_t *datagram)
Takes over a mailbox error response from a mailbox fetch datagram.
Definition mailbox.c:246
uint8_t * ec_slave_mbox_prepare_send(const ec_slave_t *slave, ec_datagram_t *datagram, uint8_t type, size_t size)
Prepares a mailbox-send datagram.
Definition mailbox.c:143
int ec_slave_mbox_check(const ec_datagram_t *datagram)
Processes a mailbox state checking datagram.
Definition mailbox.c:207
Definitions of Kernel SMP macros.
EtherCAT datagram.
Definition datagram.h:81
EtherCAT mailbox response data.
Definition mailbox.h:58
uint8_t * data
Mailbox response data.
Definition mailbox.h:59
size_t payload_size
Size of the mailbox response payload data.
Definition mailbox.h:61
size_t data_size
Size of the mailbox response data buffer.
Definition mailbox.h:60