Exemplo n.º 1
0
/*
 * Returns the current TIOCM status bits including:
 *      SMD Signals (DTR/DSR, CTS/RTS, CD, RI)
 *      TIOCM_OUT1 - reset state (1=in reset)
 *      TIOCM_OUT2 - reset state updated (1=updated)
 */
static int smd_tty_tiocmget(struct tty_struct *tty)
{
	struct smd_tty_info *info = tty->driver_data;
	unsigned long flags;
	int tiocm;

	tiocm = smd_tiocmget(info->ch);

	spin_lock_irqsave(&info->reset_lock, flags);
	tiocm |= (info->in_reset ? TIOCM_OUT1 : 0);
	if (info->in_reset_updated) {
		tiocm |= TIOCM_OUT2;
		info->in_reset_updated = 0;
	}
	spin_unlock_irqrestore(&info->reset_lock, flags);

	return tiocm;
}
Exemplo n.º 2
0
/*
 * Returns the current TIOCM status bits including:
 *      SMD Signals (DTR/DSR, CTS/RTS, CD, RI)
 *      TIOCM_OUT1 - reset state (1=in reset)
 *      TIOCM_OUT2 - reset state updated (1=updated)
 */
static int smd_tty_tiocmget(struct tty_struct *tty)
{
	struct smd_tty_info *info = tty->driver_data;
	unsigned long flags;
	int tiocm;

	tiocm = smd_tiocmget(info->ch);

	spin_lock_irqsave(&info->reset_lock, flags);
	tiocm |= (info->in_reset ? TIOCM_OUT1 : 0);
	if (info->in_reset_updated) {
		tiocm |= TIOCM_OUT2;
		info->in_reset_updated = 0;
	}
	SMD_TTY_INFO("PID %u --> %s TIOCM is %x ",
			current->pid, __func__, tiocm);
	spin_unlock_irqrestore(&info->reset_lock, flags);

	return tiocm;
}
Exemplo n.º 3
0
static long smd_vt_ioctl(struct file *file,
		    unsigned int cmd,
		    unsigned long arg)
{
    int ret;

    // SMD bug fix. 0811
    if((smd_vt_devp->open_count == 0) ||( smd_vt_devp->ch == 0)) return -1;

    switch (cmd) {
        case TIOCMGET:
            ret = smd_tiocmget(smd_vt_devp->ch);
            break;
        case TIOCMSET:
            ret = smd_tiocmset(smd_vt_devp->ch, arg, ~arg);
            break;
        default:
            ret = -1;
    }

    return ret;
}
Exemplo n.º 4
0
static int smd_tty_tiocmget(struct tty_struct *tty, struct file *file)
{
	struct smd_tty_info *info = tty->driver_data;

	return smd_tiocmget(info->ch);
}