/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to pcilib/view.h

  • Committer: Suren A. Chilingaryan
  • Date: 2015-09-24 02:28:45 UTC
  • mfrom: (305.1.19 views)
  • Revision ID: csa@suren.me-20150924022845-p7hc8lh8v0q48g0r
Finalyze XML support and provide initial support for views (only descriptions so far)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _PCILIB_VIEW_H
 
2
#define _PCILIB_VIEW_H
 
3
 
 
4
#include <pcilib.h>
 
5
#include <pcilib/unit.h>
 
6
 
 
7
#define PCILIB_VIEW_INVALID ((pcilib_view_t)-1)
 
8
 
 
9
//typedef void *pcilib_view_context_t;
 
10
typedef struct pcilib_view_context_s *pcilib_view_context_t;
 
11
 
 
12
typedef struct {
 
13
    pcilib_version_t version;
 
14
    size_t description_size;
 
15
    pcilib_view_context_t (*init)(pcilib_t *ctx);
 
16
    void (*free)(pcilib_t *ctx, pcilib_view_context_t *view);
 
17
    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);
 
18
    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);
 
19
} pcilib_view_api_description_t;
 
20
 
 
21
typedef struct {
 
22
    const pcilib_view_api_description_t *api;
 
23
    pcilib_data_type_t type;                                                    /**< The default data type returned by operation, PCILIB_VIEW_TYPE_STRING is supported by all operations */
 
24
    const char *unit;                                                           /**< Returned unit (if any) */
 
25
    const char *name;                                                           /**< Name of the view */
 
26
    const char *description;                                                    /**< Short description */
 
27
} pcilib_view_description_t;
 
28
 
 
29
#ifdef __cplusplus
 
30
extern "C" {
 
31
#endif
 
32
 
 
33
int pcilib_add_views(pcilib_t *ctx, size_t n, const pcilib_view_description_t *desc);
 
34
pcilib_view_t pcilib_find_view_by_name(pcilib_t *ctx, const char *view);
 
35
 
 
36
#ifdef __cplusplus
 
37
}
 
38
#endif
 
39
 
 
40
#endif /* PCILIB_VIEW_H */