i3c_device_desc_alloc() and i3c_i2c_device_desc_alloc() leave the
local desc pointer uninitialized when k_mem_slab_alloc() fails. The
uninitialized garbage is returned to callers that check for NULL,
causing them to dereference a random pointer instead of handling
the allocation failure.
Initialize desc to NULL so callers correctly detect the failure.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
i3c_sec_bus_reset() iterates over the attached I3C and I2C device lists
using SYS_SLIST_FOR_EACH_CONTAINER while removing each node via
i3c_detach_i3c_device()/i3c_detach_i2c_device(). The non-safe iterator
reads the current node's next pointer to advance, but detaching
invalidates that pointer. This causes the loop to either stop early
(skipping devices) or access stale memory.
Add I3C_BUS_FOR_EACH_I3CDEV_SAFE and I3C_BUS_FOR_EACH_I2CDEV_SAFE
macros that wrap SYS_SLIST_FOR_EACH_CONTAINER_SAFE, which saves the
next pointer before executing the loop body. Use these in
i3c_sec_bus_reset() so nodes can be safely detached during iteration.
Also add the new macros to .clang-format ForEachMacros list.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
i3c_sec_get_basic_info() attaches a stack-allocated temp_desc to the
persistent device linked list via i3c_attach_i3c_device(). If
i3c_ccc_do_getpid() fails or i3c_device_desc_alloc() returns NULL, the
function returns without detaching temp_desc. Once the stack frame is
reclaimed, the linked list contains a dangling pointer, corrupting
memory on any subsequent list traversal.
Add i3c_detach_i3c_device(&temp_desc) before each early return to
ensure the stack-allocated descriptor is removed from the list.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
i3c_bus_setmrl() accepts an ibi_len parameter and uses it to update the
cached descriptor value, but never sets mrl_cmd.ibi_len before sending
the SETMRL CCC on the wire. This means the IBI payload size byte sent
to the target is uninitialized stack data when BCR[2]=1.
Set mrl_cmd.ibi_len = ibi_len so the CCC payload matches the spec
(MIPI I3C v1.2 Section 5.1.9.3.15).
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Add driver for the AC057TC1 5.7-inch 7-color electrophoretic (e-ink)
display. The driver supports MIPI DBI 4-wire SPI mode and includes:
- GPIO interrupt-driven busy signal handling with semaphore-based waiting
- Deep sleep and PM device support for power management
- 4-bit per pixel (2 pixels per byte) color format with 7 color palette
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
The issues fixed for i2c transfer using polling and interrupt
modes which was observed while testing with the pic32cm_jh_01
boards.
Signed-off-by: Fabin V Martin <Fabinv.Martin@microchip.com>
When pinctrl_apply_state() returns 0 (success), the previous condition
(ret != -ENOENT) caused an early return, so i2c_bitbang_init() and
i2c_bitbang_configure() were never run. Only -ENOENT (no pinctrl
entry) should be ignored; real errors should still abort init.
Fix by returning only when ret < 0 && ret != -ENOENT.
Signed-off-by: Leevi Xu <leevi.xu@evenrealities.com>
Initial SAU UART driver support for Renesas RA0 series
Signed-off-by: Khoa Tran <khoa.tran.yj@bp.renesas.com>
Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
- Update Renesas RA GPIO driver to support Renesas RA0 series
- Add macro to disable port external interrupt the the compatible
nodes `renesas,ra-external-interrupt` are not enabled.
Signed-off-by: Khoa Tran <khoa.tran.yj@bp.renesas.com>
Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
Reduce the complexity of the set-alarm and set-top functions.
Improve the error handling.
Replace IRQ macros with static inline functions to centralize GIC/NVIC
conditional handling.
Signed-off-by: Hieu Nguyen <hieu.nguyen.ym@bp.renesas.com>
Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
Move the non-RGB mapping code into an update function.
This creates simpler functions and makes implementation of LED strip API's
update_channels function simpler.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
Some MAX32 targets may fail to raise TX half/almost empty interrupts,
so add an optional workaround for those scenarios to ensure no missed
TX completion when using the interrupt API.
Signed-off-by: Pete Johanson <pete.johanson@analog.com>
Add CONFIG_FLASH_MSPI_NOR_DMA_DATA_XFER and
CONFIG_FLASH_MSPI_NOR_DMA_CONTROL_XFER as Kconfig options for MSPI
NOR Flash driver. These options are used to select whether data and
control transfers should be performed using DMA or PIO modes.
Update flash_mspi_nor to store choices and apply them accordingly:
use data-xfer-mode for read/write data transfers, and control-xfer-mode
for command/register/configuration traffic. This selection is due to DMA
transfer's having a larger setup overhead so is less beneficial for
short control transfers.
Signed-off-by: David Jewsbury <david.jewsbury@nordicsemi.no>
Modifies 1-wire serial driver to accept configurable baud rates for
Overdrive mode.
In testing with DS2488, which are Overdrive-only, it was found that
both the baud rate and zero bit pattern needed to be adjusted for
stability. This commit allows the user to define their own baud
rates for OD mode, and modifies the zero bit in OD mode.
It is assumed that most testing has been done with standard-speed
devices, so the timings and bit patterns have not been changed or
made user-modifiable.
Signed-off-by: Glenn Andrews <andrewsglenn@meta.com>
The current implementation of video_shell_set_ctrl() incorrectly
passes &arg_value as the endptr to strtoll(), while attempting
to validate the result using an uninitialized end_value pointer.
This causes the check (*end_value != '\0') to always trigger
shell_error.
Update the code to pass the address of end_value to strtoll()
correctly, ensuring it points to the first invalid character
within the input string for proper validation.
Signed-off-by: Chin-Yao Hung <cy.hung@guc-asic.com>
Change CMakeLists.txt to register Zephyr library only if respective
source code is compiled.
Fixes CMake Warning:
No SOURCES given to Zephyr library: drivers__usb__common__buf
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
In e6daacf3c9 the mayority of the
ethernet drivers code was changed to use the Zephyr native net_
prefixed symbols, but some were forgotten.
Without this fix/change the code still builds as we are by now setting
CONFIG_NET_NAMESPACE_COMPAT_MODE. But when this is not set, things
fail to build.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
In 55c49cdb8f wifi
drivers were changed to use the Zephyr native net_ prefixed
types, but some were forgotten.
Without this fix/change the code still builds as we are by now setting
CONFIG_NET_NAMESPACE_COMPAT_MODE. But when this is not set, things
fail to build.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add missing includes and missing source macro definition to expose the
C library prototypes used by this code.
Background:
In general code which uses extensions to the C library (in this case
POSIX extensions) should set the appropriate macro so the C library
headers expose those. Instead of relaying on the C library always
exposing them or those macros being set from the cmake side.
Withtout these, one gets the following warnings when building with glibc:
`implicit declaration of function ‘strnlen’`
`implicit declaration of function ‘strtok_r’`
```
implicit declaration of function ‘snprintf’
note: include ‘<stdio.h>’ or provide a declaration of ‘snprintf’
implicit declaration of function ‘sscanf’
include ‘<stdio.h>’ or provide a declaration of ‘sscanf’
```
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Use the Zephyr prefixed naming when refering to the networking
functions, macros or types.
This ensures this code builds when
CONFIG_NET_NAMESPACE_COMPAT_MODE=n
This is a plain rename without function impact, that otherwise
is done thru macros given by net_compat.h
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Use the Zephyr prefixed naming when refering to the networking
functions, macros or types.
This ensures this code builds when
CONFIG_NET_NAMESPACE_COMPAT_MODE=n
This is a plain rename without function impact, that otherwise
is that thru macros given by net_compat.h
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Arm documentation (ddi0601) for GICD_CTRL_DS is as follows:
```
If the Distributor only supports a single Security state, this bit is
RAO/WI.
```
Since CONFIG_GIC_SINGLE_SECURITY_STATE suggest GIC has single security
state, the DS bit should not be touched and the assert should be enough
to make sure that GICD_CTRL_NS (DS bit) is set to 1.
Fixes https://github.com/zephyrproject-rtos/zephyr/issues/102239
Signed-off-by: Sudan Landge <sudan.landge@arm.com>
This commit implemented nxp (Semaphores2) sema42 peripheral
based on zephyr hwspinlock device driver API.
The hardware information can be find in MCXN947 RM chapter 27.
https://www.nxp.com/webapp/sps/download/preDownload.jsp?render=true
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
The I2C driver relies on the SCB oversampling clock (clk_scb) being
within specific frequency ranges for each I2C data rate. On PSOC4, the
peripheral clock dividers default to a division of 1, passing the full
HFCLK (48 MHz) directly to the SCB — far outside the valid range for
any I2C speed. This causes all I2C transfers to fail with -EIO.
Add _i2c_set_peri_divider_psoc4() which calculates the appropriate
divider from HFCLK and configures the peripheral clock using the
Zephyr utility wrappers (matching the UART driver convention).
SCB oversampling clock frequencies (from device reference manuals,
analog filter config AF_in=1, AF_out=0, DF_in=0):
Controller mode:
Standard (100 kHz): 2 MHz
Fast (400 kHz): 8 MHz
Fast Plus (1 MHz): 24 MHz
Target mode:
Standard (100 kHz): 8 MHz
Fast (400 kHz): 12 MHz
Fast Plus (1 MHz): 24 MHz
Tested on CY8CKIT-041S-MAX and CY8CPROTO-041TP in both target and
controller roles.
Signed-off-by: Braeden Lane <Braeden.Lane@infineon.com>
In cc13xx_cc26xx, the TX interrupt seems to be generated once initially on
enable and subsequently, when buffer goes from full to empty (since we are
operating in 1-byte buffer mode).
Due to this, if the TX interrupt is cleared in the configure function, a
new TX interrupt will not be generated untill we transition from a full to
empty buffer, even though the buffer itself is empty.
When using Zephyr Interrupt-driven UART API, one first needs to enable TX
interrupts `uart_irq_tx_enable()`, and then write data from the interrupt
callback, after checking `uart_irq_tx_ready()`. In case of cc13xx_cc26xx,
calling `uart_irq_tx_enable()` unmasks the TX interrupt, however, it will
not generate a new TX interrupt. Thus the callback will not be called
unless we first write something to the uart (using polling-API), causing a
transition in buffer state.
According to TI docs, writing 1 byte to the buffer will also clear the
TX interrupt, so it does not make sense to try clearing the interrupt
manulally in `configure` function.
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
This PR routes the DAC output to the mixer amplifier (not headphone output)
so that volume control via registers 0x24/0x25 on page 1 has any effect
Signed-off-by: Stefan Schmidt <kontakt@stefanschmidt-embedded.de>
When the received data is less than expected, DMA timeout error may occur.
This happens because the DMA transfer is not completed and the TC
(Transfer Complete) flag is never set.
This change adds support for handling cases where the received data length
is smaller than the requested length, preventing false timeout errors.
The CL covers the following scenarios:
1. received < expected (e.g. requested 10 bytes, got 9 bytes)
2. received = expected (e.g. requested 10 bytes, got 10 bytes)
3. received > expected
(e.g. requested 10 bytes, got 10 bytes, but more data is coming, T-bit = 1)
Signed-off-by: Alvis Sun <yfsun@nuvoton.com>
Modifying DMA configuration to be more specific about when to use
software triggeres and the single elmeent input trigger type.
Signed-off-by: Brett Peterson <brett.peterson@infineon.com>
Currently, the Xilinx SDHC driver does not support data
transmission with SDIO devices, requiring the addition
of CMD52 and CMD53 related functionalities.
Signed-off-by: Jack Lee <lhjhit@126.com>
The nrf54l soc init configures power and clock properties like
applying trims, capacitance and setting up regulators. This must
precede the grtc driver initializing the sys clock, as it depends
on these clocks being initialized on the nrf54l series socs.
Update the nrf54l soc init to be EARLY 0, and set grtc sys clock
driver init to EARLY 1. Additionally add comments explaining why
these specific init levels where chosen.
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Update driver to follow this, stated in the documentation of the
spi_context_release: "appropriate time to call this would be at the
end of a transfer that was initiated by a transceive API call, except
in the case that the SPI_LOCK_ON bit was set"
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
The SPI loopback test suite passes up transfers nop and null buffers
to the device drivers, expecting them to return early with -EINVAL
or -ENOTSUP, before setting the CS pins. Currently the NRFX based
nRF SPIM device driver sets CS unconditionally, without checking
the buffers, resulting in no transfer while toggling CS.
Add a check of the provided buffers in the transceive() function and
return early if buffers are invalid (result in 0 lenght transfer).
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Add counter driver for timer on Silicon Labs series 2.
Tested by building and running the sample on realboard
slwrb4180b and xg24_rb4187c.
Signed-off-by: Phuc Hoang <donp172748@gmail.com>
Add SDHC zero copy support for wifi.
This depends on SDHC host requirement
1. CONFIG_SDHC_SUPPORTS_SCATTER_GATHER_TRANSFER=y.
2. CONFIG_NET_BUF_DATA_SIZE to be 256 multiples.
3. CONFIG_NET_BUF_ALIGNMENT=32 (host cache line size).
4. CONFIG_NET_L2_ETHERNET_RESERVE_HEADER=y (to 4 bytes align net buffer).
Signed-off-by: Fengming Ye <frank.ye@nxp.com>