2 * Linux CAN-bus device driver.
3 * Written by Arnaud Westenberg email:arnaud@wanadoo.nl
4 * Rewritten for new CAN queues by Pavel Pisa - OCERA team member
5 * email:pisa@cmp.felk.cvut.cz
6 * This software is released under the GPL-License.
7 * Version lincan-0.3 17 Jun 2004
11 #include "../include/can.h"
12 #include "../include/can_sysdep.h"
13 #include "../include/main.h"
14 #include "../include/modparms.h"
16 int parse_mod_parms(void)
18 int i=0,j=0,irq_needed=0,irq_supplied=0,io_needed=0,io_supplied=0,minor_needed=0,minor_supplied=0;
19 const struct boardtype_t *brp;
21 if ( (hw[0] == NULL) | (io[0] == -1) ) {
22 //CANMSG("You must supply your type of hardware, interrupt numbers and io address.\n");
23 CANMSG("Autodetection works only for USB devices, supply your type of hardware for PCI devices \n");
24 CANMSG("Example: # insmod can.o hw=pip5 irq=4 io=0x8000\n");
28 while ( (hw[i] != NULL) && (i < MAX_HW_CARDS) ) {
29 brp = boardtype_find(hw[i]);
31 CANMSG("Sorry, hardware \"%s\" is currently not supported.\n",hw[i]);
34 irq_needed += brp->irqnum;
38 /* Check wether the supplied number of io addresses is correct. */
40 while ( (io[io_supplied] != -1) & (io_supplied<MAX_HW_CARDS) )
42 if (io_needed != io_supplied) {
43 CANMSG("Invalid number of io addresses.\n");
44 CANMSG("Supplied hardware needs %d io address(es).\n",io_needed);
48 /* Check wether the supplied number of irq's is correct. */
49 while ( (irq[irq_supplied] != -1) & (irq_supplied<MAX_IRQ) )
51 while ( (hw[j] != NULL) && (j<MAX_HW_CARDS) ) {
52 if (!strcmp(hw[j],"template"))
53 irq_needed = irq_supplied;
56 if (irq_needed != irq_supplied) {
57 CANMSG("Invalid number of interrupts.\n");
58 CANMSG("Supplied harware needs %d irq number(s).\n",irq_needed);
62 /* In case minor numbers were assigned check wether the correct number
63 * of minor numbers was supplied.
66 minor_needed=irq_needed;
67 while ((minor[minor_supplied] != -1) & (minor_supplied<MAX_IRQ))
69 if (minor_supplied != minor_needed) {
70 CANMSG("Invalid number of minor numbers.\n");
71 CANMSG("Supplied hardware needs %d minor number(s).\n",minor_needed);
78 /* list_hw is used when debugging is on to show the hardware layout */
83 DEBUGMSG("Number of boards : %d\n",hardware_p->nr_boards);
85 while ( (hw[i] != NULL) & (i<=MAX_HW_CARDS-1) ) {
86 printk(KERN_ERR "\n");
87 DEBUGMSG("Hardware : %s\n",hardware_p->candevice[i]->hwname);
88 DEBUGMSG("IO address : 0x%lx\n",hardware_p->candevice[i]->io_addr);
89 DEBUGMSG("Nr. all chips : %d\n",hardware_p->candevice[i]->nr_all_chips);
90 DEBUGMSG("Nr. of i82527 : %d\n",hardware_p->candevice[i]->nr_82527_chips);
91 DEBUGMSG("Nr. of sja1000 : %d\n",hardware_p->candevice[i]->nr_sja1000_chips);
92 for (j=0; j<hardware_p->candevice[i]->nr_all_chips; j++) {
93 DEBUGMSG("Chip%d type : %s\n", j+1, hardware_p->candevice[i]->chip[j]->chip_type);
94 DEBUGMSG("Chip base : 0x%lx\n",hardware_p->candevice[i]->chip[j]->chip_base_addr);
95 DEBUGMSG("Interrupt : %d\n",hardware_p->candevice[i]->chip[j]->chip_irq);
98 for (k=0; k<hardware_p->candevice[i]->chip[j]->max_objects; k++)
99 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);