172
172
int pcilib_add_register_ranges(pcilib_t *ctx, pcilib_model_modification_flags_t flags, size_t n, const pcilib_register_range_t *ranges);
175
* Find the register bank id (offset in \a banks array) corresponding to the specified bank address
176
* @param[in,out] ctx - pcilib context
177
* @param[in] bank - the address of register bank
178
* @return - bank id or PCILIB_REGISTER_BANK_INVALID if bank is not found
174
180
pcilib_register_bank_t pcilib_find_register_bank_by_addr(pcilib_t *ctx, pcilib_register_bank_addr_t bank);
183
* Find the register bank id (offset in \a banks array) corresponding to the specified bank name
184
* @param[in,out] ctx - pcilib context
185
* @param[in] bankname - the name of register bank
186
* @return - bank id or PCILIB_REGISTER_BANK_INVALID if bank is not found
175
188
pcilib_register_bank_t pcilib_find_register_bank_by_name(pcilib_t *ctx, const char *bankname);
191
* Find the register bank id (offset in \a banks array) corresponding to the specified bank name or address
192
* @param[in,out] ctx - pcilib context
193
* @param[in] bank - either the name or the address of the required register bank
194
* @return - bank id or PCILIB_REGISTER_BANK_INVALID if bank is not found
176
196
pcilib_register_bank_t pcilib_find_register_bank(pcilib_t *ctx, const char *bank);
199
* Find the register protocol id (offset in \a protocols array) corresponding to the specified protocol address
200
* @param[in,out] ctx - pcilib context
201
* @param[in] protocol - the address of register protocol
202
* @return - protocol id or PCILIB_REGISTER_PROTOCOL_INVALID if register protocol is not found
178
204
pcilib_register_protocol_t pcilib_find_register_protocol_by_addr(pcilib_t *ctx, pcilib_register_protocol_addr_t protocol);
207
* Find the register protocol id (offset in \a protocols array) corresponding to the specified protocol name
208
* @param[in,out] ctx - pcilib context
209
* @param[in] name - the name of register protocol
210
* @return - protocol id or PCILIB_REGISTER_PROTOCOL_INVALID if register protocol is not found
179
212
pcilib_register_protocol_t pcilib_find_register_protocol_by_name(pcilib_t *ctx, const char *name);
215
* Find the register protocol id (offset in \a protocols array) corresponding to the specified protocol name or address
216
* @param[in,out] ctx - pcilib context
217
* @param[in] name - either the name or the address of the required register protocol
218
* @return - protocol id or PCILIB_REGISTER_PROTOCOL_INVALID if register protocol is not found
180
220
pcilib_register_protocol_t pcilib_find_register_protocol(pcilib_t *ctx, const char *name);
223
* Resolves the address of the specified register bank. The address of the register0 in the bank is returned.
225
* All address types (virtual address in process address space, physical address, or bus address) can be resolved.
226
* The caller has also to specify the requested access mode (read, write, read/write) and the error will be returned
227
* if the requested access type is not possible.
229
* @param[in,out] ctx - pcilib context
230
* @param[in] flags - specifies the type of required address (virtual, physical, or bus) and the required access (ro/wo/rw)
231
* @param[in] bank - the id of register bank
232
* @return - the resolved address or PCILIB_ADDRESS_INVALID on error
182
234
uintptr_t pcilib_resolve_bank_address_by_id(pcilib_t *ctx, pcilib_address_resolution_flags_t flags, pcilib_register_bank_t bank);
237
* Resolves the address of the specified register bank. The address of the register0 in the bank is returned.
239
* All address types (virtual address in process address space, physical address, or bus address) can be resolved.
240
* The caller has also to specify the requested access mode (read, write, read/write) and the error will be returned
241
* if the requested access type is not possible.
243
* @param[in,out] ctx - pcilib context
244
* @param[in] flags - specifies the type of required address (virtual, physical, or bus) and the required access (ro/wo/rw)
245
* @param[in] bank - the name of register bank
246
* @return - the resolved address or PCILIB_ADDRESS_INVALID on error
183
248
uintptr_t pcilib_resolve_bank_address(pcilib_t *ctx, pcilib_address_resolution_flags_t flags, const char *bank);
251
* Resolves the address of the specified register.
253
* All address types (virtual address in process address space, physical address, or bus address) can be resolved.
254
* The caller has also to specify the requested access mode (read, write, read/write) and the error will be returned
255
* if the requested access type is not possible.
257
* @param[in,out] ctx - pcilib context
258
* @param[in] flags - specifies the type of required address (virtual, physical, or bus) and the required access (ro/wo/rw)
259
* @param[in] reg - the id of register
260
* @return - the resolved address or PCILIB_ADDRESS_INVALID on error
185
262
uintptr_t pcilib_resolve_register_address_by_id(pcilib_t *ctx, pcilib_address_resolution_flags_t flags, pcilib_register_t reg);
265
* Resolves the address of the specified register.
267
* All address types (virtual address in process address space, physical address, or bus address) can be resolved.
268
* The caller has also to specify the requested access mode (read, write, read/write) and the error will be returned
269
* if the requested access type is not possible.
271
* @param[in,out] ctx - pcilib context
272
* @param[in] flags - specifies the type of required address (virtual, physical, or bus) and the required access (ro/wo/rw)
273
* @param[in] bank - should specify the bank name if register with the same name may occur in multiple banks, NULL otherwise
274
* @param[in] regname - the name of the register
275
* @return - the resolved address or PCILIB_ADDRESS_INVALID on error
186
277
uintptr_t pcilib_resolve_register_address(pcilib_t *ctx, pcilib_address_resolution_flags_t flags, const char *bank, const char *regname);
280
* Extracts additional information about the specified register bank. The additional information
281
* is model-specific and are provided as extra XML attributes in XML-described register bank.
282
* The available attributes are only restricted by used XSD schema.
283
* @param[in,out] ctx - pcilib context
284
* @param[in] bank - register bank id
285
* @param[in] attr - requested attribute name
286
* @param[in,out] val - the value of attribute is returned here (see \ref public_api_value),
287
* pcilib_clean_value() will be executed if \a val contains data. Therefore it should be always initialized to 0 before first use
288
* @return - error code or 0 on success
188
290
int pcilib_get_register_bank_attr_by_id(pcilib_t *ctx, pcilib_register_bank_t bank, const char *attr, pcilib_value_t *val);
293
* Extracts additional information about the specified register bank. The additional information
294
* is model-specific and are provided as extra XML attributes in XML-described register bank.
295
* The available attributes are only restricted by used XSD schema.
296
* @param[in,out] ctx - pcilib context
297
* @param[in] bankname - the name of register bank
298
* @param[in] attr - requested attribute name
299
* @param[in,out] val - the value of attribute is returned here (see \ref public_api_value),
300
* pcilib_clean_value() will be executed if \a val contains data. Therefore it should be always initialized to 0 before first use
301
* @return - error code or 0 on success
189
303
int pcilib_get_register_bank_attr(pcilib_t *ctx, const char *bankname, const char *attr, pcilib_value_t *val);
191
305
#ifdef __cplusplus