Example #1
0
static void
elsa_test(struct IsdnCardState *cs)
{
	if ((cs->subtyp == ELSA_PCMCIA) ||
	    (cs->subtyp == ELSA_PCMCIA_IPAC) ||
	    (cs->subtyp == ELSA_QS1000PCI)) {
		return;
	} 
	if (cs->subtyp != ELSA_QS3000PCI) {
		cs->hw.elsa.counter = 0;
		cs->hw.elsa.ctrl_reg |= ELSA_ENA_TIMER_INT;
		cs->hw.elsa.status |= ELSA_TIMER_AKTIV;
		byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg);
		byteout(cs->hw.elsa.timer, 0);
		set_current_state(TASK_UNINTERRUPTIBLE);
		schedule_timeout((110*HZ)/1000);
		cs->hw.elsa.ctrl_reg &= ~ELSA_ENA_TIMER_INT;
		byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg);
		cs->hw.elsa.status &= ~ELSA_TIMER_AKTIV;
		printk(KERN_INFO "Elsa: %d timer tics in 110 msek\n",
		       cs->hw.elsa.counter);
		if ((cs->hw.elsa.counter > 10) &&
		    (cs->hw.elsa.counter < 16)) {
			printk(KERN_INFO "Elsa: timer and irq OK\n");
		} else {
			printk(KERN_WARNING
			       "Elsa: timer tic problem (%d/12) maybe an IRQ(%d) conflict\n",
			       cs->hw.elsa.counter, cs->irq);
		}
	}
#if ARCOFI_USE
	if (check_arcofi(cs)) {
		init_modem(cs);
	}
#endif
	elsa_led_handler(cs);
}
Example #2
0
static int
Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{
	int ret = 0;
	u_long flags;

	switch (mt) {
		case CARD_RESET:
			spin_lock_irqsave(&cs->lock, flags);
			reset_elsa(cs);
			spin_unlock_irqrestore(&cs->lock, flags);
			return(0);
		case CARD_RELEASE:
			release_io_elsa(cs);
			return(0);
		case CARD_INIT:
			spin_lock_irqsave(&cs->lock, flags);
			cs->debug |= L1_DEB_IPAC;
			reset_elsa(cs);
			inithscxisac(cs, 1);
			if ((cs->subtyp == ELSA_QS1000) ||
			    (cs->subtyp == ELSA_QS3000))
			{
				byteout(cs->hw.elsa.timer, 0);
			}
			if (cs->hw.elsa.trig)
				byteout(cs->hw.elsa.trig, 0xff);
			inithscxisac(cs, 2);
			spin_unlock_irqrestore(&cs->lock, flags);
			return(0);
		case CARD_TEST:
			if ((cs->subtyp == ELSA_PCMCIA) ||
				(cs->subtyp == ELSA_PCMCIA_IPAC) ||
				(cs->subtyp == ELSA_QS1000PCI)) {
				return(0);
			} else if (cs->subtyp == ELSA_QS3000PCI) {
				ret = 0;
			} else {
				spin_lock_irqsave(&cs->lock, flags);
				cs->hw.elsa.counter = 0;
				cs->hw.elsa.ctrl_reg |= ELSA_ENA_TIMER_INT;
				cs->hw.elsa.status |= ELSA_TIMER_AKTIV;
				byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg);
				byteout(cs->hw.elsa.timer, 0);
				spin_unlock_irqrestore(&cs->lock, flags);
				msleep(110);
				spin_lock_irqsave(&cs->lock, flags);
				cs->hw.elsa.ctrl_reg &= ~ELSA_ENA_TIMER_INT;
				byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg);
				cs->hw.elsa.status &= ~ELSA_TIMER_AKTIV;
				spin_unlock_irqrestore(&cs->lock, flags);
				printk(KERN_INFO "Elsa: %d timer tics in 110 msek\n",
				       cs->hw.elsa.counter);
				if ((cs->hw.elsa.counter > 10) &&
					(cs->hw.elsa.counter < 16)) {
					printk(KERN_INFO "Elsa: timer and irq OK\n");
					ret = 0;
				} else {
					printk(KERN_WARNING
					       "Elsa: timer tic problem (%d/12) maybe an IRQ(%d) conflict\n",
					       cs->hw.elsa.counter, cs->irq);
					ret = 1;
				}
			}
#if ARCOFI_USE
			if (check_arcofi(cs)) {
				init_modem(cs);
			}
#endif
			elsa_led_handler(cs);
			return(ret);
		case (MDL_REMOVE | REQUEST):
			cs->hw.elsa.status &= 0;
			break;
		case (MDL_ASSIGN | REQUEST):
			cs->hw.elsa.status |= ELSA_ASSIGN;
			break;
		case MDL_INFO_SETUP:
			if ((long) arg)
				cs->hw.elsa.status |= 0x0200;
			else
				cs->hw.elsa.status |= 0x0100;
			break;
		case MDL_INFO_CONN:
			if ((long) arg)
				cs->hw.elsa.status |= 0x2000;
			else
				cs->hw.elsa.status |= 0x1000;
			break;
		case MDL_INFO_REL:
			if ((long) arg) {
				cs->hw.elsa.status &= ~0x2000;
				cs->hw.elsa.status &= ~0x0200;
			} else {
				cs->hw.elsa.status &= ~0x1000;
				cs->hw.elsa.status &= ~0x0100;
			}
			break;
#if ARCOFI_USE
		case CARD_AUX_IND:
			if (cs->hw.elsa.MFlag) {
				int len;
				u_char *msg;

				if (!arg)
					return(0);
				msg = arg;
				len = *msg;
				msg++;
				modem_write_cmd(cs, msg, len);
			}
			break;
#endif
	}
	if (cs->typ == ISDN_CTYPE_ELSA) {
		int pwr = bytein(cs->hw.elsa.ale);
		if (pwr & 0x08)
			cs->hw.elsa.status |= ELSA_BAD_PWR;
		else
			cs->hw.elsa.status &= ~ELSA_BAD_PWR;
	}
	elsa_led_handler(cs);
	return(ret);
}