Add missing curly braces in if/while/for statements.
This is a style guideline we have that was not enforced in CI. All
issues fixed here were detected by sonarqube SCA.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add a reusable uart-bridge driver that echoes data between two serial
devices. It's mainly meant to be used with one of the devices being an
USB CDC-ACM, the data is buffered, there's a pause feature to stop the
USB endpoint when the hardware UART is filling up to avoid overrun and
there's a helper function used to propagate the USB uart configuration
to the hardware one.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
When RTS/CTS is toggled it disables the receiver and transmitter
bits to be able to change the flow control bits in the MODIR register.
After it has done so, it should restore the original value of the
CTRL register to re-enable the transmitter and/or receiver if they
were enabled before calling the mcux_lpuart_line_ctrl_set_rts()
function.
Signed-off-by: Bas van Loon <bas@arch-embedded.com>
Add minimal support for the aesc silicon UART IP core.
This core includes an internal clock divider and supports flexible
frame configurations, allowing for variable data length, parity, and
stop bit settings.
The current driver version does not support interrupts.
Signed-off-by: Daniel Schultz <dnltz@aesc-silicon.de>
This change adds additional workaround for following errata:
"USART does not generate DMA requests after setting/clearing DMAT bit"
Instead of keepint DMAT bit set, it sends first byte by polling
in firmware. This prevents additional power consumption in STOP mode,
caused by keeping DMAT bit set.
Signed-off-by: Adam Berlinger <adam.berlinger@st.com>
The buffer_length != 0 is used to check if there is transfer ongoing
inside the uart_stm32_async_tx function. uart_stm32_dma_tx_cb clears
it to 0 when TX DMA is finished, but before the USART send all
the data from shift register.
buffer_length is also cleared in callback async_evt_tx_done,
which is called when USART finished sending all the bytes.
If the uart_stm32_async_tx would be called after
uart_stm32_async_tx, but before async_evt_tx_done there
could be race condition on buffer_length.
Signed-off-by: Adam BERLINGER <adam.berlinger@st.com>
This driver doesn't need to do anything in its irq_update
implementation, but add a dummy one so that calls to uart_irq_update
don't fail with -ENOSYS.
Signed-off-by: Robert Hancock <robert.hancock@calian.com>
This driver previously caused an assertion error if non-NULL user_data
was passed to uart_irq_callback_set. Add support for this by storing the
user data and passing it back to the IRQ callback function.
Signed-off-by: Robert Hancock <robert.hancock@calian.com>
This fixes several ways to hang the driver, such as:
- typing too fast
- going over the read buffer capacity
- pasting anything
- using arrow keys (sending 2 chars at once)
etc
Signed-off-by: Camille BAUD <mail@massdriver.space>
Currently the driver code does not actually request the flow control
state, it only checks if the state exists. To fix this we should
simply call pinctrl_apply_state() and if that fails, meaning no
flow control state exists, fall back to default pin mux settings.
Another case that needed fixing is run time flow control enabling
ie in the case where we have a WIFI/bluetooth module connected
and we initially operate without flow control but later enable
it after firmware download.
This patch addresses this as well by making a generic function
to achieve this.
Signed-off-by: Bas van Loon <bas@arch-embedded.com>
Zephyr moved to microseconds to represent uart async timeout.
This one has some additional logic that was not adjusted in
the transition from milliseconds.
c590b3545a was integrated in
https://github.com/zephyrproject-rtos/zephyr/pull/39041
Signed-off-by: Stefan Giroux <stefan.g@feniex.com>
Intial serial driver support for RX MCU, this driver utilize
the SCI HWIP for uart communication
Current support include polling API and Interrupt driven API,
some of the code is using Renesas RX Driver Package (RDP) as
hal layer
Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
Signed-off-by: Sang Tran <sang.tran.jc@renesas.com>
Character glitches are observed when entering suspend and standby low
power modes.
To fix it, we make sure the `poll_out` API waits for the character
transfer to complete. This is aligned with the uart driver API
description.
Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
printf is failing in hello_world sample due to current
uart driver init level. This reverts back to PRE_KERNEL_1.
As uart depends on GDMA, set it also to same level.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Add support for transmitting using the asynchronous API. The
asynchronous portion is simulated through a dedicated polling thread.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Add support for transmitting using the asynchronous API. The
asynchronous portion is simulated through the system workqueue.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Add Bouffalo Lab serial driver. The driver uses pinctrl to configure
pins and have power management capabilities.
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
The console can't input when waken up from PM3, as get the wrong
usart_intenset when process PM_DEVICE_ACTION_TURN_ON and the
USART interrupt is not enabled. Only saving usart_intenset after
PM action of PM_DEVICE_ACTION_TURN_OFF can fix this issue.
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
PM_DEVICE_ISR_SAFE shall not be used when non-asynchronous API is used
because RX is disabled in suspend action and that takes relatively
long time. In case of PM_DEVICE_ISR_SAFE it is done with interrupts
disabled. RX is not used at all if disable-rx property is set and in
that case PM_DEVICE_ISR_SAFE can be used.
Added macro which determines if ISR safe mode can be used.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Zephyr has changed the rules for PINCTRL to use Kconfig select
feature at the driver level instead of setting the Kconfig
item directly in the board or application level. We updated
the MEC5 UART serial driver Kconfig to select PINCTRL.
Signed-off-by: Scott Worley <scott.worley@microchip.com>
If the RX FIFO buffer is full and there's nothing being transmitted
no LPUART interrupt will fire anymore. Thus the application will not
receive any bytes anymore. By enabling kLPUART_RxOverrunInterruptEnable
we will receive interrupts even though RX FIFO is full so we can recover
from this.
Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
Adds necessary pinctrl support for Arm cmsdk uart driver
Signed-off-by: Samuel Chee <samche01@arm.com>
Signed-off-by: Sudan Landge <sudan.landge@arm.com>
The callback function for the DMA is not used in the case where no DMA
properties are given in the esuart node in the device tree. It causes
a warning in the CI build.
Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
Implement `irq_is_pending` in terms of the `irq_rx_ready` and
`irq_tx_ready` function calls.
Using `intstatus` directly results in an implementation that does not
conform to the interrupt driven UART API. Since `intstatus` bits are
only only set when a buffer transitions from full to empty, any calls to
`irq_is_pending` before any bytes have been sent will return 0. This is
problematic since the documented implementation for the API IRQ handler
is:
```
while (uart_irq_update(dev) && uart_irq_is_pending(dev)) {
if (uart_irq_rx_ready(dev)) {
...
}
if (uart_irq_tx_ready(dev)) {
uart_fifo_fill(dev, ...);
}
}
```
If `uart_irq_is_pending` does not return 1 until the first byte is sent,
we never end up pushing data to be transmitted into the `uart_fifo_full`
function.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Drivers update to use shared interrupt allocator for Xtensa
and RISCV devices.
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Make use of pm_device_driver_init to perform driver initialization.
Implement PM suspend and resume, which performs the following actions:
* Enables/disables the USART
* Gates the USART clock
* Configures USART pins
Also take PM locks to prevent deep sleep during TX and RX operations.
Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
Replace prefix from "uart_silabs_eusart" to "eusart" in order to
simplify the code, and make it more readable.
Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
Allow STM32 UART driver to operate with DMA support even when
CONFIG_MEM_ATTR is disabled which happen when CONFIG_ARM_MPU is
intentionally disabled despite the CPU supports MPU.
By the way, remove some #ifdef directive on header files inclusion
that add noise in the header file inclusion section without any
benefit.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
When using the asynchronous TX API, skip the `data->pm_policy_state_on`
checks for PM policy updates. This fixes two issues:
* State conflicts with the `poll_out` implementation when both APIs are
used on the same port, resulting in the SoC sleeping while
transmissions are running.
* Scheduling a TX from the `TX_DONE` callback resulting in the PM
policy not being applied, resulting in TX errors.
Every call to `uart_tx` should have a corresponding `TX_DONE` event
generated, which makes the raw (reference counted) calls to
`pm_policy_state_lock_put/get` the correct API to use here.
Signed-off-by: Jordan Yates <jordan@embeint.com>