Пример #1
0
/**
 * serial_havechar - checks if data available for reading
 *
 * Returns 1 if data available, 0 otherwise
 */
int serial_havechar(void)
{
	/* Return if data is already read */
	if (uart_ready_data_count)
		return 1;

	/* Read data from the FIFO */
	if (msm_boot_uart_dm_read() != IPQ_UART_DM_E_SUCCESS)
		return 0;

	return 1;
}
Пример #2
0
/**
 * uart_can_rx_byte - checks if data available for reading
 *
 * Returns 1 if data available, 0 otherwise
 */
 #if 0 /* Not used yet */
int uart_can_rx_byte(void)
{
	/* Return if data is already read */
	if (valid_data)
		return 1;

	/* Read data from the FIFO */
	if (msm_boot_uart_dm_read(&word, &valid_data, 0) !=
	    MSM_BOOT_UART_DM_E_SUCCESS)
		return 0;

	return 1;
}
Пример #3
0
static int uart_serial_tstc(uart_cfg_t *uart_tmp_cfg)
{
	/* Return if data is already read */
	if (uart_valid_data)
		return 1;

	/* Read data from the FIFO */
	if (msm_boot_uart_dm_read(&uart_word, &uart_valid_data, 0,
			uart_tmp_cfg) != MSM_BOOT_UART_DM_E_SUCCESS)
		return 0;

	return 1;
}
Пример #4
0
/**
 * serial_tstc - checks if data available for reading
 *
 * Returns 1 if data available, 0 otherwise
 */
int serial_tstc(void)
{
	uart_cfg_t *uart_tmp_cfg = gboard_param->console_uart_cfg;
	/* Return if data is already read */
	if (valid_data)
		return 1;

	/* Read data from the FIFO */
	if (msm_boot_uart_dm_read(&word, &valid_data, 0,
		uart_tmp_cfg) != MSM_BOOT_UART_DM_E_SUCCESS)
		return 0;

	return 1;
}
Пример #5
0
/* UART_DM uses four character word FIFO whereas uart_getc
 * is supposed to read only one character. So we need to
 * read a word and keep track of each character in the word.
 */
int uart_getc(int port, bool wait)
{
    int byte;
    static unsigned int word = 0;

    if (!word)
    {
        /* Read from FIFO only if it's a first read or all the four
         * characters out of a word have been read */
        if (msm_boot_uart_dm_read( &word, wait) != MSM_BOOT_UART_DM_E_SUCCESS)
        {
            return -1;
        }

    }

    byte = (int) word & 0xff;
    word = word >> 8;

    return byte;
}
Пример #6
0
/* UART_DM uses four character word FIFO whereas uart_getc
 * is supposed to read only one character. So we need to
 * read a word and keep track of each character in the word.
 */
int uart_getc(int port, bool wait)
{
	int byte;
	static unsigned int word = 0;
	uint32_t uart_base = port_lookup[port];

	/* Don't do anything if UART is not initialized */
	if (!uart_init_flag)
		return -1;

	if (!word) {
		/* Read from FIFO only if it's a first read or all the four
		 * characters out of a word have been read */
		if (msm_boot_uart_dm_read(uart_base, &word, wait) != MSM_BOOT_UART_DM_E_SUCCESS) {
			return -1;
		}

	}

	byte = (int)word & 0xff;
	word = word >> 8;

	return byte;
}