Initial import of work-in-progress of Poseidon port.
[cake.git] / rom / usb / pciusb / debug.c
blobf29021b6b58e5720ed8c1e421439b793205e81fa
1 #include "debug.h"
3 #ifdef DEBUG
4 void dumpmem(void *mem, unsigned long int len)
6 unsigned char *p;
8 if (!mem || !len) { return; }
10 p = (unsigned char *) mem;
12 bug("\n");
16 unsigned char b, c, str[17];
18 for (b = 0; b < 16; b++)
20 c = *p++;
21 str[b] = ((c >= ' ') && (c <= 'z')) ? c : '.';
22 str[b + 1] = 0;
23 bug("%02lx ", c);
24 if (--len == 0) break;
27 while (++b < 16)
29 bug(" ");
32 bug(" %s\n", str);
33 } while (len);
35 bug("\n\n");
38 #endif /* DEBUG */