diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2015-10-18 07:36:47 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2015-10-18 07:36:47 +0200 |
commit | fa54d4c2ca8ffcece7a9c6e9c784e2150cbed78b (patch) | |
tree | 80f82fdbeaf8d2f94c5a1a48ea28a5e452b561f5 /pcilib/bank.c | |
parent | 6a4a556b15bda7e0c737f247c8282c1b3a9d1e0d (diff) | |
download | pcitool-fa54d4c2ca8ffcece7a9c6e9c784e2150cbed78b.tar.gz pcitool-fa54d4c2ca8ffcece7a9c6e9c784e2150cbed78b.tar.bz2 pcitool-fa54d4c2ca8ffcece7a9c6e9c784e2150cbed78b.tar.xz pcitool-fa54d4c2ca8ffcece7a9c6e9c784e2150cbed78b.zip |
Support reading/writting register views by id
Diffstat (limited to 'pcilib/bank.c')
-rw-r--r-- | pcilib/bank.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/pcilib/bank.c b/pcilib/bank.c index ec38c82..efaa810 100644 --- a/pcilib/bank.c +++ b/pcilib/bank.c @@ -242,7 +242,6 @@ pcilib_register_t pcilib_find_register(pcilib_t *ctx, const char *bank, const ch return PCILIB_REGISTER_INVALID; }; - pcilib_register_protocol_t pcilib_find_register_protocol_by_addr(pcilib_t *ctx, pcilib_register_protocol_addr_t protocol) { pcilib_register_protocol_t i; @@ -272,3 +271,21 @@ pcilib_register_protocol_t pcilib_find_register_protocol(pcilib_t *ctx, const ch return pcilib_find_register_protocol_by_name(ctx, protocol); } + +int pcilib_get_register_bank_attr_by_id(pcilib_t *ctx, pcilib_register_bank_t bank, const char *attr, pcilib_value_t *val) { + assert(bank < ctx->num_banks); + + return pcilib_get_xml_attr(ctx, ctx->bank_ctx[bank]->xml, attr, val); +} + +int pcilib_get_register_bank_attr(pcilib_t *ctx, const char *bankname, const char *attr, pcilib_value_t *val) { + pcilib_register_bank_t bank; + + bank = pcilib_find_register_bank_by_name(ctx, bankname); + if (bank == PCILIB_REGISTER_BANK_INVALID) { + pcilib_error("Bank (%s) is not found", bankname); + return PCILIB_ERROR_NOTFOUND; + } + + return pcilib_get_register_bank_attr_by_id(ctx, bank, attr, val); +} |