• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ sci_in函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: sci_handle_breaks

static inline int sci_handle_breaks(struct uart_port *port)
{
	int copied = 0;
	unsigned short status = sci_in(port, SCxSR);
	struct tty_struct *tty = port->info->tty;
	struct sci_port *s = &sci_ports[port->line];

	if (!s->break_flag && status & SCxSR_BRK(port)) {
#if defined(CONFIG_CPU_SH3)
		/* Debounce break */
		s->break_flag = 1;
#endif
		/* Notify of BREAK */
		if (tty_insert_flip_char(tty, 0, TTY_BREAK))
			copied++;
		pr_debug("sci: BREAK detected\n");
	}

#if defined(SCIF_ORER)
	/* XXX: Handle SCIF overrun error */
	if (port->type == PORT_SCIF && (sci_in(port, SCLSR) & SCIF_ORER) != 0) {
		sci_out(port, SCLSR, 0);
		if (tty_insert_flip_char(tty, 0, TTY_OVERRUN)) {
			copied++;
			pr_debug("sci: overrun error\n");
		}
	}
#endif

	if (copied)
		tty_flip_buffer_push(tty);

	return copied;
}
开发者ID:ivucica,项目名称:linux,代码行数:34,代码来源:sh-sci.c


示例2: scif_rxfill

static int scif_rxfill(struct uart_port *port)
{
	if (port->type == PORT_SCIFA)
		return sci_in(port, SCFDR) & SCIF_RFDC_MASK;
	else
		return sci_in(port, SCRFDR);
}
开发者ID:ClarkChen633,项目名称:u-boot-pi,代码行数:7,代码来源:serial_sh.c


示例3: handle_error

void handle_error(void)
{
	sci_in(&sh_sci, SCxSR);
	sci_out(&sh_sci, SCxSR, SCxSR_ERROR_CLEAR(&sh_sci));
	sci_in(&sh_sci, SCLSR);
	sci_out(&sh_sci, SCLSR, 0x00);
}
开发者ID:ClarkChen633,项目名称:u-boot-pi,代码行数:7,代码来源:serial_sh.c


示例4: sci_transmit_chars

static void sci_transmit_chars(struct uart_port *port)
{
	struct circ_buf *xmit = &port->info->xmit;
	unsigned int stopped = uart_tx_stopped(port);
	unsigned long flags;
	unsigned short status;
	unsigned short ctrl;
	int count, txroom;

	status = sci_in(port, SCxSR);
	if (!(status & SCxSR_TDxE(port))) {
		local_irq_save(flags);
		ctrl = sci_in(port, SCSCR);
		if (uart_circ_empty(xmit)) {
			ctrl &= ~SCI_CTRL_FLAGS_TIE;
		} else {
			ctrl |= SCI_CTRL_FLAGS_TIE;
		}
		sci_out(port, SCSCR, ctrl);
		local_irq_restore(flags);
		return;
	}

#if !defined(SCI_ONLY)
	if (port->type == PORT_SCIF) {
		txroom = SCIF_TXROOM_MAX - (sci_in(port, SCFDR)>>8);
	} else {
开发者ID:BackupTheBerlios,项目名称:tuxap,代码行数:27,代码来源:sh-sci.c


示例5: sci_setsignals

static void sci_setsignals(struct sci_port *port, int dtr, int rts)
{
	/* This routine is used for seting signals of: DTR, DCD, CTS/RTS */
	/* We use SCIF's hardware for CTS/RTS, so don't need any for that. */
	/* If you have signals for DTR and DCD, please implement here. */

#if defined(CONFIG_SH_SECUREEDGE5410)
	int flags;

	save_and_cli(flags);
	if (port == &sci_ports[1]) { /* port 1 only */
		if (dtr == 0)
			SECUREEDGE_WRITE_IOPORT(0x0080, 0x0080);
		else if (dtr == 1)
			SECUREEDGE_WRITE_IOPORT(0x0000, 0x0080);
		if ((sci_in(port, SCFCR) & SCFCR_MCE) == 0) {
			if (rts)
				sci_out(port, SCSPTR, sci_in(port, SCSPTR) & ~0x40);
			else
				sci_out(port, SCSPTR, sci_in(port, SCSPTR) | 0x40);
		}
	}
	if (port == &sci_ports[0]) { /* port 0 only */
		if (dtr == 0)
			SECUREEDGE_WRITE_IOPORT(0x0200, 0x0200);
		else if (dtr == 1)
			SECUREEDGE_WRITE_IOPORT(0x0000, 0x0200);
		if (rts == 0)
			SECUREEDGE_WRITE_IOPORT(0x0100, 0x0100);
		else if (rts == 1)
			SECUREEDGE_WRITE_IOPORT(0x0000, 0x0100);
	}
	restore_flags(flags);
#endif
}
开发者ID:iPodLinux,项目名称:linux-2.4.24-ipod,代码行数:35,代码来源:sh-sci.c


示例6: sci_set_termios

static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
			    struct ktermios *old)
{
	struct sci_port *s = &sci_ports[port->line];
	unsigned int status, baud, smr_val;
	unsigned long flags;
	int t;

	baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);

	switch (baud) {
		case 0:
			t = -1;
			break;
		default:
		{
#if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64)
			struct clk *clk = clk_get(NULL, "module_clk");
			t = SCBRR_VALUE(baud, clk_get_rate(clk));
			clk_put(clk);
#else
			t = SCBRR_VALUE(baud);
#endif
		}
			break;
	}

	spin_lock_irqsave(&port->lock, flags);

	do {
		status = sci_in(port, SCxSR);
	} while (!(status & SCxSR_TEND(port)));

	sci_out(port, SCSCR, 0x00);	/* TE=0, RE=0, CKE1=0 */

#if !defined(SCI_ONLY)
	if (port->type == PORT_SCIF)
		sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST);
#endif

	smr_val = sci_in(port, SCSMR) & 3;
	if ((termios->c_cflag & CSIZE) == CS7)
		smr_val |= 0x40;
	if (termios->c_cflag & PARENB)
		smr_val |= 0x20;
	if (termios->c_cflag & PARODD)
		smr_val |= 0x30;
	if (termios->c_cflag & CSTOPB)
		smr_val |= 0x08;

	uart_update_timeout(port, termios->c_cflag, baud);

	sci_out(port, SCSMR, smr_val);

	if (t > 0) {
		if(t >= 256) {
			sci_out(port, SCSMR, (sci_in(port, SCSMR) & ~3) | 1);
			t >>= 2;
		} else {
开发者ID:ivucica,项目名称:linux,代码行数:59,代码来源:sh-sci.c


示例7: change_speed

/*
 * This routine is called to set the UART divisor registers to match
 * the specified baud rate for a serial port.
 */
static void change_speed(struct sci_struct *sci)
{
	unsigned cflag;
	unsigned int status;
	unsigned int smr_val;
	unsigned int ddr;
	unsigned int i,t;

	if (!sci->info->tty || !sci->info->tty->termios)
		return;
	cflag = sci->info->tty->termios->c_cflag;

	do
		status = sci_in(sci, SCI_SSR);
	while (!(status & SCI_SSR_TEND));

	sci_out(sci, SCI_SCR, 0x00);	/* TE=0, RE=0, CKE1=0 */

	smr_val = sci_in(sci, SCI_SMR) & 3;
	if ((cflag & CSIZE) == CS7)
		smr_val |= 0x40;
	if (cflag & PARENB)
		smr_val |= 0x20;
	if (cflag & PARODD)
		smr_val |= 0x10;
	if (cflag & CSTOPB)
		smr_val |= 0x08;
	t=0;
	cflag = sci->info->tty->termios->c_cflag;
	i = cflag & CBAUD;
	if (i & CBAUDEX) {
		i &= ~CBAUDEX;
		if (i < 1 || i > 2) 
			sci->info->tty->termios->c_cflag &= ~CBAUDEX;
		else
			i += 15;
	}
	if (i == 15) {
		if ((sci->info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
			i += 1;
		if ((sci->info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
			i += 2;
		if ((sci->info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)
			t = sci->info->custom_divisor;
	}
	if (t==0)
		t=sci_baud_table[i];

	if (t > 0) {
		if(t >= 256) {
			smr_val = (t >> 8) & 3;
		}
		sci_out(sci, SCI_BRR, t & 0xff);
		udelay(32*(1 << (t*2))*(t & 0xff)*CONFIG_CLK_FREQ); /* Wait one bit interval */
	}
开发者ID:robacklin,项目名称:uclinux-linux,代码行数:59,代码来源:hitachi-sci.c


示例8: serial_raw_putc

void serial_raw_putc(const char c)
{
	while (1) {
		/* Tx fifo is empty */
		if (sci_in(&sh_sci, SCxSR) & SCxSR_TEND(&sh_sci))
			break;
	}

	sci_out(&sh_sci, SCxTDR, c);
	sci_out(&sh_sci, SCxSR, sci_in(&sh_sci, SCxSR) & ~SCxSR_TEND(&sh_sci));
}
开发者ID:ClarkChen633,项目名称:u-boot-pi,代码行数:11,代码来源:serial_sh.c


示例9: kgdb_put_char

/* Write a char */
static void kgdb_put_char(struct sci_port *port, char c)
{
        unsigned short status;

        do
                status = sci_in(port, SCxSR);
        while (!(status & SCxSR_TDxE(port)));

        sci_out(port, SCxTDR, c);
        sci_in(port, SCxSR);    /* Dummy read */
        sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port));
}
开发者ID:BackupTheBerlios,项目名称:tuxap,代码行数:13,代码来源:sh-sci.c


示例10: serial_getc_check

int serial_getc_check(void)
{
	unsigned short status;

	status = sci_in(&sh_sci, SCxSR);

	if (status & SCIF_ERRORS)
		handle_error();
	if (sci_in(&sh_sci, SCLSR) & SCxSR_ORER(&sh_sci))
		handle_error();
	return status & (SCIF_DR | SCxSR_RDxF(&sh_sci));
}
开发者ID:ClarkChen633,项目名称:u-boot-pi,代码行数:12,代码来源:serial_sh.c


示例11: kgdb_get_char

/* Get a char if there is one, else ret -1 */
static int kgdb_get_char(struct sci_port *port)
{
        int c;

        if (kgdb_is_char_ready(port) == 0)
                c = -1;
        else {
                c = sci_in(port, SCxRDR);
                sci_in(port, SCxSR);    /* Dummy read */
                sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port));
        }

        return c;
}
开发者ID:BackupTheBerlios,项目名称:tuxap,代码行数:15,代码来源:sh-sci.c


示例12: scif_sercon_putc

static void scif_sercon_putc(int c)
{
	while (((sci_in(&scif_port, SCFDR) & EPK_FIFO_BITS) >= EPK_FIFO_SIZE))
		;

	sci_in(&scif_port, SCxSR);
	sci_out(&scif_port, SCxSR, 0xf3 & ~(0x20 | 0x40));
	sci_out(&scif_port, SCxTDR, c);

	while ((sci_in(&scif_port, SCxSR) & 0x40) == 0)
		;

	if (c == '\n')
		scif_sercon_putc('\r');
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:15,代码来源:early_printk.c


示例13: transmit_chars

static _INLINE_ void transmit_chars(struct sci_struct *sci)
{
	if (sci->info->x_char) {
		sci_outp(sci, SCI_TDR, sci->info->x_char);
		sci->info->x_char = 0;
		return;
	}
	if ((sci->info->xmit_cnt <= 0) || sci->info->tty->stopped) {
		sci_ctrl_reset(sci, SCI_SCR_TIE);
		return;
	}
	
	sci_outp(sci, SCI_TDR, sci->info->xmit_buf[sci->info->xmit_tail++]);
	sci->info->xmit_tail = sci->info->xmit_tail & (SERIAL_XMIT_SIZE-1);
	sci_outp(sci,SCI_SSR,sci_in(sci,SCI_SSR) & ~SCI_SSR_TDRE);
	sci->info->xmit_cnt--;
	if (sci->info->xmit_cnt < WAKEUP_CHARS)
		rs_sched_event(sci, RS_EVENT_WRITE_WAKEUP);
#ifdef SERIAL_DEBUG_INTR
	printk("THRE...");
#endif
	if (sci->info->xmit_cnt <= 0) {
		sci_ctrl_reset(sci, SCI_SCR_TIE);
	}
}
开发者ID:robacklin,项目名称:uclinux-linux,代码行数:25,代码来源:hitachi-sci.c


示例14: put_char

static void put_char(struct sci_port *port, char c)
{
	unsigned long flags;
	unsigned short status;

	save_and_cli(flags);

	do
		status = sci_in(port, SCxSR);
	while (!(status & SCxSR_TDxE(port)));
	
	sci_out(port, SCxTDR, c);
	sci_in(port, SCxSR);            /* Dummy read */
	sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port));

	restore_flags(flags);
}
开发者ID:nhanh0,项目名称:hah,代码行数:17,代码来源:sh-sci.c


示例15: kgdb_is_char_ready

/* Is the SCI ready, ie is there a char waiting? */
static int kgdb_is_char_ready(struct sci_port *port)
{
        unsigned short status = sci_in(port, SCxSR);

        if (status & (SCxSR_ERRORS(port) | SCxSR_BRK(port)))
                kgdb_handle_error(port);

        return (status & SCxSR_RDxF(port));
}
开发者ID:BackupTheBerlios,项目名称:tuxap,代码行数:10,代码来源:sh-sci.c


示例16: sh_serial_getc

static int sh_serial_getc(void)
{
	unsigned short status;
	char ch;

	while (!serial_getc_check())
		;

	ch = sci_in(&sh_sci, SCxRDR);
	status = sci_in(&sh_sci, SCxSR);

	sci_out(&sh_sci, SCxSR, SCxSR_RDxF_CLEAR(&sh_sci));

	if (status & SCIF_ERRORS)
			handle_error();

	if (sci_in(&sh_sci, SCLSR) & SCxSR_ORER(&sh_sci))
		handle_error();
	return ch;
}
开发者ID:ClarkChen633,项目名称:u-boot-pi,代码行数:20,代码来源:serial_sh.c


示例17: sci_getsignals

static int sci_getsignals(struct sci_port *port)
{
	/* This routine is used for geting signals of: DTR, DCD, DSR, RI,
	   and CTS/RTS */

#if defined(CONFIG_SH_SECUREEDGE5410)
	if (port == &sci_ports[1]) { /* port 1 only */
		unsigned short s = SECUREEDGE_READ_IOPORT();
		int rc = TIOCM_RTS|TIOCM_DSR|TIOCM_CTS;

		if ((sci_in(port, SCFCR) & SCFCR_MCE) == 0) {
			if (sci_in(port, SCSPTR) & 0x0040)
				rc &= ~TIOCM_RTS;
			if (sci_in(port, SCSPTR) & 0x0010)
				rc &= ~TIOCM_CTS;
		}

		if ((s & 0x0001) == 0)
			rc |= TIOCM_CAR;
		if ((SECUREEDGE_READ_IOPORT() & 0x0080) == 0)
			rc |= TIOCM_DTR;
		return(rc);
	}
	if (port == &sci_ports[0]) { /* port 0 only */
		unsigned short s = SECUREEDGE_READ_IOPORT();
		int rc = TIOCM_DSR;

		if ((s & 0x0010) == 0)
			rc |= TIOCM_CAR;
		if ((s & 0x0004) == 0)
			rc |= TIOCM_CTS;
		if ((SECUREEDGE_READ_IOPORT() & 0x0200) == 0)
			rc |= TIOCM_DTR;
		if ((SECUREEDGE_READ_IOPORT() & 0x0100) == 0)
			rc |= TIOCM_RTS;
		return(rc);
	}
#endif

	return TIOCM_DTR|TIOCM_RTS|TIOCM_DSR;
}
开发者ID:iPodLinux,项目名称:linux-2.4.24-ipod,代码行数:41,代码来源:sh-sci.c


示例18: sci_set_termios

static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
			    struct ktermios *old)
{
	struct sci_port *s = &sci_ports[port->line];
	unsigned int status, baud, smr_val;
	int t = -1;

	baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
	if (likely(baud))
		t = SCBRR_VALUE(baud, port->uartclk);

	do {
		status = sci_in(port, SCxSR);
	} while (!(status & SCxSR_TEND(port)));

	sci_out(port, SCSCR, 0x00);	/* TE=0, RE=0, CKE1=0 */

#if !defined(SCI_ONLY)
	if (port->type == PORT_SCIF)
		sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST);
#endif

	smr_val = sci_in(port, SCSMR) & 3;
	if ((termios->c_cflag & CSIZE) == CS7)
		smr_val |= 0x40;
	if (termios->c_cflag & PARENB)
		smr_val |= 0x20;
	if (termios->c_cflag & PARODD)
		smr_val |= 0x30;
	if (termios->c_cflag & CSTOPB)
		smr_val |= 0x08;

	uart_update_timeout(port, termios->c_cflag, baud);

	sci_out(port, SCSMR, smr_val);

	if (t > 0) {
		if(t >= 256) {
			sci_out(port, SCSMR, (sci_in(port, SCSMR) & ~3) | 1);
			t >>= 2;
		} else {
开发者ID:mpalmer,项目名称:linux-2.6,代码行数:41,代码来源:sh-sci.c


示例19: get_char

static int get_char(struct sci_port *port)
{
	unsigned long flags;
	unsigned short status;
	int c;

	save_and_cli(flags);
        do {
		status = sci_in(port, SCxSR);
		if (status & SCxSR_ERRORS(port)) {
			handle_error(port);
			continue;
		}
	} while (!(status & SCxSR_RDxF(port)));
	c = sci_in(port, SCxRDR);
	sci_in(port, SCxSR);            /* Dummy read */
	sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port));
	restore_flags(flags);

	return c;
}
开发者ID:nhanh0,项目名称:hah,代码行数:21,代码来源:sh-sci.c


示例20: sh_serial_init

static int sh_serial_init(void)
{
	sci_out(&sh_sci, SCSCR , SCSCR_INIT(&sh_sci));
	sci_out(&sh_sci, SCSCR , SCSCR_INIT(&sh_sci));
	sci_out(&sh_sci, SCSMR, 0);
	sci_out(&sh_sci, SCSMR, 0);
	sci_out(&sh_sci, SCFCR, SCFCR_RFRST|SCFCR_TFRST);
	sci_in(&sh_sci, SCFCR);
	sci_out(&sh_sci, SCFCR, 0);

	serial_setbrg();
	return 0;
}
开发者ID:ClarkChen633,项目名称:u-boot-pi,代码行数:13,代码来源:serial_sh.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ sci_object_get_association函数代码示例发布时间:2022-05-30
下一篇:
C++ sci_base_state_machine_get_state函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap