[etherlab-dev] [PATCH] My patchset roundup July 2015

Gavin Lambert gavinl at compacsort.com
Fri Jul 10 09:13:30 CEST 2015

Hi all,

It's been a while since I last posted my current patchset for Etherlab, so
it seemed like a good time to share the newest ones.

As with the last set, this is based on stable-1.5 (specifically
4b0b906df1b40a1b5610282117b2c22581890575) and contains both my own patches
and patches from others in the community, and I'm sharing them in case
people find them useful and that hopefully they'll make it into mainline.

Having said that, it appears that some of the patches in here have made it
into the default branch already; I haven't had time yet to inspect them and
rebase my patchset onto that branch, but it's on my TODO list. :)

The series file included in the archive shows the intended application order
(though you'll probably want to skip some of them if you're on default

Short descriptions (commit notes) are at the top of each patch; detailed
descriptions for the older patches can be found in previous emails, but I'll
give a bit more background on the newer patches below.  The older patches
are unchanged except for possible defuzzing.

Before that though, just a reminder that patch 0006 "dc_sync_vs_sys_time" is
only a partial fix; it works for slaves that have AssignActivate bits 0x3000
set, and that don't mind the offset between SM events and SYNC events
changing, but won't help other slaves -- they'll need a more comprehensive
fix (fully recalculating the Sync Start Time).  It's probably not something
I will do because my slaves do work with this, and I'm not sufficiently
familiar with the way DC sync is calculated in Etherlab.

The new patches are the gavinl-2000 series, as follows:

	This adds an API "ecrt_reg_request_readwrite" and tool command
"reg_readwrite" which will write register data and read back the values
before the write in a single FPRW datagram.  This can be useful to ensure
that the data is coherent and you don't miss an update.  It assumes Knud's
rt-mutex patch has been applied; if not you'll have to switch the locking
calls back.

	This enhances some of the debug-level logging for register requests.

	This adds an API "ecrt_master_sdo_upload_complete" and extends tool
command "upload" to support reading entire objects from a slave via SDO
Complete Access (where supported by the slave).  As with the existing
download functionality only Complete Access from subindex 0 is supported;
future extension might be to support access from index 1 as well.  Note that
when using the tool "upload" it will default to the "octet_string" data
type, so you can use something like "ethercat upload -p0 INDEX | hd" to see
the data formatted nicely.  It also assumes use of Knud's rt-mutex patch.

	This might be a little more controversial. :)  This modifies the
"ecrt_sdo_request_write" API (so it's a breaking change) to also include the
size of data to be written (this must be less than or equal to the size
specified at the time the request was created).  Combined with the existing
"ecrt_sdo_request_index" API, this allows you to re-use one request object
for any SDO on the same slave, provided the initial size is large enough.
Previously you had to use at least one object per different object size, as
there was no way to set the write size other than at creation time, and the
write size was also altered whenever you did a read.  (Possible non-breaking
alternative would be to make "ecrt_sdo_request_set_data_size" or something,
but that seems messier.)

	This is another breaking API change, which adds a boolean "complete"
parameter to "ecrt_slave_config_create_sdo_request" and
"ecrt_sdo_request_index".  This allows realtime requests to use Complete
Access; prior to this patch this was only available to the non-realtime API.
(If this is judged to be *too* breaking, one possible breakage reduction is
to omit the change to the create function since that is more common than use
of the index function.  However this will require anyone that wants to
create a Complete Access request to make two API calls specifying the index
and subindex twice, which seems uglier.  Similar for adding a separate
"ecrt_sdo_request_complete" API, which I also considered.)

As before, note that these patches do not include a change to
EC_IOCTL_VERSION_MAGIC, but you should change this if you apply any of them
to reduce the risk of incompatibility (assuming that your app checks the

Gavin Lambert

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patches-gavinl-20150710.zip
Type: application/x-zip-compressed
Size: 103740 bytes
Desc: not available
URL: <http://lists.etherlab.org/pipermail/etherlab-dev/attachments/20150710/27746eb8/attachment-0003.bin>

More information about the Etherlab-dev mailing list