Closed marcfir closed 4 months ago
How do you normally read and write the input data? I think sync in the cyclic_task
Yes, that's one option. Or you can register a callback function which gets called when the cyclic group lrw frame has returned. https://github.com/robert-burger/libethercat/blob/d9c124be9059a71cc81b2941cf2ec3a9b1736b1a/src/ec.c#L1452
or async with a double or triple buffer are both possible?
But the you need to do some work which is not included a.t.m. (implement triple-buffer, copy data in cyclic_task to/from triple buffer).
If I am correct, the process data memory is defined in the pd_group
You can access the pd via the pd_groups or via the pointers in the slave structures
correct.
Access to pd is secured by a lock
No, that's only a lock for the cyclic group datagram. The process data buffers in the groups have no lock because i always make synchronous access via the above mentioned callbacks. At DLR we have a bigger hardware abstraction framework running where these are indeed copied to a triple-buffer.
Thanks for the clarification. That makes sense.
How do you normally read and write the input data? I think sync in the cyclic_task or async with a double or triple buffer are both possible?
If I am correct, the process data memory is defined in the pd_group https://github.com/robert-burger/libethercat/blob/d9c124be9059a71cc81b2941cf2ec3a9b1736b1a/include/libethercat/ec.h#L91 You can access the pd via the pd_groups https://github.com/robert-burger/libethercat/blob/d9c124be9059a71cc81b2941cf2ec3a9b1736b1a/include/libethercat/ec.h#L213 or via the pointers in the slave structures https://github.com/robert-burger/libethercat/blob/d9c124be9059a71cc81b2941cf2ec3a9b1736b1a/include/libethercat/slave.h#L276-L292
Access to pd is secured by a lock https://github.com/robert-burger/libethercat/blob/d9c124be9059a71cc81b2941cf2ec3a9b1736b1a/src/ec.c#L1434-L1449 https://github.com/robert-burger/libethercat/blob/d9c124be9059a71cc81b2941cf2ec3a9b1736b1a/src/ec.c#L1547-L1588