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
54
typedef
struct
idx_entry
{
55
osal_uint8_t
idx
;
56
osal_binary_semaphore_t
waiter
;
57
58
TAILQ_ENTRY
(
idx_entry
) qh;
59
}
idx_entry_t
;
60
TAILQ_HEAD(idx_entry_queue,
idx_entry
);
61
63
typedef
struct
idx_queue
{
64
osal_mutex_t
lock
;
65
idx_entry_t
entries
[LEC_MAX_INDEX];
66
struct
idx_entry_queue
q
;
67
}
idx_queue_t
;
68
69
#ifdef __cplusplus
70
extern
"C"
{
71
#endif
72
74
81
int
ec_index_init
(
idx_queue_t
*idx_q);
82
84
89
void
ec_index_deinit
(
idx_queue_t
*idx_q);
90
92
98
int
ec_index_get
(
idx_queue_t
*idx_q,
struct
idx_entry
**entry);
99
101
105
void
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
common.h
ethercat master common stuff
ec_index_put
void ec_index_put(idx_queue_t *idx_q, struct idx_entry *entry)
Returns index entry.
ec_index_get
int ec_index_get(idx_queue_t *idx_q, struct idx_entry **entry)
Get next free index entry.
ec_index_init
int ec_index_init(idx_queue_t *idx_q)
Initialize index queue structure.
idx_queue_t
struct idx_queue idx_queue_t
index queue
idx_entry_t
struct idx_entry idx_entry_t
index entry
ec_index_deinit
void ec_index_deinit(idx_queue_t *idx_q)
Deinitialize index queue structure.
idx_entry
index entry
Definition
idx.h:54
idx_entry::idx
osal_uint8_t idx
Datagram index.
Definition
idx.h:55
idx_entry::TAILQ_ENTRY
TAILQ_ENTRY(idx_entry) qh
Queue handle.
idx_entry::waiter
osal_binary_semaphore_t waiter
Waiter semaphore for synchronous access.
Definition
idx.h:56
idx_queue
index queue
Definition
idx.h:63
idx_queue::entries
idx_entry_t entries[LEC_MAX_INDEX]
Static queue entries, do not use directly.
Definition
idx.h:65
idx_queue::q
struct idx_entry_queue q
The head of the index queue.
Definition
idx.h:66
idx_queue::lock
osal_mutex_t lock
Queue lock, prevent concurrent queue access.
Definition
idx.h:64
include
libethercat
idx.h
Generated by
1.9.8