diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2015-09-24 04:28:45 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2015-09-24 04:28:45 +0200 |
commit | 08a01723af9cd52c078d5ca6c38c34d375b39fa0 (patch) | |
tree | 6eadea9c67f4bb56a9e4ee09f4982efaf61deece /pcilib/view.h | |
parent | 924adedb2928f5657c6668f606dbb3294b3c45da (diff) | |
parent | ae7f83a7948d8c3760f8019899a45e6ec90c2c6a (diff) | |
download | pcitool-08a01723af9cd52c078d5ca6c38c34d375b39fa0.tar.gz pcitool-08a01723af9cd52c078d5ca6c38c34d375b39fa0.tar.bz2 pcitool-08a01723af9cd52c078d5ca6c38c34d375b39fa0.tar.xz pcitool-08a01723af9cd52c078d5ca6c38c34d375b39fa0.zip |
Finalyze XML support and provide initial support for views (only descriptions so far)
Diffstat (limited to 'pcilib/view.h')
-rw-r--r-- | pcilib/view.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/pcilib/view.h b/pcilib/view.h new file mode 100644 index 0000000..7a78a1d --- /dev/null +++ b/pcilib/view.h @@ -0,0 +1,40 @@ +#ifndef _PCILIB_VIEW_H +#define _PCILIB_VIEW_H + +#include <pcilib.h> +#include <pcilib/unit.h> + +#define PCILIB_VIEW_INVALID ((pcilib_view_t)-1) + +//typedef void *pcilib_view_context_t; +typedef struct pcilib_view_context_s *pcilib_view_context_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); +} 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 */ + const char *unit; /**< Returned unit (if any) */ + const char *name; /**< Name of the view */ + const char *description; /**< Short description */ +} pcilib_view_description_t; + +#ifdef __cplusplus +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); + +#ifdef __cplusplus +} +#endif + +#endif /* PCILIB_VIEW_H */ |