Beispiel #1
0
static int
Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{
	u_int irq_flag = I4L_IRQ_FLAG;

	switch (mt) {
		case CARD_RESET:
			reset_diva(cs);
			return(0);
		case CARD_RELEASE:
			release_io_diva(cs);
			return(0);
		case CARD_SETIRQ:
			if (cs->subtyp == DIVA_PCI)
				irq_flag |= SA_SHIRQ;
			if (cs->subtyp == DIVA_IPAC_ISA) {
				return(request_irq(cs->irq, &diva_interrupt_ipac,
						irq_flag, "HiSax", cs));
			} else {
				return(request_irq(cs->irq, &diva_interrupt,
						irq_flag, "HiSax", cs));
			}
		case CARD_INIT:
			inithscxisac(cs, 3);
			return(0);
		case CARD_TEST:
			return(0);
		case (MDL_REMOVE | REQUEST):
			cs->hw.diva.status = 0;
			break;
		case (MDL_ASSIGN | REQUEST):
			cs->hw.diva.status |= DIVA_ASSIGN;
			break;
		case MDL_INFO_SETUP:
			if ((long)arg)
				cs->hw.diva.status |=  0x0200;
			else
				cs->hw.diva.status |=  0x0100;
			break;
		case MDL_INFO_CONN:
			if ((long)arg)
				cs->hw.diva.status |=  0x2000;
			else
				cs->hw.diva.status |=  0x1000;
			break;
		case MDL_INFO_REL:
			if ((long)arg) {
				cs->hw.diva.status &=  ~0x2000;
				cs->hw.diva.status &=  ~0x0200;
			} else {
				cs->hw.diva.status &=  ~0x1000;
				cs->hw.diva.status &=  ~0x0100;
			}
			break;
	}
	if (cs->subtyp != DIVA_IPAC_ISA)
		diva_led_handler(cs);
	return(0);
}
Beispiel #2
0
Datei: diva.c Projekt: nhanh0/hah
static int
Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{
	u_int *ireg;

	switch (mt) {
		case CARD_RESET:
			reset_diva(cs);
			return(0);
		case CARD_RELEASE:
			release_io_diva(cs);
			return(0);
		case CARD_INIT:
			if (cs->subtyp == DIVA_IPAC_PCI) {
				ireg = (unsigned int *)cs->hw.diva.pci_cfg;
				*ireg = PITA_INT0_ENABLE;
			}
			inithscxisac(cs, 3);
			return(0);
		case CARD_TEST:
			return(0);
		case (MDL_REMOVE | REQUEST):
			cs->hw.diva.status = 0;
			break;
		case (MDL_ASSIGN | REQUEST):
			cs->hw.diva.status |= DIVA_ASSIGN;
			break;
		case MDL_INFO_SETUP:
			if ((long)arg)
				cs->hw.diva.status |=  0x0200;
			else
				cs->hw.diva.status |=  0x0100;
			break;
		case MDL_INFO_CONN:
			if ((long)arg)
				cs->hw.diva.status |=  0x2000;
			else
				cs->hw.diva.status |=  0x1000;
			break;
		case MDL_INFO_REL:
			if ((long)arg) {
				cs->hw.diva.status &=  ~0x2000;
				cs->hw.diva.status &=  ~0x0200;
			} else {
				cs->hw.diva.status &=  ~0x1000;
				cs->hw.diva.status &=  ~0x0100;
			}
			break;
	}
	if ((cs->subtyp != DIVA_IPAC_ISA) && (cs->subtyp != DIVA_IPAC_PCI))
		diva_led_handler(cs);
	return(0);
}
Beispiel #3
0
static int
Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{
	u_int *ireg;
	u_long flags;

	switch (mt) {
	case CARD_RESET:
		spin_lock_irqsave(&cs->lock, flags);
		reset_diva(cs);
		spin_unlock_irqrestore(&cs->lock, flags);
		return (0);
	case CARD_RELEASE:
		release_io_diva(cs);
		return (0);
	case CARD_INIT:
		spin_lock_irqsave(&cs->lock, flags);
		reset_diva(cs);
		if (cs->subtyp == DIVA_IPACX_PCI) {
			ireg = (unsigned int *)cs->hw.diva.pci_cfg;
			*ireg = PITA_INT0_ENABLE;
			init_ipacx(cs, 3); // init chip and enable interrupts
			spin_unlock_irqrestore(&cs->lock, flags);
			return (0);
		}
		if (cs->subtyp == DIVA_IPAC_PCI) {
			ireg = (unsigned int *)cs->hw.diva.pci_cfg;
			*ireg = PITA_INT0_ENABLE;
		}
		inithscxisac(cs, 3);
		spin_unlock_irqrestore(&cs->lock, flags);
		return (0);
	case CARD_TEST:
		return (0);
	case (MDL_REMOVE | REQUEST):
		cs->hw.diva.status = 0;
		break;
	case (MDL_ASSIGN | REQUEST):
		cs->hw.diva.status |= DIVA_ASSIGN;
		break;
	case MDL_INFO_SETUP:
		if ((long)arg)
			cs->hw.diva.status |=  0x0200;
		else
			cs->hw.diva.status |=  0x0100;
		break;
	case MDL_INFO_CONN:
		if ((long)arg)
			cs->hw.diva.status |=  0x2000;
		else
			cs->hw.diva.status |=  0x1000;
		break;
	case MDL_INFO_REL:
		if ((long)arg) {
			cs->hw.diva.status &=  ~0x2000;
			cs->hw.diva.status &=  ~0x0200;
		} else {
			cs->hw.diva.status &=  ~0x1000;
			cs->hw.diva.status &=  ~0x0100;
		}
		break;
	}
	if ((cs->subtyp != DIVA_IPAC_ISA) &&
	    (cs->subtyp != DIVA_IPAC_PCI) &&
	    (cs->subtyp != DIVA_IPACX_PCI)) {
		spin_lock_irqsave(&cs->lock, flags);
		diva_led_handler(cs);
		spin_unlock_irqrestore(&cs->lock, flags);
	}
	return (0);
}