当前位置: 首页>>代码示例>>C++>>正文


C++ serial_putc函数代码示例

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


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

示例1: serial_putc_dev

static void serial_putc_dev(struct udevice *dev, char ch)
{
	struct dm_serial_ops *ops = serial_get_ops(cur_dev);
	int err;

	do {
		err = ops->putc(cur_dev, ch);
	} while (err == -EAGAIN);
	if (ch == '\n')
		serial_putc('\r');
}
开发者ID:test1954,项目名称:maxle-uboot-v3,代码行数:11,代码来源:serial-uclass.c

示例2: serial_putc

void serial_putc(const char c)
{
	if (c == '\n')
		serial_putc('\r');

	/* Wait for fifo to shift out some bytes */
	while (!((readb(&uart->lsr) & (UART_LSR_TDRQ | UART_LSR_TEMT)) == 0x60))
		;

	writeb((u8)c, &uart->rbr_thr_dllr);
}
开发者ID:IngenicC,项目名称:u-boot,代码行数:11,代码来源:jz_serial.c

示例3: serial_puts

void serial_puts (const char *s)
#endif
{
	while (*s) {
#if defined(CONFIG_SERIAL_MULTI)
		serial_putc_dev (dev_base, *s++);
#else
		serial_putc (*s++);
#endif
	}
}
开发者ID:Admetric,项目名称:android_u-boot_s5pv210,代码行数:11,代码来源:serial.c

示例4: uart_irq_callback

void uart_irq_callback(uint32_t id, SerialIrq event)
{
	serial_t *sobj = (void*)id;

	if(event == RxIrq) {
		acquire_wakelock(WAKELOCK_EXAMPLE);

		rc = serial_getc(sobj);

		if (rc == '\r' || rc == '\n') {
			serial_putc(sobj, '\r');
			serial_putc(sobj, '\n');
			serial_putc(sobj, '#');
			serial_putc(sobj, ' ');

			if (cmdbuf_index != 0) {

                /* NOTICE: If you don't want loss any data from treating UART signal as GPIO interrupt,
                 *         you can set FREERTOS_PMU_TICKLESS_PLL_RESERVED to 1 in "platform_opt.h".
                 *         It will reserved PLL clock in tickless and UART can receive the whole data.
                 *         But it also cost more power consumption.
                 **/

				// process command
				printf("cmd(%d): %s\r\n", cmdbuf_index, cmdbuf);

				// release wakelock and reset buf
				cmdbuf_index = 0;
				release_wakelock(WAKELOCK_EXAMPLE);
			}
		}

		if (!(rc == '\r' || rc == '\n' )) {
			// receive command
			serial_putc(sobj, rc);
			cmdbuf[cmdbuf_index] = rc;
			cmdbuf_index++;
			cmdbuf[cmdbuf_index] = '\0';
		}
	}
}
开发者ID:KuanYuChen,项目名称:ameba-sdk-gcc-make,代码行数:41,代码来源:main.c

示例5: handleSetSensorRange

void handleSetSensorRange(uint8_t sensorId, uint8_t measurementId, uint8_t range)
{
	if (sensorId < no_of_sensors_ && measurementId < sensors_[sensorId]->no_of_measurements)
	{
		sensors_[sensorId]->set_range(measurementId, range);

		serial_putc(OBJECT_START);
		serial_putc(CMD_SET_SENSOR_RANGE);
		serial_putc(DELIMITER);
		serial_putc('0' + sensorId);
		serial_putc(DELIMITER);
		serial_putc('0' + measurementId);
		serial_putc(DELIMITER);
		serial_putc('0' + sensors_[sensorId]->range[measurementId]);
		serial_putc(OBJECT_END);
	}
}
开发者ID:konstantinwerner,项目名称:sensors,代码行数:17,代码来源:sensors.c

示例6: serial_putc

/* write write out a single char */
extern void serial_putc (char ch)
{
	/* Stream-LF to CR+LF conversion */
	if (ch == 10)
		serial_putc ('\r');

	/* wait till safe to write next char */
	TxCharReady ();

	/* finally, write next char */
	p2_outl (UART_TXBUFFER_REG, ch);
}
开发者ID:Blagus,项目名称:STB8000-U-Boot,代码行数:13,代码来源:stm-asc.c

示例7: serial_printf

void serial_printf(const char* fmt, ...)
{
	char* line = malloc(82);
	va_list args;
	int linelen;

	va_start(args, fmt);
	if ((linelen = vsnprintf(line, 82, fmt, args)) >= 82)
	{
		va_end(args);
		va_start(args, fmt);
		free(line);
		line = malloc(linelen + 1);
		vsnprintf(line, linelen + 1, fmt, args);
	}
	serial_puts(line);
	va_end(args);
	free(line);
	serial_putc('\r');
	serial_putc('\n');
}
开发者ID:Tiger21820,项目名称:TempGBA,代码行数:21,代码来源:serial.c

示例8: serial_puts

/*==============================================================================
 * - serial_puts()
 *
 * - send a string
 */
int serial_puts(const char *s)
{
    int i = 0;

    SERIAL_FIFO_LOCK();
    while (*s) {
        serial_putc(*s++);
        i++;
    }
    SERIAL_FIFO_UNLOCK();
    return i;
}
开发者ID:WangDongfang,项目名称:DfewOS,代码行数:17,代码来源:serial.c

示例9: serial_putc

void serial_putc (const char c)
{
	__REG(UART_PHYS + UTXD) = c;

	/* wait for transmitter to be ready */
	while (!(__REG(UART_PHYS + UTS) & UTS_TXEMPTY))
		WATCHDOG_RESET();

	/* If \n, also do \r */
	if (c == '\n')
		serial_putc ('\r');
}
开发者ID:Aorjoa,项目名称:bootloader,代码行数:12,代码来源:serial_mxc.c

示例10: serial_put_hex

SPL_STATIC_FUNC
void serial_put_hex(unsigned int data,unsigned bitlen)
{
	int i;
    for (i=bitlen-4;i>=0;i-=4){
        if((data>>i)==0)
        {
            serial_putc(0x30);
            continue;
        }

        unsigned char s = (data>>i)&0xf;
        if (s<10)
            serial_putc(0x30+s);
        else
            serial_putc(0x61+s-10);
    }

	serial_wait_tx_empty();

}
开发者ID:alpha-it,项目名称:u-boot,代码行数:21,代码来源:serial.c

示例11: serial_putc

void serial_putc (const char c)
{
    volatile u8 *uart_lsr = (volatile u8 *)(UART_BASE + OFF_LSR);
    volatile u8 *uart_tdr = (volatile u8 *)(UART_BASE + OFF_TDR);

    if (c == '\n') serial_putc ('\r');

    /* Wait for fifo to shift out some bytes */
    while ( !((*uart_lsr & (UART_LSR_TDRQ | UART_LSR_TEMT)) == 0x60) );

    *uart_tdr = (u8)c;
}
开发者ID:yindian,项目名称:dingoo-linux,代码行数:12,代码来源:serial.c

示例12: serial_putc

/* Send a character */
void serial_putc(const char c)
{
	/* Wait for room in TX FIFO */
	while (REG_RD(DBGUART_BASE + UARTDBGFR) & TXFF)
		;

	/* Write the data byte */
	REG_WR(DBGUART_BASE + UARTDBGDR, c);

	if (c == '\n')
		serial_putc('\r');
}
开发者ID:AvalueAES,项目名称:rev-sa01,代码行数:13,代码来源:stmp3xxx_dbguart.c

示例13: serial_putc

void serial_putc (const char c)
{
	volatile u32 *uart_lsr = (volatile u32*)(UART0_ADDR+UART_LSR);
	volatile u32 *uart_tx = (volatile u32*)(UART0_ADDR+UART_TX);

	if (c == '\n') serial_putc ('\r');

	/* Wait for fifo to shift out some bytes */
	while((*uart_lsr&UART_LSR_THRE)==0);

	*uart_tx = (u32)c;
}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:12,代码来源:au1x00_serial.c

示例14: serial_putb

void serial_putb (unsigned int d) {
    unsigned int m;
    for (m = 0x80000000; m != 0x00800000; m >>= 1) serial_putc(m & d ? '1' : '0');
    serial_putc(' ');
    for (m = 0x00800000; m != 0x00008000; m >>= 1) serial_putc(m & d ? '1' : '0');
    serial_putc(' ');
    for (m = 0x00008000; m != 0x00000080; m >>= 1) serial_putc(m & d ? '1' : '0');
    serial_putc(' ');
    for (m = 0x00000080; m != 0x00000000; m >>= 1) serial_putc(m & d ? '1' : '0');
}
开发者ID:yindian,项目名称:dingoo-linux,代码行数:10,代码来源:serial.c

示例15: ameba_uart_putc

static int ameba_uart_putc (struct rt_serial_device *serial, char c)
{
    struct device_uart* uart;

    uart = serial->parent.user_data;

    /* FIFO status, contain valid data */
    /* write data */
    serial_putc(&uart->serial, c);

    return (1);
}
开发者ID:DigFarmer,项目名称:rt-thread,代码行数:12,代码来源:drv_uart.c


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