libethercat - an embeddable realtime EtherCAT-master library
Communicate with EtherCAT slaves attached to a Network interface.
Loading...
Searching...
No Matches
hw_stm32.h
Go to the documentation of this file.
1
13/*
14 * This file is part of libethercat.
15 *
16 * libethercat is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License as published by the Free Software Foundation; either
19 * version 3 of the License, or (at your option) any later version.
20 *
21 * libethercat is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with libethercat (LICENSE.LGPL-V3); if not, write
28 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
29 * Floor, Boston, MA 02110-1301, USA.
30 *
31 * Please note that the use of the EtherCAT technology, the EtherCAT
32 * brand name and the EtherCAT logo is only permitted if the property
33 * rights of Beckhoff Automation GmbH are observed. For further
34 * information please contact Beckhoff Automation GmbH & Co. KG,
35 * Hülshorstweg 20, D-33415 Verl, Germany (www.beckhoff.com) or the
36 * EtherCAT Technology Group, Ostendstraße 196, D-90482 Nuremberg,
37 * Germany (ETG, www.ethercat.org).
38 *
39 */
40
41#ifndef LIBETHERCAT_HW_STM32_H
42#define LIBETHERCAT_HW_STM32_H
43
44#include "eth.h"
45#include <libethercat/hw.h>
46//#include <stm32_hal_legacy.h>
47//#include <stm32h7xx_hal_def.h>
48
49typedef struct hw_stm32 {
50 struct hw_common common;
51
52 int frames_sent;
53 ETH_TxPacketConfig TxConfig;
54
55 osal_uint8_t send_frame[ETH_FRAME_LEN];
56 osal_uint8_t recv_frame[ETH_FRAME_LEN];
58
59// HTONS MACRO -> configured in config.h (libethcat)
60#if 0
61#define HTONS(x) (((x) << 8) | ((x) >> 8))
62#define htons(x) (((x) << 8) | ((x) >> 8))
63#endif
64
65#ifndef htons
66#define htons(x) ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))
67#endif
68
69
71
77int hw_device_stm32_open(struct hw_stm32 *phw, struct ec *pec);
78int hw_device_stm32_send(struct hw_common *phw, ec_frame_t *pframe, pooltype_t pool_type);
79int hw_device_stm32_recv(struct hw_common *phw);
80
81#endif // LIBETHERCAT_HW_STM32_H
82
enum pooltype pooltype_t
Flag to distinguish the pool types during processing.
hardware access functions
int hw_device_stm32_open(struct hw_stm32 *phw, struct ec *pec)
Opens EtherCAT hw device.
Definition datagram.h:60
ethercat master structure
Definition ec.h:188
hardware structure
Definition hw.h:126
struct ec * pec
Pointer to EtherCAT master structure.
Definition hw.h:127
Definition hw_stm32.h:49
osal_uint8_t recv_frame[ETH_FRAME_LEN]
Static receive frame.
Definition hw_stm32.h:56
osal_uint8_t send_frame[ETH_FRAME_LEN]
Static send frame.
Definition hw_stm32.h:55