Exemplo n.º 1
0
static irqreturn_t ks8695uart_modem_status(int irq, void *dev_id)
{
	struct uart_port *port = dev_id;
	unsigned int status;

	/*
	 * clear modem interrupt by reading MSR
	 */
	status = UART_GET_MSR(port);

	if (status & URMS_URDDCD)
		uart_handle_dcd_change(port, status & URMS_URDDCD);

	if (status & URMS_URDDST)
		port->icount.dsr++;

	if (status & URMS_URDCTS)
		uart_handle_cts_change(port, status & URMS_URDCTS);

	if (status & URMS_URTERI)
		port->icount.rng++;

	wake_up_interruptible(&port->info->delta_msr_wait);

	return IRQ_HANDLED;
}
Exemplo n.º 2
0
static u_int ssauart_get_mctrl (struct uart_port *port)
{
#if 1

   return 0;

#else

   /*
      Note that reading the Modem Status Register clears the signal
      change indicators, so we will miss possible interrupts if this
      function is called with modem interrupts enabled... !!!
   */

   unsigned int status = UART_GET_MSR(port);
   unsigned int result = 0;

   printk ("ssauart_get_mctrl called (delta flags will get cleared !!)\n");

   if (status & MSR_DCD) result |= TIOCM_CAR;
   if (status & MSR_DSR) result |= TIOCM_DSR;
   if (status & MSR_CTS) result |= TIOCM_CTS;

   return (result);

#endif
}
Exemplo n.º 3
0
static void ssauart_modem_status (struct uart_port *port)
{
   /*
      MSR give the values of CTS, DSR, RI and DCD inputs as well as
      an indication of which have changed since the last time that
      the MSR register was read.

      ie there is no need to maintain our own copy of status to detect changes.
   */

   unsigned int status = UART_GET_MSR(port);                    /* reading MSR clears all MSR_DELTA_xxx flags */

   if ((status & (MSR_DELTA_CTS | MSR_DELTA_DCD | MSR_DELTA_DSR)) != 0)
   {
      if (status & MSR_DELTA_CTS)
         uart_handle_cts_change (port, (status & MSR_CTS));    /* pass new value to the change function */

      if (status & MSR_DELTA_DCD)
         uart_handle_dcd_change (port, (status & MSR_DCD));    /* pass new value to the change function */

      if (status & MSR_DELTA_DSR)
         port->icount.dsr++;

      wake_up_interruptible (&port->info->delta_msr_wait);
   }
   else
   {
      /*
         Shouldn't really happen..
         Must be a spurious edge on NRI (modem ring indicator ??)
      */
   }
}
static void ambauart_modem_status(struct uart_port *port)
{
	unsigned int status, delta;

#if DEBUG
       printk("ambauart_modem_status() called\n");
#endif

	/*
	 * clear modem interrupt by reading MSR
	 */
	status = UART_GET_MSR(port);

	delta = status & 0x0B;

	if (!delta)
		return;

	if (delta & KS8695_UART_MODEM_DDCD)
		uart_handle_dcd_change(port, status & KS8695_UART_MODEM_DDCD);

	if (delta & KS8695_UART_MODEM_DDSR)
		port->icount.dsr++;

	if (delta & KS8695_UART_MODEM_DCTS)
		uart_handle_cts_change(port, status & KS8695_UART_MODEM_DCTS);

	wake_up_interruptible(&port->info->delta_msr_wait);
}
Exemplo n.º 5
0
static void uart00_modem_status(struct uart_port *port)
{
	unsigned int status;
	struct uart_icount *icount = &port->icount;
	struct uart_info *info = port->info;

	status = UART_GET_MSR(port);

	if (!status & (UART_MSR_DCTS_MSK | UART_MSR_DDSR_MSK | 
		       UART_MSR_TERI_MSK | UART_MSR_DDCD_MSK))
		return;

	if (status & UART_MSR_DDCD_MSK) {
		icount->dcd++;
#ifdef CONFIG_HARD_PPS
		if ((port->flags & ASYNC_HARDPPS_CD) &&
		    (status & UART_MSR_DCD_MSK))
			hardpps();
#endif
		if (info->flags & ASYNC_CHECK_CD) {
			if (status & UART_MSR_DCD_MSK)
				wake_up_interruptible(&info->open_wait);
			else if (!((info->flags & ASYNC_CALLOUT_ACTIVE) &&
				   (port->flags & ASYNC_CALLOUT_NOHUP))) {
				if (info->tty)
					tty_hangup(info->tty);
			}
		}
	}

	if (status & UART_MSR_DDSR_MSK)
		icount->dsr++;

	if (status & UART_MSR_DCTS_MSK) {
		icount->cts++;

		if (info->flags & ASYNC_CTS_FLOW) {
			status &= UART_MSR_CTS_MSK;

			if (info->tty->hw_stopped) {
				if (status) {
					info->tty->hw_stopped = 0;
					port->ops->start_tx(port, 0);
					uart_write_wakeup(port);
				}
			} else {
				if (!status) {
					info->tty->hw_stopped = 1;
					port->ops->stop_tx(port, 0);
				}
			}
		}
	}
	wake_up_interruptible(&info->delta_msr_wait);

}
static u_int ambauart_get_mctrl(struct uart_port *port)
{
	unsigned int result = 0;
	unsigned int status;

	status = UART_GET_MSR(port);
	if (status & KS8695_UART_MODEM_DCD)
		result |= TIOCM_CAR;
	if (status & KS8695_UART_MODEM_DSR)
		result |= TIOCM_DSR;
	if (status & KS8695_UART_MODEM_CTS)
		result |= TIOCM_CTS;

	return result;
}
Exemplo n.º 7
0
static unsigned int uart00_get_mctrl(struct uart_port *port)
{
	unsigned int result = 0;
	unsigned int status;

	status = UART_GET_MSR(port);
	if (status & UART_MSR_DCD_MSK)
		result |= TIOCM_CAR;
	if (status & UART_MSR_DSR_MSK)
		result |= TIOCM_DSR;
	if (status & UART_MSR_CTS_MSK)
		result |= TIOCM_CTS;
	if (status & UART_MSR_RI_MSK)
		result |= TIOCM_RI;

	return result;
}
Exemplo n.º 8
0
static unsigned int ks8695uart_get_mctrl(struct uart_port *port)
{
	unsigned int result = 0;
	unsigned int status;

	status = UART_GET_MSR(port);
	if (status & URMS_URDCD)
		result |= TIOCM_CAR;
	if (status & URMS_URDSR)
		result |= TIOCM_DSR;
	if (status & URMS_URCTS)
		result |= TIOCM_CTS;
	if (status & URMS_URRI)
		result |= TIOCM_RI;

	return result;
}
Exemplo n.º 9
0
static void uart00_modem_status(struct uart_port *port)
{
	unsigned int status;

	status = UART_GET_MSR(port);

	if (!(status & (UART_MSR_DCTS_MSK | UART_MSR_DDSR_MSK | 
			UART_MSR_TERI_MSK | UART_MSR_DDCD_MSK)))
		return;

	if (status & UART_MSR_DDCD_MSK)
		uart_handle_dcd_change(port, status & UART_MSR_DCD_MSK);

	if (status & UART_MSR_DDSR_MSK)
		port->icount.dsr++;

	if (status & UART_MSR_DCTS_MSK)
		uart_handle_cts_change(port, status & UART_MSR_CTS_MSK);

	wake_up_interruptible(&port->info->delta_msr_wait);
}