/* atmtest1.c */ /* This program reads one register from the "control region" */ /* (local address base 0x04000000) of the APE 25 */ #include #include #include "atmuser.h" int iobuf[1024]; void main( int argc, char **argv) { int fd; int regid; fd = open("/dev/ape25", O_RDWR); if (fd < 0) { printf("Device /dev/ape25 could not be opened. \n"); exit(1); } if (argc < 2) { printf("This program reads one control region register \n"); printf("You must supply its OFFSET in hex as parm 1. \n"); exit(1); } sscanf(argv[1], "%x", iobuf + 0); /* Id of reg to read */ ioctl(fd, AIO_RDCREG, iobuf); printf("Value of control reg %x is %x \n", iobuf[0], iobuf[1]); }