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("Example: # insmod can.o hw=pip5 irq=4 io=0x8000\n");
27 while ( (hw[i] != NULL) && (i < MAX_HW_CARDS) ) {
28 brp = boardtype_find(hw[i]);
30 CANMSG("Sorry, hardware \"%s\" is currently not supported.\n",hw[i]);
33 irq_needed += brp->irqnum;
37 /* Check wether the supplied number of io addresses is correct. */
39 while ( (io[io_supplied] != -1) & (io_supplied<MAX_HW_CARDS) )
41 if (io_needed != io_supplied) {
42 CANMSG("Invalid number of io addresses.\n");
43 CANMSG("Supplied hardware needs %d io address(es).\n",io_needed);
47 /* Check wether the supplied number of irq's is correct. */
48 while ( (irq[irq_supplied] != -1) & (irq_supplied<MAX_IRQ) )
50 while ( (hw[j] != NULL) && (j<MAX_HW_CARDS) ) {
51 if (!strcmp(hw[j],"template"))
52 irq_needed = irq_supplied;
55 if (irq_needed != irq_supplied) {
56 CANMSG("Invalid number of interrupts.\n");
57 CANMSG("Supplied harware needs %d irq number(s).\n",irq_needed);
61 /* In case minor numbers were assigned check wether the correct number
62 * of minor numbers was supplied.
65 minor_needed=irq_needed;
66 while ((minor[minor_supplied] != -1) & (minor_supplied<MAX_IRQ))
68 if (minor_supplied != minor_needed) {
69 CANMSG("Invalid number of minor numbers.\n");
70 CANMSG("Supplied hardware needs %d minor number(s).\n",minor_needed);
77 /* list_hw is used when debugging is on to show the hardware layout */
82 DEBUGMSG("Number of boards : %d\n",hardware_p->nr_boards);
84 while ( (hw[i] != NULL) & (i<=MAX_HW_CARDS-1) ) {
85 printk(KERN_ERR "\n");
86 DEBUGMSG("Hardware : %s\n",hardware_p->candevice[i]->hwname);
87 DEBUGMSG("IO address : 0x%lx\n",hardware_p->candevice[i]->io_addr);
88 DEBUGMSG("Nr. all chips : %d\n",hardware_p->candevice[i]->nr_all_chips);
89 DEBUGMSG("Nr. of i82527 : %d\n",hardware_p->candevice[i]->nr_82527_chips);
90 DEBUGMSG("Nr. of sja1000 : %d\n",hardware_p->candevice[i]->nr_sja1000_chips);
91 for (j=0; j<hardware_p->candevice[i]->nr_all_chips; j++) {
92 DEBUGMSG("Chip%d type : %s\n", j+1, hardware_p->candevice[i]->chip[j]->chip_type);
93 DEBUGMSG("Chip base : 0x%lx\n",hardware_p->candevice[i]->chip[j]->chip_base_addr);
94 DEBUGMSG("Interrupt : %d\n",hardware_p->candevice[i]->chip[j]->chip_irq);
97 for (k=0; k<hardware_p->candevice[i]->chip[j]->max_objects; k++)
98 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);