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

Graeme Foot Graeme.Foot at touchcut.com
Mon Jul 13 00:20:04 CEST 2015


Re: gavinl-2004-sdo_write_size.

What I have been doing to allow one SDO Request object for all data sizes is to call ecrt_sdo_request_read() every time before calling ecrt_sdo_request_write().  This sets the size specific to the object you are about to write at the expense of extra time and processing.  It does however ensure the size is matched correctly to the object you are about to write to.

I like the idea of this change for speed but I would probably still be calling ecrt_sdo_request_read() before the first write to confirm things are as expected.

Also as you say, the SDO Request must be created with the largest expected data size.  The largest I have come across so far is a STRING[16] (16 bytes).  Has anyone seen larger?


-----Original Message-----
From: etherlab-dev [mailto:etherlab-dev-bounces at etherlab.org] On Behalf Of Gavin Lambert
Sent: Friday, 10 July 2015 7:14 p.m.
To: etherlab-dev at etherlab.org; Florian Pose
Subject: [QUARANTINE] [etherlab-dev] [PATCH] My patchset roundup July 2015
Importance: Low

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 already).

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 versions).

Gavin Lambert

More information about the etherlab-dev mailing list