diff options
author | Vasilii Chernov <vchernov@inr.ru> | 2016-02-24 18:24:22 +0100 |
---|---|---|
committer | Vasilii Chernov <vchernov@inr.ru> | 2016-02-24 18:24:22 +0100 |
commit | b0a034e6ef4a958235a56ebde0831c0f30a84d30 (patch) | |
tree | a1f46d2d536c692edd6b17efc61ac9fefef2796b /pcilib/pcilib.h | |
parent | da842568b94b0e00c1709ae01f441a7424c15b87 (diff) | |
parent | 3ea1907f3169e0233d3a32a7d470af3c34b6f967 (diff) | |
download | pcitool-b0a034e6ef4a958235a56ebde0831c0f30a84d30.tar.gz pcitool-b0a034e6ef4a958235a56ebde0831c0f30a84d30.tar.bz2 pcitool-b0a034e6ef4a958235a56ebde0831c0f30a84d30.tar.xz pcitool-b0a034e6ef4a958235a56ebde0831c0f30a84d30.zip |
Merge with Suren branch. Fix memory leaks.
Diffstat (limited to 'pcilib/pcilib.h')
-rw-r--r-- | pcilib/pcilib.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/pcilib/pcilib.h b/pcilib/pcilib.h index c32d1fb..8ab8e9e 100644 --- a/pcilib/pcilib.h +++ b/pcilib/pcilib.h @@ -43,7 +43,8 @@ typedef enum { typedef enum { PCILIB_ACCESS_R = 1, /**< getting property is allowed */ PCILIB_ACCESS_W = 2, /**< setting property is allowed */ - PCILIB_ACCESS_RW = 3 + PCILIB_ACCESS_RW = 3, + PCILIB_ACCESS_INCONSISTENT = 0x10000 /**< inconsistent access, one will not read that one has written */ } pcilib_access_mode_t; typedef enum { @@ -54,7 +55,7 @@ typedef enum { PCILIB_REGISTER_RW1C = 5, PCILIB_REGISTER_W1I = 8, /**< writting 1 inversts the bit, writting 0 keeps the value */ PCILIB_REGISTER_RW1I = 9, - PCILIB_REGISTER_INCONSISTENT = 0x1000 /**< dont check register value after set*/ + PCILIB_REGISTER_INCONSISTENT = 0x10000 /**< inconsistent register, writting and reading does not match */ } pcilib_register_mode_t; typedef enum { @@ -1257,6 +1258,16 @@ int pcilib_set_value_from_register_value(pcilib_t *ctx, pcilib_value_t *val, pci int pcilib_set_value_from_static_string(pcilib_t *ctx, pcilib_value_t *val, const char *str); /** + * Initializes the polymorphic value from the string. The string is copied. + * If `val` already contains the value, cleans it first. Therefore, before first usage the value should be always initialized to 0. + * @param[in] ctx - pcilib context + * @param[in,out] val - initialized polymorphic value + * @param[in] str - initializer + * @return - 0 on success or memory error + */ +int pcilib_set_value_from_string(pcilib_t *ctx, pcilib_value_t *value, const char *str); + +/** * Get the floating point value from the polymorphic type. May inmply impliced type conversion, * for isntance parsing the number from the string. Will return 0. and report an error if * conversion failed. |