00001
00002
00003
00004
00005
00006
00013 #include <stdlib.h>
00014 #include <stdio.h>
00015 #include <string.h>
00016 #include <sys/ioctl.h>
00017 #include <unistd.h>
00018 #include <sys/types.h>
00019 #include <asm/types.h>
00020 #include <sys/stat.h>
00021 #include <fcntl.h>
00022 #include <signal.h>
00023 #include <sched.h>
00024 #include <sys/resource.h>
00025 #include <sys/io.h>
00026 #include <E12user.h>
00027
00028
00029
00030
00031 #define ARGCHECK(num){if(argc!=num){printf("invalid number of arguements\n");help();return -1;}}
00032
00033 #define OPENDEV(filed,dev){if((filed = open(dev, O_RDWR))<=0){printf("couldn't open %s\n",dev);return -1;}}
00034
00035 static int help(void)
00036 {
00037 const char *help_table = "**********************************************
00038 *ISO_in *
00039 *Nathan Z. Gustavson *
00040 *Emac.inc *
00041 *"__DATE__" *
00042 *usage: *
00043 *ISO_in device *
00044 *ex: *
00045 *ISO_in /dev/37e12 *
00046 *reads the hex value of the ISO_in port *
00047 *of /dev/37e12 *
00048 **********************************************\n";
00049 printf("%s",help_table);
00050 return 0;
00051 }
00052
00053 int main(int argc, char **argv)
00054 {
00055
00056 int fd;
00057 isodata data;
00058
00059 ARGCHECK(2);
00060 OPENDEV(fd,argv[1]);
00061
00062 ioctl(fd,ISO_DIG_IN,&data);
00063
00064 printf("%x\n",data);
00065
00066 close(fd);
00067 return 0;
00068 }
00069
00070