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

devconf.c

00001 
00009 #include <stdlib.h>
00010 #include <stdio.h>
00011 #include <string.h>
00012 #include <sys/ioctl.h>
00013 #include <unistd.h>
00014 #include <sys/types.h>
00015 #include <asm/types.h>
00016 #include <sys/stat.h>
00017 #include <fcntl.h>
00018 #include <signal.h>
00019 #include <sched.h>
00020 #include <sys/resource.h>
00021 #include <sys/io.h>
00022 #include <E12user.h>
00023 #include <packet.h>
00024 #include <coprocessor.h>
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 *devconf                                     *
00036 *Nathan Z. Gustavson                         *
00037 *Emac.inc                                    * 
00038 *"__DATE__"                                 *   
00039 *usage:                                      *   
00040 *devconf device irq address                  *
00041 *ex:                                         *
00042 *devconf /dev/37e12 10 0x220                 *
00043 *configures the 37e12 device                 *
00044 */dev/37e12 to irq 10 and address 0x220      *
00045 *configurations last until the driver is     *
00046 *unloaded                                    *
00047 **********************************************\n";
00048 printf("%s",help_table);
00049 return 0;
00050 }
00051 
00052 #define VERSIONMASK BITMASK(VERSIONINFO)
00053 
00054 int main(int argc, char **argv)
00055 {
00056 int fd;
00057 E12_config_struct config;
00058 
00059 ARGCHECK(4);
00060 OPENDEV(fd,argv[1]);
00061 
00062 config.address = strtoul(argv[3],NULL,0);
00063 config.IRQ     = strtoul(argv[2],NULL,0);
00064 config.IRQedge = 1;
00065 
00066 ioctl(fd, E12_CONFIG,&config);
00067 
00068 close(fd);
00069 
00070 return 0;
00071 
00072   }
00073 
00074 

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