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 | |
parent | 1234f4a7e2410b127120aaa20dfe3c996ad34ef4 (diff) | |
download | pcitool-c871ef59e748678b11d964e21debab05082948a0.tar.gz pcitool-c871ef59e748678b11d964e21debab05082948a0.tar.bz2 pcitool-c871ef59e748678b11d964e21debab05082948a0.tar.xz pcitool-c871ef59e748678b11d964e21debab05082948a0.zip |
soka
-rw-r--r-- | pcilib/views.c | 29 | ||||
-rw-r--r-- | pcilib/xml.c | 1 | ||||
-rw-r--r-- | pcitool/cli.c | 5 |
3 files changed, 26 insertions, 9 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); } } diff --git a/pcitool/cli.c b/pcitool/cli.c index 378b8ba..69151b6 100644 --- a/pcitool/cli.c +++ b/pcitool/cli.c @@ -1033,6 +1033,7 @@ int ReadRegister(pcilib_t *handle, const pcilib_model_description_t *model_info, pcilib_register_value_t value; if (reg && !(strchr(fullreg,'/'))) { + printf("pass1\n"); pcilib_register_t regid = pcilib_find_register(handle, bank, reg); bank_id = pcilib_find_register_bank_by_addr(handle, model_info->registers[regid].bank); format = model_info->banks[bank_id].format; @@ -1047,6 +1048,7 @@ int ReadRegister(pcilib_t *handle, const pcilib_model_description_t *model_info, printf("\n"); } }else if(reg && (s1=strchr(fullreg,'/'))){ + printf("pass2\n"); char* enum_command=malloc(sizeof(char*)); if(!enum_command){ printf("Error allocating memory for the result\n"); @@ -1054,7 +1056,8 @@ int ReadRegister(pcilib_t *handle, const pcilib_model_description_t *model_info, } *s1=0; regname=fullreg; - viewname=fullreg+1; + viewname=s1+1; + printf("regname %s, viewname %s\n",regname,viewname); if(!strcasecmp(viewname,"name")){ err = pcilib_read_view(handle,bank,regname,viewname,sizeof(char*),enum_command); if (err) printf("Error reading register %s with an enum view\n", reg); |