]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/setup.c
Added initial support for "virtual" CAN interface
[lincan.git] / lincan / src / setup.c
index 88f04509bbd222e258998221b896dd2a4458bf08..49b43153994e672d3dd04fc5e16f7286f437d9e2 100644 (file)
 #include <linux/fs.h>
 #include <linux/ioport.h>
 
-#include ".supported_cards.h"
-
 #include "../include/main.h"
 #include "../include/devcommon.h"
 #include "../include/setup.h"
-#include "../include/pip.h"
-#include "../include/pccan.h"
-#include "../include/smartcan.h"
-#include "../include/pc-i03.h"
-#include "../include/pcm3680.h"
-#include "../include/m437.h"
-#include "../include/template.h"
-#include "../include/i82527.h"
-#include "../include/aim104.h"
-#include "../include/pcccan.h"
 
 extern int sja1000_register(struct chipspecops_t *chipspecops);
 extern int sja1000p_register(struct chipspecops_t *chipspecops);
 extern int i82527_register(struct chipspecops_t *chipspecops);
-extern int template_register(struct hwspecops_t *hwspecops);
-extern int pip5_register(struct hwspecops_t *hwspecops);
-extern int pip6_register(struct hwspecops_t *hwspecops);
-extern int smartcan_register(struct hwspecops_t *hwspecops);
-extern int pccanf_register(struct hwspecops_t *hwspecops);
-extern int pccand_register(struct hwspecops_t *hwspecops);
-extern int pccanq_register(struct hwspecops_t *hwspecops);
-extern int nsi_register(struct hwspecops_t *hwspecops);
-extern int cc104_register(struct hwspecops_t *hwspecops);
-extern int pci03_register(struct hwspecops_t *hwspecops);
-extern int pcm3680_register(struct hwspecops_t *hwspecops);
-extern int aim104_register(struct hwspecops_t *hwspecops);
-extern int pcccan_register(struct hwspecops_t *hwspecops);
-extern int ssv_register(struct hwspecops_t *hwspecops);
-extern int bfadcan_register(struct hwspecops_t *hwspecops);
-extern int pikronisa_register(struct hwspecops_t *hwspecops);
 
 int init_device_struct(int card);
 int init_hwspecops(struct candevice_t *candev);
@@ -242,6 +214,7 @@ int init_device_struct(int card)
        else
                if ( add_mem_to_list(candev->hwspecops) )
                        return -ENOMEM;
+       memset(candev->hwspecops, 0, sizeof(struct hwspecops_t));
 
        if (init_hwspecops(candev))
                return -ENODEV;
@@ -353,93 +326,22 @@ int init_obj_struct(struct candevice_t *candev, struct chip_t *hostchip, int min
 
 int init_hwspecops(struct candevice_t *candev)
 {
-       #ifdef ENABLE_CARD_template
-       if (!strcmp(candev->hwname,"template")) {
-               template_register(candev->hwspecops);
-       }
-       #endif
-       #ifdef ENABLE_CARD_pip
-       if (!strcmp(candev->hwname,"pip5")) {
-               pip5_register(candev->hwspecops);
-       }
-       else if (!strcmp(candev->hwname,"pip6")) {
-               pip6_register(candev->hwspecops);
-       }
-       #endif
-       #ifdef ENABLE_CARD_smartcan
-       if (!strcmp(candev->hwname,"smartcan")) {
-               smartcan_register(candev->hwspecops);
-       }
-       #endif
-       #ifdef ENABLE_CARD_nsi
-       if (!strcmp(candev->hwname,"nsican")) {
-               nsi_register(candev->hwspecops);
-       }
-       #endif
-       #ifdef ENABLE_CARD_cc_can104
-       if (!strcmp(candev->hwname,"cc104")) {
-               cc104_register(candev->hwspecops);
-       }
-       #endif
-       #ifdef ENABLE_CARD_aim104
-       if (!strcmp(candev->hwname,"aim104")) {
-               aim104_register(candev->hwspecops);
-       }
-       #endif
-       #ifdef ENABLE_CARD_pc_i03
-       if (!strcmp(candev->hwname,"pc-i03")) {
-               pci03_register(candev->hwspecops);
-       }
-       #endif
-       #ifdef ENABLE_CARD_pcm3680
-       if (!strcmp(candev->hwname,"pcm3680")) {
-               pcm3680_register(candev->hwspecops);
-       }
-       #endif
-       #ifdef ENABLE_CARD_pccan
-       if (!strcmp(candev->hwname,"pccan-f") |
-                !strcmp(candev->hwname,"pccan-s") ) {
-               pccanf_register(candev->hwspecops);
-       }
-       if (!strcmp(candev->hwname,"pccan-d")) {
-               pccand_register(candev->hwspecops);
-       }
-       if (!strcmp(candev->hwname,"pccan-q")) {
-               pccanq_register(candev->hwspecops);
-       }
-       #endif
-       #ifdef ENABLE_CARD_m437
-       if (!strcmp(candev->hwname,"m437")) {
-               m437_register(candev->hwspecops);
-       }
-       #endif
-       #ifdef ENABLE_CARD_pcccan
-       if (!strcmp(candev->hwname,"pcccan")) {
-               pcccan_register(candev->hwspecops);
-       }
-       #endif
-       #ifdef ENABLE_CARD_ssv
-       if (!strcmp(candev->hwname,"ssv")) {
-               ssv_register(candev->hwspecops);
-       }
-       #endif
-       #ifdef ENABLE_CARD_bfadcan
-       if (!strcmp(candev->hwname,"bfadcan")) {
-               bfadcan_register(candev->hwspecops);
-       }
-       #endif
-       #ifdef ENABLE_CARD_pikronisa
-       if (!strcmp(candev->hwname,"pikronisa")) {
-               pikronisa_register(candev->hwspecops);
+       const struct boardtype_t *brp;
+       
+       brp = boardtype_find(candev->hwname);
+       
+       if(!brp) {
+               CANMSG("Sorry, hardware \"%s\" is currently not supported.\n",candev->hwname);
+               return -EINVAL;
        }
-       #endif
+       
+       brp->board_register(candev->hwspecops);
+
        return 0;
 }
 
 int init_chipspecops(struct candevice_t *candev, int chipnr)
 {
-       candev->chip[chipnr]->max_objects=0;
-       
        if (!strcmp(candev->chip[chipnr]->chip_type,"i82527")) {
                candev->chip[chipnr]->max_objects=15;
                i82527_register(candev->chip[chipnr]->chipspecops);