您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ tty_port_tty_get函数代码示例

51自学网 2021-06-03 09:00:29
  C++
这篇教程C++ tty_port_tty_get函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中tty_port_tty_get函数的典型用法代码示例。如果您正苦于以下问题:C++ tty_port_tty_get函数的具体用法?C++ tty_port_tty_get怎么用?C++ tty_port_tty_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了tty_port_tty_get函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: acm_reset_resume

static int acm_reset_resume(struct usb_interface *intf){	struct acm *acm = usb_get_intfdata(intf);	struct tty_struct *tty;	mutex_lock(&acm->mutex);	if (acm->port.count) {		tty = tty_port_tty_get(&acm->port);		if (tty) {			tty_hangup(tty);			tty_kref_put(tty);		}	}	mutex_unlock(&acm->mutex);	return acm_resume(intf);}
开发者ID:RepoBackups,项目名称:bricked-pyramid-3.0,代码行数:16,


示例2: acm_process_read_urb

static void acm_process_read_urb(struct acm *acm, struct urb *urb){	struct tty_struct *tty;	if (!urb->actual_length)		return;	tty = tty_port_tty_get(&acm->port);	if (!tty)		return;	tty_insert_flip_string(tty, urb->transfer_buffer, urb->actual_length);	tty_flip_buffer_push(tty);	tty_kref_put(tty);}
开发者ID:RepoBackups,项目名称:bricked-pyramid-3.0,代码行数:16,


示例3: ssu100_process_read_urb

static void ssu100_process_read_urb(struct urb *urb){	struct usb_serial_port *port = urb->context;	struct tty_struct *tty;	int count;	tty = tty_port_tty_get(&port->port);	if (!tty)		return;	count = ssu100_process_packet(urb, tty);	if (count)		tty_flip_buffer_push(tty);	tty_kref_put(tty);}
开发者ID:AllenDou,项目名称:linux,代码行数:16,


示例4: kobil_read_int_callback

static void kobil_read_int_callback(struct urb *urb){    int result;    struct usb_serial_port *port = urb->context;    struct tty_struct *tty;    unsigned char *data = urb->transfer_buffer;    int status = urb->status;    /*	char *dbg_data; */    dbg("%s - port %d", __func__, port->number);    if (status) {        dbg("%s - port %d Read int status not zero: %d",            __func__, port->number, status);        return;    }    tty = tty_port_tty_get(&port->port);    if (urb->actual_length) {        /* BEGIN DEBUG */        /*          dbg_data = kzalloc((3 *  purb->actual_length + 10)        				* sizeof(char), GFP_KERNEL);          if (! dbg_data) {        	  return;          }          for (i = 0; i < purb->actual_length; i++) {        	  sprintf(dbg_data +3*i, "%02X ", data[i]);          }          dbg(" <-- %s", dbg_data);          kfree(dbg_data);        */        /* END DEBUG */        tty_buffer_request_room(tty, urb->actual_length);        tty_insert_flip_string(tty, data, urb->actual_length);        tty_flip_buffer_push(tty);    }    tty_kref_put(tty);    /* someone sets the dev to 0 if the close method has been called */    port->interrupt_in_urb->dev = port->serial->dev;    result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);    dbg("%s - port %d Send read URB returns: %i",        __func__, port->number, result);}
开发者ID:KroMignon,项目名称:linux-emcraft,代码行数:47,


示例5: pl2303_update_line_status

static void pl2303_update_line_status(struct usb_serial_port *port,				      unsigned char *data,				      unsigned int actual_length){	struct pl2303_private *priv = usb_get_serial_port_data(port);	struct tty_struct *tty;	unsigned long flags;	u8 status_idx = UART_STATE;	u8 length = UART_STATE + 1;	u8 prev_line_status;	u16 idv, idp;	idv = le16_to_cpu(port->serial->dev->descriptor.idVendor);	idp = le16_to_cpu(port->serial->dev->descriptor.idProduct);	if (idv == SIEMENS_VENDOR_ID) {		if (idp == SIEMENS_PRODUCT_ID_X65 ||		    idp == SIEMENS_PRODUCT_ID_SX1 ||		    idp == SIEMENS_PRODUCT_ID_X75) {			length = 1;			status_idx = 0;		}	}	if (actual_length < length)		return;	/* Save off the uart status for others to look at */	spin_lock_irqsave(&priv->lock, flags);	prev_line_status = priv->line_status;	priv->line_status = data[status_idx];	spin_unlock_irqrestore(&priv->lock, flags);	if (priv->line_status & UART_BREAK_ERROR)		usb_serial_handle_break(port);	wake_up_interruptible(&port->port.delta_msr_wait);	tty = tty_port_tty_get(&port->port);	if (!tty)		return;	if ((priv->line_status ^ prev_line_status) & UART_DCD)		usb_serial_handle_dcd_change(port, tty,				priv->line_status & UART_DCD);	tty_kref_put(tty);}
开发者ID:daltenty,项目名称:kernel-ubuntu.trusty-vgt,代码行数:47,


示例6: belkin_sa_process_read_urb

static void belkin_sa_process_read_urb(struct urb *urb){	struct usb_serial_port *port = urb->context;	struct belkin_sa_private *priv = usb_get_serial_port_data(port);	struct tty_struct *tty;	unsigned char *data = urb->transfer_buffer;	unsigned long flags;	unsigned char status;	char tty_flag;	/* Update line status */	tty_flag = TTY_NORMAL;	spin_lock_irqsave(&priv->lock, flags);	status = priv->last_lsr;	priv->last_lsr &= ~BELKIN_SA_LSR_ERR;	spin_unlock_irqrestore(&priv->lock, flags);	if (!urb->actual_length)		return;	tty = tty_port_tty_get(&port->port);	if (!tty)		return;	if (status & BELKIN_SA_LSR_ERR) {		/* Break takes precedence over parity, which takes precedence		 * over framing errors. */		if (status & BELKIN_SA_LSR_BI)			tty_flag = TTY_BREAK;		else if (status & BELKIN_SA_LSR_PE)			tty_flag = TTY_PARITY;		else if (status & BELKIN_SA_LSR_FE)			tty_flag = TTY_FRAME;		dev_dbg(&port->dev, "tty_flag = %d/n", tty_flag);		/* Overrun is special, not associated with a char. */		if (status & BELKIN_SA_LSR_OE)			tty_insert_flip_char(tty, 0, TTY_OVERRUN);	}	tty_insert_flip_string_fixed_flag(tty, data, tty_flag,							urb->actual_length);	tty_flip_buffer_push(tty);	tty_kref_put(tty);}
开发者ID:sombree,项目名称:Hulk-Kernel-V2,代码行数:46,


示例7: rs_interrupt_single

/* * This is the serial driver's interrupt routine for a single port */static irqreturn_t rs_interrupt_single(int irq, void *dev_id){	struct serial_state *info = dev_id;	struct tty_struct *tty = tty_port_tty_get(&info->port);	if (!tty) {		printk(KERN_INFO "%s: tty=0 problem/n", __func__);		return IRQ_NONE;	}	/*	 * pretty simple in our case, because we only get interrupts	 * on inbound traffic	 */	receive_chars(tty);	tty_kref_put(tty);	return IRQ_HANDLED;}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:20,


示例8: flush_and_resubmit_read_urb

/* Push data to tty layer and resubmit the bulk read URB */static void flush_and_resubmit_read_urb(struct usb_serial_port *port){	struct urb *urb = port->read_urb;	struct tty_struct *tty = tty_port_tty_get(&port->port);	int room;	/* Push data to tty */	if (tty && urb->actual_length) {		room = tty_buffer_request_room(tty, urb->actual_length);		if (room) {			tty_insert_flip_string(tty, urb->transfer_buffer, room);			tty_flip_buffer_push(tty);		}	}	tty_kref_put(tty);	resubmit_read_urb(port, GFP_ATOMIC);}
开发者ID:artm1248,项目名称:linux,代码行数:19,


示例9: qt_close

static void qt_close(struct usb_serial_port *port){	struct usb_serial *serial = port->serial;	struct tty_struct *tty = tty_port_tty_get(&port->port);	unsigned int index = port->port_number;	struct quatech_port *qt_port = qt_get_port_private(port);	struct quatech_port *port0 = qt_get_port_private(serial->port[0]);	/* shutdown any bulk reads that might be going on */	if (serial->num_bulk_out)		usb_unlink_urb(port->write_urb);	if (serial->num_bulk_in)		usb_unlink_urb(port->read_urb);	/* wait up to for transmitter to empty */	if (serial->dev)		qt_block_until_empty(tty, qt_port);	tty_kref_put(tty);	/* Close uart channel */	if (qt_close_channel(serial, index) < 0)		dev_dbg(&port->dev, "%s - qt_close_channel failed./n",			__func__);	port0->open_ports--;	dev_dbg(&port->dev, "qt_num_open_ports in close%d/n",		port0->open_ports);	if (port0->open_ports == 0) {		if (serial->port[0]->interrupt_in_urb) {			dev_dbg(&port->dev, "Shutdown interrupt_in_urb/n");			usb_kill_urb(serial->port[0]->interrupt_in_urb);		}	}	if (qt_port->write_urb) {		/* if this urb had a transfer buffer already (old tx) free it */		kfree(qt_port->write_urb->transfer_buffer);		usb_free_urb(qt_port->write_urb);	}}
开发者ID:MaxChina,项目名称:linux,代码行数:44,


示例10: kobil_read_int_callback

static void kobil_read_int_callback(struct urb *urb){	int result;	struct usb_serial_port *port = urb->context;	struct tty_struct *tty;	unsigned char *data = urb->transfer_buffer;	int status = urb->status;/*                 */	dbg("%s - port %d", __func__, port->number);	if (status) {		dbg("%s - port %d Read int status not zero: %d",		    __func__, port->number, status);		return;	}	tty = tty_port_tty_get(&port->port);	if (tty && urb->actual_length) {		/*             */		/*                                                                                                                                                                                                                                                                                   */		/*           */		tty_insert_flip_string(tty, data, urb->actual_length);		tty_flip_buffer_push(tty);	}	tty_kref_put(tty);	result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);	dbg("%s - port %d Send read URB returns: %i",			__func__, port->number, result);}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:44,


示例11: omninet_read_bulk_callback

static void omninet_read_bulk_callback(struct urb *urb){	struct usb_serial_port 	*port 	= urb->context;	unsigned char 		*data 	= urb->transfer_buffer;	struct omninet_header 	*header = (struct omninet_header *) &data[0];	int status = urb->status;	int result;	int i;	dbg("%s - port %d", __func__, port->number);	if (status) {		dbg("%s - nonzero read bulk status received: %d",		    __func__, status);		return;	}	if (debug && header->oh_xxx != 0x30) {		if (urb->actual_length) {			printk(KERN_DEBUG "%s: omninet_read %d: ",			       __FILE__, header->oh_len);			for (i = 0; i < (header->oh_len +						OMNINET_HEADERLEN); i++)				printk("%.2x ", data[i]);			printk("/n");		}	}	if (urb->actual_length && header->oh_len) {		struct tty_struct *tty = tty_port_tty_get(&port->port);		tty_insert_flip_string(tty, data + OMNINET_DATAOFFSET,							header->oh_len);		tty_flip_buffer_push(tty);		tty_kref_put(tty);	}	/* Continue trying to always read  */	result = usb_submit_urb(urb, GFP_ATOMIC);	if (result)		dev_err(&port->dev,			"%s - failed resubmitting read urb, error %d/n",			__func__, result);}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:43,


示例12: tegra_uart_rx_buffer_push

static void tegra_uart_rx_buffer_push(struct tegra_uart_port *tup,				      unsigned int residue){	struct tty_port *port = &tup->uport.state->port;	struct tty_struct *tty = tty_port_tty_get(port);	unsigned int count;	async_tx_ack(tup->rx_dma_desc);	count = tup->rx_bytes_requested - residue;	/* If we are here, DMA is stopped */	tegra_uart_copy_rx_to_tty(tup, port, count);	tegra_uart_handle_rx_pio(tup, port);	if (tty) {		tty_flip_buffer_push(port);		tty_kref_put(tty);	}}
开发者ID:Lyude,项目名称:linux,代码行数:19,


示例13: ch341_update_line_status

static void ch341_update_line_status(struct usb_serial_port *port,					unsigned char *data, size_t len){	struct ch341_private *priv = usb_get_serial_port_data(port);	struct tty_struct *tty;	unsigned long flags;	u8 status;	u8 delta;	if (len < 4)		return;	status = ~data[2] & CH341_BITS_MODEM_STAT;	spin_lock_irqsave(&priv->lock, flags);	delta = status ^ priv->line_status;	priv->line_status = status;	spin_unlock_irqrestore(&priv->lock, flags);	if (data[1] & CH341_MULT_STAT)		dev_dbg(&port->dev, "%s - multiple status change/n", __func__);	if (!delta)		return;	if (delta & CH341_BIT_CTS)		port->icount.cts++;	if (delta & CH341_BIT_DSR)		port->icount.dsr++;	if (delta & CH341_BIT_RI)		port->icount.rng++;	if (delta & CH341_BIT_DCD) {		port->icount.dcd++;		tty = tty_port_tty_get(&port->port);		if (tty) {			usb_serial_handle_dcd_change(port, tty,						status & CH341_BIT_DCD);			tty_kref_put(tty);		}	}	wake_up_interruptible(&port->port.delta_msr_wait);}
开发者ID:19Dan01,项目名称:linux,代码行数:43,


示例14: navman_read_int_callback

static void navman_read_int_callback(struct urb *urb){	struct usb_serial_port *port = urb->context;	unsigned char *data = urb->transfer_buffer;	struct tty_struct *tty;	int status = urb->status;	int result;	switch (status) {	case 0:		/* success */		break;	case -ECONNRESET:	case -ENOENT:	case -ESHUTDOWN:		/* this urb is terminated, clean up */		dbg("%s - urb shutting down with status: %d",		    __func__, status);		return;	default:		dbg("%s - nonzero urb status received: %d",		    __func__, status);		goto exit;	}	usb_serial_debug_data(debug, &port->dev, __func__,			      urb->actual_length, data);	tty = tty_port_tty_get(&port->port);	if (tty && urb->actual_length) {		tty_buffer_request_room(tty, urb->actual_length);		tty_insert_flip_string(tty, data, urb->actual_length);		tty_flip_buffer_push(tty);	}	tty_kref_put(tty);exit:	result = usb_submit_urb(urb, GFP_ATOMIC);	if (result)		dev_err(&urb->dev->dev,			"%s - Error %d submitting interrupt urb/n",			__func__, result);}
开发者ID:ArthySundaram,项目名称:firstrepo,代码行数:43,


示例15: cdns_uart_suspend

/** * cdns_uart_suspend - suspend event * @device: Pointer to the device structure * * Return: 0 */static int cdns_uart_suspend(struct device *device){    struct uart_port *port = dev_get_drvdata(device);    struct tty_struct *tty;    struct device *tty_dev;    int may_wake = 0;    /* Get the tty which could be NULL so don't assume it's valid */    tty = tty_port_tty_get(&port->state->port);    if (tty) {        tty_dev = tty->dev;        may_wake = device_may_wakeup(tty_dev);        tty_kref_put(tty);    }    /*     * Call the API provided in serial_core.c file which handles     * the suspend.     */    uart_suspend_port(&cdns_uart_uart_driver, port);    if (console_suspend_enabled && !may_wake) {        struct cdns_uart *cdns_uart = port->private_data;        clk_disable(cdns_uart->uartclk);        clk_disable(cdns_uart->pclk);    } else {        unsigned long flags = 0;        spin_lock_irqsave(&port->lock, flags);        /* Empty the receive FIFO 1st before making changes */        while (!(cdns_uart_readl(CDNS_UART_SR_OFFSET) &                 CDNS_UART_SR_RXEMPTY))            cdns_uart_readl(CDNS_UART_FIFO_OFFSET);        /* set RX trigger level to 1 */        cdns_uart_writel(1, CDNS_UART_RXWM_OFFSET);        /* disable RX timeout interrups */        cdns_uart_writel(CDNS_UART_IXR_TOUT, CDNS_UART_IDR_OFFSET);        spin_unlock_irqrestore(&port->lock, flags);    }    return 0;}
开发者ID:mikemvk,项目名称:linux-at91,代码行数:48,


示例16: tegra_uart_handle_rx_dma

static void tegra_uart_handle_rx_dma(struct tegra_uart_port *tup){	struct dma_tx_state state;	struct tty_struct *tty = tty_port_tty_get(&tup->uport.state->port);	struct tty_port *port = &tup->uport.state->port;	int count;	int rx_level = 0;	/* Deactivate flow control to stop sender */	if (tup->rts_active)		set_rts(tup, false);	dmaengine_terminate_all(tup->rx_dma_chan);	dmaengine_tx_status(tup->rx_dma_chan,  tup->rx_cookie, &state);	async_tx_ack(tup->rx_dma_desc);	count = tup->rx_bytes_requested - state.residue;	/* If we are here, DMA is stopped */	if (count)		tegra_uart_copy_rx_to_tty(tup, port, count);	tegra_uart_handle_rx_pio(tup, port);	if (tup->enable_rx_buffer_throttle) {		rx_level = tty_buffer_get_level(port);		if (rx_level > 70)			mod_timer(&tup->timer,					jiffies + tup->timer_timeout_jiffies);	}	if (tty) {		tty_flip_buffer_push(port);		tty_kref_put(tty);	}	tegra_uart_start_rx_dma(tup);	if (tup->enable_rx_buffer_throttle) {		if ((rx_level <= 70) && tup->rts_active)			set_rts(tup, true);	} else if (tup->rts_active)		set_rts(tup, true);}
开发者ID:Toradex-Apalis-TK1-AndroidTV,项目名称:android_kernel_nvidia_mm,代码行数:42,


示例17: tegra_uart_stop_rx

static void tegra_uart_stop_rx(struct uart_port *u){	struct tegra_uart_port *tup = to_tegra_uport(u);	struct tty_struct *tty;	struct tty_port *port = &u->state->port;	struct dma_tx_state state;	unsigned long ier;	int count;	if (tup->rts_active)		set_rts(tup, false);	if (!tup->rx_in_progress)		return;	tty = tty_port_tty_get(&tup->uport.state->port);	tegra_uart_wait_sym_time(tup, 1); /* wait a character interval */	ier = tup->ier_shadow;	ier &= ~(UART_IER_RDI | UART_IER_RLSI | UART_IER_RTOIE |					TEGRA_UART_IER_EORD);	tup->ier_shadow = ier;	tegra_uart_write(tup, ier, UART_IER);	tup->rx_in_progress = 0;	if (tup->rx_dma_chan && !tup->use_rx_pio) {		dmaengine_terminate_all(tup->rx_dma_chan);		dmaengine_tx_status(tup->rx_dma_chan, tup->rx_cookie, &state);		async_tx_ack(tup->rx_dma_desc);		count = tup->rx_bytes_requested - state.residue;		if (count)			tegra_uart_copy_rx_to_tty(tup, port, count);		tegra_uart_handle_rx_pio(tup, port);	} else {		tegra_uart_handle_rx_pio(tup, port);	}	if (tty) {		tty_flip_buffer_push(port);		tty_kref_put(tty);	}	return;}
开发者ID:Toradex-Apalis-TK1-AndroidTV,项目名称:android_kernel_nvidia_mm,代码行数:42,


示例18: xuartps_resume

/** * xuartps_resume - Resume after a previous suspend * @device: Pointer to the device structure * * Returns 0 */static int xuartps_resume(struct device *device){	struct uart_port *port = dev_get_drvdata(device);	unsigned long flags = 0;	u32 ctrl_reg;	struct tty_struct *tty;	struct device *tty_dev;	int may_wake = 0;	/* Get the tty which could be NULL so don't assume it's valid */	tty = tty_port_tty_get(&port->state->port);	if (tty) {		tty_dev = tty->dev;		may_wake = device_may_wakeup(tty_dev);		tty_kref_put(tty);	}	if (console_suspend_enabled && !may_wake) {		struct xuartps *xuartps = port->private_data;		clk_enable(xuartps->aperclk);		clk_enable(xuartps->devclk);		spin_lock_irqsave(&port->lock, flags);		/* Set TX/RX Reset */		xuartps_writel(xuartps_readl(XUARTPS_CR_OFFSET) |				(XUARTPS_CR_TXRST | XUARTPS_CR_RXRST),				XUARTPS_CR_OFFSET);		/* Enable Tx/Rx */		ctrl_reg = xuartps_readl(XUARTPS_CR_OFFSET);		xuartps_writel(			(ctrl_reg & ~(XUARTPS_CR_TX_DIS | XUARTPS_CR_RX_DIS)) |			(XUARTPS_CR_TX_EN | XUARTPS_CR_RX_EN),			XUARTPS_CR_OFFSET);		spin_unlock_irqrestore(&port->lock, flags);	}	return uart_resume_port(&xuartps_uart_driver, port);}
开发者ID:Analias,项目名称:SNOWLeo-SDR-1,代码行数:48,


示例19: ipaq_read_bulk_callback

static void ipaq_read_bulk_callback(struct urb *urb){    struct usb_serial_port	*port = urb->context;    struct tty_struct	*tty;    unsigned char		*data = urb->transfer_buffer;    int			result;    int status = urb->status;    dbg("%s - port %d", __func__, port->number);    if (status) {        dbg("%s - nonzero read bulk status received: %d",            __func__, status);        return;    }    usb_serial_debug_data(debug, &port->dev, __func__,                          urb->actual_length, data);    tty = tty_port_tty_get(&port->port);    if (tty && urb->actual_length) {        tty_buffer_request_room(tty, urb->actual_length);        tty_insert_flip_string(tty, data, urb->actual_length);        tty_flip_buffer_push(tty);        bytes_in += urb->actual_length;    }    tty_kref_put(tty);    /* Continue trying to always read  */    usb_fill_bulk_urb(port->read_urb, port->serial->dev,                      usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress),                      port->read_urb->transfer_buffer,                      port->read_urb->transfer_buffer_length,                      ipaq_read_bulk_callback, port);    result = usb_submit_urb(port->read_urb, GFP_ATOMIC);    if (result)        dev_err(&port->dev,                "%s - failed resubmitting read urb, error %d/n",                __func__, result);    return;}
开发者ID:artm1248,项目名称:linux,代码行数:41,


示例20: qt_write_bulk_callback

static void qt_write_bulk_callback(struct urb *urb){	struct tty_struct *tty;	int status;	struct quatech_port *quatech_port;	status = urb->status;	if (status) {		dev_dbg(&urb->dev->dev,			"nonzero write bulk status received:%d/n", status);		return;	}	quatech_port = urb->context;	tty = tty_port_tty_get(&quatech_port->port->port);	if (tty)		tty_wakeup(tty);	tty_kref_put(tty);}
开发者ID:AiWinters,项目名称:linux,代码行数:22,


示例21: safe_process_read_urb

static void safe_process_read_urb(struct urb *urb){	struct usb_serial_port *port = urb->context;	unsigned char *data = urb->transfer_buffer;	unsigned char length = urb->actual_length;	int actual_length;	struct tty_struct *tty;	__u16 fcs;	if (!length)		return;	tty = tty_port_tty_get(&port->port);	if (!tty)		return;	if (!safe)		goto out;	fcs = fcs_compute10(data, length, CRC10_INITFCS);	if (fcs) {		dev_err(&port->dev, "%s - bad CRC %x/n", __func__, fcs);		goto err;	}	actual_length = data[length - 2] >> 2;	if (actual_length > (length - 2)) {		dev_err(&port->dev, "%s - inconsistent lengths %d:%d/n",				__func__, actual_length, length);		goto err;	}	dev_info(&urb->dev->dev, "%s - actual: %d/n", __func__, actual_length);	length = actual_length;out:	tty_insert_flip_string(tty, data, length);	tty_flip_buffer_push(tty);err:	tty_kref_put(tty);}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:39,


示例22: option_indat_callback

static void option_indat_callback(struct urb *urb){	int err;	int endpoint;	struct usb_serial_port *port;	struct tty_struct *tty;	unsigned char *data = urb->transfer_buffer;	int status = urb->status;	dbg("%s: %p", __func__, urb);	endpoint = usb_pipeendpoint(urb->pipe);	port =  urb->context;	if (status) {		dbg("%s: nonzero status: %d on endpoint %02x.",		    __func__, status, endpoint);	} else {		tty = tty_port_tty_get(&port->port);		if (urb->actual_length) {			tty_buffer_request_room(tty, urb->actual_length);			tty_insert_flip_string(tty, data, urb->actual_length);			tty_flip_buffer_push(tty);		} else 			dbg("%s: empty read urb received", __func__);		tty_kref_put(tty);		/* Resubmit urb so we continue receiving */		if (port->port.count && status != -ESHUTDOWN) {			err = usb_submit_urb(urb, GFP_ATOMIC);			if (err)				printk(KERN_ERR "%s: resubmit read urb failed. "					"(%d)", __func__, err);		}	}	return;}
开发者ID:melgurth,项目名称:i780-kernel,代码行数:37,


示例23: tegra_uart_rx_buffer_throttle_timer

static void tegra_uart_rx_buffer_throttle_timer(unsigned long _data){	struct tegra_uart_port *tup = (struct tegra_uart_port *)_data;	struct uart_port *u = &tup->uport;	struct tty_struct *tty = tty_port_tty_get(&tup->uport.state->port);	struct tty_port *port = &tup->uport.state->port;	int rx_level;	unsigned long flags;	spin_lock_irqsave(&u->lock, flags);	rx_level = tty_buffer_get_level(port);	if (rx_level < 30) {		if (tup->rts_active)			set_rts(tup, true);	} else {		mod_timer(&tup->timer, jiffies + tup->timer_timeout_jiffies);	}	if (tty)		tty_kref_put(tty);	spin_unlock_irqrestore(&u->lock, flags);}
开发者ID:Toradex-Apalis-TK1-AndroidTV,项目名称:android_kernel_nvidia_mm,代码行数:24,


示例24: pdc_console_poll

static void pdc_console_poll(unsigned long unused){	int data, count = 0;	struct tty_struct *tty = tty_port_tty_get(&tty_port);	if (!tty)		return;	while (1) {		data = pdc_console_poll_key(NULL);		if (data == -1)			break;		tty_insert_flip_char(tty, data & 0xFF, TTY_NORMAL);		count ++;	}	if (count)		tty_flip_buffer_push(tty);	tty_kref_put(tty);	if (pdc_cons.flags & CON_ENABLED)		mod_timer(&pdc_console_timer, jiffies + PDC_CONS_POLL_DELAY);}
开发者ID:AllenDou,项目名称:linux,代码行数:24,


示例25: escvp_get_rd_callback

static void escvp_get_rd_callback(struct urb *urb){  char *data;  struct escvp_port *vport;  struct device *dev = &urb->dev->dev;  int status = urb->status;  struct tty_struct *tty;  vport = urb->context;  tty = tty_port_tty_get(&vport->port->port);  switch (status) {    case 0:      break;    case -ECONNRESET:    case -ENOENT:    case -ESHUTDOWN:      dev_dbg(dev, "%s - urb shutdown with status: %d/n",__func__, status);      goto out;    default:      dev_dbg(dev, "%s - nonzero urb status received: %d/n",__func__, status);      goto out;  }  dev_dbg(dev, "%s urb buffer size is %d/n", __func__, urb->actual_length);  data = urb->transfer_buffer;  if (tty) {#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)    tty_insert_flip_string(tty, data, urb->actual_length);    tty_flip_buffer_push(tty);#else    tty_insert_flip_string(&vport->port->port, data, urb->actual_length);    tty_flip_buffer_push(&vport->port->port);#endif    tty_kref_put(tty);  }out:  clear_bit_unlock(ESCVP_FLAG_CTRL_BUSY, &vport->flags);}
开发者ID:bahulneel,项目名称:escvp,代码行数:36,


示例26: raw3215_irq

/* * Interrupt routine, called from common io layer */static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,			struct irb *irb){	struct raw3215_info *raw;	struct raw3215_req *req;	struct tty_struct *tty;	int cstat, dstat;	int count;	raw = dev_get_drvdata(&cdev->dev);	req = (struct raw3215_req *) intparm;	tty = tty_port_tty_get(&raw->port);	cstat = irb->scsw.cmd.cstat;	dstat = irb->scsw.cmd.dstat;	if (cstat != 0)		raw3215_next_io(raw, tty);	if (dstat & 0x01) { /* we got a unit exception */		dstat &= ~0x01;	 /* we can ignore it */	}	switch (dstat) {	case 0x80:		if (cstat != 0)			break;		/* Attention interrupt, someone hit the enter key */		raw3215_mk_read_req(raw);		raw3215_next_io(raw, tty);		break;	case 0x08:	case 0x0C:		/* Channel end interrupt. */		if ((raw = req->info) == NULL)			goto put_tty;	     /* That shouldn't happen ... */		if (req->type == RAW3215_READ) {			/* store residual count, then wait for device end */			req->residual = irb->scsw.cmd.count;		}		if (dstat == 0x08)			break;	case 0x04:		/* Device end interrupt. */		if ((raw = req->info) == NULL)			goto put_tty;	     /* That shouldn't happen ... */		if (req->type == RAW3215_READ && tty != NULL) {			unsigned int cchar;			count = 160 - req->residual;			EBCASC(raw->inbuf, count);			cchar = ctrlchar_handle(raw->inbuf, count, tty);			switch (cchar & CTRLCHAR_MASK) {			case CTRLCHAR_SYSRQ:				break;			case CTRLCHAR_CTRL:				tty_insert_flip_char(&raw->port, cchar,						TTY_NORMAL);				tty_flip_buffer_push(&raw->port);				break;			case CTRLCHAR_NONE:				if (count < 2 ||				    (strncmp(raw->inbuf+count-2, "/252n", 2) &&				     strncmp(raw->inbuf+count-2, "^n", 2)) ) {					/* add the auto /n */					raw->inbuf[count] = '/n';					count++;				} else					count -= 2;				tty_insert_flip_string(&raw->port, raw->inbuf,						count);				tty_flip_buffer_push(&raw->port);				break;			}		} else if (req->type == RAW3215_WRITE) {			raw->count -= req->len;			raw->written -= req->len;		}		raw->flags &= ~RAW3215_WORKING;		raw3215_free_req(req);		/* check for empty wait */		if (waitqueue_active(&raw->empty_wait) &&		    raw->queued_write == NULL &&		    raw->queued_read == NULL) {			wake_up_interruptible(&raw->empty_wait);		}		raw3215_next_io(raw, tty);		break;	default:		/* Strange interrupt, I'll do my best to clean up */		if (req != NULL && req->type != RAW3215_FREE) {			if (req->type == RAW3215_WRITE) {				raw->count -= req->len;				raw->written -= req->len;			}			raw->flags &= ~RAW3215_WORKING;			raw3215_free_req(req);		}		raw3215_next_io(raw, tty);//.........这里部分代码省略.........
开发者ID:spacex,项目名称:kernel-centos7,代码行数:101,



注:本文中的tty_port_tty_get函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ tty_port_tty_set函数代码示例
C++ tty_port_init函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。