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

DtoA.c

00001 /***************************************************************************
00002                           DtoA.c  -  description
00003                              -------------------
00004     begin                : Wed Dec 10 2003
00005     copyright            : (C) 2003 by NZG
00006     email                : ngustavson@emacinc.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00024 #include <stdlib.h>
00025 #include <stdio.h>
00026 #include <string.h>
00027 #include <sys/ioctl.h>
00028 #include <unistd.h>
00029 #include <sys/types.h>
00030 #include <asm/types.h>
00031 #include <sys/stat.h>
00032 #include <fcntl.h>
00033 #include <signal.h>
00034 #include <sched.h>
00035 #include <sys/resource.h>
00036 #include <sys/io.h>
00037 #include <E12user.h>
00038 #include <packet.h>
00039 #include <coprocessor.h>
00040 
00041 #define ARGCHECK(num){if(argc<=num){printf("invalid number of arguements\n");help();return -1;}}
00042 #define OPENDEV(filed,dev){if((filed = open(dev, O_RDWR))<=0){printf("couldn't open %s\n",dev);return -1;}}
00043 
00044 static int help(void)
00045 {
00046 const char *help_table = "**********************************************
00047 *DtoAwrite                                   *
00048 *Nathan Z. Gustavson                         *
00049 *Emac.inc                                    *
00050 *"__DATE__"                                 *
00051 *usage:                                      *
00052 *DtoAwrite device channel value             *
00053 *ex                                          *
00054 *DtoAwrite /dev/37e12 0 0xff                 *
00055 *writes 0xff to DtoA channel 0               *
00056 **********************************************\n";
00057 printf("%s",help_table);
00058 return 0;
00059 }
00060 
00061 int main(int argc, char **argv)
00062 {
00063 int fd,channel,data;
00064 ARGCHECK(3);
00065 channel = strtoul(argv[2],NULL,0);
00066 data = strtoul(argv[3],NULL,0);
00067 OPENDEV(fd,argv[1]);
00068 E12_DtoA_Write(fd, channel,data);
00069 close(fd);
00070 return 0;
00071 }
00072 

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