1995-08-24 09:03:04 +00:00
|
|
|
#include <stdio.h>
|
1995-08-25 09:46:01 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
1995-08-24 09:03:04 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
|
|
|
|
#include <pccard/card.h>
|
1995-08-25 09:46:01 +00:00
|
|
|
void
|
1995-08-24 09:03:04 +00:00
|
|
|
dumpslot(sl)
|
1996-04-10 05:45:39 +00:00
|
|
|
int sl;
|
1995-08-24 09:03:04 +00:00
|
|
|
{
|
1996-04-10 05:45:39 +00:00
|
|
|
char name[64];
|
|
|
|
int fd;
|
|
|
|
struct pcic_reg r;
|
1995-08-24 09:03:04 +00:00
|
|
|
|
|
|
|
sprintf(name, "/dev/card%d", sl);
|
|
|
|
fd = open(name, 2);
|
1996-04-10 05:45:39 +00:00
|
|
|
if (fd < 0) {
|
1995-08-24 09:03:04 +00:00
|
|
|
perror(name);
|
|
|
|
return;
|
1996-04-10 05:45:39 +00:00
|
|
|
}
|
1995-08-24 09:03:04 +00:00
|
|
|
printf("Registers for slot %d\n", sl);
|
1996-04-10 05:45:39 +00:00
|
|
|
for (r.reg = 0; r.reg < 0x40; r.reg++) {
|
|
|
|
if (ioctl(fd, PIOCGREG, &r)) {
|
1995-08-24 09:03:04 +00:00
|
|
|
perror("ioctl");
|
|
|
|
break;
|
1996-04-10 05:45:39 +00:00
|
|
|
}
|
|
|
|
if ((r.reg % 16) == 0)
|
1995-08-24 09:03:04 +00:00
|
|
|
printf("%02x:", r.reg);
|
|
|
|
printf(" %02x", r.value);
|
1996-04-10 05:45:39 +00:00
|
|
|
if ((r.reg % 16) == 15)
|
1995-08-24 09:03:04 +00:00
|
|
|
printf("\n");
|
1996-04-10 05:45:39 +00:00
|
|
|
}
|
1995-08-24 09:03:04 +00:00
|
|
|
close(fd);
|
|
|
|
}
|
1996-04-10 05:45:39 +00:00
|
|
|
|
1995-08-25 09:46:01 +00:00
|
|
|
int
|
|
|
|
rdreg_main(argc, argv)
|
1996-04-10 05:45:39 +00:00
|
|
|
int argc;
|
|
|
|
char *argv[];
|
1995-08-25 09:46:01 +00:00
|
|
|
{
|
1996-04-10 05:45:39 +00:00
|
|
|
if (argc != 2) {
|
1995-08-25 09:46:01 +00:00
|
|
|
dumpslot(0);
|
|
|
|
dumpslot(1);
|
1996-04-10 05:45:39 +00:00
|
|
|
} else
|
1995-08-25 09:46:01 +00:00
|
|
|
dumpslot(atoi(argv[1]));
|
|
|
|
return 0;
|
|
|
|
}
|