diff options
author | Patrick Benavoli <patrickx.benavoli@intel.com> | 2011-08-31 11:23:24 +0200 |
---|---|---|
committer | David Wagner <david.wagner@intel.com> | 2014-02-10 17:13:21 +0100 |
commit | 6ba361d96bc2581667b3400f87ff89fae6449e1f (patch) | |
tree | e72e959d7d4c3b0f0b6dc20ec4f07d957eae1a50 /parameter/SubsystemObject.cpp | |
parent | 68a912857707864bbaaff9808717813105072a6e (diff) | |
download | external_parameter-framework-6ba361d96bc2581667b3400f87ff89fae6449e1f.zip external_parameter-framework-6ba361d96bc2581667b3400f87ff89fae6449e1f.tar.gz external_parameter-framework-6ba361d96bc2581667b3400f87ff89fae6449e1f.tar.bz2 |
parameter-framework: improvements and corrections
BZ: 6721
- Bug correction concerning selection criteria display (inclusive type)
- Adapted XML format to allow for only on parameter to be associated to
a domain
- Removed unused files in parameter project
Change-Id: I9f42d08ff8cb60354714fe3d6b0f0b321ad0a7bf
Orig-Change-Id: I837e553070f5acf2d275082c986ba29433493e31
Signed-off-by: Patrick Benavoli <patrickx.benavoli@intel.com>
Reviewed-on: http://android.intel.com:8080/16878
Reviewed-by: Mahe, Erwan <erwan.mahe@intel.com>
Tested-by: Barthes, FabienX <fabienx.barthes@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'parameter/SubsystemObject.cpp')
-rw-r--r-- | parameter/SubsystemObject.cpp | 95 |
1 files changed, 80 insertions, 15 deletions
diff --git a/parameter/SubsystemObject.cpp b/parameter/SubsystemObject.cpp index fb53520..f0f1985 100644 --- a/parameter/SubsystemObject.cpp +++ b/parameter/SubsystemObject.cpp @@ -32,9 +32,15 @@ #include "InstanceConfigurableElement.h" #include "ParameterBlackboard.h" #include <assert.h> +#include <stdlib.h> +#include <string.h> +#include <sstream> CSubsystemObject::CSubsystemObject(CInstanceConfigurableElement* pInstanceConfigurableElement) - : _pInstanceConfigurableElement(pInstanceConfigurableElement), _uiDataSize(pInstanceConfigurableElement->getFootPrint()), _pvSynchronizedLocation(NULL) + : _pInstanceConfigurableElement(pInstanceConfigurableElement), + _uiDataSize(pInstanceConfigurableElement->getFootPrint()), + _pucBlackboardLocation(NULL), + _uiAccessedIndex(0) { // Syncer _pInstanceConfigurableElement->setSyncer(this); @@ -45,10 +51,10 @@ CSubsystemObject::~CSubsystemObject() _pInstanceConfigurableElement->unsetSyncer(); } -// Synchronized location -void CSubsystemObject::setSynchronizedLocation(void* pvSynchronizedLocation) +// Blackboard data location +uint8_t* CSubsystemObject::getBlackboardLocation() const { - _pvSynchronizedLocation = pvSynchronizedLocation; + return _pucBlackboardLocation; } // Size @@ -57,10 +63,28 @@ uint32_t CSubsystemObject::getSize() const return _uiDataSize; } +// Conversion utility +uint32_t CSubsystemObject::asInteger(const string& strValue) +{ + return strtoul(strValue.c_str(), NULL, 0); +} + +string CSubsystemObject::asString(uint32_t uiValue) +{ + ostringstream ostr; + + ostr << uiValue; + + return ostr.str(); +} + // Synchronization bool CSubsystemObject::sync(CParameterBlackboard& parameterBlackboard, bool bBack, string& strError) { - assert(_pvSynchronizedLocation); + // Get blackboard location + _pucBlackboardLocation = parameterBlackboard.getLocation(_pInstanceConfigurableElement->getOffset()); + // Access index init + _uiAccessedIndex = 0; #ifdef SIMULATION return true; @@ -70,28 +94,69 @@ bool CSubsystemObject::sync(CParameterBlackboard& parameterBlackboard, bool bBac if (bBack) { // Read from HW - if (!receiveFromHW()) { + if (!accessHW(true, strError)) { - strError = "Unable to back synchronize configurable element " + _pInstanceConfigurableElement->getPath(); + strError = "Unable to back synchronize configurable element " + _pInstanceConfigurableElement->getPath() + ": " + strError; return false; } - // Write parameter block data - parameterBlackboard.rawWrite(_pvSynchronizedLocation, _uiDataSize, _pInstanceConfigurableElement->getOffset()); - } else { - // Read parameter block data - parameterBlackboard.rawRead(_pvSynchronizedLocation, _uiDataSize, _pInstanceConfigurableElement->getOffset()); - // Send to HW - if (!sendToHW()) { + if (!accessHW(false, strError)) { - strError = "Unable to synchronize configurable element " + _pInstanceConfigurableElement->getPath(); + strError = "Unable to synchronize configurable element " + _pInstanceConfigurableElement->getPath() + ": " + strError; return false; } } return true; } + +// Sync to/from HW +bool CSubsystemObject::sendToHW(string& strError) +{ + strError = "Send to HW interface not implemented at subsystsem level!"; + + return false; +} + +bool CSubsystemObject::receiveFromHW(string& strError) +{ + strError = "Receive from HW interface not implemented at subsystsem level!"; + + return false; +} + +// Fall back HW access +bool CSubsystemObject::accessHW(bool bReceive, string& strError) +{ + // Default access falls back + if (bReceive) { + + return receiveFromHW(strError); + } else { + + return sendToHW(strError); + } +} + +// Blackboard access from subsystems +void CSubsystemObject::blackboardRead(void* pvData, uint32_t uiSize) +{ + assert(_uiAccessedIndex + uiSize <= _uiDataSize); + + memcpy(pvData, _pucBlackboardLocation + _uiAccessedIndex, uiSize); + + _uiAccessedIndex += uiSize; +} + +void CSubsystemObject::blackboardWrite(const void* pvData, uint32_t uiSize) +{ + assert(_uiAccessedIndex + uiSize <= _uiDataSize); + + memcpy(_pucBlackboardLocation + _uiAccessedIndex, pvData, uiSize); + + _uiAccessedIndex += uiSize; +} |