aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Green <andy.green@linaro.org>2012-10-14 12:42:48 +0800
committerAndy Green <andy.green@linaro.org>2012-10-14 12:42:48 +0800
commit93a3d0724c9bc593d6759d80fdbc430151afab36 (patch)
tree2891b9a258a621914d148d3976cb8a49ff76488c
parent7e79599d0e1ec600c9f670cf1d94f11bdafb1c46 (diff)
config add channel class field
Signed-off-by: Andy Green <andy.green@linaro.org>
-rw-r--r--arm-probe/arm-probe.c5
-rw-r--r--config18
-rw-r--r--libarmep/configuration.c32
-rw-r--r--libarmep/libarmep.h2
-rw-r--r--libarmep/service.c25
5 files changed, 44 insertions, 38 deletions
diff --git a/arm-probe/arm-probe.c b/arm-probe/arm-probe.c
index 3a8c629..23816a3 100644
--- a/arm-probe/arm-probe.c
+++ b/arm-probe/arm-probe.c
@@ -329,11 +329,12 @@ int main(int argc, char *argv[])
if (first) {
first = 0;
for (n = 0; n < aep_context.aep_shared->chans; n++)
- printf("# %s\t%s\t%s\t%s\n",
+ printf("# %s\t%s\t%s\t%s\t%s\n",
aep_context.aep_shared->channel_name[n],
aep_context.aep_shared->channel_name_pretty[n],
aep_context.aep_shared->supply[n],
- aep_context.aep_shared->colour[n]);
+ aep_context.aep_shared->colour[n],
+ aep_context.aep_shared->class[n]);
printf("#\n#\ntime ");
for (n = 0; n < aep_context.aep_shared->chans; n++)
diff --git a/config b/config
index 8a8b008..41f4e92 100644
--- a/config
+++ b/config
@@ -5,19 +5,19 @@ PandaBoardES-B1-ANDY
# <device path>
/dev/ttyACM0
- VDD_VCORE1 0.220000 -14.500000 -0.019856 0.011774 -0.000311 0.000943 0 SoCVCORE1/MPU DC_IN #8B4567
- VDD_VCORE2 0.470000 -45.000000 -0.015710 0.007876 -0.002165 0.000874 0 SoCVCORE2/IVA\\_AUDIO DC_IN #7B23C6
- VDD_VCORE3 0.470000 -27.500000 -0.016074 0.002175 -0.000272 0.000625 0 SoCVCORE3/CORE DC_IN #3C9869
+ VDD_VCORE1 0.220000 -14.500000 -0.019856 0.011774 -0.000311 0.000943 0 SoCVCORE1/MPU DC_IN #8B4567 SoC
+ VDD_VCORE2 0.470000 -45.000000 -0.015710 0.007876 -0.002165 0.000874 0 SoCVCORE2/IVA\\_AUDIO DC_IN #7B23C6 SoC
+ VDD_VCORE3 0.470000 -27.500000 -0.016074 0.002175 -0.000272 0.000625 0 SoCVCORE3/CORE DC_IN #3C9869 SoC
/dev/ttyACM1
- VDD_1V8 0.470000 -8.000000 -0.004642 0.006818 -0.000242 0.000600 0 SoCVIO\\_1V8 DC_IN #334873
- VDD_V2V1 0.470000 -38.000000 -0.016012 0.005433 -0.000305 0.000400 0 SoCVDD\\_V2V1/AUDIO DC_IN #B0DC51
- VDD_V1V29 0.470000 -38.000000 -0.016701 0.005867 -0.000262 0.000367 0 SoCV1V29/LPDDR2 DC_IN #495CFF
+ VDD_1V8 0.470000 -8.000000 -0.004642 0.006818 -0.000242 0.000600 0 SoCVIO\\_1V8 DC_IN #334873 SoC
+ VDD_V2V1 0.470000 -38.000000 -0.016012 0.005433 -0.000305 0.000400 0 SoCVDD\\_V2V1/AUDIO DC_IN #B0DC51 SoC
+ VDD_V1V29 0.470000 -38.000000 -0.016701 0.005867 -0.000262 0.000367 0 SoCV1V29/LPDDR2 DC_IN #495CFF SoC
/dev/ttyACM2
- DC_IN 0.100000 -19.500000 -0.001628 0.003839 -0.000118 0.000288 0 DC\\_IN none #E8944A
- USBHUB 0.470000 -39.000000 -0.017226 0.003700 -0.000432 0.000263 0 USBHUB DC_IN #5558EC
- VDD_3V3 0.470000 -51.000000 -0.018237 0.006000 -0.000625 0.000433 0 VDD\\_3V3 DC_IN #8E1F29
+ DC_IN 0.100000 -19.500000 -0.001628 0.003839 -0.000118 0.000288 0 DC\\_IN none #E8944A -
+ USBHUB 0.470000 -39.000000 -0.017226 0.003700 -0.000432 0.000263 0 USBHUB DC_IN #5558EC -
+ VDD_3V3 0.470000 -51.000000 -0.018237 0.006000 -0.000625 0.000433 0 VDD\\_3V3 DC_IN #8E1F29 -
#/dev/ttyACM3
# ch10 0.470000 -29.000000 -0.016016 0.004660 -0.000393 0.000545 0 ch10
diff --git a/libarmep/configuration.c b/libarmep/configuration.c
index 81a391f..3da36cf 100644
--- a/libarmep/configuration.c
+++ b/libarmep/configuration.c
@@ -40,6 +40,7 @@ enum fields {
AEPC_FIELD_PRETTY_NAME,
AEPC_FIELD_SUPPLY,
AEPC_FIELD_COLOUR,
+ AEPC_FIELD_CLASS,
/* always last */
FIELDS_PER_CHANNEL
@@ -209,7 +210,7 @@ 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\n",
+ " %s\t%f\t%f\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,
@@ -220,7 +221,8 @@ int configure(struct aep_context *aep_context, struct aep *aep, const char *dev_
ch->pretrigger_ms,
ch->channel_name_pretty,
ch->supply,
- ch->colour
+ ch->colour,
+ ch->class
);
if (aep->aep_context->verbose)
fprintf(stderr, "Updating config "
@@ -281,6 +283,10 @@ int configure(struct aep_context *aep_context, struct aep *aep, const char *dev_
strncpy(ch->colour, marshall, sizeof(ch->colour) - 1);
ch->colour[sizeof(ch->colour) - 1] = '\0';
break;
+ case AEPC_FIELD_CLASS:
+ strncpy(ch->class, marshall, sizeof(ch->class) - 1);
+ ch->class[sizeof(ch->class) - 1] = '\0';
+ break;
default:
break;
}
@@ -301,20 +307,6 @@ int configure(struct aep_context *aep_context, struct aep *aep, const char *dev_
ch->channel_name[copy_pos++] = c;
ch->channel_name[copy_pos] = '\0';
break;
- case AEPC_FIELD_RSHUNT:
- case AEPC_FIELD_INTERCHANNEL_ERROR_ESTIMATE:
- case AEPC_FIELD_ZERO_OFFSET_V1:
- case AEPC_FIELD_ZERO_NOISE_V1:
- case AEPC_FIELD_ZERO_OFFSET_V2:
- case AEPC_FIELD_ZERO_NOISE_V2:
- case AEPC_FIELD_RELATIVE_PRETRIG:
- case AEPC_FIELD_SUPPLY:
- case AEPC_FIELD_COLOUR:
- if (copy_pos >= sizeof marshall - 1)
- break;
- marshall[copy_pos++] = c;
- marshall[copy_pos] = '\0';
- break;
case AEPC_FIELD_PRETTY_NAME:
if (copy_pos >=
sizeof ch->channel_name_pretty - 1)
@@ -323,9 +315,11 @@ int configure(struct aep_context *aep_context, struct aep *aep, const char *dev_
ch->channel_name_pretty[copy_pos] = '\0';
break;
default:
- fprintf(stderr, "Unable to parse config\n");
- close(fd);
- return -1;
+ if (copy_pos >= sizeof marshall - 1)
+ break;
+ marshall[copy_pos++] = c;
+ marshall[copy_pos] = '\0';
+ break;
}
break;
}
diff --git a/libarmep/libarmep.h b/libarmep/libarmep.h
index 7a686a9..49e0b31 100644
--- a/libarmep/libarmep.h
+++ b/libarmep/libarmep.h
@@ -153,6 +153,7 @@ struct aep_channel {
char channel_name_pretty[64];
char supply[64]; /* parent channel name */
char colour[16]; /* #xxxxxx HTML-style colour */
+ char class[16]; /* optional class of power, eg, Soc */
int pretrigger_ms;
int pretrigger_samples_taken;
double rshunt;
@@ -240,6 +241,7 @@ struct aep_shared {
char channel_name_pretty[MAX_PROBES * CHANNELS_PER_PROBE][64];
char supply[MAX_PROBES * CHANNELS_PER_PROBE][64];
char colour[MAX_PROBES * CHANNELS_PER_PROBE][16];
+ char class[MAX_PROBES * CHANNELS_PER_PROBE][16];
int chans;
int finished;
double averages[MAX_PROBES * CHANNELS_PER_PROBE][3];
diff --git a/libarmep/service.c b/libarmep/service.c
index a57b2f2..77683e5 100644
--- a/libarmep/service.c
+++ b/libarmep/service.c
@@ -99,6 +99,7 @@ static void init_aep(struct aep_context *aep_context, struct aep *aep, const cha
ch->samples = 0;
strcpy(ch->supply, "none");
sprintf(ch->colour, "#%06X", rand() & 0xffffff);
+ strcpy(ch->class, "-");
}
}
@@ -148,6 +149,21 @@ void probe_close(struct aep *aep)
close(aep->fd);
}
+static void copy_public_ch_info_to_shared(struct aep_shared *aep_shared, struct aep_channel *ch)
+{
+ strncpy(aep_shared->channel_name[chan], ch->channel_name, sizeof(aep_shared->channel_name[0]));
+ aep_shared->channel_name[chan][sizeof(aep_shared->channel_name[0]) - 1] = '\0';
+ strncpy(aep_shared->channel_name_pretty[chan], ch->channel_name_pretty, sizeof(aep_shared->channel_name_pretty[0]));
+ aep_shared->channel_name_pretty[chan][sizeof(aep_shared->channel_name_pretty[0]) - 1] = '\0';
+ strncpy(aep_shared->supply[chan], ch->supply, sizeof(aep_shared->supply[0]));
+ aep_shared->supply[chan][sizeof(aep_shared->supply[0]) - 1] = '\0';
+ strncpy(aep_shared->colour[chan], ch->colour, sizeof(aep_shared->colour[0]));
+ aep_shared->colour[chan][sizeof(aep_shared->colour[0]) - 1] = '\0';
+ strncpy(aep_shared->class[chan], ch->class, sizeof(aep_shared->class[0]));
+ aep_shared->class[chan][sizeof(aep_shared->class[0]) - 1] = '\0';
+
+}
+
int service_aeps(struct aep_context *aep_context, int fd_with_rx)
{
static unsigned char zero[8] = { 0, 0, 0, 0, 0, 0, 0, 0, };
@@ -357,14 +373,7 @@ bail:
if (!ch->requested)
continue;
- strncpy(aep_context->aep_shared->channel_name[chan], ch->channel_name, sizeof(aep_context->aep_shared->channel_name[0]));
- aep_context->aep_shared->channel_name[chan][sizeof(aep_context->aep_shared->channel_name[0]) - 1] = '\0';
- strncpy(aep_context->aep_shared->channel_name_pretty[chan], ch->channel_name_pretty, sizeof(aep_context->aep_shared->channel_name_pretty[0]));
- aep_context->aep_shared->channel_name_pretty[chan][sizeof(aep_context->aep_shared->channel_name_pretty[0]) - 1] = '\0';
- strncpy(aep_context->aep_shared->supply[chan], ch->supply, sizeof(aep_context->aep_shared->supply[0]));
- aep_context->aep_shared->supply[chan][sizeof(aep_context->aep_shared->supply[0]) - 1] = '\0';
- strncpy(aep_context->aep_shared->colour[chan], ch->colour, sizeof(aep_context->aep_shared->colour[0]));
- aep_context->aep_shared->colour[chan][sizeof(aep_context->aep_shared->colour[0]) - 1] = '\0';
+ copy_public_ch_info_to_shared(aep_context->aep_shared, ch);
chan++;
aep_context->aep_shared->chans = chan;