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 
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 
46 enum {
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 
58 typedef 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
uint8_t * data
Mailbox response data.
Definition: mailbox.h:59
uint8_t * ec_slave_mbox_fetch(const ec_slave_t *, ec_mbox_data_t *, uint8_t *, size_t *)
Processes received mailbox data.
Definition: mailbox.c:290
EtherCAT mailbox response data.
Definition: mailbox.h:58
void ec_mbox_data_clear(ec_mbox_data_t *)
Free internal memory for mailbox response data.
Definition: mailbox.c:53
EtherCAT datagram.
Definition: datagram.h:81
Global definitions and macros.
EtherCAT slave.
Definition: slave.h:170
Definitions of Kernel SMP macros.
int ec_slave_mbox_prepare_fetch(const ec_slave_t *, ec_datagram_t *)
Prepares a datagram to fetch mailbox data.
Definition: mailbox.c:219
int ec_slave_mbox_prepare_check(const ec_slave_t *, ec_datagram_t *)
Prepares a datagram for checking the mailbox state.
Definition: mailbox.c:188
size_t data_size
Size of the mailbox response data buffer.
Definition: mailbox.h:60
void ec_slave_mbox_take_error(ec_mbox_data_t *, const ec_datagram_t *)
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 *, ec_datagram_t *, uint8_t, size_t)
Prepares a mailbox-send datagram.
Definition: mailbox.c:143
EtherCAT datagram structure.
void ec_slave_mbox_prealloc(ec_slave_t *)
Allocates the mailbox response buffers of a slave.
Definition: mailbox.c:100
int ec_slave_mbox_check(const ec_datagram_t *)
Processes a mailbox state checking datagram.
Definition: mailbox.c:207
void ec_mbox_data_init(ec_mbox_data_t *)
Initialize mailbox response data.
Definition: mailbox.c:40
size_t payload_size
Size of the mailbox response payload data.
Definition: mailbox.h:61