Exemplo n.º 1
0
static void __exit HiSax_exit(void)
{
	int cardnr = nrcards - 1;

	while (cardnr >= 0)
		HiSax_closecard(cardnr--);
	Isdnl1Free();
	TeiFree();
	Isdnl2Free();
	Isdnl3Free();
	CallcFree();
	printk(KERN_INFO "HiSax module removed\n");
}
Exemplo n.º 2
0
void
cleanup_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");
}
Exemplo n.º 3
0
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_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 */
	if (!HiSax_inithardware(NULL))
		return -ENODEV;
	return 0;

out_tei:
	TeiFree();
out_isdnl2:
	Isdnl2Free();
out_isdnl3:
	Isdnl3Free();
out_callc:
	CallcFree();
out:
	return retval;
}