drivers: serial: pl011: Add err_check function
Implementing err_check function by porting from rpi_pico implementation. Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
This commit is contained in:
parent
dd84e8db26
commit
e93cf224b6
1 changed files with 24 additions and 0 deletions
|
@ -153,6 +153,29 @@ static void pl011_poll_out(const struct device *dev,
|
|||
get_uart(dev)->dr = (uint32_t)c;
|
||||
}
|
||||
|
||||
static int pl011_err_check(const struct device *dev)
|
||||
{
|
||||
int errors = 0;
|
||||
|
||||
if (get_uart(dev)->rsr & PL011_RSR_ECR_OE) {
|
||||
errors |= UART_ERROR_OVERRUN;
|
||||
}
|
||||
|
||||
if (get_uart(dev)->rsr & PL011_RSR_ECR_BE) {
|
||||
errors |= UART_BREAK;
|
||||
}
|
||||
|
||||
if (get_uart(dev)->rsr & PL011_RSR_ECR_PE) {
|
||||
errors |= UART_ERROR_PARITY;
|
||||
}
|
||||
|
||||
if (get_uart(dev)->rsr & PL011_RSR_ECR_FE) {
|
||||
errors |= UART_ERROR_FRAMING;
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
static int pl011_runtime_configure_internal(const struct device *dev,
|
||||
const struct uart_config *cfg,
|
||||
bool disable)
|
||||
|
@ -390,6 +413,7 @@ static void pl011_irq_callback_set(const struct device *dev,
|
|||
static const struct uart_driver_api pl011_driver_api = {
|
||||
.poll_in = pl011_poll_in,
|
||||
.poll_out = pl011_poll_out,
|
||||
.err_check = pl011_err_check,
|
||||
#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE
|
||||
.configure = pl011_runtime_configure,
|
||||
.config_get = pl011_runtime_config_get,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue