summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pccard/pccardc/rdreg.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/pccard/pccardc/rdreg.c')
-rw-r--r--usr.sbin/pccard/pccardc/rdreg.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/usr.sbin/pccard/pccardc/rdreg.c b/usr.sbin/pccard/pccardc/rdreg.c
new file mode 100644
index 0000000..c278ae5
--- /dev/null
+++ b/usr.sbin/pccard/pccardc/rdreg.c
@@ -0,0 +1,48 @@
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+#include <pccard/card.h>
+int
+rdreg_main(argc, argv)
+int argc;
+char *argv[];
+{
+ if (argc != 2)
+ {
+ dumpslot(0);
+ dumpslot(1);
+ }
+ else
+ dumpslot(atoi(argv[1]));
+}
+dumpslot(sl)
+int sl;
+{
+char name[64];
+int fd;
+struct pcic_reg r;
+
+ sprintf(name, "/dev/card%d", sl);
+ fd = open(name, 2);
+ if (fd < 0)
+ {
+ perror(name);
+ return;
+ }
+ printf("Registers for slot %d\n", sl);
+ for (r.reg = 0; r.reg < 0x40; r.reg++)
+ {
+ if (ioctl(fd, PIOCGREG, &r))
+ {
+ perror("ioctl");
+ break;
+ }
+ if ((r.reg % 16)==0)
+ printf("%02x:", r.reg);
+ printf(" %02x", r.value);
+ if ((r.reg % 16)==15)
+ printf("\n");
+ }
+ close(fd);
+}
OpenPOWER on IntegriCloud