/*ISO_in.c Isolated Digital input application for the 37e12 */ /*! @defgroup ISO_in ISO_in - ISO_in.c This module is used to build the ISO_in application. ISO_in is used to read from the external input port of the 37e12. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define ARGCHECK(num){if(argc!=num){printf("invalid number of arguements\n");help();return -1;}} #define OPENDEV(filed,dev){if((filed = open(dev, O_RDWR))<=0){printf("couldn't open %s\n",dev);return -1;}} static int help(void) { const char *help_table = "********************************************** *ISO_in * *Nathan Z. Gustavson * *Emac.inc * *"__DATE__" * *usage: * *ISO_in device * *ex: * *ISO_in /dev/37e12 * *reads the hex value of the ISO_in port * *of /dev/37e12 * **********************************************\n"; printf("%s",help_table); return 0; } int main(int argc, char **argv) { int fd; isodata data; ARGCHECK(2); OPENDEV(fd,argv[1]); ioctl(fd,ISO_DIG_IN,&data); printf("%x\n",data); close(fd); return 0; }