#ifdef CONFIG_OC_LINCAN_DETAILED_ERRORS
-static const char *sja1000_ecc_errc_str[]={
- "bit error",
- "form error",
- "stuff error",
- "other type of error"
-};
-
-static const char *sja1000_ecc_seg_str[]={
- "?0?",
- "?1?",
- "ID.28 to ID.21",
- "start of frame",
- "bit SRTR",
- "bit IDE",
- "ID.20 to ID.18",
- "ID.17 to ID.13",
- "CRC sequence",
- "reserved bit 0",
- "data field",
- "data length code",
- "bit RTR",
- "reserved bit 1",
- "ID.4 to ID.0",
- "ID.12 to ID.5",
- "?16?"
- "active error flag",
- "intermission",
- "tolerate dominant bits",
- "?20?",
- "?21?",
- "passive error flag",
- "error delimiter",
- "CRC delimiter",
- "acknowledge slot",
- "end of frame",
- "acknowledge delimiter",
- "overload flag",
- "?29?",
- "?30?",
- "?31?"
-};
+// static const char *sja1000_ecc_errc_str[]={
+// "bit error",
+// "form error",
+// "stuff error",
+// "other type of error"
+// };
+//
+// static const char *sja1000_ecc_seg_str[]={
+// "?0?",
+// "?1?",
+// "ID.28 to ID.21",
+// "start of frame",
+// "bit SRTR",
+// "bit IDE",
+// "ID.20 to ID.18",
+// "ID.17 to ID.13",
+// "CRC sequence",
+// "reserved bit 0",
+// "data field",
+// "data length code",
+// "bit RTR",
+// "reserved bit 1",
+// "ID.4 to ID.0",
+// "ID.12 to ID.5",
+// "?16?"
+// "active error flag",
+// "intermission",
+// "tolerate dominant bits",
+// "?20?",
+// "?21?",
+// "passive error flag",
+// "error delimiter",
+// "CRC delimiter",
+// "acknowledge slot",
+// "end of frame",
+// "acknowledge delimiter",
+// "overload flag",
+// "?29?",
+// "?30?",
+// "?31?"
+// };
#endif /*CONFIG_OC_LINCAN_DETAILED_ERRORS*/
{"nsicanpci", nsi_canpci_register, 1},
#endif
#if defined(CONFIG_OC_LINCAN_CARD_usbcan)
- {"nsicanpci", usbcan_register, 0},
+ {"usbcan", usbcan_register, 0},
#endif
{NULL}
};
struct candevice_t* register_usbdev(const char *hwname,void *anydev){
- int i=0, j, board;
+ int i=0, j, board=0;
struct candevice_t *candev;
struct canchip_t *chip;
struct boardtype_t *brp;
while ( (hw[board] != NULL) && (board < MAX_HW_CARDS) )
board++;
+ if (board>=MAX_HW_CARDS){
+ CANMSG("Maximum number of devices has been reached, no space for new device");
+ return NULL;
+ }
brp = boardtype_find(hwname);
if(!brp) {
CANMSG("Sorry, hardware \"%s\" is currently not supported.\n",hw[board]);
const struct boardtype_t *brp;
if ( (hw[0] == NULL) | (io[0] == -1) ) {
- CANMSG("You must supply your type of hardware, interrupt numbers and io address.\n");
+ //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 can.o hw=pip5 irq=4 io=0x8000\n");
- return -ENODEV;
+ //return -ENODEV;
}
while ( (hw[i] != NULL) && (i < MAX_HW_CARDS) ) {
/* 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");
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);
return 0;
}
-static int sja1000_report_error_limit_counter;
+// static int sja1000_report_error_limit_counter;
static void sja1000_report_error(struct canchip_t *chip,
unsigned sr, unsigned ir, unsigned ecc)
if (test_bit(USBCAN_ERROR,&dev->flags)){
CANMSG("URB error %d\n",retval);
- break;
+ clear_bit(USBCAN_ERROR,&dev->flags);
}
{ /* Normal work to do */
err("Out of memory");
goto error;
}
+ memset(dev, 0, sizeof(struct usbcan_usb));
sema_init(&dev->limit_sem, WRITES_IN_FLIGHT);
spin_lock_init(&dev->err_lock);
int minor = interface->minor;
dev = usb_get_intfdata(interface);
+ if (!dev)
+ return;
usb_set_intfdata(interface, NULL);
/* prevent more I/O from starting */