Fix coverity issue 20534: read the status of a volatile
variable in an ASSERT statement via a stack variable
declared and defined for this purpose.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Use semaphore to synchronize lll_reset completion with HCI thread for
returning (command complete) only when all is done.
Signed-off-by: Morten Priess <mtpr@oticon.com>
The I2C peripheral should be configured using the CPU clock frequency
and not the system clock frequency. This used to be fine because they
were the same before #19232, but now that the system clock is
RTC-based (which has a different frequency), we can no longer make
that assumption.
Fixes#20480
Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
Fix connection update procedure to be cacheable if any other
local or remote control procedure is in progress.
Relates to commit 9c14567ce2 ("Bluetooth: controller: Fix
conn update to be cacheable").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Non-direct ISRs are supposed to take a void pointer as an argument,
unliike direct ones, which take no arguments. Since the radio ISR is not
declared as direct, the void pointer argument was missing, likely due to
a copy-paste mistake from the nordic LLL, which indeed uses a direct ISR
for the radio ISR.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
bt_conn_create_pdu_timeout() may return NULL if no buffer
is available, l2cap_chan_create_seg() does not check the
subsequent return value.
Fix possible null pointer dereference in l2cap_chan_create_seg()
and l2cap_chan_le_send().
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
An issue with DT generation where instance defines are not determinstic
generating values that collide with existing IRQs.
Fixes#20558
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The smallest region that can be erashed is one sector, so setting
SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=2048 will fail at runtime when the
flash page API is used to erase a single (or misaligned) page. Add a
compile-time check that the requested layout page size is erasable.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Add internal API to enter and exit deep power-down mode. Add Kconfig
option to return to DPD whenever device is not active.
When device power management becomes more mature it should be possible
to implement it, which would allow use of DPD without having to enter
and exit DPD between consecutive transactions.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Convert the LOCK/UNLOCK macros to acquire/release functions in
preparation for extending those steps to include power management.
Also commit to always allocating a semophore, and use a more clean
way of conditionalizing the operations.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Provide information required to allow the driver to put the flash chip
into a deep power down mode. This can reduce standby current by as
much as 90%.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
The SPI NOR driver requires that the size (in bits) be provided in the
devicetree node. Update the binding to make the property required,
and update all nodes based on the memory chip identified.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Add assert when negative (except K_FOREVER) is passed as timeout.
Add negative timeout correction to 0.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Timeout and use s32_t as an argument but only positive values are
accepted (or special value like K_FOREVER). It was not specified in
the description which may lead to misinterpretation.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
The addition of API to correctly handle conversion between durations
in different clocks inadvertently changed the type of the value
produced by the API. Specific changes were:
s32_t z_ms_to_ticks(s32_t t) =>
u32_t k_ms_to_ticks_ceil32(u32_t t) : signedness change
s32_t __ticks_to_us(s32_t t) =>
u64_t k_ticks_to_us_floor64(u64_t t) : signedness and rank change
s32_t z_us_to_ticks(s32_t t) =>
u64_t k_us_to_ticks_ceil64(u64_t t) : signedness and rank change
int sys_clock_hw_cycles_per_tick() =>
u32_t k_ticks_to_cyc_floor32(1) : signedness change
The effect of this is to change the essential type of operands in
existing expressions, potentially resulting in behavior changes when
calculations were promoted to unsigned types, or code size by
requiring 64-bot arithmetic.
Add casts as necessary to preserve the original return type, and to
explicitly recognize impact of passing macro parameters into a context
where a specific type will be used.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Some use cases require using high-resolution tick or cycle clocks to
measure sub-millisecond durations. Generate the corresponding 32-bit
conversions to avoid the cost of 64-bit math in the common case where
the duration fits in 32 bits in both original and converted scale.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Previously, passing K_FOREVER to k_sleep() would return
immediately.
Forever is a long time. Even if woken up at some point,
we still had forever to sleep, so return K_FOREVER in this
case.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The races are believed to be resolved with the patch to
irq_offload(). Allow the MMU to be turned on and enable
it for qemu_x86_64.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Entering irq_offload() on multiple CPUs can cause
difficult to debug/reproduce crashes. Demote irq_offload()
to non-inline (it never needed to be inline anyway) and
wrap the arch call in a semaphore.
Some tests which were unnecessarily killing threads
have been fixed; these threads exit by themselves anyway
and we won't leave the semaphore dangling.
The definition of z_arch_irq_offload() moved to
arch_interface.h as it only gets called by kernel C code.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
We add the functionality that allows the nRF5340 Application
MCU to boot the Network MCU by releasing the RESET line. The
Application MCU may optionally allocate and corfigure resources
that the Network MCU is going to use (currently GPIO and secure
attribution) if running in secure mode. Non-Secure Application
MCU firmware can only issue Network MCU resets.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Move functions in order to avoid function prototype and use IS_ENABLED
instead of #if defined where possible.
Signed-off-by: François Delawarde <fnde@oticon.com>
This commits adds a BT_SETTINGS_CCC_LAZY_LOADING option to allow for
CCC settings to be loaded on demand when a peer device connects in
order to reduce memory usage.
Signed-off-by: François Delawarde <fnde@oticon.com>
Maintain Service Changed entry as long as the peer device is subscribed
to SC indications and bonded. This allows to save indication data for
disconnected peers peers when CCC settings are not available (loaded
on-demand).
Signed-off-by: François Delawarde <fnde@oticon.com>
This commit provides the DPPI configuration for the Radio
driver for nRF5340 SoC, supporting LE Coded PHY.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit provides the DPPI configuration for the Radio
driver for nRF5340 SoC.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Add the require #ifdef blocks in radio.c, in order to support
building for nRF53 SoC series (and, in particular, for nRF5340
CPU1 SoC).
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Conditionally include nrf5340_radio.h when building the
BLE controller for nRF5340 SoC. Introduce the header for
nrf5340.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
When building with support for BLE stack, enable
the BLE Controller module for the nRF5340 DK NRF5340
CPUNET (Network MCU).
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit adds a string representation of the
nRF53 variant in bluetooth host.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit enables support in bluetooth/controller/Kconfig
for nRF53 series of SoCs.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
nRF5340 does not support a Radio TX power of 4dBm, so we
introduce a dependency for the respective Kconfig option
for TX power, so the option is never defined for nRF5340.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Define the nRF53 HW variant in include/bluetooth/hci_vs.h
and pass the define in hci_vendor.h
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit extends the nrfjprog.py runner script so it adds
support for nRF53. In the wake of the changes done in the
runner script, we extend the testing done in test_nrfjprog.py,
adding the required coverage for the nRF53.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>