libethercat - an embeddable realtime EtherCAT-master library
Communicate with EtherCAT slaves attached to a Network interface.
Loading...
Searching...
No Matches
hw_sock_raw_mmaped.h
Go to the documentation of this file.
1
12/*
13 * This file is part of libethercat.
14 *
15 * libethercat is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 3 of the License, or (at your option) any later version.
19 *
20 * libethercat is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with libethercat (LICENSE.LGPL-V3); if not, write
27 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
28 * Floor, Boston, MA 02110-1301, USA.
29 *
30 * Please note that the use of the EtherCAT technology, the EtherCAT
31 * brand name and the EtherCAT logo is only permitted if the property
32 * rights of Beckhoff Automation GmbH are observed. For further
33 * information please contact Beckhoff Automation GmbH & Co. KG,
34 * Hülshorstweg 20, D-33415 Verl, Germany (www.beckhoff.com) or the
35 * EtherCAT Technology Group, Ostendstraße 196, D-90482 Nuremberg,
36 * Germany (ETG, www.ethercat.org).
37 *
38 */
39
40#ifndef LIBETHERCAT_HW_SOCK_RAW_MMAPED_H
41#define LIBETHERCAT_HW_SOCK_RAW_MMAPED_H
42
43#include <libethercat/ec.h>
44#include <libethercat/hw.h>
45#include <libosal/task.h>
46
47typedef struct hw_sock_raw_mmaped {
48 struct hw_common common;
49
50 int sockfd;
51
52 osal_uint8_t send_frame[ETH_FRAME_LEN];
53 osal_uint8_t recv_frame[ETH_FRAME_LEN];
54
56 osal_char_t *rx_ring;
57 osal_char_t *tx_ring;
58
59 osal_off_t rx_ring_offset;
60 osal_off_t tx_ring_offset;
61
62 // receiver thread settings
63 osal_task_t rxthread;
66
67#ifdef __cplusplus
68extern "C" {
69#endif
70
72
81int hw_device_sock_raw_mmaped_open(struct hw_sock_raw_mmaped *phw_sock_raw_mmaped, ec_t *pec, const osal_char_t *devname, int prio, int cpumask);
82
83#ifdef __cplusplus
84}
85#endif
86
87#endif // LIBETHERCAT_HW_SOCK_RAW_MMAPED_H
88
89
ethercat master functions.
hardware access functions
int hw_device_sock_raw_mmaped_open(struct hw_sock_raw_mmaped *phw_sock_raw_mmaped, ec_t *pec, const osal_char_t *devname, int prio, int cpumask)
Opens EtherCAT hw device.
ethercat master structure
Definition ec.h:188
hardware structure
Definition hw.h:123
struct ec * pec
Pointer to EtherCAT master structure.
Definition hw.h:124
Definition hw_sock_raw_mmaped.h:47
osal_off_t tx_ring_offset
Offset in TX ring.
Definition hw_sock_raw_mmaped.h:60
osal_char_t * tx_ring
kernel mmap send buffers
Definition hw_sock_raw_mmaped.h:57
osal_char_t * rx_ring
kernel mmap receive buffers
Definition hw_sock_raw_mmaped.h:56
osal_off_t rx_ring_offset
Offset in RX ring.
Definition hw_sock_raw_mmaped.h:59
osal_uint8_t recv_frame[ETH_FRAME_LEN]
Static receive frame.
Definition hw_sock_raw_mmaped.h:53
osal_uint8_t send_frame[ETH_FRAME_LEN]
Static send frame.
Definition hw_sock_raw_mmaped.h:52
int rxthreadrunning
receiver thread running flag
Definition hw_sock_raw_mmaped.h:64
osal_task_t rxthread
receiver thread handle
Definition hw_sock_raw_mmaped.h:63
int mmap_packets
Doing mmap packets.
Definition hw_sock_raw_mmaped.h:55
int sockfd
raw socket file descriptor
Definition hw_sock_raw_mmaped.h:50