コード例 #1
0
ファイル: isurf.c プロジェクト: robacklin/ts4700
static int
ISurf_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{
	u_long flags;

	switch (mt) {
		case CARD_RESET:
			spin_lock_irqsave(&cs->lock, flags);
			reset_isurf(cs, ISURF_RESET);
			spin_unlock_irqrestore(&cs->lock, flags);
			return(0);
		case CARD_RELEASE:
			release_io_isurf(cs);
			return(0);
		case CARD_INIT:
			spin_lock_irqsave(&cs->lock, flags);
			reset_isurf(cs, ISURF_RESET);
			clear_pending_isac_ints(cs);
			writeb(0, cs->hw.isurf.isar+ISAR_IRQBIT);mb();
			initisac(cs);
			initisar(cs);
			/* Reenable ISAC IRQ */
			cs->writeisac(cs, ISAC_MASK, 0);
			/* RESET Receiver and Transmitter */
			cs->writeisac(cs, ISAC_CMDR, 0x41);
			spin_unlock_irqrestore(&cs->lock, flags);
			return(0);
		case CARD_TEST:
			return(0);
	}
	return(0);
}
コード例 #2
0
ファイル: sedlbauer.c プロジェクト: TitaniumBoy/lin
static int
Sedl_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{
	switch (mt) {
		case CARD_RESET:
			reset_sedlbauer(cs);
			return(0);
		case CARD_RELEASE:
			if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) {
				writereg(cs->hw.sedl.adr, cs->hw.sedl.hscx,
					ISAR_IRQBIT, 0);
				writereg(cs->hw.sedl.adr, cs->hw.sedl.isac,
					ISAC_MASK, 0xFF);
				reset_sedlbauer(cs);
				writereg(cs->hw.sedl.adr, cs->hw.sedl.hscx,
					ISAR_IRQBIT, 0);
				writereg(cs->hw.sedl.adr, cs->hw.sedl.isac,
					ISAC_MASK, 0xFF);
			}
			release_io_sedlbauer(cs);
			return(0);
		case CARD_INIT:
			if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) {
				clear_pending_isac_ints(cs);
				writereg(cs->hw.sedl.adr, cs->hw.sedl.hscx,
					ISAR_IRQBIT, 0);
				initisac(cs);
				initisar(cs);
				/* Reenable all IRQ */
				cs->writeisac(cs, ISAC_MASK, 0);
				/* RESET Receiver and Transmitter */
				cs->writeisac(cs, ISAC_CMDR, 0x41);
			} else {
				inithscxisac(cs, 3);
			}
			return(0);
		case CARD_TEST:
			return(0);
		case MDL_INFO_CONN:
			if (cs->subtyp != SEDL_SPEEDFAX_PYRAMID)
				return(0);
			if ((long) arg)
				cs->hw.sedl.reset_off &= ~SEDL_ISAR_PCI_LED2;
			else
				cs->hw.sedl.reset_off &= ~SEDL_ISAR_PCI_LED1;
			byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off);
			break;
		case MDL_INFO_REL:
			if (cs->subtyp != SEDL_SPEEDFAX_PYRAMID)
				return(0);
			if ((long) arg)
				cs->hw.sedl.reset_off |= SEDL_ISAR_PCI_LED2;
			else
				cs->hw.sedl.reset_off |= SEDL_ISAR_PCI_LED1;
			byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off);
			break;
	}
	return(0);
}
コード例 #3
0
static int
Sedl_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{
	u_long flags;

	switch (mt) {
	case CARD_RESET:
		spin_lock_irqsave(&cs->lock, flags);
		reset_sedlbauer(cs);
		spin_unlock_irqrestore(&cs->lock, flags);
		return (0);
	case CARD_RELEASE:
		if (cs->hw.sedl.bus == SEDL_BUS_PCI)
			/*                 */
			byteout(cs->hw.sedl.cfg_reg + 5, 0);
		if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) {
			spin_lock_irqsave(&cs->lock, flags);
			writereg(cs->hw.sedl.adr, cs->hw.sedl.hscx,
				 ISAR_IRQBIT, 0);
			writereg(cs->hw.sedl.adr, cs->hw.sedl.isac,
				 ISAC_MASK, 0xFF);
			reset_sedlbauer(cs);
			writereg(cs->hw.sedl.adr, cs->hw.sedl.hscx,
				 ISAR_IRQBIT, 0);
			writereg(cs->hw.sedl.adr, cs->hw.sedl.isac,
				 ISAC_MASK, 0xFF);
			spin_unlock_irqrestore(&cs->lock, flags);
		}
		release_io_sedlbauer(cs);
		return (0);
	case CARD_INIT:
		spin_lock_irqsave(&cs->lock, flags);
		if (cs->hw.sedl.bus == SEDL_BUS_PCI)
			/*                */
			byteout(cs->hw.sedl.cfg_reg + 5, 0x02);
		reset_sedlbauer(cs);
		if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) {
			clear_pending_isac_ints(cs);
			writereg(cs->hw.sedl.adr, cs->hw.sedl.hscx,
				 ISAR_IRQBIT, 0);
			initisac(cs);
			initisar(cs);
			/*                  */
			cs->writeisac(cs, ISAC_MASK, 0);
			/*                                */
			cs->writeisac(cs, ISAC_CMDR, 0x41);
		} else {
			inithscxisac(cs, 3);
		}
		spin_unlock_irqrestore(&cs->lock, flags);
		return (0);
	case CARD_TEST:
		return (0);
	case MDL_INFO_CONN:
		if (cs->subtyp != SEDL_SPEEDFAX_PYRAMID)
			return (0);
		spin_lock_irqsave(&cs->lock, flags);
		if ((long) arg)
			cs->hw.sedl.reset_off &= ~SEDL_ISAR_PCI_LED2;
		else
			cs->hw.sedl.reset_off &= ~SEDL_ISAR_PCI_LED1;
		byteout(cs->hw.sedl.cfg_reg + 3, cs->hw.sedl.reset_off);
		spin_unlock_irqrestore(&cs->lock, flags);
		break;
	case MDL_INFO_REL:
		if (cs->subtyp != SEDL_SPEEDFAX_PYRAMID)
			return (0);
		spin_lock_irqsave(&cs->lock, flags);
		if ((long) arg)
			cs->hw.sedl.reset_off |= SEDL_ISAR_PCI_LED2;
		else
			cs->hw.sedl.reset_off |= SEDL_ISAR_PCI_LED1;
		byteout(cs->hw.sedl.cfg_reg + 3, cs->hw.sedl.reset_off);
		spin_unlock_irqrestore(&cs->lock, flags);
		break;
	}
	return (0);
}