diff options
author | nicolas.zilio@hotmail.fr <> | 2015-09-15 14:56:35 +0200 |
---|---|---|
committer | nicolas.zilio@hotmail.fr <> | 2015-09-15 14:56:35 +0200 |
commit | c871ef59e748678b11d964e21debab05082948a0 (patch) | |
tree | 8afdbc92982bcfc412806ef09933f2a0630ecca0 /pcilib/views.c | |
parent | 1234f4a7e2410b127120aaa20dfe3c996ad34ef4 (diff) | |
download | pcitool-c871ef59e748678b11d964e21debab05082948a0.tar.gz pcitool-c871ef59e748678b11d964e21debab05082948a0.tar.bz2 pcitool-c871ef59e748678b11d964e21debab05082948a0.tar.xz pcitool-c871ef59e748678b11d964e21debab05082948a0.zip |
soka
Diffstat (limited to 'pcilib/views.c')
-rw-r--r-- | pcilib/views.c | 29 |
1 files changed, 21 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; } |