Beispiel #1
0
void ForwMachine::connect_FWT(TalkConnection * tcCaller)
{
    /** FWT : This is the method in which we take the connection to both
     * clients and send each character received from one side to the other
     * side. This allows to pass a firewall for instance. */
    message("-- connect_FWT : Waiting for connection from Answerer (%s)", answ_user);
    if (tcAnsw->accept())
    {
        message("-- connect_FWT : Trying to connect to Caller (%s)",caller_username);
        if (tcCaller->connect())
        {
            message("-- connect_FWT : Connected to caller (%s)", caller_username);
            message("-- connect_FWT : Connected to both. Let's go");
            int socktC = tcCaller->get_sockt();
            int socktA = tcAnsw->get_sockt();
            int max_sockt = (socktC>socktA) ? socktC : socktA;
            unsigned char buf[BUFSIZ];
            fd_set read_mask;
            int nb;
            int nbtot = 0;
            for (;;) {
                FD_ZERO(&read_mask);
                FD_SET(socktA, &read_mask); // wait on both connections
                FD_SET(socktC, &read_mask);
                nb = select(max_sockt+1, &read_mask, NULL, NULL, NULL); // no timeout
                if (nb <= 0) {
                    if (errno == EINTR) {
                        continue;
                    }
                    /* panic, we don't know what happened */
                    TalkConnection::p_error("Unexpected error from select");
                }
                if (FD_ISSET(socktA, &read_mask)) {
                    /* There is data on sockt A */
                    nb = transmit_chars(socktA, socktC, buf);
                    if (nb==0) return ;
                }
                if (FD_ISSET(socktC, &read_mask)) {
                    /* There is data on sockt C */
                    nb = transmit_chars(socktC, socktA, buf);
                    if (nb==0) return ;
                    nbtot += nb;
                    if (nbtot == 3) // just after the 3 edit chars
                    {
                        struct hostent * hp = gethostbyaddr((char *)&caller_machine_addr,
                                                            sizeof (struct in_addr), AF_INET);
                        if (hp != (struct hostent *)0) {
                            // Write first line for answerer.
                            // i18n() missing
                            sprintf((char *)buf, "Speaking to %s@%s\n", caller_username, hp->h_name);
                            write(socktA, (char *)buf, strlen((char *)buf));
                        } else message("-- ERROR : Unable to resolve caller_machine_addr !");
                    }
                }
            } // for
        } else syslog(LOG_ERR,"-- FWT : Caller connected, but not answerer !");
    } else syslog(LOG_ERR,"-- FWT : Caller did not connect !");
}
Beispiel #2
0
static void sci_tx_interrupt(int irq, void *dev_id, struct pt_regs * regs)
{
	int ch;
	for(ch=0;ch<NR_PORTS;ch++)
		if(rs_table[ch].irq+2==irq)
			transmit_chars(&rs_table[ch]);
}
void rs_interrupt(int irq, void * dev_id, struct pt_regs * regs)
{
	char status;

	struct cnxt_serial * info = &uart_info;
  	struct uart_regs *uart = uart_info.uart;
  	
	status = (uart->iir & 0x0f); /* only concerned w/ lower nibble */
	
	if (status == ISR_Tx_Rdy_Source) {
		transmit_chars(info);
	}
	if ((status == ISR_Rx_Rdy_Source) ||
            (status == ISR_Rx_Rdy_TO_Src )){
		receive_chars(info,status);
	}
	#if 0
		if(!info->use_ints){
			serialpoll.data = (void *)&sp_uart_info;		
			queue_task_irq_off(&serialpoll, &tq_timer);
		}
	#endif


	return;
}
Beispiel #4
0
/**
 * serial_omap_irq() - This handles the interrupt from one port
 * @irq: uart port irq number
 * @dev_id: uart port info
 */
static inline irqreturn_t serial_omap_irq(int irq, void *dev_id)
{
	struct uart_omap_port *up = dev_id;
	unsigned int iir, lsr;
	unsigned long flags;

	iir = serial_in(up, UART_IIR);
	if (iir & UART_IIR_NO_INT)
		return IRQ_NONE;

	spin_lock_irqsave(&up->port.lock, flags);
	lsr = serial_in(up, UART_LSR);
	if (iir & UART_IIR_RLSI) {
		if (!up->use_dma) {
			if (lsr & UART_LSR_DR)
				receive_chars(up, &lsr);
		} else {
			up->ier &= ~(UART_IER_RDI | UART_IER_RLSI);
			serial_out(up, UART_IER, up->ier);
			if ((serial_omap_start_rxdma(up) != 0) &&
					(lsr & UART_LSR_DR))
				receive_chars(up, &lsr);
		}
	}

	check_modem_status(up);
	if ((lsr & UART_LSR_THRE) && (iir & UART_IIR_THRI))
		transmit_chars(up);

	spin_unlock_irqrestore(&up->port.lock, flags);
	up->port_activity = jiffies;
	return IRQ_HANDLED;
}
Beispiel #5
0
kern_return_t
serial_write_reply(char *handle, kern_return_t return_code,
        char *data,  unsigned int data_count)
{
	struct async_struct *info = (struct async_struct *) handle;

	info->write_busy = FALSE;

	if (info->tty == NULL) 	 /* Lost tty.. */
		return KERN_SUCCESS;

	/* TODO -- maybe handle errors some how? */
	if (return_code != KERN_SUCCESS) {
		MACH3_DEBUG(1, return_code,
			("serial_write_reply failed: %d", return_code));
	} else {
		info->xmit_tail += data_count;
		info->xmit_tail &= SERIAL_XMIT_SIZE-1;
		info->xmit_cnt -= data_count;
	}

	transmit_chars(info);	/* Transmit next block .. */

	return KERN_SUCCESS;
}
/*
 * This is the serial driver's generic interrupt routine
 */
irqreturn_t rs_interrupt(int irq, void *dev_id)
{
	struct m68k_serial *info = dev_id;
	struct tty_struct *tty = tty_port_tty_get(&info->tport);
	m68328_uart *uart;
	unsigned short rx;
	unsigned short tx;

	uart = &uart_addr[info->line];
	rx = uart->urx.w;

#ifdef USE_INTS
	tx = uart->utx.w;

	if (rx & URX_DATA_READY)
		receive_chars(info, rx);
	if (tx & UTX_TX_AVAIL)
		transmit_chars(info, tty);
#else
	receive_chars(info, rx);
#endif
	tty_kref_put(tty);

	return IRQ_HANDLED;
}
static int rs_write(struct tty_struct * tty,
		    const unsigned char *buf, int count)
{
	struct serial_state *info = tty->driver_data;
	int	c, ret = 0;
	unsigned long flags;

	if (!info->xmit.buf)
		return 0;

	local_irq_save(flags);
	while (1) {
		c = CIRC_SPACE_TO_END(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
		if (count < c)
			c = count;
		if (c <= 0) {
			break;
		}
		memcpy(info->xmit.buf + info->xmit.head, buf, c);
		info->xmit.head = ((info->xmit.head + c) &
				   (SERIAL_XMIT_SIZE-1));
		buf += c;
		count -= c;
		ret += c;
	}
	local_irq_restore(flags);
	/*
	 * Hey, we transmit directly from here in our case
	 */
	if (CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE) &&
			!tty->stopped && !tty->hw_stopped)
		transmit_chars(tty, info, NULL);

	return ret;
}
Beispiel #8
0
static void rs_interrupt_elsa(struct IsdnCardState *cs)
{
	int status, iir, msr;
	int pass_counter = 0;
	
#ifdef SERIAL_DEBUG_INTR
;
#endif

	do {
		status = serial_inp(cs, UART_LSR);
		debugl1(cs,"rs LSR %02x", status);
#ifdef SERIAL_DEBUG_INTR
;
#endif
		if (status & UART_LSR_DR)
			receive_chars(cs, &status);
		if (status & UART_LSR_THRE)
			transmit_chars(cs, NULL);
		if (pass_counter++ > RS_ISR_PASS_LIMIT) {
;
			break;
		}
		iir = serial_inp(cs, UART_IIR);
		debugl1(cs,"rs IIR %02x", iir);
		if ((iir & 0xf) == 0) {
			msr = serial_inp(cs, UART_MSR);
			debugl1(cs,"rs MSR %02x", msr);
		}
	} while (!(iir & UART_IIR_NO_INT));
#ifdef SERIAL_DEBUG_INTR
;
#endif
}
/*
 * This handles the interrupt from one port.
 */
static inline irqreturn_t serial_omap_irq(int irq, void *dev_id)
{
	struct uart_omap_port *up = dev_id;
	unsigned int iir, lsr;

	iir = serial_in(up, UART_IIR);
	if (iir & UART_IIR_NO_INT)
		return IRQ_NONE;
	lsr = serial_in(up, UART_LSR);
	if ((iir & 0x4) && up->use_dma) {
		up->ier &= ~UART_IER_RDI;
		serial_out(up, UART_IER, up->ier);
		serial_omap_start_rxdma(up);
	}
	else if (lsr & UART_LSR_DR) {
		receive_chars(up, &lsr);
	}
	check_modem_status(up);
	if ((lsr & UART_LSR_THRE) && (iir & 0x2)) {
		transmit_chars(up);
	}
	isr8250_activity = jiffies;

	return IRQ_HANDLED;
}
Beispiel #10
0
/*
 * This is the serial driver's generic interrupt routine
 */
static irqreturn_t am_uart_interrupt(int irq, void *dev, struct pt_regs *regs)
{
    struct am_uart_port *info=(struct am_uart_port *)dev;
    am_uart_t *uart = NULL;
    struct tty_struct *tty = NULL;

    if (!info)
        goto out;

    tty = info->port.state->port.tty;
    if (!tty)
    {
        goto out;
    }

    uart = uart_addr[info->line];
    if (!uart)
        goto out;

    if (!(readl(&uart->status) & UART_RXEMPTY)){

        receive_chars(info, 0, readl(&uart->rdata));
    }

    if ((readl(&uart->mode) & UART_TXENB)&&!(readl(&uart->status) & UART_TXFULL)) {
        transmit_chars(info);
    }
out:
    am_uart_sched_event(info, 0);
    return IRQ_HANDLED;

}
Beispiel #11
0
/*
 * This is the serial driver's generic interrupt routine
 */
void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs)
{
    struct m68k_serial * info;
    m68328_uart *uart;
    unsigned short rx;
#ifdef USE_INTS
    unsigned short tx;
#endif

    info = IRQ_ports[irq];
    if(!info)
        return;

    uart = &uart_addr[info->line];
    rx = uart->urx.w;

#ifdef USE_INTS
    tx = uart->utx.w;

    if (rx & URX_DATA_READY) receive_chars(info, regs, rx);
    if (tx & UTX_TX_AVAIL)   transmit_chars(info);
#else
    receive_chars(info, regs, rx);
#endif
    return;
}
Beispiel #12
0
/*
 * This handles the interrupt from one port.
 */
static inline irqreturn_t serial_omap_irq(int irq, void *dev_id)
{
	struct uart_omap_port *up = dev_id;
	unsigned int iir, lsr;

	iir = serial_in(up, UART_IIR);
	if (iir & UART_IIR_NO_INT)
		return IRQ_NONE;
	lsr = serial_in(up, UART_LSR);
	if ((iir & 0x4) && up->use_dma) {
		up->ier &= ~UART_IER_RDI;
		serial_out(up, UART_IER, up->ier);
		serial_omap_start_rxdma(up);
	} else if (lsr & UART_LSR_DR) {
		receive_chars(up, &lsr);
		/* XXX: After driver resume optimization, lower this */
		wake_lock_timeout(&omap_serial_wakelock, (HZ * 1));
	}
	check_modem_status(up);
	if ((lsr & UART_LSR_THRE) && (iir & 0x2))
		transmit_chars(up);
	isr8250_activity = jiffies;

	return IRQ_HANDLED;
}
Beispiel #13
0
/**
 * serial_omap_irq() - This handles the interrupt from one port
 * @irq: uart port irq number
 * @dev_id: uart port info
 */
static irqreturn_t serial_omap_irq(int irq, void *dev_id)
{
	struct uart_omap_port *up = dev_id;
	struct tty_struct *tty = up->port.state->port.tty;
	unsigned int iir, lsr;
	unsigned int type;
	irqreturn_t ret = IRQ_NONE;
	int max_count = 256;

	spin_lock(&up->port.lock);
	pm_runtime_get_sync(up->dev);

	do {
		iir = serial_in(up, UART_IIR);
		if (iir & UART_IIR_NO_INT)
			break;

		ret = IRQ_HANDLED;
		lsr = serial_in(up, UART_LSR);

		/* extract IRQ type from IIR register */
		type = iir & 0x3e;

		switch (type) {
		case UART_IIR_MSI:
			check_modem_status(up);
			break;
		case UART_IIR_THRI:
			transmit_chars(up, lsr);
			break;
		case UART_IIR_RX_TIMEOUT:
			/* FALLTHROUGH */
		case UART_IIR_RDI:
			serial_omap_rdi(up, lsr);
			break;
		case UART_IIR_RLSI:
			serial_omap_rlsi(up, lsr);
			break;
		case UART_IIR_CTS_RTS_DSR:
			/* simply try again */
			break;
		case UART_IIR_XOFF:
			/* FALLTHROUGH */
		default:
			break;
		}
	} while (!(iir & UART_IIR_NO_INT) && max_count--);

	spin_unlock(&up->port.lock);

	tty_flip_buffer_push(tty);

	pm_runtime_mark_last_busy(up->dev);
	pm_runtime_put_autosuspend(up->dev);
	up->port_activity = jiffies;

	return ret;
}
static irqreturn_t
dpram_irq_tx(int irq, void *dev_id)
{

	dprintk("dpram_irq_tx\n");
	dpram_ack1();
	transmit_chars(dev_id);
	return IRQ_HANDLED;
}
Beispiel #15
0
/*
 * This is the serial driver's generic interrupt routine
 */
void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs)
{
	struct LEON_serial * info = &LEON_soft;
	unsigned int stat = leon->uartstatus1;

	if (stat & USTAT_DR) receive_chars(info, regs, stat);
	if (stat & USTAT_TH) transmit_chars(info);
	return;
}
Beispiel #16
0
/* static void rs_360_interrupt(void *dev_id) */ /* until and if we start servicing irqs here */
static void rs_360_interrupt(int vec, void *dev_id)
{
	u_char	events;
	int	idx;
	ser_info_t *info;
	volatile struct smc_regs *smcp;
	volatile struct scc_regs *sccp;
	
	info = dev_id;

	idx = PORT_NUM(info->state->smc_scc_num);
	if (info->state->smc_scc_num & NUM_IS_SCC) {
		sccp = &pquicc->scc_regs[idx];
		events = sccp->scc_scce;
		if (events & SCCM_RX)
			receive_chars(info);
		if (events & SCCM_TX)
			transmit_chars(info);
		sccp->scc_scce = events;
	} else {
		smcp = &pquicc->smc_regs[idx];
		events = smcp->smc_smce;
		if (events & SMCM_BRKE)
			receive_break(info);
		if (events & SMCM_RX)
			receive_chars(info);
		if (events & SMCM_TX)
			transmit_chars(info);
		smcp->smc_smce = events;
	}
	
#ifdef SERIAL_DEBUG_INTR
	printk("rs_interrupt_single(%d, %x)...",
					info->state->smc_scc_num, events);
#endif
#ifdef modem_control
	check_modem_status(info);
#endif
	info->last_active = jiffies;
#ifdef SERIAL_DEBUG_INTR
	printk("end.\n");
#endif
}
Beispiel #17
0
/*
 * This handles the interrupt from one port.
 */
static inline void m32r_sio_handle_port(struct uart_sio_port *up,
	unsigned int status)
{
	pr_debug("status = %x...\n", status);

	if (status & 0x04)
		receive_chars(up, &status);
	if (status & 0x01)
		transmit_chars(up);
}
static void rs_flush_chars(struct tty_struct *tty)
{
	struct serial_state *info = tty->driver_data;

	if (info->xmit.head == info->xmit.tail || tty->stopped ||
			tty->hw_stopped || !info->xmit.buf)
		return;

	transmit_chars(tty, info, NULL);
}
/*
 * This is the serial driver's generic interrupt routine
 */
void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs)
{
	struct NIOS_serial * info = (struct NIOS_serial *) dev_id;
	np_uart *	uart= (np_uart *)(info->port);
	unsigned short stat = uart->np_uartstatus;
	uart->np_uartstatus = 0;		/* clear any error status */

	if (stat & np_uartstatus_rrdy_mask) receive_chars(info, regs, stat);
	if (stat & np_uartstatus_trdy_mask) transmit_chars(info);
	return;
}
/**
 * serial_omap_irq() - This handles the interrupt from one port
 * @irq: uart port irq number
 * @dev_id: uart port info
 */
static inline irqreturn_t serial_omap_irq(int irq, void *dev_id)
{
	struct uart_omap_port *up = dev_id;
	unsigned int iir, lsr;
	unsigned long flags;

	spin_lock_irqsave(&up->port.lock, flags);
#ifdef CONFIG_PM
	/*
	 * This will enable the clock for some reason if the
	 * clocks get disabled. This would enable the ICK also
	 * in case if the Idle state is set and the PRCM modul
	 * just shutdown the ICK because of inactivity.
	 */
	omap_uart_enable_clock_from_irq(up->pdev->id);
#endif

	iir = serial_in(up, UART_IIR);
	if (iir & UART_IIR_NO_INT) {
		spin_unlock_irqrestore(&up->port.lock, flags);
		return IRQ_NONE;
	}

	lsr = serial_in(up, UART_LSR);
	if (iir & UART_IIR_RLSI) {
		if (!up->use_dma) {
			if (lsr & UART_LSR_DR) {
				receive_chars(up, &lsr);
				if (omap_is_console_port(&up->port) &&
						(up->plat_hold_wakelock)) {
					spin_unlock(&up->port.lock);
					up->plat_hold_wakelock(up, WAKELK_IRQ);
					spin_lock(&up->port.lock);
				}
			}
		} else {
			up->ier &= ~UART_IER_RDI;
			serial_out(up, UART_IER, up->ier);
			if (serial_omap_start_rxdma(up) != 0)
				if (lsr & UART_LSR_DR)
					receive_chars(up, &lsr);
		}
	}

	check_modem_status(up);
	if ((lsr & UART_LSR_THRE) && (iir & UART_IIR_THRI))
		transmit_chars(up);

	spin_unlock_irqrestore(&up->port.lock, flags);
	up->port_activity = jiffies;
	return IRQ_HANDLED;
}
/*
 * This function is used to send a high-priority XON/XOFF character to
 * the device
 */
static void rs_send_xchar(struct tty_struct *tty, char ch)
{
	struct serial_state *info = tty->driver_data;

	info->x_char = ch;
	if (ch) {
		/*
		 * I guess we could call console->write() directly but
		 * let's do that for now.
		 */
		transmit_chars(tty, info, NULL);
	}
}
Beispiel #22
0
/*
 * This handles the interrupt from one port.
 */
static inline void
serial8250_handle_port(struct uart_8250_port *up, struct pt_regs *regs)
{
	unsigned int status = serial_inp(up, UART_LSR);

	DEBUG_INTR("status = %x...", status);

	if (status & UART_LSR_DR)
		receive_chars(up, &status, regs);
	check_modem_status(up);
	if (status & UART_LSR_THRE)
		transmit_chars(up);
}
Beispiel #23
0
/*
 * This is the serial driver's generic interrupt routine
 */
irqreturn_t mcfrs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
	struct mcf_serial	*info;
	unsigned char		isr;

	info = &mcfrs_table[(irq - IRQBASE)];
	isr = info->addr[MCFUART_UISR] & info->imr;

	if (isr & MCFUART_UIR_RXREADY)
		receive_chars(info);
	if (isr & MCFUART_UIR_TXREADY)
		transmit_chars(info);
	return IRQ_HANDLED;
}
/**
 * serial_omap_irq() - This handles the interrupt from one port
 * @irq: uart port irq number
 * @dev_id: uart port info
 */
static inline irqreturn_t serial_omap_irq(int irq, void *dev_id)
{
	struct uart_omap_port *up = dev_id;
	unsigned int iir, lsr;
	unsigned int int_id;
	unsigned long flags;
	int ret = IRQ_HANDLED;
	u8 tx_fifo_lvl;

	serial_omap_port_enable(up);
	iir = serial_in(up, UART_IIR);
	if (iir & UART_IIR_NO_INT) {
		serial_omap_port_disable(up);
		return IRQ_NONE;
	}

	int_id = iir & UART_OMAP_IIR_ID;

	spin_lock_irqsave(&up->port.lock, flags);
	lsr = serial_in(up, UART_LSR);
	if (int_id == UART_IIR_RDI || int_id == UART_OMAP_IIR_RX_TIMEOUT ||
	    int_id == UART_IIR_RLSI) {
		if (!up->use_dma) {
			if (lsr & UART_LSR_DR)
				receive_chars(up, &lsr);
		} else {
			up->ier &= ~(UART_IER_RDI | UART_IER_RLSI);
			serial_out(up, UART_IER, up->ier);
			if ((serial_omap_start_rxdma(up) != 0) &&
					(lsr & UART_LSR_DR))
				receive_chars(up, &lsr);
		}
	}

	check_modem_status(up);
	if (int_id == UART_IIR_THRI) {
		tx_fifo_lvl = serial_in(up, UART_OMAP_TXFIFO_LVL);
		if (lsr & UART_LSR_THRE || tx_fifo_lvl < up->port.fifosize)
			transmit_chars(up, tx_fifo_lvl);
		else
			ret = IRQ_NONE;
	}

	spin_unlock_irqrestore(&up->port.lock, flags);
	serial_omap_port_disable(up);

	up->port_activity = jiffies;
	return ret;
}
static irqreturn_t sc26xx_interrupt(int irq, void *dev_id)
{
	struct uart_sc26xx_port *up = dev_id;
	unsigned long flags;
	bool push;
	u8 isr;

	spin_lock_irqsave(&up->port[0].lock, flags);

	push = false;
	isr = READ_SC(&up->port[0], ISR);
	if (isr & ISR_TXRDYA)
	    transmit_chars(&up->port[0]);
	if (isr & ISR_RXRDYA)
	    push = receive_chars(&up->port[0]);

	spin_unlock(&up->port[0].lock);

	if (push)
		tty_flip_buffer_push(&up->port[0].state->port);

	spin_lock(&up->port[1].lock);

	push = false;
	if (isr & ISR_TXRDYB)
	    transmit_chars(&up->port[1]);
	if (isr & ISR_RXRDYB)
	    push = receive_chars(&up->port[1]);

	spin_unlock_irqrestore(&up->port[1].lock, flags);

	if (push)
		tty_flip_buffer_push(&up->port[1].state->port);

	return IRQ_HANDLED;
}
static irqreturn_t sc26xx_interrupt(int irq, void *dev_id)
{
	struct uart_sc26xx_port *up = dev_id;
	struct tty_struct *tty;
	unsigned long flags;
	u8 isr;

	spin_lock_irqsave(&up->port[0].lock, flags);

	tty = NULL;
	isr = READ_SC(&up->port[0], ISR);
	if (isr & ISR_TXRDYA)
	    transmit_chars(&up->port[0]);
	if (isr & ISR_RXRDYA)
	    tty = receive_chars(&up->port[0]);

	spin_unlock(&up->port[0].lock);

	if (tty)
		tty_flip_buffer_push(tty);

	spin_lock(&up->port[1].lock);

	tty = NULL;
	if (isr & ISR_TXRDYB)
	    transmit_chars(&up->port[1]);
	if (isr & ISR_RXRDYB)
	    tty = receive_chars(&up->port[1]);

	spin_unlock_irqrestore(&up->port[1].lock, flags);

	if (tty)
		tty_flip_buffer_push(tty);

	return IRQ_HANDLED;
}
/*
 * ------------------------------------------------------------
 * dz_interrupt ()
 *
 * this is the main interrupt routine for the DZ chip.
 * It deals with the multiple ports.
 * ------------------------------------------------------------
 */
static void dz_interrupt(int irq, void *dev, struct pt_regs *regs)
{
	struct dz_serial *info;
	unsigned short status;

	/* get the reason why we just got an irq */
	status = dz_in((struct dz_serial *) dev, DZ_CSR);
	info = lines[LINE(status)];	/* re-arrange info the proper port */

	if (status & DZ_RDONE)
		receive_chars(info);	/* the receive function */

	if (status & DZ_TRDY)
		transmit_chars(info);
}
Beispiel #28
0
/*
 * This handles the interrupt from one port.
 */
static inline irqreturn_t serial_pxa_irq(int irq, void *dev_id)
{
	struct uart_pxa_port *up = dev_id;
	unsigned int iir, lsr;

	iir = serial_in(up, UART_IIR);
	if (iir & UART_IIR_NO_INT)
		return IRQ_NONE;
	lsr = serial_in(up, UART_LSR);
	if (lsr & UART_LSR_DR)
		receive_chars(up, &lsr);
	check_modem_status(up);
	if (lsr & UART_LSR_THRE)
		transmit_chars(up);
	return IRQ_HANDLED;
}
Beispiel #29
0
static void rs_flush_chars(struct tty_struct *tty)
{
	struct async_struct *info = (struct async_struct *)tty->driver_data;
	unsigned long flags;
				
	if (serial_paranoia_check(info, tty->device, "rs_flush_chars"))
		return;

	if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped ||
	    !info->xmit_buf)
		return;

	save_flags(flags); cli();
	transmit_chars(info);
	restore_flags(flags);
}
Beispiel #30
0
static irqreturn_t ser_tx_int(int irq, void *dev_id)
{
	struct serial_state *info = dev_id;

	if (custom.serdatr & SDR_TBE) {
#ifdef SERIAL_DEBUG_INTR
	  printk("ser_tx_int...");
#endif

	  if (!info->tport.tty)
		return IRQ_NONE;

	  transmit_chars(info);
#ifdef SERIAL_DEBUG_INTR
	  printk("end.\n");
#endif
	}
	return IRQ_HANDLED;
}