📄 config.c
字号:
cs->tqueue.sync = 0; cs->tqueue.data = cs; skb_queue_head_init(&cs->rq); skb_queue_head_init(&cs->sq); init_bcstate(cs, 0); init_bcstate(cs, 1); ret = init_card(cs); if (ret) { closecard(cardnr); restore_flags(flags); return (0); } init_tei(cs, cs->protocol); CallcNewChan(cs); /* ISAR needs firmware download first */ if (!test_bit(HW_ISAR, &cs->HW_Flags)) ll_run(cs, 0); restore_flags(flags); return (1);}void __devinitHiSax_shiftcards(int idx){ int i; for (i = idx; i < (HISAX_MAX_CARDS - 1); i++) memcpy(&cards[i], &cards[i + 1], sizeof(cards[i]));}int __devinitHiSax_inithardware(int *busy_flag){ int foundcards = 0; int i = 0; int t = ','; int flg = 0; char *id; char *next_id = HiSax_id; char ids[20]; if (strchr(HiSax_id, ',')) t = ','; else if (strchr(HiSax_id, '%')) t = '%'; while (i < nrcards) { if (cards[i].typ < 1) break; id = next_id; if ((next_id = strchr(id, t))) { *next_id++ = 0; strcpy(ids, id); flg = i + 1; } else { next_id = id; if (flg >= i) strcpy(ids, id); else sprintf(ids, "%s%d", id, i); } if (checkcard(i, ids, busy_flag)) { foundcards++; i++; } else { printk(KERN_WARNING "HiSax: Card %s not installed !\n", CardType[cards[i].typ]); if (cards[i].cs) kfree((void *) cards[i].cs); cards[i].cs = NULL; HiSax_shiftcards(i); nrcards--; } } return foundcards;}voidHiSax_closecard(int cardnr){ int i,last=nrcards - 1; if (cardnr>last) return; if (cards[cardnr].cs) { ll_stop(cards[cardnr].cs); release_tei(cards[cardnr].cs); CallcFreeChan(cards[cardnr].cs); closecard(cardnr); if (cards[cardnr].cs->irq) free_irq(cards[cardnr].cs->irq, cards[cardnr].cs); kfree((void *) cards[cardnr].cs); cards[cardnr].cs = NULL; } i = cardnr; while (i!=last) { cards[i] = cards[i+1]; i++; } nrcards--;}voidHiSax_reportcard(int cardnr, int sel){ struct IsdnCardState *cs = cards[cardnr].cs; printk(KERN_DEBUG "HiSax: reportcard No %d\n", cardnr + 1); printk(KERN_DEBUG "HiSax: Type %s\n", CardType[cs->typ]); printk(KERN_DEBUG "HiSax: debuglevel %x\n", cs->debug); printk(KERN_DEBUG "HiSax: HiSax_reportcard address 0x%lX\n", (ulong) & HiSax_reportcard); printk(KERN_DEBUG "HiSax: cs 0x%lX\n", (ulong) cs); printk(KERN_DEBUG "HiSax: HW_Flags %lx bc0 flg %lx bc1 flg %lx\n", cs->HW_Flags, cs->bcs[0].Flag, cs->bcs[1].Flag); printk(KERN_DEBUG "HiSax: bcs 0 mode %d ch%d\n", cs->bcs[0].mode, cs->bcs[0].channel); printk(KERN_DEBUG "HiSax: bcs 1 mode %d ch%d\n", cs->bcs[1].mode, cs->bcs[1].channel);#ifdef ERROR_STATISTIC printk(KERN_DEBUG "HiSax: dc errors(rx,crc,tx) %d,%d,%d\n", cs->err_rx, cs->err_crc, cs->err_tx); printk(KERN_DEBUG "HiSax: bc0 errors(inv,rdo,crc,tx) %d,%d,%d,%d\n", cs->bcs[0].err_inv, cs->bcs[0].err_rdo, cs->bcs[0].err_crc, cs->bcs[0].err_tx); printk(KERN_DEBUG "HiSax: bc1 errors(inv,rdo,crc,tx) %d,%d,%d,%d\n", cs->bcs[1].err_inv, cs->bcs[1].err_rdo, cs->bcs[1].err_crc, cs->bcs[1].err_tx); if (sel == 99) { cs->err_rx = 0; cs->err_crc = 0; cs->err_tx = 0; cs->bcs[0].err_inv = 0; cs->bcs[0].err_rdo = 0; cs->bcs[0].err_crc = 0; cs->bcs[0].err_tx = 0; cs->bcs[1].err_inv = 0; cs->bcs[1].err_rdo = 0; cs->bcs[1].err_crc = 0; cs->bcs[1].err_tx = 0; }#endif}int __initHiSax_init(void){ int i,j; int nzproto = 0; HiSaxVersion(); CallcNew(); Isdnl3New(); Isdnl2New(); TeiNew(); Isdnl1New();#ifdef MODULE if (!type[0]) { /* We 'll register drivers later, but init basic functions*/ return 0; }#ifdef CONFIG_HISAX_ELSA if (type[0] == ISDN_CTYPE_ELSA_PCMCIA) { /* we have exported and return in this case */ return 0; }#endif#ifdef CONFIG_HISAX_SEDLBAUER if (type[0] == ISDN_CTYPE_SEDLBAUER_PCMCIA) { /* we have to export and return in this case */ return 0; }#endif#ifdef CONFIG_HISAX_AVM_A1_PCMCIA if (type[0] == ISDN_CTYPE_A1_PCMCIA) { /* we have to export and return in this case */ return 0; }#endif#ifdef CONFIG_HISAX_HFC_SX if (type[0] == ISDN_CTYPE_HFC_SP_PCMCIA) { /* we have to export and return in this case */ return 0; }#endif#endif nrcards = 0;#ifdef MODULE if (id) /* If id= string used */ HiSax_id = id; for (i = j = 0; j < HISAX_MAX_CARDS; i++) { cards[j].typ = type[i]; if (protocol[i]) { cards[j].protocol = protocol[i]; nzproto++; } switch (type[i]) { case ISDN_CTYPE_16_0: cards[j].para[0] = irq[i]; cards[j].para[1] = mem[i]; cards[j].para[2] = io[i]; break; case ISDN_CTYPE_8_0: cards[j].para[0] = irq[i]; cards[j].para[1] = mem[i]; break;#ifdef IO0_IO1 case ISDN_CTYPE_PNP: case ISDN_CTYPE_NICCY: cards[j].para[0] = irq[i]; cards[j].para[1] = io0[i]; cards[j].para[2] = io1[i]; break; case ISDN_CTYPE_COMPAQ_ISA: cards[j].para[0] = irq[i]; cards[j].para[1] = io0[i]; cards[j].para[2] = io1[i]; cards[j].para[3] = io[i]; break;#endif case ISDN_CTYPE_ELSA: case ISDN_CTYPE_HFC_PCI: cards[j].para[0] = io[i]; break; case ISDN_CTYPE_16_3: case ISDN_CTYPE_TELESPCMCIA: case ISDN_CTYPE_A1: case ISDN_CTYPE_A1_PCMCIA: case ISDN_CTYPE_ELSA_PNP: case ISDN_CTYPE_ELSA_PCMCIA: case ISDN_CTYPE_IX1MICROR2: case ISDN_CTYPE_DIEHLDIVA: case ISDN_CTYPE_ASUSCOM: case ISDN_CTYPE_TELEINT: case ISDN_CTYPE_SEDLBAUER: case ISDN_CTYPE_SEDLBAUER_PCMCIA: case ISDN_CTYPE_SEDLBAUER_FAX: case ISDN_CTYPE_SPORTSTER: case ISDN_CTYPE_MIC: case ISDN_CTYPE_TELES3C: case ISDN_CTYPE_ACERP10: case ISDN_CTYPE_S0BOX: case ISDN_CTYPE_FRITZPCI: case ISDN_CTYPE_HSTSAPHIR: case ISDN_CTYPE_GAZEL: case ISDN_CTYPE_HFC_SX: case ISDN_CTYPE_HFC_SP_PCMCIA: cards[j].para[0] = irq[i]; cards[j].para[1] = io[i]; break; case ISDN_CTYPE_ISURF: cards[j].para[0] = irq[i]; cards[j].para[1] = io[i]; cards[j].para[2] = mem[i]; break; case ISDN_CTYPE_ELSA_PCI: case ISDN_CTYPE_NETJET_S: case ISDN_CTYPE_AMD7930: case ISDN_CTYPE_TELESPCI: case ISDN_CTYPE_W6692: case ISDN_CTYPE_NETJET_U: break; case ISDN_CTYPE_BKM_A4T: break; case ISDN_CTYPE_SCT_QUADRO: if (irq[i]) { cards[j].para[0] = irq[i]; } else { /* QUADRO is a 4 BRI card */ cards[j++].para[0] = 1; cards[j].typ = ISDN_CTYPE_SCT_QUADRO; cards[j].protocol = protocol[i]; cards[j++].para[0] = 2; cards[j].typ = ISDN_CTYPE_SCT_QUADRO; cards[j].protocol = protocol[i]; cards[j++].para[0] = 3; cards[j].typ = ISDN_CTYPE_SCT_QUADRO; cards[j].protocol = protocol[i]; cards[j].para[0] = 4; } break; } j++; } if (!nzproto) { printk(KERN_WARNING "HiSax: Warning - no protocol specified\n"); printk(KERN_WARNING "HiSax: using protocol %s\n", DEFAULT_PROTO_NAME); }#endif if (!HiSax_id) HiSax_id = HiSaxID; if (!HiSaxID[0]) strcpy(HiSaxID, "HiSax"); for (i = 0; i < HISAX_MAX_CARDS; i++) if (cards[i].typ > 0) nrcards++; printk(KERN_DEBUG "HiSax: Total %d card%s defined\n", nrcards, (nrcards > 1) ? "s" : ""); if (HiSax_inithardware(NULL)) { /* Install only, if at least one card found */ return (0); } else { Isdnl1Free(); TeiFree(); Isdnl2Free(); Isdnl3Free(); CallcFree(); return -EIO; }}#ifdef MODULEint init_module(void) { return HiSax_init(); }voidcleanup_module(void){ int cardnr = nrcards -1; long flags; save_flags(flags); cli(); while(cardnr>=0) HiSax_closecard(cardnr--); Isdnl1Free(); TeiFree(); Isdnl2Free(); Isdnl3Free(); CallcFree(); restore_flags(flags); printk(KERN_INFO "HiSax module removed\n");}#endif#ifdef CONFIG_HISAX_ELSAint elsa_init_pcmcia(void *pcm_iob, int pcm_irq, int *busy_flag, int prot){#ifdef MODULE int i; nrcards = 0; /* Initialize all structs, even though we only accept two pcmcia cards */ for (i = 0; i < HISAX_MAX_CARDS; i++) { cards[i].para[0] = irq[i]; cards[i].para[1] = io[i]; cards[i].typ = type[i]; if (protocol[i]) { cards[i].protocol = protocol[i]; } } cards[0].para[0] = pcm_irq; cards[0].para[1] = (int)pcm_iob; cards[0].protocol = prot; cards[0].typ = ISDN_CTYPE_ELSA_PCMCIA; if (!HiSax_id) HiSax_id = HiSaxID; if (!HiSaxID[0]) strcpy(HiSaxID, "HiSax"); for (i = 0; i < HISAX_MAX_CARDS; i++) if (cards[i].typ > 0) nrcards++; printk(KERN_DEBUG "HiSax: Total %d card%s defined\n", nrcards, (nrcards > 1) ? "s" : ""); HiSax_inithardware(busy_flag); printk(KERN_NOTICE "HiSax: module installed\n");#endif return (0);}#endif#ifdef CONFIG_HISAX_HFC_SXint hfc_init_pcmcia(void *pcm_iob, int pcm_irq, int *busy_flag, int prot){#ifdef MODULE int i; int nzproto = 0; nrcards = 0; /* Initialize all structs, even though we only accept two pcmcia cards */ for (i = 0; i < HISAX_MAX_CARDS; i++) { cards[i].para[0] = irq[i]; cards[i].para[1] = io[i]; cards[i].typ = type[i]; if (protocol[i]) { cards[i].protocol = protocol[i]; nzproto++; } } cards[0].para[0] = pcm_irq; cards[0].para[1] = (int)pcm_iob; cards[0].protocol = prot; cards[0].typ = ISDN_CTYPE_HFC_SP_PCMCIA; nzproto = 1; if (!HiSax_id) HiSax_id = HiSaxID; if (!HiSaxID[0]) strcpy(HiSaxID, "HiSax"); for (i = 0; i < HISAX_MAX_CARDS; i++) if (cards[i].typ > 0) nrcards++; printk(KERN_DEBUG "HiSax: Total %d card%s defined\n", nrcards, (nrcards > 1) ? "s" : ""); HiSax_inithardware(busy_flag); printk(KERN_NOTICE "HiSax: module installed\n");#endif return (0);}#endif#ifdef CONFIG_HISAX_SEDLBAUERint sedl_init_pcmcia(void *pcm_iob, int pcm_irq, int *busy_flag, int prot){#ifdef MODULE int i; int nzproto = 0; nrcards = 0; /* Initialize all structs, even though we only accept two pcmcia cards */ for (i = 0; i < HISAX_MAX_CARDS; i++) { cards[i].para[0] = irq[i]; cards[i].para[1] = io[i]; cards[i].typ = type[i]; if (protocol[i]) { cards[i].protocol = protocol[i]; nzproto++; } } cards[0].para[0] = pcm_irq; cards[0].para[1] = (int)pcm_iob; cards[0].protocol = prot; cards[0].typ = ISDN_CTYPE_SEDLBAUER_PCMCIA; nzproto = 1; if (!HiSax_id) HiSax_id = HiSaxID; if (!HiSaxID[0]) strcpy(HiSaxID, "HiSax"); for (i = 0; i < HISAX_MAX_CARDS; i++) if (cards[i].typ > 0) nrcards++; printk(KERN_DEBUG "HiSax: Total %d card%s defined\n", nrcards, (nrcards > 1) ? "s" : ""); HiSax_inithardware(busy_flag); printk(KERN_NOTICE "HiSax: module installed\n");#endif return (0);}#endif#ifdef CONFIG_HISAX_AVM_A1_PCMCIAint avm_a1_init_pcmcia(void *pcm_iob, int pcm_irq, int *busy_flag, int prot){#ifdef MODULE int i; int nzproto = 0; nrcards = 0; /* Initialize all structs, even though we only accept two pcmcia cards */ for (i = 0; i < HISAX_MAX_CARDS; i++) { cards[i].para[0] = irq[i]; cards[i].para[1] = io[i]; cards[i].typ = type[i]; if (protocol[i]) { cards[i].protocol = protocol[i]; nzproto++; } } cards[0].para[0] = pcm_irq; cards[0].para[1] = (int)pcm_iob; cards[0].protocol = prot; cards[0].typ = ISDN_CTYPE_A1_PCMCIA; nzproto = 1; if (!HiSax_id) HiSax_id = HiSaxID; if (!HiSaxID[0]) strcpy(HiSaxID, "HiSax"); for (i = 0; i < HISAX_MAX_CARDS; i++) if (cards[i].typ > 0) nrcards++; printk(KERN_DEBUG "HiSax: Total %d card%s defined\n", nrcards, (nrcards > 1) ? "s" : ""); HiSax_inithardware(busy_flag); printk(KERN_NOTICE "HiSax: module installed\n");#endif return (0);}#endifint __devinit hisax_init_pcmcia(void *pcm_iob, int *busy_flag, struct IsdnCard *card){ u_char ids[16]; int ret = -1; cards[nrcards] = *card; if (nrcards) sprintf(ids, "HiSax%d", nrcards); else sprintf(ids, "HiSax"); if (!checkcard(nrcards, ids, busy_flag)) { return(-1); } ret = nrcards; nrcards++; return (ret);}static struct pci_device_id hisax_pci_tbl[] __initdata = {#ifdef CONFIG_HISAX_FRTIZPCI {PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_FRITZ, PCI_ANY_ID, PCI_ANY_ID},#endif#ifdef CONFIG_HISAX_DIEHLDIVA {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA20, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA20_U, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA201, PCI_ANY_ID, PCI_ANY_ID},#endif#ifdef CONFIG_HISAX_ELSA {PCI_VENDOR_ID_ELSA, PCI_DEVICE_ID_ELSA_MICROLINK, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_ELSA, PCI_DEVICE_ID_ELSA_QS3000, PCI_ANY_ID, PCI_ANY_ID},#endif#ifdef CONFIG_HISAX_GAZEL {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_R685, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_R753, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_DJINN_ITOO, PCI_ANY_ID, PCI_ANY_ID},#endif#ifdef CONFIG_HISAX_QUADRO {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, PCI_ANY_ID, PCI_ANY_ID},#endif#ifdef CONFIG_HISAX_NICCY {PCI_VENDOR_ID_SATSAGEM, PCI_DEVICE_ID_SATSAGEM_NICCY, PCI_ANY_ID,PCI_ANY_ID},#endif#ifdef CONFIG_HISAX_SEDLBAUER {PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100, PCI_ANY_ID,PCI_ANY_ID},#endif#if defined(CONFIG_HISAX_NETJET) || defined(CONFIG_HISAX_NETJET_U) {PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_300, PCI_ANY_ID,PCI_ANY_ID},#endif#if defined(CONFIG_HISAX_TELESPCI) || defined(CONFIG_HISAX_SCT_QUADRO) {PCI_VENDOR_ID_ZORAN, PCI_DEVICE_ID_ZORAN_36120, PCI_ANY_ID,PCI_ANY_ID},#endif#ifdef CONFIG_HISAX_W6692 {PCI_VENDOR_ID_DYNALINK, PCI_DEVICE_ID_DYNALINK_IS64PH, PCI_ANY_ID,PCI_ANY_ID}, {PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_6692, PCI_ANY_ID,PCI_ANY_ID},#endif#ifdef CONFIG_HISAX_HFC_PCI {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_2BD0, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B000, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B006, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B007, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B008, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B009, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00A, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00B, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00C, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B100, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_ABOCOM, PCI_DEVICE_ID_ABOCOM_2BD1, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_ASUSTEK, PCI_DEVICE_ID_ASUSTEK_0675, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_T_CONCEPT, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_A1T, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_ANIGMA, PCI_DEVICE_ID_ANIGMA_MC145575, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_ZOLTRIX, PCI_DEVICE_ID_ZOLTRIX_2BD0, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_E, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_E, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_A, PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_A, PCI_ANY_ID, PCI_ANY_ID},#endif { } /* Terminating entry */};MODULE_DEVICE_TABLE(pci, hisax_pci_tbl);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -