From f13867f64fcba24ef2cb9d726b5ee1082ac1a8b9 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Fri, 9 Oct 2015 04:42:53 +0200 Subject: Implement enum view --- pcitool/cli.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'pcitool') diff --git a/pcitool/cli.c b/pcitool/cli.c index d140b98..71a8ea2 100644 --- a/pcitool/cli.c +++ b/pcitool/cli.c @@ -574,20 +574,21 @@ void List(pcilib_t *handle, const pcilib_model_description_t *model_info, const void RegisterInfo(pcilib_t *handle, pcilib_register_t reg) { int err; - pcilib_register_value_t val; + pcilib_value_t val = {0}; + pcilib_register_value_t regval; const pcilib_model_description_t *model_info = pcilib_get_model_description(handle); const pcilib_register_description_t *r = &model_info->registers[reg]; pcilib_register_bank_t bank = pcilib_find_register_bank_by_addr(handle, r->bank); const pcilib_register_bank_description_t *b = &model_info->banks[bank]; - err = pcilib_read_register_by_id(handle, reg, &val); + err = pcilib_read_register_by_id(handle, reg, ®val); printf("%s/%s\n", b->name, r->name); printf(" Current value: "); if (err) printf("error %i", err); - else printf(b->format, val); + else printf(b->format, regval); if (r->mode&PCILIB_REGISTER_W) { printf(" (default: "); @@ -631,6 +632,17 @@ void RegisterInfo(pcilib_t *handle, pcilib_register_t reg) { } printf(")\n"); + err = pcilib_read_register_view(handle, b->name, r->name, r->views[i].name, &val); + if (!err) err = pcilib_convert_value_type(handle, &val, PCILIB_TYPE_STRING); + + if (err) + printf(" Current value : error %i\n", err); + else { + printf(" Current value : %s", val.sval); + if (v->unit) printf(" (units: %s)", v->unit); + printf("\n"); + } + if (v->unit) { pcilib_unit_t unit = pcilib_find_unit_by_name(handle, v->unit); -- cgit v1.2.3