mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-17 16:10:46 +01:00
f2b46629be
This is not quite finished yet, and therefore I have not added it to the usr.sbin/Makefile yet. I collected a bunch of Andrews small programs into one: pccardc /phk Reviewed by: phk Submitted by: Andrew McRae <andrew@mega.com.au>
49 lines
694 B
C
49 lines
694 B
C
#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);
|
|
}
|