libethercat - an embeddable realtime EtherCAT-master library
Communicate with EtherCAT slaves attached to a Network interface.
Loading...
Searching...
No Matches
idx.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_IDX_H
41#define LIBETHERCAT_IDX_H
42
43#include <libosal/queue.h>
44
45#include <libosal/types.h>
46#include <libosal/binary_semaphore.h>
47#include <libosal/mutex.h>
48
49#include "libethercat/common.h"
50
51#define LEC_MAX_INDEX 256
52
54typedef struct idx_entry {
55 osal_uint8_t idx;
56 osal_binary_semaphore_t waiter;
57
60TAILQ_HEAD(idx_entry_queue, idx_entry);
61
63typedef struct idx_queue {
64 osal_mutex_t lock;
65 idx_entry_t entries[LEC_MAX_INDEX];
66 struct idx_entry_queue q;
68
69#ifdef __cplusplus
70extern "C" {
71#endif
72
74
82
84
90
92
98int ec_index_get(idx_queue_t *idx_q, struct idx_entry **entry);
99
101
105void ec_index_put(idx_queue_t *idx_q, struct idx_entry *entry);
106
107#ifdef __cplusplus
108}
109#endif
110
111#endif // LIBETHERCAT_IDX_H
112
ethercat master common stuff
void ec_index_put(idx_queue_t *idx_q, struct idx_entry *entry)
Returns index entry.
int ec_index_get(idx_queue_t *idx_q, struct idx_entry **entry)
Get next free index entry.
int ec_index_init(idx_queue_t *idx_q)
Initialize index queue structure.
struct idx_queue idx_queue_t
index queue
struct idx_entry idx_entry_t
index entry
void ec_index_deinit(idx_queue_t *idx_q)
Deinitialize index queue structure.
index entry
Definition idx.h:54
osal_uint8_t idx
Datagram index.
Definition idx.h:55
TAILQ_ENTRY(idx_entry) qh
Queue handle.
osal_binary_semaphore_t waiter
Waiter semaphore for synchronous access.
Definition idx.h:56
index queue
Definition idx.h:63
idx_entry_t entries[LEC_MAX_INDEX]
Static queue entries, do not use directly.
Definition idx.h:65
struct idx_entry_queue q
The head of the index queue.
Definition idx.h:66
osal_mutex_t lock
Queue lock, prevent concurrent queue access.
Definition idx.h:64