diff options
author | Frédéric Boisnard <fredericx.boisnard@intel.com> | 2012-05-30 16:15:02 +0200 |
---|---|---|
committer | David Wagner <david.wagner@intel.com> | 2014-02-12 17:03:10 +0100 |
commit | 9620e44c6c7605bf589f60331eb5b05b71336853 (patch) | |
tree | 24de41296b6da730e70f1ced0ad633bb4a7c7da3 /parameter/BitwiseAreaConfiguration.cpp | |
parent | 8b01852701d50869318663f568270f977d93dbdf (diff) | |
download | external_parameter-framework-9620e44c6c7605bf589f60331eb5b05b71336853.zip external_parameter-framework-9620e44c6c7605bf589f60331eb5b05b71336853.tar.gz external_parameter-framework-9620e44c6c7605bf589f60331eb5b05b71336853.tar.bz2 |
PFW: Fixed bug on BitParameterTypes
BZ: 44148
The save and restore operation would not work correctly when BitParameters
of a BitParameterBlock were used in more than a single Domain.
This patch aims to fixup this bug and introduces a new class: BitwiseAreaConfiguration.
Change-Id: I0aaccd57cf1cce33400f94a8879565171d283425
Orig-Change-Id: I7107f7db9f01cfff3c38cbac606a8c1e9bca8b5e
Signed-off-by: Frédéric Boisnard <fredericx.boisnard@intel.com>
Reviewed-on: http://android.intel.com:8080/58363
Reviewed-by: Mendi, EduardoX <eduardox.mendi@intel.com>
Tested-by: Mendi, EduardoX <eduardox.mendi@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'parameter/BitwiseAreaConfiguration.cpp')
-rw-r--r-- | parameter/BitwiseAreaConfiguration.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/parameter/BitwiseAreaConfiguration.cpp b/parameter/BitwiseAreaConfiguration.cpp new file mode 100644 index 0000000..d3ea463 --- /dev/null +++ b/parameter/BitwiseAreaConfiguration.cpp @@ -0,0 +1,59 @@ +#include "BitwiseAreaConfiguration.h" +#include "BitParameter.h" +#include "Subsystem.h" + +#define base CAreaConfiguration + +CBitwiseAreaConfiguration::CBitwiseAreaConfiguration(const CConfigurableElement *pConfigurableElement, const CSyncerSet *pSyncerSet) + : base(pConfigurableElement, pSyncerSet, static_cast<const CBitParameter*>(pConfigurableElement)->getBelongingBlockSize()), + _bBigEndian(pConfigurableElement->getBelongingSubsystem()->isBigEndian()) +{ +} + +// Blackboard copies +void CBitwiseAreaConfiguration::copyTo(CParameterBlackboard* pToBlackboard, uint32_t uiOffset) const +{ + // Beware this code works on little endian architectures only! + const CBitParameter* pBitParameter = static_cast<const CBitParameter*>(_pConfigurableElement); + + uint32_t uiSrcData = 0; + uint32_t uiDstData = 0; + + /// Read/modify/write + + // Read dst blackboard + pToBlackboard->readInteger(&uiDstData, pBitParameter->getBelongingBlockSize(), uiOffset, _bBigEndian); + + // Read src blackboard + _blackboard.readInteger(&uiSrcData, pBitParameter->getBelongingBlockSize(), 0, _bBigEndian); + + // Convert + uiDstData = pBitParameter->merge(uiDstData, uiSrcData); + + // Write dst blackboard + pToBlackboard->writeInteger(&uiDstData, pBitParameter->getBelongingBlockSize(), uiOffset, _bBigEndian); +} + +void CBitwiseAreaConfiguration::copyFrom(const CParameterBlackboard* pFromBlackboard, uint32_t uiOffset) +{ + // Beware this code works on little endian architectures only! + const CBitParameter* pBitParameter = static_cast<const CBitParameter*>(_pConfigurableElement); + + uint32_t uiSrcData = 0; + uint32_t uiDstData = 0; + + /// Read/modify/write + + // Read dst blackboard + _blackboard.readInteger(&uiDstData, pBitParameter->getBelongingBlockSize(), 0, _bBigEndian); + + // Read src blackboard + pFromBlackboard->readInteger(&uiSrcData, pBitParameter->getBelongingBlockSize(), uiOffset, _bBigEndian); + + // Convert + uiDstData = pBitParameter->merge(uiDstData, uiSrcData); + + // Write dst blackboard + _blackboard.writeInteger(&uiDstData, pBitParameter->getBelongingBlockSize(), 0, _bBigEndian); +} + |