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

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

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

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

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

示例1: apbuart_rx_chars

static void apbuart_rx_chars(struct uart_port *port){	unsigned int status, ch, rsr, flag;	unsigned int max_chars = port->fifosize;	status = UART_GET_STATUS(port);	while (UART_RX_DATA(status) && (max_chars--)) {		ch = UART_GET_CHAR(port);		flag = TTY_NORMAL;		port->icount.rx++;		rsr = UART_GET_STATUS(port) | UART_DUMMY_RSR_RX;		UART_PUT_STATUS(port, 0);		if (rsr & UART_STATUS_ERR) {			if (rsr & UART_STATUS_BR) {				rsr &= ~(UART_STATUS_FE | UART_STATUS_PE);				port->icount.brk++;				if (uart_handle_break(port))					goto ignore_char;			} else if (rsr & UART_STATUS_PE) {				port->icount.parity++;			} else if (rsr & UART_STATUS_FE) {				port->icount.frame++;			}			if (rsr & UART_STATUS_OE)				port->icount.overrun++;			rsr &= port->read_status_mask;			if (rsr & UART_STATUS_PE)				flag = TTY_PARITY;			else if (rsr & UART_STATUS_FE)				flag = TTY_FRAME;		}		if (uart_handle_sysrq_char(port, ch))			goto ignore_char;		uart_insert_char(port, rsr, UART_STATUS_OE, ch, flag);	      ignore_char:		status = UART_GET_STATUS(port);	}	spin_unlock(&port->lock);	tty_flip_buffer_push(&port->state->port);	spin_lock(&port->lock);}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:53,


示例2: ks8695uart_rx_chars

static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id){	struct uart_port *port = dev_id;	unsigned int status, ch, lsr, flg, max_count = 256;	status = UART_GET_LSR(port);		/* clears pending LSR interrupts */	while ((status & URLS_URDR) && max_count--) {		ch = UART_GET_CHAR(port);		flg = TTY_NORMAL;		port->icount.rx++;		/*		 * Note that the error handling code is		 * out of the main execution path		 */		lsr = UART_GET_LSR(port) | UART_DUMMY_LSR_RX;		if (unlikely(lsr & (URLS_URBI | URLS_URPE | URLS_URFE | URLS_URROE))) {			if (lsr & URLS_URBI) {				lsr &= ~(URLS_URFE | URLS_URPE);				port->icount.brk++;				if (uart_handle_break(port))					goto ignore_char;			}			if (lsr & URLS_URPE)				port->icount.parity++;			if (lsr & URLS_URFE)				port->icount.frame++;			if (lsr & URLS_URROE)				port->icount.overrun++;			lsr &= port->read_status_mask;			if (lsr & URLS_URBI)				flg = TTY_BREAK;			else if (lsr & URLS_URPE)				flg = TTY_PARITY;			else if (lsr & URLS_URFE)				flg = TTY_FRAME;		}		if (uart_handle_sysrq_char(port, ch))			goto ignore_char;		uart_insert_char(port, lsr, URLS_URROE, ch, flg);ignore_char:		status = UART_GET_LSR(port);	}	tty_flip_buffer_push(&port->state->port);	return IRQ_HANDLED;}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:53,


示例3: clps711xuart_int_rx

static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *regs){	struct uart_port *port = dev_id;	struct tty_struct *tty = port->info->tty;	unsigned int status, ch, flg;	status = clps_readl(SYSFLG(port));	while (!(status & SYSFLG_URXFE)) {		ch = clps_readl(UARTDR(port));		port->icount.rx++;		flg = TTY_NORMAL;		/*		 * Note that the error handling code is		 * out of the main execution path		 */		if (unlikely(ch & UART_ANY_ERR)) {			if (ch & UARTDR_PARERR)				port->icount.parity++;			else if (ch & UARTDR_FRMERR)				port->icount.frame++;			if (ch & UARTDR_OVERR)				port->icount.overrun++;			ch &= port->read_status_mask;			if (ch & UARTDR_PARERR)				flg = TTY_PARITY;			else if (ch & UARTDR_FRMERR)				flg = TTY_FRAME;#ifdef SUPPORT_SYSRQ			port->sysrq = 0;#endif		}		if (uart_handle_sysrq_char(port, ch, regs))			goto ignore_char;		/*		 * CHECK: does overrun affect the current character?		 * ASSUMPTION: it does not.		 */		uart_insert_char(port, ch, UARTDR_OVERR, ch, flg);	ignore_char:		status = clps_readl(SYSFLG(port));	}	tty_flip_buffer_push(tty);	return IRQ_HANDLED;}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:53,


示例4: atmel_rx_chars

/* * Characters received (called from interrupt handler) */static void atmel_rx_chars(struct uart_port *port){	struct tty_struct *tty = port->info->tty;	unsigned int status, ch, flg;	status = UART_GET_CSR(port);	while (status & ATMEL_US_RXRDY) {		ch = UART_GET_CHAR(port);		port->icount.rx++;		flg = TTY_NORMAL;		/*		 * note that the error handling code is		 * out of the main execution path		 */		if (unlikely(status & (ATMEL_US_PARE | ATMEL_US_FRAME | ATMEL_US_OVRE | ATMEL_US_RXBRK))) {			UART_PUT_CR(port, ATMEL_US_RSTSTA);	/* clear error */			if (status & ATMEL_US_RXBRK) {				status &= ~(ATMEL_US_PARE | ATMEL_US_FRAME);	/* ignore side-effect */				port->icount.brk++;				if (uart_handle_break(port))					goto ignore_char;			}			if (status & ATMEL_US_PARE)				port->icount.parity++;			if (status & ATMEL_US_FRAME)				port->icount.frame++;			if (status & ATMEL_US_OVRE)				port->icount.overrun++;			status &= port->read_status_mask;			if (status & ATMEL_US_RXBRK)				flg = TTY_BREAK;			else if (status & ATMEL_US_PARE)				flg = TTY_PARITY;			else if (status & ATMEL_US_FRAME)				flg = TTY_FRAME;		}		if (uart_handle_sysrq_char(port, ch))			goto ignore_char;		uart_insert_char(port, status, ATMEL_US_OVRE, ch, flg);	ignore_char:		status = UART_GET_CSR(port);	}	tty_flip_buffer_push(tty);}
开发者ID:StephenMacras,项目名称:dsl-n55u-bender,代码行数:56,


示例5: pl010_rx_chars

static void pl010_rx_chars(struct uart_amba_port *uap){	unsigned int status, ch, flag, rsr, max_count = 256;	status = readb(uap->port.membase + UART01x_FR);	while (UART_RX_DATA(status) && max_count--) {		ch = readb(uap->port.membase + UART01x_DR);		flag = TTY_NORMAL;		uap->port.icount.rx++;		/*		 * Note that the error handling code is		 * out of the main execution path		 */		rsr = readb(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;		if (unlikely(rsr & UART01x_RSR_ANY)) {			writel(0, uap->port.membase + UART01x_ECR);			if (rsr & UART01x_RSR_BE) {				rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE);				uap->port.icount.brk++;				if (uart_handle_break(&uap->port))					goto ignore_char;			} else if (rsr & UART01x_RSR_PE)				uap->port.icount.parity++;			else if (rsr & UART01x_RSR_FE)				uap->port.icount.frame++;			if (rsr & UART01x_RSR_OE)				uap->port.icount.overrun++;			rsr &= uap->port.read_status_mask;			if (rsr & UART01x_RSR_BE)				flag = TTY_BREAK;			else if (rsr & UART01x_RSR_PE)				flag = TTY_PARITY;			else if (rsr & UART01x_RSR_FE)				flag = TTY_FRAME;		}		if (uart_handle_sysrq_char(&uap->port, ch))			goto ignore_char;		uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag);	ignore_char:		status = readb(uap->port.membase + UART01x_FR);	}	spin_unlock(&uap->port.lock);	tty_flip_buffer_push(&uap->port.state->port);	spin_lock(&uap->port.lock);}
开发者ID:AeroGirl,项目名称:VAR-SOM-AM33-SDK7-Kernel,代码行数:53,


示例6: sa1100_rx_chars

static voidsa1100_rx_chars(struct sa1100_port *sport, struct pt_regs *regs){	struct tty_struct *tty = sport->port.info->tty;	unsigned int status, ch, flg;	status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) |		 UTSR0_TO_SM(UART_GET_UTSR0(sport));	while (status & UTSR1_TO_SM(UTSR1_RNE)) {		ch = UART_GET_CHAR(sport);		if (tty->flip.count >= TTY_FLIPBUF_SIZE)			goto ignore_char;		sport->port.icount.rx++;		flg = TTY_NORMAL;		/*		 * note that the error handling code is		 * out of the main execution path		 */		if (status & UTSR1_TO_SM(UTSR1_PRE | UTSR1_FRE | UTSR1_ROR)) {			if (status & UTSR1_TO_SM(UTSR1_PRE))				sport->port.icount.parity++;			else if (status & UTSR1_TO_SM(UTSR1_FRE))				sport->port.icount.frame++;			if (status & UTSR1_TO_SM(UTSR1_ROR))				sport->port.icount.overrun++;			status &= sport->port.read_status_mask;			if (status & UTSR1_TO_SM(UTSR1_PRE))				flg = TTY_PARITY;			else if (status & UTSR1_TO_SM(UTSR1_FRE))				flg = TTY_FRAME;#ifdef SUPPORT_SYSRQ			sport->port.sysrq = 0;#endif		}		if (uart_handle_sysrq_char(&sport->port, ch, regs))			goto ignore_char;		uart_insert_char(&sport->port, status, UTSR1_TO_SM(UTSR1_ROR), ch, flg);	ignore_char:		status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) |			 UTSR0_TO_SM(UART_GET_UTSR0(sport));	}	tty_flip_buffer_push(tty);}
开发者ID:OpenHMR,项目名称:Open-HMR600,代码行数:52,


示例7: receive_chars

static voidreceive_chars(struct uart_port *up){	struct tty_struct *tty = up->info->tty;	unsigned int ch, flag;	int i,count;	unsigned short s;	unsigned char *rxptr;	int max_count = 256;	rxptr=dpram_data.data_virt+0x200;	s=REG6;	dprintk("REG6=0x%x/n", s);	count=s & 0x3ff;	if ((s & 0x1000) && count) {		dprintk("%d bytes data available/n", count);		for (i = 0 ; i < count ; i++) {			ch=*rxptr++;			flag = TTY_NORMAL;			up->icount.rx++;			uart_insert_char(up, 0, 0, ch, flag);		}		tty_flip_buffer_push(tty);	}	REG4|=0x800;	return;	do {		ch = 0; /* serial_in(up, UART_RX); */		flag = TTY_NORMAL;		up->icount.rx++;		uart_insert_char(up, 0, UART_LSR_OE, ch, flag);	} while ((max_count-- > 0));	tty_flip_buffer_push(tty);}
开发者ID:ManiacTwister,项目名称:linux-hnd,代码行数:38,


示例8: pl011_rx_chars

static void pl011_rx_chars(struct uart_amba_port *uap){	struct tty_struct *tty = uap->port.info->tty;	unsigned int status, ch, flag, max_count = 256;	status = readw(uap->port.membase + UART01x_FR);	while ((status & UART01x_FR_RXFE) == 0 && max_count--) {		ch = readw(uap->port.membase + UART01x_DR) | UART_DUMMY_DR_RX;		flag = TTY_NORMAL;		uap->port.icount.rx++;		/*		 * Note that the error handling code is		 * out of the main execution path		 */		if (unlikely(ch & UART_DR_ERROR)) {			if (ch & UART011_DR_BE) {				ch &= ~(UART011_DR_FE | UART011_DR_PE);				uap->port.icount.brk++;				if (uart_handle_break(&uap->port))					goto ignore_char;			} else if (ch & UART011_DR_PE)				uap->port.icount.parity++;			else if (ch & UART011_DR_FE)				uap->port.icount.frame++;			if (ch & UART011_DR_OE)				uap->port.icount.overrun++;			ch &= uap->port.read_status_mask;			if (ch & UART011_DR_BE)				flag = TTY_BREAK;			else if (ch & UART011_DR_PE)				flag = TTY_PARITY;			else if (ch & UART011_DR_FE)				flag = TTY_FRAME;		}		if (uart_handle_sysrq_char(&uap->port, ch & 255))			goto ignore_char;		uart_insert_char(&uap->port, ch, UART011_DR_OE, ch, flag);	ignore_char:		status = readw(uap->port.membase + UART01x_FR);	}	spin_unlock(&uap->port.lock);	tty_flip_buffer_push(tty);	spin_lock(&uap->port.lock);}
开发者ID:smx-smx,项目名称:dsl-n55u,代码行数:50,


示例9: sbd_receive_chars

static void sbd_receive_chars(struct sbd_port *sport){	struct uart_port *uport = &sport->port;	struct uart_icount *icount;	unsigned int status, ch, flag;	int count;	for (count = 16; count; count--) {		status = read_sbdchn(sport, R_DUART_STATUS);		if (!(status & M_DUART_RX_RDY))			break;		ch = read_sbdchn(sport, R_DUART_RX_HOLD);		flag = TTY_NORMAL;		icount = &uport->icount;		icount->rx++;		if (unlikely(status &			     (M_DUART_RCVD_BRK | M_DUART_FRM_ERR |			      M_DUART_PARITY_ERR | M_DUART_OVRUN_ERR))) {			if (status & M_DUART_RCVD_BRK) {				icount->brk++;				if (uart_handle_break(uport))					continue;			} else if (status & M_DUART_FRM_ERR)				icount->frame++;			else if (status & M_DUART_PARITY_ERR)				icount->parity++;			if (status & M_DUART_OVRUN_ERR)				icount->overrun++;			status &= uport->read_status_mask;			if (status & M_DUART_RCVD_BRK)				flag = TTY_BREAK;			else if (status & M_DUART_FRM_ERR)				flag = TTY_FRAME;			else if (status & M_DUART_PARITY_ERR)				flag = TTY_PARITY;		}		if (uart_handle_sysrq_char(uport, ch))			continue;		uart_insert_char(uport, status, M_DUART_OVRUN_ERR, ch, flag);	}	tty_flip_buffer_push(uport->state->port.tty);}
开发者ID:rrowicki,项目名称:Chrono_Kernel-1,代码行数:50,


示例10: altera_uart_rx_chars

static void altera_uart_rx_chars(struct altera_uart *pp){	struct uart_port *port = &pp->port;	unsigned char ch, flag;	unsigned short status;	while ((status = altera_uart_readl(port, ALTERA_UART_STATUS_REG)) &	       ALTERA_UART_STATUS_RRDY_MSK) {		ch = altera_uart_readl(port, ALTERA_UART_RXDATA_REG);		flag = TTY_NORMAL;		port->icount.rx++;		if (status & ALTERA_UART_STATUS_E_MSK) {			altera_uart_writel(port, status,					   ALTERA_UART_STATUS_REG);			if (status & ALTERA_UART_STATUS_BRK_MSK) {				port->icount.brk++;				if (uart_handle_break(port))					continue;			} else if (status & ALTERA_UART_STATUS_PE_MSK) {				port->icount.parity++;			} else if (status & ALTERA_UART_STATUS_ROE_MSK) {				port->icount.overrun++;			} else if (status & ALTERA_UART_STATUS_FE_MSK) {				port->icount.frame++;			}			status &= port->read_status_mask;			if (status & ALTERA_UART_STATUS_BRK_MSK)				flag = TTY_BREAK;			else if (status & ALTERA_UART_STATUS_PE_MSK)				flag = TTY_PARITY;			else if (status & ALTERA_UART_STATUS_FE_MSK)				flag = TTY_FRAME;		}		if (uart_handle_sysrq_char(port, ch))			continue;		uart_insert_char(port, status, ALTERA_UART_STATUS_ROE_MSK, ch,				 flag);	}	spin_unlock(&port->lock);	tty_flip_buffer_push(&port->state->port);	spin_lock(&port->lock);}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:48,


示例11: digicolor_uart_rx

static void digicolor_uart_rx(struct uart_port *port){	unsigned long flags;	spin_lock_irqsave(&port->lock, flags);	while (1) {		u8 status, ch;		unsigned int ch_flag;		if (digicolor_uart_rx_empty(port))			break;		ch = readb_relaxed(port->membase + UA_EMI_REC);		status = readb_relaxed(port->membase + UA_STATUS);		port->icount.rx++;		ch_flag = TTY_NORMAL;		if (status) {			if (status & UA_STATUS_PARITY_ERR)				port->icount.parity++;			else if (status & UA_STATUS_FRAME_ERR)				port->icount.frame++;			else if (status & UA_STATUS_OVERRUN_ERR)				port->icount.overrun++;			status &= port->read_status_mask;			if (status & UA_STATUS_PARITY_ERR)				ch_flag = TTY_PARITY;			else if (status & UA_STATUS_FRAME_ERR)				ch_flag = TTY_FRAME;			else if (status & UA_STATUS_OVERRUN_ERR)				ch_flag = TTY_OVERRUN;		}		if (status & port->ignore_status_mask)			continue;		uart_insert_char(port, status, UA_STATUS_OVERRUN_ERR, ch,				 ch_flag);	}	spin_unlock_irqrestore(&port->lock, flags);	tty_flip_buffer_push(&port->state->port);}
开发者ID:020gzh,项目名称:linux,代码行数:48,


示例12: milkymist_uart_rx_char

static void milkymist_uart_rx_char(struct uart_port *port){	struct tty_port *tport = &port->state->port;	unsigned char ch;	ch = ioread32be(port->membase + UART_RXTX) & 0xff;	port->icount.rx++;	if (uart_handle_sysrq_char(port, ch))		goto ignore_char;	uart_insert_char(port, 0, 0, ch, TTY_NORMAL);ignore_char:	tty_flip_buffer_push(tport);}
开发者ID:m-labs,项目名称:linux-milkymist,代码行数:16,


示例13: serial_omap_rlsi

static void serial_omap_rlsi(struct uart_omap_port *up, unsigned int lsr){	unsigned int flag;	unsigned char ch = 0;	if (likely(lsr & UART_LSR_DR))		ch = serial_in(up, UART_RX);	up->port.icount.rx++;	flag = TTY_NORMAL;	if (lsr & UART_LSR_BI) {		flag = TTY_BREAK;		lsr &= ~(UART_LSR_FE | UART_LSR_PE);		up->port.icount.brk++;		/*		 * We do the SysRQ and SAK checking		 * here because otherwise the break		 * may get masked by ignore_status_mask		 * or read_status_mask.		 */		if (uart_handle_break(&up->port))			return;	}	if (lsr & UART_LSR_PE) {		flag = TTY_PARITY;		up->port.icount.parity++;	}	if (lsr & UART_LSR_FE) {		flag = TTY_FRAME;		up->port.icount.frame++;	}	if (lsr & UART_LSR_OE)		up->port.icount.overrun++;#ifdef CONFIG_SERIAL_OMAP_CONSOLE	if (up->port.line == up->port.cons->index) {		/* Recover the break flag from console xmit */		lsr |= up->lsr_break_flag;	}#endif	uart_insert_char(&up->port, lsr, UART_LSR_OE, 0, flag);}
开发者ID:DenisLug,项目名称:mptcp,代码行数:47,


示例14: serial_omap_rdi

static void serial_omap_rdi(struct uart_omap_port *up, unsigned int lsr){	unsigned char ch = 0;	unsigned int flag;	if (!(lsr & UART_LSR_DR))		return;	ch = serial_in(up, UART_RX);	flag = TTY_NORMAL;	up->port.icount.rx++;	if (uart_handle_sysrq_char(&up->port, ch))		return;	uart_insert_char(&up->port, lsr, UART_LSR_OE, ch, flag);}
开发者ID:DenisLug,项目名称:mptcp,代码行数:17,


示例15: lh7a40xuart_rx_chars

static void lh7a40xuart_rx_chars (struct uart_port* port){	struct tty_struct* tty = port->info->tty;	int cbRxMax = 256;	/* (Gross) limit on receive */	unsigned int data;	/* Received data and status */	unsigned int flag;	while (!(UR (port, UART_R_STATUS) & nRxRdy) && --cbRxMax) {		data = UR (port, UART_R_DATA);		flag = TTY_NORMAL;		++port->icount.rx;		if (unlikely(data & RxError)) {			if (data & RxBreak) {				data &= ~(RxFramingError | RxParityError);				++port->icount.brk;				if (uart_handle_break (port))					continue;			}			else if (data & RxParityError)				++port->icount.parity;			else if (data & RxFramingError)				++port->icount.frame;			if (data & RxOverrunError)				++port->icount.overrun;				/* Mask by termios, leave Rx'd byte */			data &= port->read_status_mask | 0xff;			if (data & RxBreak)				flag = TTY_BREAK;			else if (data & RxParityError)				flag = TTY_PARITY;			else if (data & RxFramingError)				flag = TTY_FRAME;		}		if (uart_handle_sysrq_char (port, (unsigned char) data))			continue;		uart_insert_char(port, data, RxOverrunError, data, flag);	}	tty_flip_buffer_push (tty);	return;}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:45,


示例16: mcf_rx_chars

static void mcf_rx_chars(struct mcf_uart *pp){	struct uart_port *port = &pp->port;	unsigned char status, ch, flag;	while ((status = readb(port->membase + MCFUART_USR)) & MCFUART_USR_RXREADY) {		ch = readb(port->membase + MCFUART_URB);		flag = TTY_NORMAL;		port->icount.rx++;		if (status & MCFUART_USR_RXERR) {			writeb(MCFUART_UCR_CMDRESETERR,				port->membase + MCFUART_UCR);			if (status & MCFUART_USR_RXBREAK) {				port->icount.brk++;				if (uart_handle_break(port))					continue;			} else if (status & MCFUART_USR_RXPARITY) {				port->icount.parity++;			} else if (status & MCFUART_USR_RXOVERRUN) {				port->icount.overrun++;			} else if (status & MCFUART_USR_RXFRAMING) {				port->icount.frame++;			}			status &= port->read_status_mask;			if (status & MCFUART_USR_RXBREAK)				flag = TTY_BREAK;			else if (status & MCFUART_USR_RXPARITY)				flag = TTY_PARITY;			else if (status & MCFUART_USR_RXFRAMING)				flag = TTY_FRAME;		}		if (uart_handle_sysrq_char(port, ch))			continue;		uart_insert_char(port, status, MCFUART_USR_RXOVERRUN, ch, flag);	}	spin_unlock(&port->lock);	tty_flip_buffer_push(&port->state->port);	spin_lock(&port->lock);}
开发者ID:3null,项目名称:linux,代码行数:45,


示例17: netx_rxint

static void netx_rxint(struct uart_port *port){	unsigned char rx, flg, status;	struct tty_struct *tty = port->info->port.tty;	while (!(readl(port->membase + UART_FR) & FR_RXFE)) {		rx = readl(port->membase + UART_DR);		flg = TTY_NORMAL;		port->icount.rx++;		status = readl(port->membase + UART_SR);		if (status & SR_BE) {			writel(0, port->membase + UART_SR);			if (uart_handle_break(port))				continue;		}		if (unlikely(status & (SR_FE | SR_PE | SR_OE))) {			if (status & SR_PE)				port->icount.parity++;			else if (status & SR_FE)				port->icount.frame++;			if (status & SR_OE)				port->icount.overrun++;			status &= port->read_status_mask;			if (status & SR_BE)				flg = TTY_BREAK;			else if (status & SR_PE)				flg = TTY_PARITY;			else if (status & SR_FE)				flg = TTY_FRAME;		}		if (uart_handle_sysrq_char(port, rx))			continue;		uart_insert_char(port, status, SR_OE, rx, flg);	}	tty_flip_buffer_push(tty);	return;}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:44,


示例18: netx_rxint

static void netx_rxint(struct uart_port *port, unsigned long *flags){	unsigned char rx, flg, status;	while (!(readl(port->membase + UART_FR) & FR_RXFE)) {		rx = readl(port->membase + UART_DR);		flg = TTY_NORMAL;		port->icount.rx++;		status = readl(port->membase + UART_SR);		if (status & SR_BE) {			writel(0, port->membase + UART_SR);			if (uart_handle_break(port))				continue;		}		if (unlikely(status & (SR_FE | SR_PE | SR_OE))) {			if (status & SR_PE)				port->icount.parity++;			else if (status & SR_FE)				port->icount.frame++;			if (status & SR_OE)				port->icount.overrun++;			status &= port->read_status_mask;			if (status & SR_BE)				flg = TTY_BREAK;			else if (status & SR_PE)				flg = TTY_PARITY;			else if (status & SR_FE)				flg = TTY_FRAME;		}		if (uart_handle_sysrq_char(port, rx))			continue;		uart_insert_char(port, status, SR_OE, rx, flg);	}	spin_unlock_irqrestore(&port->lock, *flags);	tty_flip_buffer_push(&port->state->port);	spin_lock_irqsave(&port->lock, *flags);}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:44,


示例19: mxs_auart_rx_char

static void mxs_auart_rx_char(struct mxs_auart_port *s){	int flag;	u32 stat;	u8 c;	c = readl(s->port.membase + AUART_DATA);	stat = readl(s->port.membase + AUART_STAT);	flag = TTY_NORMAL;	s->port.icount.rx++;	if (stat & AUART_STAT_BERR) {		s->port.icount.brk++;		if (uart_handle_break(&s->port))			goto out;	} else if (stat & AUART_STAT_PERR) {		s->port.icount.parity++;	} else if (stat & AUART_STAT_FERR) {		s->port.icount.frame++;	}	/*	 * Mask off conditions which should be ingored.	 */	stat &= s->port.read_status_mask;	if (stat & AUART_STAT_BERR) {		flag = TTY_BREAK;	} else if (stat & AUART_STAT_PERR)		flag = TTY_PARITY;	else if (stat & AUART_STAT_FERR)		flag = TTY_FRAME;	if (stat & AUART_STAT_OERR)		s->port.icount.overrun++;	if (uart_handle_sysrq_char(&s->port, c))		goto out;	uart_insert_char(&s->port, stat, AUART_STAT_OERR, c, flag);out:	writel(stat, s->port.membase + AUART_STAT);}
开发者ID:maikelwever,项目名称:android_kernel_htc_msm8660-caf,代码行数:44,


示例20: altera_jtaguart_rx_chars

static void altera_jtaguart_rx_chars(struct altera_jtaguart *pp){	struct uart_port *port = &pp->port;	unsigned char ch, flag;	unsigned long status;	while ((status = readl(port->membase + ALTERA_JTAGUART_DATA_REG)) &	       ALTERA_JTAGUART_DATA_RVALID_MSK) {		ch = status & ALTERA_JTAGUART_DATA_DATA_MSK;		flag = TTY_NORMAL;		port->icount.rx++;		if (uart_handle_sysrq_char(port, ch))			continue;		uart_insert_char(port, 0, 0, ch, flag);	}	tty_flip_buffer_push(&port->state->port);}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:19,


示例21: serial_omap_rdi

static void serial_omap_rdi(struct uart_omap_port *up, unsigned int lsr){	unsigned char ch = 0;	unsigned int flag;	if (!(lsr & UART_LSR_DR))		return;	ch = serial_in(up, UART_RX);	flag = TTY_NORMAL;	up->port.icount.rx++;#ifdef CONFIG_CONSOLE_POLL	if (up->port.poll_rx_cb && up->port.poll_rx_cb(ch))		return;#endif	if (uart_handle_sysrq_char(&up->port, ch))		return;	uart_insert_char(&up->port, lsr, UART_LSR_OE, ch, flag);}
开发者ID:neominds,项目名称:wrfx227819,代码行数:21,


示例22: sirfsoc_uart_pio_rx_chars

static unsigned intsirfsoc_uart_pio_rx_chars(struct uart_port *port, unsigned int max_rx_count){	unsigned int ch, rx_count = 0;	while (!(rd_regl(port, SIRFUART_RX_FIFO_STATUS) &					SIRFUART_FIFOEMPTY_MASK(port))) {		ch = rd_regl(port, SIRFUART_RX_FIFO_DATA) | SIRFUART_DUMMY_READ;		if (unlikely(uart_handle_sysrq_char(port, ch)))			continue;		uart_insert_char(port, 0, 0, ch, TTY_NORMAL);		rx_count++;		if (rx_count >= max_rx_count)			break;	}	port->icount.rx += rx_count;	tty_flip_buffer_push(&port->state->port);	return rx_count;}
开发者ID:Cool-Joe,项目名称:imx23-audio,代码行数:21,


示例23: sprd_rx

static inline void sprd_rx(struct uart_port *port){	struct tty_port *tty = &port->state->port;	unsigned int ch, flag, lsr, max_count = SPRD_TIMEOUT;	while ((serial_in(port, SPRD_STS1) & 0x00ff) && max_count--) {		lsr = serial_in(port, SPRD_LSR);		ch = serial_in(port, SPRD_RXD);		flag = TTY_NORMAL;		port->icount.rx++;		if (lsr & (SPRD_LSR_BI | SPRD_LSR_PE |			SPRD_LSR_FE | SPRD_LSR_OE))			if (handle_lsr_errors(port, &lsr, &flag))				continue;		if (uart_handle_sysrq_char(port, ch))			continue;		uart_insert_char(port, lsr, SPRD_LSR_OE, ch, flag);	}	tty_flip_buffer_push(tty);}
开发者ID:DenisLug,项目名称:mptcp,代码行数:23,


示例24: xuartps_isr

/** * xuartps_isr - Interrupt handler * @irq: Irq number * @dev_id: Id of the port * * Returns IRQHANDLED **/static irqreturn_t xuartps_isr(int irq, void *dev_id){    struct uart_port *port = (struct uart_port *)dev_id;    unsigned long flags;    unsigned int isrstatus, numbytes;    unsigned int data;    char status = TTY_NORMAL;    spin_lock_irqsave(&port->lock, flags);    /* Read the interrupt status register to determine which     * interrupt(s) is/are active.     */    isrstatus = xuartps_readl(XUARTPS_ISR_OFFSET);    /* drop byte with parity error if IGNPAR specified */    if (isrstatus & port->ignore_status_mask & XUARTPS_IXR_PARITY)        isrstatus &= ~(XUARTPS_IXR_RXTRIG | XUARTPS_IXR_TOUT);    isrstatus &= port->read_status_mask;    isrstatus &= ~port->ignore_status_mask;    if ((isrstatus & XUARTPS_IXR_TOUT) ||            (isrstatus & XUARTPS_IXR_RXTRIG)) {        /* Receive Timeout Interrupt */        while ((xuartps_readl(XUARTPS_SR_OFFSET) &                XUARTPS_SR_RXEMPTY) != XUARTPS_SR_RXEMPTY) {            data = xuartps_readl(XUARTPS_FIFO_OFFSET);            port->icount.rx++;            if (isrstatus & XUARTPS_IXR_PARITY) {                port->icount.parity++;                status = TTY_PARITY;            } else if (isrstatus & XUARTPS_IXR_FRAMING) {                port->icount.frame++;                status = TTY_FRAME;            } else if (isrstatus & XUARTPS_IXR_OVERRUN)                port->icount.overrun++;            uart_insert_char(port, isrstatus, XUARTPS_IXR_OVERRUN,                             data, status);        }        spin_unlock(&port->lock);        tty_flip_buffer_push(&port->state->port);        spin_lock(&port->lock);    }    /* Dispatch an appropriate handler */    if ((isrstatus & XUARTPS_IXR_TXEMPTY) == XUARTPS_IXR_TXEMPTY) {        if (uart_circ_empty(&port->state->xmit)) {            xuartps_writel(XUARTPS_IXR_TXEMPTY,                           XUARTPS_IDR_OFFSET);        } else {            numbytes = port->fifosize;            /* Break if no more data available in the UART buffer */            while (numbytes--) {                if (uart_circ_empty(&port->state->xmit))                    break;                /* Get the data from the UART circular buffer                 * and write it to the xuartps's TX_FIFO                 * register.                 */                xuartps_writel(                    port->state->xmit.buf[port->state->xmit.                                          tail], XUARTPS_FIFO_OFFSET);                port->icount.tx++;                /* Adjust the tail of the UART buffer and wrap                 * the buffer if it reaches limit.                 */                port->state->xmit.tail =                    (port->state->xmit.tail + 1) & /                    (UART_XMIT_SIZE - 1);            }            if (uart_circ_chars_pending(                        &port->state->xmit) < WAKEUP_CHARS)                uart_write_wakeup(port);        }    }    xuartps_writel(isrstatus, XUARTPS_ISR_OFFSET);    /* be sure to release the lock and tty before leaving */    spin_unlock_irqrestore(&port->lock, flags);    return IRQ_HANDLED;}
开发者ID:Niisp,项目名称:MT6795.kernel,代码行数:96,


示例25: stmp_appuart_rx

void stmp_appuart_rx(struct stmp_appuart_port *s, u8 *rx_buffer, int count){	u8 c;	int flag;	struct tty_struct *tty = s->port.info->port.tty;	u32 stat;	spin_lock(&s->lock);	stat = HW_UARTAPP_STAT_RD_NB(s->mem);	if (count < 0) {		count = HW_UARTAPP_STAT_RD_NB(s->mem) & BM_UARTAPP_STAT_RXCOUNT;		dev_dbg(s->dev, "count = %d/n", count);	}	for (;;) {		if (!rx_buffer) {			if (stat & BM_UARTAPP_STAT_RXFE)				break;			c = HW_UARTAPP_DATA_RD_NB(s->mem) & 0xFF;		} else {			if (count-- <= 0)				break;			c = *rx_buffer++;			dev_dbg(s->dev, "Received: %x(%c)/n", c, chr(c));		}		flag = TTY_NORMAL;		if (stat & BM_UARTAPP_STAT_BERR) {			stat &= ~BM_UARTAPP_STAT_BERR;			s->port.icount.brk++;			if (uart_handle_break(&s->port))				goto ignore;			flag = TTY_BREAK;		} else if (stat & BM_UARTAPP_STAT_PERR) {			stat &= ~BM_UARTAPP_STAT_PERR;				s->port.icount.parity++;				flag = TTY_PARITY;		} else if (stat & BM_UARTAPP_STAT_FERR) {			stat &= ~BM_UARTAPP_STAT_FERR;			s->port.icount.frame++;			flag = TTY_FRAME;		}		if (stat & BM_UARTAPP_STAT_OERR)			s->port.icount.overrun++;		if (uart_handle_sysrq_char(&s->port, c))			goto ignore;		uart_insert_char(&s->port, stat,			BM_UARTAPP_STAT_OERR, c, flag);ignore:		if (pio_mode) {			HW_UARTAPP_STAT_WR_NB(s->mem, stat);			stat = HW_UARTAPP_STAT_RD_NB(s->mem);		}	}	HW_UARTAPP_STAT_WR_NB(s->mem, stat);	tty_flip_buffer_push(tty);	spin_unlock(&s->lock);}
开发者ID:traveller42,项目名称:linux-2.6.28.mx233-falconwing,代码行数:63,



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


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