/*! @defgroup devconf devconf - devconf.c This module is used to build the devconf application. The devconf program is used to configure a Linux 37e12 device ie /dev/37e12 to address an IO range and an IRQ, thereby identifying a 37e12 board. */ #include #include #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 = "********************************************** *devconf * *Nathan Z. Gustavson * *Emac.inc * *"__DATE__" * *usage: * *devconf device irq address * *ex: * *devconf /dev/37e12 10 0x220 * *configures the 37e12 device * */dev/37e12 to irq 10 and address 0x220 * *configurations last until the driver is * *unloaded * **********************************************\n"; printf("%s",help_table); return 0; } #define VERSIONMASK BITMASK(VERSIONINFO) int main(int argc, char **argv) { int fd; E12_config_struct config; ARGCHECK(4); OPENDEV(fd,argv[1]); config.address = strtoul(argv[3],NULL,0); config.IRQ = strtoul(argv[2],NULL,0); config.IRQedge = 1; ioctl(fd, E12_CONFIG,&config); close(fd); return 0; }