示例#1
0
void PutUARTByte (const char c)
{
    while (!(UART_READ32 (UART_LSR(g_uart)) & UART_LSR_THRE))
    {
    }

    if (c == '\n')
        UART_WRITE32 ((unsigned int) '\r', UART_THR(g_uart));

    UART_WRITE32 ((unsigned int) c, UART_THR(g_uart));
}
static void local_put_char(int hub2, char ch)
{
	int flags = 0;

	if (hub2 < 0 || hub2 > 1) {
		printk("Error: Invalid serial port requested.\n");
		return; /* validate port op(UART 0|1) */
	}

	save_flags(flags); cli();

	while (!(UART_LSR(hub2) & UART_LSR_THRE)) {
		SYNC_ALL;
	}

	ACCESS_PORT_IER(hub2)
	UART_THR(hub2) = ch;
	SYNC_ALL;

	while (UART_LSR(hub2) & UART_LSR_THRE) {
		udelay(5);
	}

	restore_flags(flags);
}
示例#3
0
文件: pe_sun4i.c 项目: DiogoPC/xnu
void Sun4i_putc(int c)
{
    if (!gSun4iUartBase)
        return;

    while (!TX_READY)
        barrier();
    writel(c, UART_THR(UART));
}
示例#4
0
/* This Function Wait Data TX Ready, and Write Data to UART 
	if rx_timeout_nb_cycles = 0 Infinite wait
*/
void uart_write(uart_num_t uart_num, uint8_t data)
{
	uint32_t uart_port;

	uart_port = uart_num;

	/* Wait Until FIFO not full  */
	while ((UART_LSR(uart_port) & UART_LSR_THRE) == 0);

	UART_THR(uart_port) = data;
}