Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Related Pages  

ISO_in.c

00001 /*ISO_in.c
00002 Isolated Digital input application for the 37e12
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 

Generated on Thu Jan 8 09:51:00 2004 for PCM-37e12 by doxygen1.2.15