zephyr/drivers/serial/uart_riscv_qemu.c
David B. Kinder ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00

55 lines
1.2 KiB
C

/*
* Copyright (c) 2016 Jean-Paul Etienne <fractalclone@gmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <kernel.h>
#include <arch/cpu.h>
#include <uart.h>
#include <sys_io.h>
#define DEV_CFG(dev) \
((const struct uart_device_config * const) \
(dev)->config->config_info)
static unsigned char uart_riscv_qemu_poll_out(struct device *dev,
unsigned char c)
{
sys_write8(c, DEV_CFG(dev)->regs);
return c;
}
static int uart_riscv_qemu_poll_in(struct device *dev, unsigned char *c)
{
*c = sys_read8(DEV_CFG(dev)->regs);
return 0;
}
static int uart_riscv_qemu_init(struct device *dev)
{
/* Nothing to do */
return 0;
}
static const struct uart_driver_api uart_riscv_qemu_driver_api = {
.poll_in = uart_riscv_qemu_poll_in,
.poll_out = uart_riscv_qemu_poll_out,
.err_check = NULL,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
#error "Interrupt not available in uart riscv32-qemu"
#endif
};
static const struct uart_device_config uart_riscv_qemu_dev_cfg_0 = {
.regs = RISCV_QEMU_UART_BASE,
};
DEVICE_AND_API_INIT(uart_riscv_qemu_0, "uart0",
uart_riscv_qemu_init, NULL,
&uart_riscv_qemu_dev_cfg_0,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
(void *)&uart_riscv_qemu_driver_api);