diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2015-10-08 20:04:37 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2015-10-08 20:04:37 +0200 |
commit | 21812f8d763fac8ee9bb3fdc593642b06f405a2b (patch) | |
tree | a55e99115e8c238e6b34159e063ac7d01ba65d54 /pcilib/view.h | |
parent | e28e74adf3d58deb95ce84c66423f347cbe2f859 (diff) | |
download | pcitool-21812f8d763fac8ee9bb3fdc593642b06f405a2b.tar.gz pcitool-21812f8d763fac8ee9bb3fdc593642b06f405a2b.tar.bz2 pcitool-21812f8d763fac8ee9bb3fdc593642b06f405a2b.tar.xz pcitool-21812f8d763fac8ee9bb3fdc593642b06f405a2b.zip |
Base functions for views
Diffstat (limited to 'pcilib/view.h')
-rw-r--r-- | pcilib/view.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/pcilib/view.h b/pcilib/view.h index 7a78a1d..bf0ea28 100644 --- a/pcilib/view.h +++ b/pcilib/view.h @@ -9,18 +9,23 @@ //typedef void *pcilib_view_context_t; typedef struct pcilib_view_context_s *pcilib_view_context_t; +typedef enum { + PCILIB_VIEW_FLAG_PROPERTY = 1 /**< Indicates that view does not depend on a value and is independent property */ +} pcilib_view_flags_t; + typedef struct { pcilib_version_t version; size_t description_size; pcilib_view_context_t (*init)(pcilib_t *ctx); void (*free)(pcilib_t *ctx, pcilib_view_context_t *view); - int (*read_from_reg)(pcilib_t *ctx, pcilib_view_context_t *view, const pcilib_register_value_t *regval, pcilib_data_type_t viewval_type, size_t viewval_size, void *viewval); - int (*write_to_reg)(pcilib_t *ctx, pcilib_view_context_t *view, pcilib_register_value_t *regval, pcilib_data_type_t viewval_type, size_t viewval_size, const void *viewval); + int (*read_from_reg)(pcilib_t *ctx, pcilib_view_context_t *view, const pcilib_register_value_t *regval, pcilib_value_t *val); + int (*write_to_reg)(pcilib_t *ctx, pcilib_view_context_t *view, pcilib_register_value_t *regval, const pcilib_value_t *val); } pcilib_view_api_description_t; typedef struct { const pcilib_view_api_description_t *api; - pcilib_data_type_t type; /**< The default data type returned by operation, PCILIB_VIEW_TYPE_STRING is supported by all operations */ + pcilib_value_type_t type; /**< The default data type returned by operation, PCILIB_VIEW_TYPE_STRING is supported by all operations */ + pcilib_view_flags_t flags; /**< Flags specifying type of the view */ const char *unit; /**< Returned unit (if any) */ const char *name; /**< Name of the view */ const char *description; /**< Short description */ @@ -31,7 +36,10 @@ extern "C" { #endif int pcilib_add_views(pcilib_t *ctx, size_t n, const pcilib_view_description_t *desc); + pcilib_view_t pcilib_find_view_by_name(pcilib_t *ctx, const char *view); +pcilib_view_t pcilib_find_register_view_by_name(pcilib_t *ctx, pcilib_register_t reg, const char *name); +pcilib_view_t pcilib_find_register_view(pcilib_t *ctx, pcilib_register_t reg, const char *name); #ifdef __cplusplus } |