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

ISO_out.c

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

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