]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/modparms.c
CAN driver infrastructure redesign to LinCAN-0.2 version
[lincan.git] / lincan / src / modparms.c
index 6f9a0dee3a7085713d9254bae1c6e6907609f9d5..96d66d525b3fc7caf21bcefb950fe0058bb7e955 100644 (file)
@@ -1,56 +1,58 @@
 /* mod_parms.c
  * Linux CAN-bus device driver.
  * Written by Arnaud Westenberg email:arnaud@wanadoo.nl
+ * Rewritten for new CAN queues by Pavel Pisa - OCERA team member
+ * email:pisa@cmp.felk.cvut.cz
  * This software is released under the GPL-License.
- * Version 0.7  6 Aug 2001
+ * Version lincan-0.2  9 Jul 2003
  */
 
 
 #include <linux/autoconf.h>
-#if defined (CONFIG_MODVERSIONS) && !defined (MODVERSIONS)
-#define MODVERSIONS
-#endif
 
-#if defined (MODVERSIONS)
-#include <linux/modversions.h>
-#endif
+#include ".supported_cards.h"
 
-#include "../.support"
-#ifndef PIP
-#define PIP 0
+#ifndef ENABLE_CARD_pip
+#define ENABLE_CARD_pip 0
+#endif
+#ifndef ENABLE_CARD_smartcan
+#define ENABLE_CARD_smartcan 0
+#endif
+#ifndef ENABLE_CARD_pccan
+#define ENABLE_CARD_pccan 0
 #endif
-#ifndef SMARTCAN
-#define SMARTCAN 0
+#ifndef ENABLE_CARD_nsi
+#define ENABLE_CARD_nsi 0
 #endif
-#ifndef PCCAN
-#define PCCAN 0
+#ifndef ENABLE_CARD_cc_can104
+#define ENABLE_CARD_cc_can104 0
 #endif
-#ifndef NSI
-#define NSI 0
+#ifndef ENABLE_CARD_aim104
+#define ENABLE_CARD_aim104 0
 #endif
-#ifndef CC104
-#define CC104 0
+#ifndef ENABLE_CARD_pc_i03
+#define ENABLE_CARD_pc_i03 0
 #endif
-#ifndef AIM104
-#define AIM104 0
+#ifndef ENABLE_CARD_pcm3680
+#define ENABLE_CARD_pcm3680 0
 #endif
-#ifndef PCI03
-#define PCI03 0
+#ifndef ENABLE_CARD_m437
+#define ENABLE_CARD_m437 0
 #endif
-#ifndef PCM3680
-#define PCM3680 0
+#ifndef ENABLE_CARD_pcccan
+#define ENABLE_CARD_pcccan 0
 #endif
-#ifndef M437
-#define M437 0
+#ifndef ENABLE_CARD_ssv
+#define ENABLE_CARD_ssv 0
 #endif
-#ifndef PCCCAN
-#define PCCCAN 0
+#ifndef ENABLE_CARD_bfadcan
+#define ENABLE_CARD_bfadcan 0
 #endif
-#ifndef SSV
-#define SSV 0
+#ifndef ENABLE_CARD_pikronisa
+#define ENABLE_CARD_pikronisa 0
 #endif
-#ifndef TEMPLATE
-#define TEMPLATE 0
+#ifndef ENABLE_CARD_template
+#define ENABLE_CARD_template 0
 #endif
 
 #include <linux/string.h>
@@ -70,37 +72,41 @@ int parse_mod_parms(void)
        }
 
        while ( (hw[i] != NULL) && (i < MAX_HW_CARDS) ) {
-               if ( !strcmp(hw[i],"pip5") && PIP )
+               if ( !strcmp(hw[i],"pip5") && ENABLE_CARD_pip )
                        irq_needed++;
-               else if (!strcmp(hw[i],"pip6") && PIP)
+               else if (!strcmp(hw[i],"pip6") && ENABLE_CARD_pip)
                        irq_needed++;
-               else if (!strcmp(hw[i],"smartcan") && SMARTCAN)
+               else if (!strcmp(hw[i],"smartcan") && ENABLE_CARD_smartcan)
                        irq_needed++;
-               else if (!strcmp(hw[i],"pccan-q") && PCCAN)
+               else if (!strcmp(hw[i],"pccan-q") && ENABLE_CARD_pccan)
                        irq_needed=irq_needed+4;
-               else if (!strcmp(hw[i],"pccan-f") && PCCAN)
+               else if (!strcmp(hw[i],"pccan-f") && ENABLE_CARD_pccan)
                        irq_needed++;
-               else if (!strcmp(hw[i],"pccan-s") && PCCAN)
+               else if (!strcmp(hw[i],"pccan-s") && ENABLE_CARD_pccan)
                        irq_needed++;
-               else if (!strcmp(hw[i],"pccan-d") && PCCAN)
+               else if (!strcmp(hw[i],"pccan-d") && ENABLE_CARD_pccan)
                        irq_needed=irq_needed+2;
-               else if (!strcmp(hw[i],"nsican") && NSI)
+               else if (!strcmp(hw[i],"nsican") && ENABLE_CARD_nsi)
                        irq_needed++;
-               else if (!strcmp(hw[i],"cc104") && CC104)
+               else if (!strcmp(hw[i],"cc104") && ENABLE_CARD_cc_can104)
                        irq_needed++;
-               else if (!strcmp(hw[i],"aim104") && AIM104)
+               else if (!strcmp(hw[i],"aim104") && ENABLE_CARD_aim104)
                        irq_needed++;
-               else if (!strcmp(hw[i],"pc-i03") && PCI03)
+               else if (!strcmp(hw[i],"pc-i03") && ENABLE_CARD_pc_i03)
                        irq_needed++;
-               else if (!strcmp(hw[i],"pcm3680") && PCM3680)
+               else if (!strcmp(hw[i],"pcm3680") && ENABLE_CARD_pcm3680)
                        irq_needed=irq_needed+2;
-               else if (!strcmp(hw[i],"m437") && M437)
+               else if (!strcmp(hw[i],"m437") && ENABLE_CARD_m437)
                        irq_needed++;
-               else if (!strcmp(hw[i],"pcccan") && PCCCAN)
+               else if (!strcmp(hw[i],"pcccan") && ENABLE_CARD_pcccan)
                        irq_needed++;
-               else if (!strcmp(hw[i],"ssv") && SSV)
+               else if (!strcmp(hw[i],"ssv") && ENABLE_CARD_ssv)
                        irq_needed=irq_needed+2;
-               else if (!strcmp(hw[i],"template") && TEMPLATE);
+               else if (!strcmp(hw[i],"bfadcan") && ENABLE_CARD_bfadcan)
+                       irq_needed++;
+               else if (!strcmp(hw[i],"pikronisa") && ENABLE_CARD_pikronisa)
+                       irq_needed++;
+               else if (!strcmp(hw[i],"template") && ENABLE_CARD_template);
                else {
                        CANMSG("Sorry, hardware \"%s\" is currently not supported.\n",hw[i]);
                        return -EINVAL;
@@ -122,7 +128,7 @@ int parse_mod_parms(void)
        while ( (irq[irq_supplied] != -1) & (irq_supplied<MAX_IRQ) )
                irq_supplied++;
        while ( (hw[j] != NULL) && (j<MAX_HW_CARDS) ) {
-               if (!strcmp(hw[j],"template") && TEMPLATE)
+               if (!strcmp(hw[j],"template") && ENABLE_CARD_template)
                        irq_needed = irq_supplied;
                j++;
        }
@@ -159,24 +165,17 @@ int list_hw(void)
                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. all chips    : %d\n",hardware_p->candevice[i]->nr_all_chips);
                DEBUGMSG("Nr. of i82527    : %d\n",hardware_p->candevice[i]->nr_82527_chips);
                DEBUGMSG("Nr. of sja1000   : %d\n",hardware_p->candevice[i]->nr_sja1000_chips);
-               for (j=0; j<hardware_p->candevice[i]->nr_82527_chips+hardware_p->candevice[i]->nr_sja1000_chips; j++) {
+               for (j=0; j<hardware_p->candevice[i]->nr_all_chips; j++) {
                        DEBUGMSG("Chip%d type       : %s\n", j+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,"i82527")) {
-                               for (k=0; k<15; 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);
-                       }
-
-                       if (!strcmp(hardware_p->candevice[i]->chip[j]->chip_type,"sja1000")) {
-                               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);
-                       } 
-
+                       for (k=0; k<hardware_p->candevice[i]->chip[j]->max_objects; 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++;