summaryrefslogtreecommitdiffstats
path: root/pcitool
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-10-09 04:42:53 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-10-09 04:42:53 +0200
commitf13867f64fcba24ef2cb9d726b5ee1082ac1a8b9 (patch)
treed7186eb2a2c2d2e36c05cc702eb0ab0b3c877443 /pcitool
parent3b8e32c9bbe0d909c34303da0ad36ef0ef5be852 (diff)
downloadpcitool-f13867f64fcba24ef2cb9d726b5ee1082ac1a8b9.tar.gz
pcitool-f13867f64fcba24ef2cb9d726b5ee1082ac1a8b9.tar.bz2
pcitool-f13867f64fcba24ef2cb9d726b5ee1082ac1a8b9.tar.xz
pcitool-f13867f64fcba24ef2cb9d726b5ee1082ac1a8b9.zip
Implement enum view
Diffstat (limited to 'pcitool')
-rw-r--r--pcitool/cli.c18
1 files changed, 15 insertions, 3 deletions
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, &regval);
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);