📄 config.c
字号:
#if CARD_HFC_PCI case ISDN_CTYPE_HFC_PCI: ret = setup_hfcpci(card); break;#endif#if CARD_HFC_SX case ISDN_CTYPE_HFC_SX: ret = setup_hfcsx(card); break;#endif#if CARD_NICCY case ISDN_CTYPE_NICCY: ret = setup_niccy(card); break;#endif#if CARD_AMD7930 case ISDN_CTYPE_AMD7930: ret = setup_amd7930(card); break;#endif#if CARD_ISURF case ISDN_CTYPE_ISURF: ret = setup_isurf(card); break;#endif#if CARD_HSTSAPHIR case ISDN_CTYPE_HSTSAPHIR: ret = setup_saphir(card); break;#endif#if CARD_TESTEMU case ISDN_CTYPE_TESTEMU: ret = setup_testemu(card); break;#endif#if CARD_BKM_A4T case ISDN_CTYPE_BKM_A4T: ret = setup_bkm_a4t(card); break;#endif#if CARD_SCT_QUADRO case ISDN_CTYPE_SCT_QUADRO: ret = setup_sct_quadro(card); break;#endif#if CARD_GAZEL case ISDN_CTYPE_GAZEL: ret = setup_gazel(card); break;#endif#if CARD_W6692 case ISDN_CTYPE_W6692: ret = setup_w6692(card); break;#endif#if CARD_NETJET_U case ISDN_CTYPE_NETJET_U: ret = setup_netjet_u(card); break;#endif case ISDN_CTYPE_DYNAMIC: ret = 2; break; default: printk(KERN_WARNING "HiSax: Support for %s Card not selected\n", CardType[card->typ]); ll_unload(cs); goto outf_cs; } if (!ret) { ll_unload(cs); goto outf_cs; } if (!(cs->rcvbuf = kmalloc(MAX_DFRAME_LEN_L1, GFP_ATOMIC))) { printk(KERN_WARNING "HiSax: No memory for isac rcvbuf\n"); ll_unload(cs); goto outf_cs; } cs->rcvidx = 0; cs->tx_skb = NULL; cs->tx_cnt = 0; cs->event = 0; 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); /* init_card only handles interrupts which are not */ /* used here for the loadable driver */ switch (card->typ) { case ISDN_CTYPE_DYNAMIC: ret = 0; break; default: ret = init_card(cs); break; } if (ret) { closecard(cardnr); ret = 0; goto outf_cs; } init_tei(cs, cs->protocol); ret = CallcNewChan(cs); if (ret) { closecard(cardnr); ret = 0; goto outf_cs; } /* ISAR needs firmware download first */ if (!test_bit(HW_ISAR, &cs->HW_Flags)) ll_run(cs, 0); ret = 1; goto out; outf_dlog: kfree(cs->dlog); outf_cs: kfree(cs); card->cs = NULL; out: restore_flags(flags); return ret;}void __devinit HiSax_shiftcards(int idx){ int i; for (i = idx; i < (HISAX_MAX_CARDS - 1); i++) memcpy(&cards[i], &cards[i + 1], sizeof(cards[i]));}int __devinit HiSax_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]); HiSax_shiftcards(i); nrcards--; } } return foundcards;}void HiSax_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--;}void HiSax_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}static int __init HiSax_init(void){ int i, retval;#ifdef MODULE int j; int nzproto = 0;#endif HiSaxVersion(); retval = CallcNew(); if (retval) goto out; retval = Isdnl3New(); if (retval) goto out_callc; retval = Isdnl2New(); if (retval) goto out_isdnl3; retval = TeiNew(); if (retval) goto out_isdnl2; retval = Isdnl1New(); if (retval) goto out_tei;#ifdef MODULE if (!type[0]) { /* We 'll register drivers later, but init basic functions */ for (i = 0; i < HISAX_MAX_CARDS; i++) cards[i].typ = 0; 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++; } else { cards[j].protocol = DEFAULT_PROTO; } 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; /* we need to check if further cards can be added */ if (j < HISAX_MAX_CARDS) { cards[j].typ = ISDN_CTYPE_SCT_QUADRO; cards[j].protocol = protocol[i]; cards[j++].para[0] = 2; } if (j < HISAX_MAX_CARDS) { cards[j].typ = ISDN_CTYPE_SCT_QUADRO; cards[j].protocol = protocol[i]; cards[j++].para[0] = 3; } if (j < HISAX_MAX_CARDS) { 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" : ""); /* Install only, if at least one card found */ HiSax_inithardware(NULL); return 0; out_tei: TeiFree(); out_isdnl2: Isdnl2Free(); out_isdnl3: Isdnl3Free(); out_callc: CallcFree(); out: return retval;}static void __exit HiSax_exit(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");}#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]; } else { cards[i].protocol = DEFAULT_PROTO; } } 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; 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]; } else { cards[i].protocol = DEFAULT_PROTO; } } 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; if (!HiSax_id) HiSax_id = HiSaxID; if (!HiSaxID[0]) strcpy(HiSaxID, "HiSax");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -