diff options
Diffstat (limited to 'pcilib')
-rw-r--r-- | pcilib/views.c | 29 | ||||
-rw-r--r-- | pcilib/xml.c | 1 |
2 files changed, 22 insertions, 8 deletions
diff --git a/pcilib/views.c b/pcilib/views.c index 9fe8810..12c09e5 100644 --- a/pcilib/views.c +++ b/pcilib/views.c @@ -138,25 +138,38 @@ int pcilib_read_view(pcilib_t *ctx, const char *bank, const char *regname, const return PCILIB_ERROR_INVALID_REQUEST; } - for(j=0;ctx->register_ctx[i].views[j].name;j++){ + + for(j=0;ctx->num_views;j++){ + if(!(ctx->register_ctx[i].views[j].name)) break; + if(ctx->register_ctx[i].views[j].name) printf("name %s\n",ctx->register_ctx[i].views[j].name); + } + + for(j=0;ctx->num_views;j++){ + if(!(ctx->register_ctx[i].views[j].name)) break; + if(ctx->register_ctx[i].views[j].name){ + printf("unit %s, view %s\n",unit,ctx->register_ctx[i].views[j].name); if(!(strcasecmp(ctx->register_ctx[i].views[j].base_unit.name,unit))){/*if we asked for the unit "name"*/ + printf("in unit\n"); err=ctx->register_ctx[i].views[j].op(ctx,ctx->register_ctx[i].views[j].parameters,value/*the command name*/,0,&temp_value,0,&(ctx->register_ctx[i].views[j])); if(err){ pcilib_error("can't write to the register with the enum view"); return PCILIB_ERROR_FAILED; } + break; }else if(!(strcasecmp(ctx->register_ctx[i].views[j].name,(char*)unit))){/*in this case we asked for the name of the view in unit*/ + printf("pass here2\n"); err=ctx->register_ctx[i].views[j].op(ctx,ctx->register_ctx[i].views[j].parameters,(char*)unit, 0, &temp_value,0,&(ctx->register_ctx[i].views[j])); - if(err){ - pcilib_error("can't write to the register with the formula view %s", unit); - return PCILIB_ERROR_FAILED; - } - *(pcilib_register_value_t*)value=temp_value; - break; + if(err){ + pcilib_error("can't write to the register with the formula view %s", unit); + return PCILIB_ERROR_FAILED; + } + *(pcilib_register_value_t*)value=temp_value; + break; } - return 0; + return 0; } + } pcilib_error("the view asked and the register do not correspond"); return PCILIB_ERROR_NOTAVAILABLE; } diff --git a/pcilib/xml.c b/pcilib/xml.c index 31b9926..47bcf5c 100644 --- a/pcilib/xml.c +++ b/pcilib/xml.c @@ -864,6 +864,7 @@ int pcilib_process_xml(pcilib_t *ctx, const char *location) { for(j=0;j<ctx->num_views;j++){ if(!(ctx->register_ctx[i].views[j].name)) break; if(ctx->register_ctx[i].views[j].name){ + printf("register %s view %s\n",ctx->registers[i].name,ctx->register_ctx[i].views[j].name); pcilib_get_unit_of_view(ctx,&(ctx->register_ctx[i].views[j]),ctx->register_ctx[i].views[j].base_unit.name); } } |