Closed lpetre-ulb closed 4 years ago
This seems like it introduces an API change in addition to a bugfix. Is there any way we can factor out the bugfix part alone? Or is the impact of the API change internal only to the(this) module space?
Indeed, the API does change. I didn't find any way around it without using an hard-coded mask which would break the LMDB registers abstraction.
If the function could be used in different RPC modules since it is declared in the header, in practice, it is not used outside calibration_routine
. It is safe to replace only the calibration_routine
module.
Actually in this particular case hard-coded mask won't really break the LMDB abstraction because the channel registers in SW/FW mirror their hardware implementation in VFAT3 chips, i.e. this mask will never change unless we replace VFAT3 with something else.
Well, the abstraction would still be broken. ;-) But I agree it should be safe to do so in this case.
Following that direction, it should be possible to generate the VFAT3 registers algorithmically instead of relying on the LMDB. The LMDB database size would shrink by much and the performances should also improve.
Well, the abstraction would still be broken. ;-) But I agree it should be safe to do so in this case.
Following that direction, it should be possible to generate the VFAT3 registers algorithmically instead of relying on the LMDB. The LMDB database size would shrink by much and the performances should also improve.
This has been a longstanding back-burner idea, and once we have a minimally functional suite with the templated framework operational, I'd say it could make sense to pursue it. My primary concern in this particular case was to make it simple to transport this change into the templated branch (since a lot of work was done recently to rebase that on top of all the recent changes in the "legacy" code)
This has been a longstanding back-burner idea, and once we have a minimally functional suite with the templated framework operational, I'd say it could make sense to pursue it.
:+1:
My primary concern in this particular case was to make it simple to transport this change into the templated branch (since a lot of work was done recently to rebase that on top of all the recent changes in the "legacy" code)
In any case, this bugfix does not translate well into the templated branch since it is not exception safe at all. Indeed, if an exception is thrown and not caught at the right place within the RPC method, the system state won't be restored. The safe way to do fix this (and any other state restoration) would be to restore the system state in a object destructor, ignoring any write errors (best effort strategy). Unless we don't want to give any guarantee in case an error is reported to the DAQ software...
Provided this requires no downstream changes (which I believe is the case)
Indeed, this is a bug-fix (despite the slight API change). All the software was designed as if the ctp7_modules
code was working properly.
This PR fixes an issue in the per-channel Sbit rate vs
THR_ARM_DAC
scan reported by @mexanick and discussed in a separate email thread.Here is the relevant quote:
Description
Before this PR, the
setSingleChanMask
andapplyChanMask
functions were using the raw register write methodwriteRawAddress
which does perform an unmasked write. Since the mask bit is not the LSB in the per-channel VFAT configuration, the channels were not masked. As a side effect, the per-channel configuration was corrupted (even after the channel mask restoration).The fix uses the method
writeReg
which performs a masked write which the appropriate mask (from the LMDB). ThesetSingleChanMask
andapplyChanMask
signatures had to be changed to use astd::map
indexed bystd::string
s rather thanstd::uin32_t
s. All the calls in the code base have been adapted.The bugfix targets only the
release/v1.1.X
branch. Indeed, the behavior is not exception-safe so that a different, and more versatile method, should be used in thefeature/remplated-rpc-methods
branch.Types of changes
Motivation and Context
See first paragraphs.
How Has This Been Tested?
The per-channel Sbit rate vs
THR_ARM_DAC
scan runs seamlessly and shows varying behavior across the VFAT channels (see the screenshots).Screenshots (if appropriate):
Before the fix all the channels present the same Sbit rate vs
THR_ARM_DAC
behavior:After the fix the channels present varying Sbit rate vs
THR_ARM_DAC
behaviors:Checklist: