1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-22 14:10:37 +02:00

tools/atrf-gpio/atben.c: made error report easier to read

- atben.c (decode_cfg): report pull-up as "R" instead of "P"
- atben.c (dump_pd): show "-" for values where we don't expect a
  specific result
This commit is contained in:
Werner Almesberger 2011-06-04 10:53:44 -03:00
parent b0f3cb099b
commit 6bf03fe0a6

View File

@ -73,7 +73,7 @@ static char decode_cfg(uint32_t bit)
{
if (*pddir & bit)
return *pddat & bit ? '1' : '0';
return *pdpe & bit ? 'Z' : 'P';
return *pdpe & bit ? 'Z' : 'R';
}
@ -85,9 +85,10 @@ static void dump_pd(uint32_t expect, uint32_t got, uint32_t mask)
for (pin = pins; pin->name; pin++) {
uint32_t bit = 1 << pin->bit;
fprintf(stderr, "%s\t%c %d %d",
fprintf(stderr, "%s\t%c %c %d",
pin->name, decode_cfg(bit),
!!(expect & bit), !!(got & bit));
mask & bit ? expect & bit ? '1' : '0' : '-',
!!(got & bit));
if ((expect ^ got) & mask & bit)
fprintf(stderr, "\t***");
fputc('\n', stderr);