Skip to content

Commit

Permalink
tests: drivers: uart_async_api: fix userspace fault
Browse files Browse the repository at this point in the history
Updated driver to add missing configuration during
init while using async APIs.

Updated overlay and conf files for mimxrt1064
to run outside of usersapce mode to avoid
inaccessible memory regions when using nocache.
  • Loading branch information
EmilioCBen committed Sep 4, 2024
1 parent 494f880 commit ddb032b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
17 changes: 17 additions & 0 deletions drivers/serial/uart_mcux_lpuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,23 @@ static int mcux_lpuart_configure_init(const struct device *dev, const struct uar
return ret;
}

#ifdef CONFIG_UART_ASYNC_API
uart_config.rxIdleType = kLPUART_IdleTypeStopBit;
uart_config.rxIdleConfig = kLPUART_IdleCharacter1;
data->async.next_rx_buffer = NULL;
data->async.next_rx_buffer_len = 0;
data->async.uart_dev = dev;
k_work_init_delayable(&data->async.rx_dma_params.timeout_work,
mcux_lpuart_async_rx_timeout);
k_work_init_delayable(&data->async.tx_dma_params.timeout_work,
mcux_lpuart_async_tx_timeout);

/* Disable the UART Receiver until the async API provides a buffer to
* to receive into with rx_enable
*/
uart_config.enableRx = false;
#endif

LPUART_Init(config->base, &uart_config, clock_freq);

if (cfg->flow_ctrl == UART_CFG_FLOW_CTRL_RS485) {
Expand Down
2 changes: 2 additions & 0 deletions tests/drivers/uart/uart_async_api/boards/mimxrt1064_evk.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Userspace is unable to access the nocache region.
CONFIG_USERSPACE=n
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
/* SPDX-License-Identifier: Apache-2.0 */

/ {
chosen {
zephyr,sram = &dtcm;
};
};

dut: &lpuart3 {
status = "okay";
current-speed = <115200>;
Expand Down

0 comments on commit ddb032b

Please sign in to comment.