summaryrefslogtreecommitdiffstats
path: root/parameter/FixedPointParameterType.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Drop release v2.6.0+no-stlportJean-Michel Trivi2015-07-151-6/+7
| | | | | | | Bug 246391 Change-Id: I662b7b0f90c97cb169978e1b64ad1fe32c440cf5 Signed-off-by: Jean-Michel Trivi <jmtrivi@google.com>
* Remove using std::XXX from headersSebastien Gonzalve2014-09-111-9/+11
| | | | | This is a bad practice to have using in headers because it pollutes the namespace of any user of that header.
* FixedPointParameter: Rename conversion functionsMattijs Korpershoek2014-06-251-12/+12
| | | | | | | | | | BZ: 197723 Give a few functions more meaningful names. Add some cast fixes and doxygen to the renamed functions. Change-Id: I002a3fa9b397294153c23b9883c3ad3b1c136e54 Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
* Fix fixed-point parameter range checkMattijs Korpershoek2014-06-251-7/+1
| | | | | | | | | | | | BZ: 197723 When adding parameters which are far out of bounds, the range check does not refuse to set the value. This is unexpected behaviour. This patch adds a correct range check. Change-Id: I325920bcabc9485bd8f95aadcaff36a67182b97c Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
* FixedPointParameter: Removed precision notionDavid Wagner2014-06-251-23/+3
| | | | | | | | | | | | | | | | | | | BZ: 197723 Significant digits were computed in order to prevent odd behaviour when printing a converted fixed point parameter. After converting a number from fixed point towards a double, we had to round up/down in order to print the double to the user (or towards a file). The printing showed only the significant digits, in other words, the digits which can vary from 0 to 9. This caused unpredictable behaviour when rounding using the setPrecision() function. This patch removes the 'precision' notion related to fixed points in order to have a predictable behaviour by displaying all fractional digits. Change-Id: Id5a9b5b8a80d5a96bcbbb6af9213770a05a70083 Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
* Fix Fixed Point convert issue.Francois Gaffie2014-06-251-53/+84
| | | | | | | | | | | | | | BZ: 185336 Convert is failing when trying to convert the string value to integer value within FixedPointParameterType class. This patch fixes the issue by requesting to convert the string into a signed type. Change-Id: I77987eb1564292bd6dcdd0da4db52c4b4f92818f Signed-off-by: Francois Gaffie <francois.gaffie@intel.com> Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
* Correct FixedPointParameter display precisionDavid Wagner2014-06-251-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BZ: 176178 Explain the precision computation (m * log10(2)): For a Qn.m number, the step between each storable number is 2^(-m). Hence, on a decimal representation, the Dth digit after the decimal point can take all possible values (1..9) - meaning that it is significant - only if 2^(-m) <= 10^(-D) -m <= log2(10^(-D)) -m <= log10(10^(-D)) / log10(2) -m <= -D / log10(2) m * log10(2) >= D Conversly, the Dth digit can be represented if D <= m * log10(2) We add 1 to the precision in order to display the digit right after the last significant digit. This will lead to oddities such as: $ setParameter /Test/test/f32_Q8.23 0.1234569 $ getParameter /Test/test/f32_Q8.23 > 0.1234570 but it will avoid modifying raw values when converting from string to Q-format and back to string. Also, use std::setprecision() on the stream instead of manually truncating the displayed number. Change-Id: Ief2a7daabf4505ae4312e79036b0374f53368cac Signed-off-by: David Wagner <david.wagner@intel.com>
* FixedPointParameterType: fix potential compilation issueDavid Wagner2014-06-251-22/+9
| | | | | | | | | | | | | | | BZ: 176178 The isEncodable() method has several prototypes and some compilers are not able to decide which version to use and produce a compilation error. Remove unnecessary casts and make the code simpler by using a template-based conversion library from string to various numeric types instead of using strtoll and strtod. Change-Id: I53d0b4ebd12f2cbb315bb52d98365a35876b5aef Signed-off-by: David Wagner <david.wagner@intel.com> Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
* Change the license to 3-clause BSDDavid Wagner2014-02-131-23/+28
| | | | | | | Add license header in all source files and Makefiles, Add a "COPYING" file containing the license text. Signed-off-by: David Wagner <david.wagner@intel.com>
* Avoid integer overflow while calculating max valuesDmitry Shkurko2014-02-121-3/+1
| | | | | | | | | | | | BZ: 134249 The behavior is undefined in the case of signed integer overflow for enum and fixed point parameter types. Modify the behavior to handle correctly the signed integers. Change-Id: Idbd0798a39f826853ae1afcd05cebd897675b9a8 Signed-off-by: Dmitry Shkurko <Dmitry.V.Shkurko@intel.com>
* PFW: Add two commands to print xml settings and structureGeorges-Henri Baron2014-02-121-0/+15
| | | | | | | | | | | | | | | | | | | | | BZ: 44910 Creates two commands that can be called through the command line of the parameter-framework. First command getDomainXML returns a string containing the xml structure of the domains, configurations and settings. Second command getSystemClassXML returns a string containing the xml structure of all the instantiated parameter with their attributes. Change-Id: I9a35333802049a2177b8fc416754fdb67e6efff0 Signed-off-by: Georges-Henri Baron <georges-henrix.baron@intel.com> Reviewed-on: http://android.intel.com:8080/55155 Reviewed-by: Rocard, KevinX <kevinx.rocard@intel.com> Reviewed-by: Centelles, Sylvain <sylvain.centelles@intel.com> Tested-by: Mendi, EduardoX <eduardox.mendi@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
* PFW: Remove names from PFW license headerKevin Rocard2014-02-121-7/+1
| | | | | | | | | | | | | | | BZ: 47701 As parameter framework code is proprietary, it should not be signed (patrick Benavoli name inside the header). Change-Id: I198f2851ee2a6cffed64a552fa399b072a0cbd3e orig-Change-Id: I335ecce2fa22ad11d6fa24f57c7cbbae3423bf1e Signed-off-by: Kevin Rocard <kevinx.rocard@intel.com> Reviewed-on: http://android.intel.com:8080/59560 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>
* PFW: overflow not detected for int parametersFrederic Boisnard2014-02-121-39/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BZ: 26285 The following errors were not detected by the PFW when setting parameters of type (U)INT8, (U)INT16, (U)INT32: - When setting a value out of the int32 range (ex: 999999999999999), the strtol/strtoul functions return the value -1 which was then assumed correct by the PFW. Now the errno value is checked to ensure that no range error was encountered by strtol/strtoul. - When the input string does not contain any digits, the strtol/strtoul functions return 0 which was assumed correct by the PFW. Now the endptr argument is checked to make sure that at least a part of the string was parsed. In any case an error message is displayed and the original value is not updated. Made the change compliant to 64-bit OSes. Applied the same corrections to Enum and FixedPoint types. Change-Id: I135538def791208a6eb6143444a3fc30337137e1 Orig-Change-Id: I1519dbf798228a9be579aaf612f456d5eb1b41b5 Signed-off-by: Frederic Boisnard <fredericx.boisnard@intel.com> Reviewed-on: http://android.intel.com:8080/55443 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>
* PFW: Fix precision error on FixedPointParametersFrédéric Boisnard2014-02-121-1/+3
| | | | | | | | | | | | | | | | | | | | | | | BZ: 36789 When exporting the settings to an XML file and importing this file right after, an error occurs on some fixed point parameters. The values of these parameters are incorrectly saved into the output file. This bug is due to a precision error when converting the raw value from the blackboard. The setprecision() manipulator rounds the result instead of truncating it, sometimes leading to an overflow. The fix consists in performing a truncation after the last significant digit. Change-Id: I70c59bffabfd61f1ce95a8fb4cef33273a326eaf Signed-off-by: Frédéric Boisnard <fredericx.boisnard@intel.com> Reviewed-on: http://android.intel.com:8080/50935 Reviewed-by: Benavoli, Patrick <patrick.benavoli@intel.com> Reviewed-by: Centelles, Sylvain <sylvain.centelles@intel.com> Reviewed-by: Denneulin, Guillaume <guillaume.denneulin@intel.com> Tested-by: Mendi, EduardoX <eduardox.mendi@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
* PFW: Fixed bug on fixed point parameter typesFrederic Boisnard2014-02-121-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | BZ: 29464 When reading from the blackboard a value of type fixed point parameter (size < 32 bits), the sign extend was not taken into account: - Added a call to signExtend() before the conversion, - Updated the display as well (precision support), - Set up the notation type (fixed) to prevent the scientific notation display. Compilation on target would fail because of the use of an ambigous function : log10. Changed the notation of the number to double for the parameter of this function to force binding to: double log10(double). Change-Id: Ibb77259b84db33e00971ba662600547522cf9bb1 Signed-off-by: Frederic Boisnard <fredericx.boisnard@intel.com> Reviewed-on: http://android.intel.com:8080/41649 Reviewed-by: De Chivre, RenaudX <renaudx.de.chivre@intel.com> Reviewed-by: Centelles, Sylvain <sylvain.centelles@intel.com> Tested-by: Barthes, FabienX <fabienx.barthes@intel.com> Reviewed-by: Benavoli, PatrickX <patrickx.benavoli@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
* PFW: Type safe dynamic parameter accessPatrick Benavoli2014-02-101-12/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BZ: 15065 Replaced high level string based parameter access interface with typed ones. Now hosting platforms that want to control parameters must instantiate a CParameterHandle object out of the desired parameter path. CParameterHandle object may be used to access any kind of parameters, whatever its internal type, whether it's an array or not. Note that non rogue parameters offer a read access only. Any attempt to write them will fail. CParameterHandle objects offer the following kind of parameter accessing interfaces: - Boolean - Integer (signed or unsigned) - Double - String Note that those interfaces are available for scalar as well as for array parameters. Not all parameter types support all access kinds. Naturally, array parameters are only accessed via array interfaces while scalar parameters are managed through scalar interfaces. Here's a list of parameter types that may be controlled through each kind of access interface: - Boolean access: boolean, bit (bit size must be one); - Integer access: integer (sign must match), boolean (unsigned access only, value <= 1), enumerations; - Double access: for now only fixed points (soon integers will support them also through platform adaptation objects) - String access: all parameter types In addition, cleaned up parameter access related code so as to make it more generic and reusable. Changed version to 2.0.0 Change-Id: Ib80868cdb773e90962e48f1f38d2ff0029189815 Signed-off-by: Patrick Benavoli <patrickx.benavoli@intel.com> Reviewed-on: http://android.intel.com:8080/25406 Reviewed-by: Barthes, FabienX <fabienx.barthes@intel.com> Tested-by: Barthes, FabienX <fabienx.barthes@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
* PFW: Wrong file export in hexadecimal formatGuillaume Denneulin2014-02-101-3/+6
| | | | | | | | | | | | | | | | | | BZ: 18097 For fixed point parameters, if the output raw format is hexadecimal, the settings were exported on 32 bits instead of their actual size (8, 16 bits...). Aligns also the way to deal with format on integer type Change-Id: Ifb25f4d6769bcc7c55de5654443a4862ef5a9e0f OLD-Change-Id: I5a9d695de98a7828af185b19e9943d4abf8bb805 Signed-off-by: Guillaume Denneulin <guillaumex.denneulin@intel.com> Reviewed-on: http://android.intel.com:8080/29818 Reviewed-by: Barthes, FabienX <fabienx.barthes@intel.com> Tested-by: Barthes, FabienX <fabienx.barthes@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
* parameter-framework: import/export XMLPatrick Benavoli2014-02-101-25/+21
| | | | | | | | | | | | | | | | | | BZ: 10948 - Max value handling on integers corrected - Left-justified Qn.m numbers - Corrections after code review: removed fixed numbers from the code and unified byte to bit conversions Change-Id: Iaf54e413201eae61013735580e046c5ab1874700 Signed-off-by: Patrick Benavoli <patrickx.benavoli@intel.com> Reviewed-on: http://android.intel.com:8080/22316 Reviewed-by: Centelles, Sylvain <sylvain.centelles@intel.com> Tested-by: Barthes, FabienX <fabienx.barthes@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com> Reviewed-on: http://android.intel.com:8080/26777 Reviewed-by: Barthes, FabienX <fabienx.barthes@intel.com>
* Min/max value computation; Tuning lock handlingPatrick Benavoli2014-02-101-5/+26
| | | | | | | | | | | | | | | | | | | | | BZ: 7466 - Min/max values are now correctly computed. They concern integer and fixed point parameters - tuning mode lock issue solved: created an AutoLock class for safe lock handling - added configuration files for a demo on Ubuntu environment - had AMIXER subsystem plugin compliant for derivation - LPE library: add carriage return on logs - removed obsolete files - some cosmetics Change-Id: Ife7a4799fd48dd4a1ca25dae666c4e453815881e Orig-Change-Id: I72fc5c1ff6abf638b43266a75bc00e21ad412349 Signed-off-by: Patrick Benavoli <patrickx.benavoli@intel.com> Reviewed-on: http://android.intel.com:8080/16880 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>
* Parameter Framework: Parameter property displayPatrick Benavoli2014-02-101-0/+13
| | | | | | | | | | | | | | | | | BZ: 7137 Added showProperties remote command Changed EQU to MONO_EQ for CAPTURE paths in LPE Subsystem structure definition Had to create a generic class for Parameter and BitParameter classes Change-Id: If6ab97ff002d8ba81df5a4a60bc3eb07dbe14e5e Orig-Change-Id: I425f81cd414b1c721f5c11169e9a489f5c638ab9 Signed-off-by: Patrick Benavoli <patrickx.benavoli@intel.com> Reviewed-on: http://android.intel.com:8080/16879 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>
* parameter-framework: improvements and correctionsPatrick Benavoli2014-02-101-30/+83
| | | | | | | | | | | | | | | | | | 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>
* parameter-framework: initial commitPatrick Benavoli2011-09-081-0/+173
BZ: 6081 Parameter-framework is still-under-development, Intel proprietary, multi-platform (standard C++, for now only linux, no dependency on Android) software that allows system-wide parameter management. It relies on a number of configurations files, from which it knows how / when to hand out settings towards the hardware (subsystems) at runtime. 3 kinds of configuration files are used: - Structure description files indicating the actual parameter structure, types, min/max values, data representation. - Configurable domain description file containing the actual distribution of parameters over different domains, that is, different set of configurations, each of which being dynamically activated based on selection criteria rules that are themselves configurable. Configurable domains file contain the tuned settings along the tuning process, that is during the period where the system is being tuned. - Binary settings file used to store the settings when the tuning process is complete. Changing any of those files causes no recompilation of the framework. This project is based on a open plugin architecture allowing any kind of subsystems to be handled, whatever their respective Endianness. It fully relies on the platform SW to provide it with with the kowledge of exisitng selection criteria (selected device, current mode), as well as change events that occuring on them, thus triggering the application of corresponding configuration settings wherever appropriate. It supports handling mutliple parameter classes (Audio, Energy management) through TCP/IP interface. For now tuning commands can be sent to parameter-framework instances through a command-line utility, via adb over USB or via ethernet/WIFI. Change-Id: If7709c464db118f367f953e0824f49cce9fd0402 Orig-Change-Id: I7842e8808a4cfc0c615e0365e6d02101971ae2dc Signed-off-by: Patrick Benavoli <patrickx.benavoli@intel.com> Reviewed-on: http://android.intel.com:8080/16877 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>