1
0
mirror of git://projects.qi-hardware.com/antorcha.git synced 2024-11-25 19:10:18 +02:00

tools/antorcha.c: new option -d to enable message content dumping

This was a quick and dirty compile-time option before.
This commit is contained in:
Werner Almesberger 2012-06-20 17:15:24 -03:00
parent bafdc8c563
commit 625f262e1d

View File

@ -27,6 +27,7 @@
static int verbose = 1; static int verbose = 1;
static int debug = 0;
static void rf_init(struct atrf_dsc *dsc, int trim, int channel) static void rf_init(struct atrf_dsc *dsc, int trim, int channel)
@ -55,13 +56,14 @@ static void rf_send(struct atrf_dsc *dsc, void *buf, int len)
wait_for_interrupt(dsc, IRQ_TRX_END, wait_for_interrupt(dsc, IRQ_TRX_END,
IRQ_TRX_END | IRQ_PLL_LOCK, 10); IRQ_TRX_END | IRQ_PLL_LOCK, 10);
atrf_reg_write(dsc, REG_TRX_STATE, TRX_CMD_RX_ON); atrf_reg_write(dsc, REG_TRX_STATE, TRX_CMD_RX_ON);
#if 0
int i; if (debug) {
fprintf(stderr, "\r%d:", len); int i;
for (i = 0; i != len; i++) fprintf(stderr, "\r%d:", len);
fprintf(stderr, " %02x", ((uint8_t *) buf)[i]);; for (i = 0; i != len; i++)
fprintf(stderr, "\n"); fprintf(stderr, " %02x", ((uint8_t *) buf)[i]);;
#endif fprintf(stderr, "\n");
}
} }
@ -279,9 +281,9 @@ static void image(struct atrf_dsc *dsc, const char *name)
static void usage(const char *name) static void usage(const char *name)
{ {
fprintf(stderr, fprintf(stderr,
"usage: %s image_file\n" "usage: %s [-d] image_file\n"
"%6s %s -F firmware_file\n" "%6s %s [-d] -F firmware_file\n"
"%6s %s -P\n" "%6s %s [-d] -P\n"
, name, "", name, "", name); , name, "", name, "", name);
exit(1); exit(1);
} }
@ -294,8 +296,11 @@ int main(int argc, char **argv)
struct atrf_dsc *dsc; struct atrf_dsc *dsc;
int c; int c;
while ((c = getopt(argc, argv, "F:P")) != EOF) while ((c = getopt(argc, argv, "dF:P")) != EOF)
switch (c) { switch (c) {
case 'd':
debug = 1;
break;
case 'F': case 'F':
fw = optarg; fw = optarg;
break; break;