* 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 lincan-0.2 9 Jul 2003
+ * Version lincan-0.3 17 Jun 2004
*/
-#include <linux/autoconf.h>
-
-#include ".supported_cards.h"
-
-#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 ENABLE_CARD_nsi
-#define ENABLE_CARD_nsi 0
-#endif
-#ifndef ENABLE_CARD_cc_can104
-#define ENABLE_CARD_cc_can104 0
-#endif
-#ifndef ENABLE_CARD_aim104
-#define ENABLE_CARD_aim104 0
-#endif
-#ifndef ENABLE_CARD_pc_i03
-#define ENABLE_CARD_pc_i03 0
-#endif
-#ifndef ENABLE_CARD_pcm3680
-#define ENABLE_CARD_pcm3680 0
-#endif
-#ifndef ENABLE_CARD_m437
-#define ENABLE_CARD_m437 0
-#endif
-#ifndef ENABLE_CARD_pcccan
-#define ENABLE_CARD_pcccan 0
-#endif
-#ifndef ENABLE_CARD_ssv
-#define ENABLE_CARD_ssv 0
-#endif
-#ifndef ENABLE_CARD_bfadcan
-#define ENABLE_CARD_bfadcan 0
-#endif
-#ifndef ENABLE_CARD_pikronisa
-#define ENABLE_CARD_pikronisa 0
-#endif
-#ifndef ENABLE_CARD_template
-#define ENABLE_CARD_template 0
-#endif
-
-#include <linux/string.h>
-#include <linux/fs.h>
-
+#include "../include/can.h"
+#include "../include/can_sysdep.h"
#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;
+ const struct boardtype_t *brp;
- 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 can.o hw=pip5 irq=4 io=0x8000\n");
- return -ENODEV;
+ if ( (hw[0] == NULL) | (io[0] == -1) ) {
+ //CANMSG("You must supply your type of hardware, interrupt numbers and io address.\n");
+ CANMSG("Autodetection works only for USB devices, supply your type of hardware for PCI devices \n");
+ CANMSG("Example: # insmod lincan.ko hw=pip5 irq=4 io=0x8000\n");
+ //return -ENODEV;
}
while ( (hw[i] != NULL) && (i < MAX_HW_CARDS) ) {
- if ( !strcmp(hw[i],"pip5") && ENABLE_CARD_pip )
- irq_needed++;
- else if (!strcmp(hw[i],"pip6") && ENABLE_CARD_pip)
- irq_needed++;
- else if (!strcmp(hw[i],"smartcan") && ENABLE_CARD_smartcan)
- irq_needed++;
- else if (!strcmp(hw[i],"pccan-q") && ENABLE_CARD_pccan)
- irq_needed=irq_needed+4;
- else if (!strcmp(hw[i],"pccan-f") && ENABLE_CARD_pccan)
- irq_needed++;
- else if (!strcmp(hw[i],"pccan-s") && ENABLE_CARD_pccan)
- irq_needed++;
- else if (!strcmp(hw[i],"pccan-d") && ENABLE_CARD_pccan)
- irq_needed=irq_needed+2;
- else if (!strcmp(hw[i],"nsican") && ENABLE_CARD_nsi)
- irq_needed++;
- else if (!strcmp(hw[i],"cc104") && ENABLE_CARD_cc_can104)
- irq_needed++;
- else if (!strcmp(hw[i],"aim104") && ENABLE_CARD_aim104)
- irq_needed++;
- else if (!strcmp(hw[i],"pc-i03") && ENABLE_CARD_pc_i03)
- irq_needed++;
- else if (!strcmp(hw[i],"pcm3680") && ENABLE_CARD_pcm3680)
- irq_needed=irq_needed+2;
- else if (!strcmp(hw[i],"m437") && ENABLE_CARD_m437)
- irq_needed++;
- else if (!strcmp(hw[i],"pcccan") && ENABLE_CARD_pcccan)
- irq_needed++;
- else if (!strcmp(hw[i],"ssv") && ENABLE_CARD_ssv)
- irq_needed=irq_needed+2;
- 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 {
+ brp = boardtype_find(hw[i]);
+ if(!brp) {
CANMSG("Sorry, hardware \"%s\" is currently not supported.\n",hw[i]);
return -EINVAL;
}
+ irq_needed += brp->irqnum;
i++;
}
/* Check wether the supplied number of io addresses is correct. */
io_needed=i;
- while ( (io[io_supplied] != -1) & (io_supplied<MAX_HW_CARDS) )
+ while ( (io[io_supplied] != -1) & (io_supplied<MAX_HW_CARDS) )
io_supplied++;
if (io_needed != io_supplied) {
CANMSG("Invalid number of io addresses.\n");
while ( (irq[irq_supplied] != -1) & (irq_supplied<MAX_IRQ) )
irq_supplied++;
while ( (hw[j] != NULL) && (j<MAX_HW_CARDS) ) {
- if (!strcmp(hw[j],"template") && ENABLE_CARD_template)
+ if (!strcmp(hw[j],"template"))
irq_needed = irq_supplied;
j++;
}
if (minor[0] != -1) {
minor_needed=irq_needed;
while ((minor[minor_supplied] != -1) & (minor_supplied<MAX_IRQ))
- minor_supplied++;
+ minor_supplied++;
if (minor_supplied != minor_needed) {
CANMSG("Invalid number of minor numbers.\n");
CANMSG("Supplied hardware needs %d minor number(s).\n",minor_needed);