/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/pcilib.h

  • Committer: Suren A. Chilingaryan
  • Date: 2015-10-19 04:59:53 UTC
  • Revision ID: csa@suren.me-20151019045953-h4ur2flqzf3ky412
Provide register listings in public API

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
} pcilib_log_priority_t;
36
36
 
37
37
typedef enum {
38
 
    PCILIB_HOST_ENDIAN = 0,
39
 
    PCILIB_LITTLE_ENDIAN,
40
 
    PCILIB_BIG_ENDIAN
 
38
    PCILIB_HOST_ENDIAN = 0,                     /**< The same byte ordering as on the host system running the driver */
 
39
    PCILIB_LITTLE_ENDIAN,                       /**< x86 is Little-endian, least significant bytes are at the lower addresses */
 
40
    PCILIB_BIG_ENDIAN                           /**< Old mainframes and network byte order, most significant bytes are at the lower addresses */
41
41
} pcilib_endianess_t;
42
42
 
43
43
typedef enum {
47
47
} pcilib_access_mode_t;
48
48
 
49
49
typedef enum {
 
50
    PCILIB_REGISTER_R = 1,                      /**< reading from register is allowed */
 
51
    PCILIB_REGISTER_W = 2,                      /**< normal writting to register is allowed */
 
52
    PCILIB_REGISTER_RW = 3,
 
53
    PCILIB_REGISTER_W1C = 4,                    /**< writting 1 resets the bit, writting 0 keeps the value */
 
54
    PCILIB_REGISTER_RW1C = 5,
 
55
    PCILIB_REGISTER_W1I = 8,                    /**< writting 1 inversts the bit, writting 0 keeps the value */
 
56
    PCILIB_REGISTER_RW1I = 9,
 
57
} pcilib_register_mode_t;
 
58
 
 
59
typedef enum {
50
60
    PCILIB_TYPE_INVALID = 0,                    /**< uninitialized */
51
61
    PCILIB_TYPE_DEFAULT = 0,                    /**< default type */
52
62
    PCILIB_TYPE_STRING = 1,                     /**< char* */
102
112
    PCILIB_EVENT_INFO_FLAG_BROKEN = 1           /**< Indicates broken frames (if this flag is fales, the frame still can be broken) */
103
113
} pcilib_event_info_flags_t;
104
114
 
105
 
typedef struct {
106
 
    pcilib_event_t type;
107
 
    uint64_t seqnum;                            /**< we will add seqnum_overflow if required */
108
 
    uint64_t offset;                            /**< nanoseconds */
109
 
    struct timeval timestamp;                   /**< most accurate timestamp */
110
 
    pcilib_event_info_flags_t flags;            /**< flags */
111
 
} pcilib_event_info_t;
112
 
 
113
115
typedef enum {
114
116
    PCILIB_LIST_FLAGS_DEFAULT = 0,
115
117
    PCILIB_LIST_FLAG_CHILDS = 1                 /**< Request all sub-elements or indicated that sub-elements are available */
133
135
} pcilib_value_t;
134
136
 
135
137
typedef struct {
 
138
    pcilib_register_value_t min, max;           /**< Minimum and maximum allowed values */
 
139
} pcilib_register_value_range_t;
 
140
 
 
141
typedef struct {
 
142
    pcilib_register_value_t value;              /**< This value will get assigned instead of the name */
 
143
    pcilib_register_value_t min, max;           /**< the values in the specified range are aliased by name */
 
144
    const char *name;                           /**< corresponding string to value */
 
145
} pcilib_register_value_name_t;
 
146
 
 
147
typedef struct {
 
148
    pcilib_register_t id;                       /**< Direct register ID which can be used in API calls */
 
149
    const char *name;                           /**< The access name of the register */
 
150
    const char *description;                    /**< Brief description of the register */
 
151
    const char *bank;                           /**< The name of the bank register belongs to */
 
152
    pcilib_register_mode_t mode;                /**< Register access (ro/wo/rw) and how writting to register works (clearing/inverting set bits) */
 
153
    pcilib_register_value_t defvalue;           /**< Default register value */
 
154
    const pcilib_register_value_range_t *range; /**< Specifies default, minimum, and maximum values */
 
155
    const pcilib_register_value_name_t *values; /**< The list of enum names for the register value */
 
156
} pcilib_register_info_t;
 
157
 
 
158
typedef struct {
136
159
    const char *name;                           /**< Name of the property view */
137
160
    const char *path;                           /**< Full path to the property */
138
161
    const char *description;                    /**< Short description */
142
165
    const char *unit;                           /**< Returned unit (if any) */
143
166
} pcilib_property_info_t;
144
167
 
 
168
typedef struct {
 
169
    pcilib_event_t type;
 
170
    uint64_t seqnum;                            /**< we will add seqnum_overflow if required */
 
171
    uint64_t offset;                            /**< nanoseconds */
 
172
    struct timeval timestamp;                   /**< most accurate timestamp */
 
173
    pcilib_event_info_flags_t flags;            /**< flags */
 
174
} pcilib_event_info_t;
 
175
 
145
176
 
146
177
#define PCILIB_BAR_DETECT               ((pcilib_bar_t)-1)
147
178
#define PCILIB_BAR_INVALID              ((pcilib_bar_t)-1)
194
225
#endif
195
226
 
196
227
 
 
228
 
197
229
int pcilib_set_logger(pcilib_log_priority_t min_prio, pcilib_logger_t logger, void *arg);
198
230
 
199
231
pcilib_t *pcilib_open(const char *device, const char *model);
200
232
void pcilib_close(pcilib_t *ctx);
201
233
 
 
234
pcilib_property_info_t *pcilib_get_property_list(pcilib_t *ctx, const char *branch, pcilib_list_flags_t flags);
 
235
void pcilib_free_property_info(pcilib_t *ctx, pcilib_property_info_t *info);
 
236
pcilib_register_info_t *pcilib_get_register_list(pcilib_t *ctx, const char *bank, pcilib_list_flags_t flags);
 
237
pcilib_register_info_t *pcilib_get_register_info(pcilib_t *ctx, const char *req_bank_name, const char *req_reg_name, pcilib_list_flags_t flags);
 
238
void pcilib_free_register_info(pcilib_t *ctx, pcilib_register_info_t *info);
 
239
 
 
240
 
202
241
int pcilib_start_dma(pcilib_t *ctx, pcilib_dma_engine_t dma, pcilib_dma_flags_t flags);
203
242
int pcilib_stop_dma(pcilib_t *ctx, pcilib_dma_engine_t dma, pcilib_dma_flags_t flags);
204
243
 
243
282
int pcilib_write_register_view(pcilib_t *ctx, const char *bank, const char *regname, const char *unit, const pcilib_value_t *value);
244
283
int pcilib_read_register_view_by_id(pcilib_t *ctx, pcilib_register_t reg, const char *view, pcilib_value_t *val);
245
284
int pcilib_write_register_view_by_id(pcilib_t *ctx, pcilib_register_t reg, const char *view, const pcilib_value_t *valarg);
 
285
int pcilib_get_property(pcilib_t *ctx, const char *prop, pcilib_value_t *val);
 
286
int pcilib_set_property(pcilib_t *ctx, const char *prop, const pcilib_value_t *val);
246
287
 
247
288
void pcilib_clean_value(pcilib_t *ctx, pcilib_value_t *val);
248
289
int pcilib_copy_value(pcilib_t *ctx, pcilib_value_t *dst, const pcilib_value_t *src);
256
297
int pcilib_convert_value_unit(pcilib_t *ctx, pcilib_value_t *val, const char *unit_name);
257
298
int pcilib_convert_value_type(pcilib_t *ctx, pcilib_value_t *val, pcilib_value_type_t type);
258
299
 
259
 
pcilib_property_info_t *pcilib_get_property_list(pcilib_t *ctx, const char *branch, pcilib_list_flags_t flags);
260
 
void pcilib_free_property_info(pcilib_t *ctx, pcilib_property_info_t *info);
261
 
int pcilib_get_property(pcilib_t *ctx, const char *prop, pcilib_value_t *val);
262
 
int pcilib_set_property(pcilib_t *ctx, const char *prop, const pcilib_value_t *val);
263
 
 
264
300
int pcilib_get_property_attr(pcilib_t *ctx, const char *prop, const char *attr, pcilib_value_t *val);
265
301
int pcilib_get_register_attr_by_id(pcilib_t *ctx, pcilib_register_t reg, const char *attr, pcilib_value_t *val);
266
302
int pcilib_get_register_attr(pcilib_t *ctx, const char *bank, const char *regname, const char *attr, pcilib_value_t *val);