summaryrefslogtreecommitdiffstats
path: root/pcilib/unit.h
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-10-22 15:57:59 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-10-22 15:57:59 +0200
commita0fe5cdea15bca52d3b101a88c11cb160ef08b2f (patch)
treee40e5d90ed013e33617931b049c5039e37a1f51f /pcilib/unit.h
parentee18798c64c6e40433413b73bf07bbe027a9cc6e (diff)
downloadpcitool-a0fe5cdea15bca52d3b101a88c11cb160ef08b2f.tar.gz
pcitool-a0fe5cdea15bca52d3b101a88c11cb160ef08b2f.tar.bz2
pcitool-a0fe5cdea15bca52d3b101a88c11cb160ef08b2f.tar.xz
pcitool-a0fe5cdea15bca52d3b101a88c11cb160ef08b2f.zip
Documentation update
Diffstat (limited to 'pcilib/unit.h')
-rw-r--r--pcilib/unit.h39
1 files changed, 27 insertions, 12 deletions
diff --git a/pcilib/unit.h b/pcilib/unit.h
index 2351f26..77161b7 100644
--- a/pcilib/unit.h
+++ b/pcilib/unit.h
@@ -40,41 +40,56 @@ extern "C" {
* already registered unit. The function will copy the context of unit description, but name,
* transform, and other strings in the structure are considered to have static duration
* and will not be copied. On error no new units are initalized.
- * @param[in,out] ctx - pcilib context
- * @param[in] n - number of units to initialize. It is OK to pass 0 if protocols variable is NULL terminated (last member of protocols array have all members set to 0)
- * @param[in] desc - unit descriptions
- * @return - error or 0 on success
+ * @param[in,out] ctx - pcilib context
+ * @param[in] n - number of units to initialize. It is OK to pass 0 if protocols variable is NULL terminated (last member of protocols array have all members set to 0)
+ * @param[in] desc - unit descriptions
+ * @return - error or 0 on success
*/
int pcilib_add_units(pcilib_t *ctx, size_t n, const pcilib_unit_description_t *desc);
/**
* Destroys data associated with units. This is an internal function and will
* be called during clean-up.
- * @param[in,out] ctx - pcilib context
- * @param[in] start - specifies first unit to clean (used to clean only part of the units to keep the defined state if pcilib_add_units has failed)
+ * @param[in,out] ctx - pcilib context
+ * @param[in] start - specifies first unit to clean (used to clean only part of the units to keep the defined state if pcilib_add_units has failed)
*/
void pcilib_clean_units(pcilib_t *ctx, pcilib_unit_t start);
+/**
+ * Find unit id using supplied name.
+ * @param[in] ctx - pcilib context
+ * @param[in] unit - the requested unit name
+ * @return - unit id or PCILIB_UNIT_INVALID if error not found or error has occured
+ */
pcilib_unit_t pcilib_find_unit_by_name(pcilib_t *ctx, const char *unit);
+
+/**
+ * Find the required transform between two specified units.
+ * @param[in] ctx - pcilib context
+ * @param[in] from - the source unit
+ * @param[in] to - destination unit
+ * @return - the pointer to unit transform or NULL in case of error. If no transform required (i.e. \a from = \a to),
+ the function will return #pcilib_unit_transform_t structure with \a transform field set to NULL.
+ */
pcilib_unit_transform_t *pcilib_find_transform_by_unit_names(pcilib_t *ctx, const char *from, const char *to);
/**
* Converts value to the requested units. It is error to convert values with unspecified units.
* This is internal function, use pcilib_value_convert_value_unit instead.
- * @param[in,out] ctx - pcilib context
- * @param[in] trans - the requested unit transform
+ * @param[in,out] ctx - pcilib context
+ * @param[in] trans - the requested unit transform
* @param[in,out] value - the value to be converted (changed on success)
- * @return - error or 0 on success
+ * @return - error or 0 on success
*/
int pcilib_transform_unit(pcilib_t *ctx, const pcilib_unit_transform_t *trans, pcilib_value_t *value);
/**
* Converts value to the requested units. It is error to convert values with unspecified units.
* This is internal function, use pcilib_value_convert_value_unit instead.
- * @param[in,out] ctx - pcilib context
- * @param[in] name - specifies the requested unit of the value
+ * @param[in,out] ctx - pcilib context
+ * @param[in] to - specifies the requested unit of the value
* @param[in,out] value - the value to be converted (changed on success)
- * @return - error or 0 on success
+ * @return - error or 0 on success
*/
int pcilib_transform_unit_by_name(pcilib_t *ctx, const char *to, pcilib_value_t *value);