diff options
author | Guillaume Denneulin <guillaume.denneulin@intel.com> | 2012-09-27 15:13:10 +0200 |
---|---|---|
committer | David Wagner <david.wagner@intel.com> | 2014-02-12 17:03:14 +0100 |
commit | 9533156ebad9b5989703db70be3f6bd22c9811c4 (patch) | |
tree | 13be07f704900c328300f8a386a212be0e9883d1 /parameter | |
parent | 8b243f50a38a26e6b373287e07cb7e4743a8cd28 (diff) | |
download | external_parameter-framework-9533156ebad9b5989703db70be3f6bd22c9811c4.zip external_parameter-framework-9533156ebad9b5989703db70be3f6bd22c9811c4.tar.gz external_parameter-framework-9533156ebad9b5989703db70be3f6bd22c9811c4.tar.bz2 |
Allow 64bits bitParameterBlocks
BZ: 59348
bitParameterBlocks are limited to 32 bits, extend it to 64 bits.
This change includes:
- PFW code change
- XML schema update
Change-Id: I9861cea0538a17fcba77fa7d573faae36d8731e0
Signed-off-by: Guillaume Denneulin <guillaume.denneulin@intel.com>
Reviewed-on: http://android.intel.com:8080/68189
Reviewed-by: Gozalvez Herrero, Juan AntonioX <juan.antoniox.gozalvez.herrero@intel.com>
Tested-by: Gozalvez Herrero, Juan AntonioX <juan.antoniox.gozalvez.herrero@intel.com>
Diffstat (limited to 'parameter')
-rw-r--r-- | parameter/BitParameter.cpp | 10 | ||||
-rw-r--r-- | parameter/BitParameter.h | 4 | ||||
-rw-r--r-- | parameter/BitParameterType.cpp | 24 | ||||
-rw-r--r-- | parameter/BitParameterType.h | 18 | ||||
-rw-r--r-- | parameter/BitwiseAreaConfiguration.cpp | 8 | ||||
-rw-r--r-- | parameter/Element.cpp | 9 | ||||
-rw-r--r-- | parameter/Element.h | 1 |
7 files changed, 42 insertions, 32 deletions
diff --git a/parameter/BitParameter.cpp b/parameter/BitParameter.cpp index 1ee3178..1f1b3b7 100644 --- a/parameter/BitParameter.cpp +++ b/parameter/BitParameter.cpp @@ -81,7 +81,7 @@ bool CBitParameter::accessAsBoolean(bool& bValue, bool bSet, CParameterAccessCon } // Rely on integer access - uint32_t uiValue; + uint64_t uiValue; if (bSet) { @@ -102,7 +102,7 @@ bool CBitParameter::accessAsBoolean(bool& bValue, bool bSet, CParameterAccessCon } // Integer Access -bool CBitParameter::accessAsInteger(uint32_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const +bool CBitParameter::accessAsInteger(uint64_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const { uint32_t uiOffset = getOffset(); @@ -127,7 +127,7 @@ bool CBitParameter::accessAsInteger(uint32_t& uiValue, bool bSet, CParameterAcce template <typename type> bool CBitParameter::doSet(type value, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const { - uint32_t uiData = 0; + uint64_t uiData = 0; // Read/modify/write CParameterBlackboard* pBlackboard = parameterAccessContext.getParameterBlackboard(); @@ -149,7 +149,7 @@ bool CBitParameter::doSet(type value, uint32_t uiOffset, CParameterAccessContext template <typename type> void CBitParameter::doGet(type& value, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const { - uint32_t uiData = 0; + uint64_t uiData = 0; // Read blackboard const CParameterBlackboard* pBlackboard = parameterAccessContext.getParameterBlackboard(); @@ -168,7 +168,7 @@ CAreaConfiguration* CBitParameter::createAreaConfiguration(const CSyncerSet* pSy } // Access from area configuration -uint32_t CBitParameter::merge(uint32_t uiOriginData, uint32_t uiNewData) const +uint64_t CBitParameter::merge(uint64_t uiOriginData, uint64_t uiNewData) const { // Convert return static_cast<const CBitParameterType*>(getTypeElement())->merge(uiOriginData, uiNewData); diff --git a/parameter/BitParameter.h b/parameter/BitParameter.h index b7844c7..50e59c6 100644 --- a/parameter/BitParameter.h +++ b/parameter/BitParameter.h @@ -44,7 +44,7 @@ public: virtual bool accessAsBoolean(bool& bValue, bool bSet, CParameterAccessContext& parameterAccessContext) const; // Integer Access - virtual bool accessAsInteger(uint32_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const; + virtual bool accessAsInteger(uint64_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const; // AreaConfiguration creation virtual CAreaConfiguration* createAreaConfiguration(const CSyncerSet* pSyncerSet) const; @@ -53,7 +53,7 @@ public: uint32_t getBelongingBlockSize() const; // Access from area configuration - uint32_t merge(uint32_t uiOriginData, uint32_t uiNewData) const; + uint64_t merge(uint64_t uiOriginData, uint64_t uiNewData) const; private: // String Access diff --git a/parameter/BitParameterType.cpp b/parameter/BitParameterType.cpp index 6c5a90f..20d29d3 100644 --- a/parameter/BitParameterType.cpp +++ b/parameter/BitParameterType.cpp @@ -31,7 +31,7 @@ #define base CTypeElement -CBitParameterType::CBitParameterType(const string& strName) : base(strName), _uiBitPos(0), _uiBitSize(0), _uiMax(uint32_t(-1)) +CBitParameterType::CBitParameterType(const string& strName) : base(strName), _uiBitPos(0), _uiBitSize(0), _uiMax(uint64_t(-1)) { } @@ -114,13 +114,13 @@ bool CBitParameterType::fromXml(const CXmlElement& xmlElement, CXmlSerializingCo } // Conversion -bool CBitParameterType::toBlackboard(const string& strValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const +bool CBitParameterType::toBlackboard(const string& strValue, uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const { // Hexa bool bValueProvidedAsHexa = !strValue.compare(0, 2, "0x"); // Get value - uint32_t uiConvertedValue = strtoul(strValue.c_str(), NULL, 0); + uint64_t uiConvertedValue = strtoull(strValue.c_str(), NULL, 0); if (uiConvertedValue > _uiMax) { @@ -149,9 +149,9 @@ bool CBitParameterType::toBlackboard(const string& strValue, uint32_t& uiValue, return true; } -void CBitParameterType::fromBlackboard(string& strValue, const uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const +void CBitParameterType::fromBlackboard(string& strValue, const uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const { - uint32_t uiConvertedValue = (uiValue & getMask()) >> _uiBitPos; + uint64_t uiConvertedValue = (uiValue & getMask()) >> _uiBitPos; // Format ostringstream strStream; @@ -169,7 +169,7 @@ void CBitParameterType::fromBlackboard(string& strValue, const uint32_t& uiValue // Value access // Integer -bool CBitParameterType::toBlackboard(uint32_t uiUserValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const +bool CBitParameterType::toBlackboard(uint64_t uiUserValue, uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const { if (uiUserValue > _uiMax) { @@ -184,7 +184,7 @@ bool CBitParameterType::toBlackboard(uint32_t uiUserValue, uint32_t& uiValue, CP return true; } -void CBitParameterType::fromBlackboard(uint32_t& uiUserValue, uint32_t uiValue, CParameterAccessContext& parameterAccessContext) const +void CBitParameterType::fromBlackboard(uint64_t& uiUserValue, uint64_t uiValue, CParameterAccessContext& parameterAccessContext) const { (void)parameterAccessContext; @@ -192,7 +192,7 @@ void CBitParameterType::fromBlackboard(uint32_t& uiUserValue, uint32_t uiValue, } // Access from area configuration -uint32_t CBitParameterType::merge(uint32_t uiOriginData, uint32_t uiNewData) const +uint64_t CBitParameterType::merge(uint64_t uiOriginData, uint64_t uiNewData) const { return (uiOriginData & ~getMask()) | (uiNewData & getMask()); } @@ -209,19 +209,19 @@ CInstanceConfigurableElement* CBitParameterType::doInstantiate() const } // Max value -uint32_t CBitParameterType::getMaxEncodableValue() const +uint64_t CBitParameterType::getMaxEncodableValue() const { - return (uint32_t)-1L >> (8 * sizeof(uint32_t) - _uiBitSize); + return (uint64_t)-1L >> (8 * sizeof(uint64_t) - _uiBitSize); } // Biwise mask -uint32_t CBitParameterType::getMask() const +uint64_t CBitParameterType::getMask() const { return getMaxEncodableValue() << _uiBitPos; } // Check data has no bit set outside available range -bool CBitParameterType::isEncodable(uint32_t uiData) const +bool CBitParameterType::isEncodable(uint64_t uiData) const { uint32_t uiShift = 8 * sizeof(uiData) - _uiBitSize; diff --git a/parameter/BitParameterType.h b/parameter/BitParameterType.h index 08201da..abf3c47 100644 --- a/parameter/BitParameterType.h +++ b/parameter/BitParameterType.h @@ -42,13 +42,13 @@ public: virtual void toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const; /// Conversion // String - bool toBlackboard(const string& strValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const; - void fromBlackboard(string& strValue, const uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const; + bool toBlackboard(const string& strValue, uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const; + void fromBlackboard(string& strValue, const uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const; // Integer - bool toBlackboard(uint32_t uiUserValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const; - void fromBlackboard(uint32_t& uiUserValue, uint32_t uiValue, CParameterAccessContext& parameterAccessContext) const; + bool toBlackboard(uint64_t uiUserValue, uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const; + void fromBlackboard(uint64_t& uiUserValue, uint64_t uiValue, CParameterAccessContext& parameterAccessContext) const; // Access from area configuration - uint32_t merge(uint32_t uiOriginData, uint32_t uiNewData) const; + uint64_t merge(uint64_t uiOriginData, uint64_t uiNewData) const; // Bit Size uint32_t getBitSize() const; @@ -62,16 +62,16 @@ private: // Instantiation virtual CInstanceConfigurableElement* doInstantiate() const; // Max encodable value - uint32_t getMaxEncodableValue() const; + uint64_t getMaxEncodableValue() const; // Biwise mask - uint32_t getMask() const; + uint64_t getMask() const; // Check data has no bit set outside available range - bool isEncodable(uint32_t uiData) const; + bool isEncodable(uint64_t uiData) const; // Pos in bits uint32_t _uiBitPos; // Size in bits uint32_t _uiBitSize; // Max value - uint32_t _uiMax; + uint64_t _uiMax; }; diff --git a/parameter/BitwiseAreaConfiguration.cpp b/parameter/BitwiseAreaConfiguration.cpp index d3ea463..3c07c08 100644 --- a/parameter/BitwiseAreaConfiguration.cpp +++ b/parameter/BitwiseAreaConfiguration.cpp @@ -16,8 +16,8 @@ void CBitwiseAreaConfiguration::copyTo(CParameterBlackboard* pToBlackboard, uint // 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; + uint64_t uiSrcData = 0; + uint64_t uiDstData = 0; /// Read/modify/write @@ -39,8 +39,8 @@ void CBitwiseAreaConfiguration::copyFrom(const CParameterBlackboard* pFromBlackb // 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; + uint64_t uiSrcData = 0; + uint64_t uiDstData = 0; /// Read/modify/write diff --git a/parameter/Element.cpp b/parameter/Element.cpp index 220005b..aa4f1b1 100644 --- a/parameter/Element.cpp +++ b/parameter/Element.cpp @@ -169,6 +169,15 @@ string CElement::toString(uint32_t uiValue) return ostr.str(); } +string CElement::toString(uint64_t uiValue) +{ + ostringstream ostr; + + ostr << uiValue; + + return ostr.str(); +} + string CElement::toString(int32_t iValue) { ostringstream ostr; diff --git a/parameter/Element.h b/parameter/Element.h index 75171cc..6e5abc9 100644 --- a/parameter/Element.h +++ b/parameter/Element.h @@ -96,6 +96,7 @@ public: // Conversion utilities static string toString(uint32_t uiValue); + static string toString(uint64_t uiValue); static string toString(int32_t iValue); static string toString(double dValue); |