aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2016-01-08 15:41:58 +0800
committerAndy Green <andy.green@linaro.org>2016-01-08 19:13:06 +0800
commitdfce92c9a1d1fc9b7539c5ed9d2224c756ffeed3 (patch)
tree8119d36f1808c5879e514099d727c5ad86d9a424
parent47fc4790a229f9ba0c3078106e7c3be212e2de7e (diff)
downloadarm-probe-dfce92c9a1d1fc9b7539c5ed9d2224c756ffeed3.tar.gz
configure: change channel percentage_error_ref to channel number
The percentage_error_ref is used to guess channel percentage error drifting. This value is realted to different channel number and fixed. Let stupid user to guess this value isn't helpful, since normal user just know which channel their using. So remove this value and change it to easy understanding 'channel number'. Note, This change requires the configure file change accordingly. A example here: - VDD_VCORE1 0.020000 -14.5000 + VDD_VCORE1 0.020000 1 Signed-off-by: Alex Shi <alex.shi@linaro.org>
-rwxr-xr-xlibarmep/configuration.c6
-rw-r--r--libarmep/libarmep.h2
-rw-r--r--libarmep/service.c32
3 files changed, 20 insertions, 20 deletions
diff --git a/libarmep/configuration.c b/libarmep/configuration.c
index 2db43a4..7822f4f 100755
--- a/libarmep/configuration.c
+++ b/libarmep/configuration.c
@@ -56,7 +56,7 @@ static void process_token(struct aep_channel *ch, char *marshall, enum fields fi
fprintf(stderr, "**** channel cannot have 0R shunt\n");
break;
case AEPC_FIELD_INTERCHANNEL_ERROR_ESTIMATE:
- ch->percentage_error_ref = atof(marshall);
+ ch->channel_num = atoi(marshall);
break;
case AEPC_FIELD_ZERO_OFFSET_V1:
ch->voffset[0] = atof(marshall);
@@ -283,10 +283,10 @@ int configure(struct aep_context *aep_context, struct aep *aep, const char *dev_
index++;
if (ch == wch) {
sprintf(linebuf,
- " %s\t%f\t%f\t%f\t%f\t%f\t%f\t%d\t%s\t%s\t%s\t%s\n",
+ " %s\t%f\t%d\t%f\t%f\t%f\t%f\t%d\t%s\t%s\t%s\t%s\n",
ch->channel_name,
ch->rshunt,
- ch->percentage_error_ref,
+ ch->channel_num,
ch->voffset[0],
ch->vnoise[0],
ch->voffset[1],
diff --git a/libarmep/libarmep.h b/libarmep/libarmep.h
index c3d8084..f02c292 100644
--- a/libarmep/libarmep.h
+++ b/libarmep/libarmep.h
@@ -160,8 +160,8 @@ struct aep_channel {
char class[16]; /* optional class of power, eg, Soc */
int pretrigger_ms;
int pretrigger_samples_taken;
+ int channel_num;
double rshunt;
- double percentage_error_ref;
double voffset[2];
double vnoise[2];
diff --git a/libarmep/service.c b/libarmep/service.c
index 7d569c0..96fdbba 100644
--- a/libarmep/service.c
+++ b/libarmep/service.c
@@ -107,26 +107,26 @@ static void init_aep(struct aep_context *aep_context, struct aep *aep, const cha
static void select_map(struct aep_channel *ch)
{
- int m;
int sel = -1;
- double delta = 999999;
- for (m = 0; m < (sizeof interp_tables / sizeof interp_tables[0]); m++) {
- if (ch->percentage_error_ref <= interp_tables[m].percentage_error_ref) {
- if (delta > (interp_tables[m].percentage_error_ref - ch->percentage_error_ref)) {
- delta = interp_tables[m].percentage_error_ref - ch->percentage_error_ref;
- sel = m;
- }
- } else {
- if (delta > (ch->percentage_error_ref - interp_tables[m].percentage_error_ref)) {
- delta = ch->percentage_error_ref - interp_tables[m].percentage_error_ref;
- sel = m;
- }
- }
+ switch(ch->channel_num) {
+ case 1:
+ sel = 0;
+ break;
+ case 2:
+ sel = 1;
+ break;
+ case 3:
+ sel = 2;
+ break;
+ default:
+ fprintf(stderr, "AEP channel number %d is wrong. It's only 3 channel, 1, 2 or 3\n",
+ ch->channel_num);
}
+
if (ch->aep->aep_context->verbose)
- fprintf(stderr, "%s = corr map %d %f%%\n",
- ch->channel_name, sel, ch->percentage_error_ref);
+ fprintf(stderr, "%s = corr map %d %d\n",
+ ch->channel_name, sel, ch->channel_num);
ch->map_table = &interp_tables[sel];
}