/* Output a character in polled mode. 
This function will block until transmitter is ready. Then, a character will be transmitted. */
static void uart_altera_poll_out(const struct device *dev, unsigned char c)
/* Output a character in polled mode. 
This function will block until transmitter is ready. Then, a character will be transmitted. */
static void uart_altera_poll_out(const struct device *dev, unsigned char c)
{
	const struct uart_altera_device_config *config = dev->config;
	struct uart_altera_device_data *data = dev->data;
	uint32_t status;
	k_spinlock_key_t key = k_spin_lock(&data->lock);
	do {
		status = sys_read32(config->base + ALTERA_AVALON_UART_STATUS_REG_OFFSET);
	} while ((status & ALTERA_AVALON_UART_STATUS_TRDY_MSK) == 0);
	sys_write32(c, config->base + ALTERA_AVALON_UART_TXDATA_REG_OFFSET);
	k_spin_unlock(&data->lock, key);
}