Ejemplo n.º 1
0
__initfunc(static int check_midi(unsigned int iobase))
{
    unsigned long timeout;
    unsigned long flags;
    unsigned char b;

    if (iobase <= 0 || iobase > 0x1000-MIDI_EXTENT)
        return 0;
    if (check_region(iobase, MIDI_EXTENT))
        return 0;
    timeout = jiffies + (HZ / 100);
    while (inb(MIDI_STATUS(iobase)) & MIDI_WRITE_EMPTY)
        if ((signed)(jiffies - timeout) > 0)
            return 0;
    save_flags(flags);
    cli();
    outb(0xff, MIDI_DATA(iobase));
    b = inb(MIDI_STATUS(iobase));
    restore_flags(flags);
    if (!(b & MIDI_WRITE_EMPTY))
        return 0;
    while (inb(MIDI_STATUS(iobase)) & MIDI_WRITE_EMPTY)
        if ((signed)(jiffies - timeout) > 0)
            return 0;
    return 1;
}
Ejemplo n.º 2
0
static void output_status(struct hfmodem_state *dev, int ptt)
{
    int dcd = 0;

    ptt = !!ptt;
    if (dev->ptt_out.flags & SP_SER) {
        outb(dcd | (ptt << 1), UART_MCR(dev->ptt_out.seriobase));
        outb(0x40 & (-ptt), UART_LCR(dev->ptt_out.seriobase));
    }
    if (dev->ptt_out.flags & SP_PAR) {
        outb(ptt | (dcd << 1), LPT_DATA(dev->ptt_out.pariobase));
    }
    if (dev->ptt_out.flags & SP_MIDI && ptt) {
        outb(0, MIDI_DATA(dev->ptt_out.midiiobase));
    }
}
Ejemplo n.º 3
0
void sm_output_status(struct sm_state *sm)
{
	int invert_dcd = 0;
	int invert_ptt = 0;

	int ptt = /*hdlcdrv_ptt(&sm->hdrv)*/(sm->dma.ptt_cnt > 0) ^ invert_ptt;
	int dcd = (!!sm->hdrv.hdlcrx.dcd) ^ invert_dcd;

	if (sm->hdrv.ptt_out.flags & SP_SER) {
		outb(dcd | (ptt << 1), UART_MCR(sm->hdrv.ptt_out.seriobase));
		outb(0x40 & (-ptt), UART_LCR(sm->hdrv.ptt_out.seriobase));
	}
	if (sm->hdrv.ptt_out.flags & SP_PAR && sm->pardev && sm->pardev->port)
		parport_write_data(sm->pardev->port, ptt | (dcd << 1));
	if (sm->hdrv.ptt_out.flags & SP_MIDI && hdlcdrv_ptt(&sm->hdrv))
		outb(0, MIDI_DATA(sm->hdrv.ptt_out.midiiobase));
}