Commit e7b84b83 authored by Tristan Gingold's avatar Tristan Gingold

vmedma.c: add --verbose, disp data in BE32.

parent ea24fca9
......@@ -132,6 +132,7 @@ static const struct option options[] =
{ "2e", required_argument, 0, 'e' },
{ "dump", no_argument, 0, 'd' },
{ "help", no_argument, 0, 'h' },
{ "verbose", no_argument, 0, 'v' },
{ "vbs", required_argument, 0, OPT_VBS },
{ "pbs", required_argument, 0, OPT_PBS },
{ NULL, 0, 0, 0 }
......@@ -146,9 +147,10 @@ main (int argc, char **argv)
int c;
void *buf;
int flag_dump = 0;
int flag_verbose = 0;
enum vme_2esst_mode vmode = VME_2eVME;
while ((c = getopt_long (argc, argv, "a:m:n:e:dh",
while ((c = getopt_long (argc, argv, "a:m:n:e:dhv",
options, NULL)) != -1)
switch (c)
{
......@@ -176,6 +178,9 @@ main (int argc, char **argv)
case 'd':
flag_dump = 1;
break;
case 'v':
flag_verbose = 1;
break;
case OPT_VBS:
vbs = convert_block_size (optarg);
break;
......@@ -204,8 +209,9 @@ main (int argc, char **argv)
return 2;
}
printf ("INFO: test DMA for am 0x%02x, mode: %u (addr: 0x%08x, len: 0x%0x)\n",
am, vmode, addr, len);
if (flag_verbose)
printf ("INFO: test DMA for am 0x%02x, mode: %u (addr: 0x%08x, len: 0x%0x)\n",
am, vmode, addr, len);
if (posix_memalign (&buf, 4096, len) != 0)
{
......@@ -217,7 +223,15 @@ main (int argc, char **argv)
if (flag_dump)
for (unsigned i = 0; i < len; i += 4)
printf ("%08x: %08x\n", addr + i, ((unsigned int *)buf)[i >> 2]);
{
unsigned int v;
/* Read as BE32. */
v = (buf[i] << 24)
| (buf[i + 1] << 16)
| (buf[i + 2] << 8)
| buf[i + 3];
printf ("%08x: %08x\n", addr + i, v);
}
free (buf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment