www.pudn.com > 422.rar > modparms.c
/* mod_parms.c * Linux serial-bus device driver. * Written by wang song yue--bupt email:wsy5228@sina.com * This software is released under the GPL-License. * Version 0.1 28 october 2005 */ #include#if defined (CONFIG_MODVERSIONS) && !defined (MODVERSIONS) #define MODVERSIONS #endif #if defined (MODVERSIONS) #include #endif #include "../.support" #ifndef AIM104 #define AIM104 0 #endif #include #include #include "../include/main.h" #include "../include/modparms.h" int parse_mod_parms(void) { int i=0,j=0,irq_needed=0,irq_supplied=0,io_needed=0,io_supplied=0,minor_needed=0,minor_supplied=0; if ( (hw[0] == NULL) | (irq[0] == -1) | (io[0] == -1) ) { CANMSG("You must supply your type of hardware, interrupt numbers and io address.\n"); CANMSG("Example: # insmod serial.o hw=aim104 irq=59 io=0xffd00000\n"); return -ENODEV; } while ( (hw[i] != NULL) && (i < MAX_HW_CARDS) ) { if (!strcmp(hw[i],"aim104") && AIM104) irq_needed++; else { CANMSG("Sorry, hardware \"%s\" is currently not supported.\n",hw[i]); return -EINVAL; } i++; } /* Check wether the supplied number of io addresses is correct. */ io_needed=i; while ( (io[io_supplied] != -1) & (io_supplied nr_boards); while ( (hw[i] != NULL) & (i<=MAX_HW_CARDS-1) ) { printk(KERN_ERR "\n"); DEBUGMSG("Hardware : %s\n",hardware_p->candevice[i]->hwname); DEBUGMSG("IO address : 0x%lx\n",hardware_p->candevice[i]->io_addr); DEBUGMSG("Nr. of 16c554 : %d\n",hardware_p->candevice[i]->nr_16c554_chips); for (j=0; j candevice[i]->nr_16c554_chips; j++) { DEBUGMSG("Chip%d type : %s\n", i+1, hardware_p->candevice[i]->chip[j]->chip_type); DEBUGMSG("Chip base : 0x%lx\n",hardware_p->candevice[i]->chip[j]->chip_base_addr); DEBUGMSG("Interrupt : %d\n",hardware_p->candevice[i]->chip[j]->chip_irq); if (!strcmp(hardware_p->candevice[i]->chip[j]->chip_type,"l6c554")) { for (k=0; k<1; k++) DEBUGMSG("Obj%d: minor: %d base: 0x%lx\n",k,hardware_p->candevice[i]->chip[j]->msgobj[k]->minor,hardware_p->candevice[i]->chip[j]->msgobj[k]->obj_base_addr); } } i++; } return 0; }