Add a log message to indicate that a new emulator is attached. Also add
a message in the assert to make it clearer what has gone wrong.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add an emulation controller which routes SPI traffic to an attached
emulator. Only one emulator is supported per bus at present, since
chip-selction functionality is not present.
This allows drivers for SPI peripherals to be tested on systems that
don't have that peripheral attached, with the emulator handling the SPI
traffic.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present register access is a mix of constants and open-coded values
in the driver. Add a few more constants to clean this up.
Signed-off-by: Simon Glass <sjg@chromium.org>
The existing tests is for generic sensor drivers. To make room for a
driver-specific one, move it into a subdirectory.
Signed-off-by: Simon Glass <sjg@chromium.org>
Only difference compared to existing Xe variant is less flash memory.
Existing nodes for DAC were moved up one level to stm32g474.dtsi
Signed-off-by: Martin Jäger <martin@libre.solar>
Default buffer mode is setup by fopen depending on isatty value.
Expect only 0, 1 & 2 to be tty for CONFIG_POSIX_API cases.
This way regular files are opened in block buffering mode (instead
of line buffering mode) which really speed up fread/fwrite
operations on FS.
Signed-off-by: Arnaud Mouiche <arnaud.mouiche@invoxia.com>
Using fopen() in application failed to build when configured with
CONFIG_NEWLIB_LIBC=y
CONFIG_POSIX_API=y
Signed-off-by: Arnaud Mouiche <arnaud.mouiche@invoxia.com>
In case a "required: False" enum binding doesn't mention a
default value, but a default value makes sense to be set in the code,
DT_ENUM_IDX_OR could be used to provide the default idx to be used.
New macro comes with appropriate tests.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
If HW flow control is enabled, then modem_context framework won't drain
UART FIFO blindly, but will stop when there is no more space in RX
ring_buf. This prevents data loss by "pausing" incoming data on hardware
level.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
If HW flow control is enabled, then modem_context framework won't drain
UART FIFO blindly, but will stop when there is no more space in RX
ring_buf. This prevents data loss by "pausing" incoming data on hardware
level.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
So far all received bytes over UART where blindly drained and pushed to
ring_buf. This approach is okay for UART devices without configured HW
flow control, as it basically decouples data processing from ISR handler
and gives more time before data overrun. However when HW flow control
is enabled, such behavior somehow suppresses UART flow control
advantage, because data can overrun when pushing to ring_buf.
Allow drivers utilizing modem_context framework to pass information
about whether HW flow control is enabled or not. If it is enabled, then
read data from UART FIFO to the point when RX ring_buf is totally filled
and follow such situation by disabling RX interrupt. Incoming data will
be paused on HW level, so there is lots of time for RX thread to process
ring_buf content. Reenable RX interrupts after all data in ring_buf is
processed, so that number of context switches is kept at minimum level.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
This API allows to drop use of preallocated isr_buf. Most importantly as
a result RAM usage is reduced for each driver utilizing modem_context
framework. Additionally there is less copying done in ISR context, as
data is direcly read from UART FIFO to ring_buf.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
This commit fixes PUSH FOTA when opaque content-format is used.
This consists of the following fixes:
* Moved `struct block_context` to a private header, so that it can be a
part of `struct lwm2m_input_context`. This allows content decoders to
make use of the block context data.
* Removed faulty `get_length_left` function from the plain text
decoder, and replace it with coap_packet_get_payload() to obtain the
actual payload size.
* Introduce `struct lwm2m_opaque_context` as a part of block context,
which allows to keep track of opaque data download progress.
* Simplify `lwm2m_write_handler_opaque()` function. It will now only
make calls to `engine_get_opaque` - it's the decoder responsibility
to update the opaque context according to it's content format (for
instance TLV decoder should only update it with the actual opaque
data size, not the whole TLV).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Added a check for adv->lll.aux before starting extended advertising to
fix observed NULL pointer dereference when updating AD data of legacy
advertising.
Fixes#28544.
Signed-off-by: Jordan Montgomery <montytyper@msn.com>
Change a runtime log check such that Coverity does not report a
needless issue on every use of any log macro.
Before the change, this was used in log macros:
else if(is_user_context || (_level <= LOG_RUNTIME_FILTER(_filter)))
If runtime filtering is not enabled, this expands to:
else if(is_user_context || 1)
Because the level is compared to log level debug (4) and will always be,
equal or lower.
Coverity always reports this as a potential issue, since the
variable part (is_user_context) makes no difference.
After the change, a macro is used which expands into the original code
when runtime filtering is used, else it simply expands to:
else if(true)
Which has equal semantics as the previous code but isn't flagged by
Coverity.
Signed-off-by: Torstein Grindvik <torstein.grindvik@nordicsemi.no>
Add more detail description for test case of arch_curr_cpu() and
arch_sched_ipi(). This is in order to make the purpose and process of
the test cases more clear.
Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
Remove old K_ prefixed macros defined in kernel.h as well as the
following APIs:
k_uptime_delta_32
k_enable_sys_clock_always_on
k_disable_sys_clock_always_on
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Removed the following macros as they have been marked deprecated for at
least 2 releases:
__ticks_to_ms()
__ticks_to_us()
z_us_to_ticks()
sys_clock_hw_cycles_per_tick()
SYS_CLOCK_HW_CYCLES_TO_NS64()
SYS_CLOCK_HW_CYCLES_TO_NS()
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The L4 connected/disconnected events are usually used to detect
when the application is connected to the network. Unfortunately
if the device has also a static address, then the connected event
might be created (for the static address) even if DHCPv4 is not
ready yet and application would not be able to connect (yet) to the
network. In order to allow the application to fine tune the network
connection creation, generate start, bound and stop events for DHCPv4.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Application would need this information in order to know when
it is able to create sockets with proper IPv4 address.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
gen_isr_tables.py generates C-code which initializes a table with
values, and these values are structs with members cast to
(const void *) and (void *), respectively.
The actual struct definition has a member of type (const void *)
and another of type void (*)(const void *).
In order to avoid a large amount of reported issues in Coverity,
cast this to the exact type.
Signed-off-by: Torstein Grindvik <torstein.grindvik@nordicsemi.no>
Avoid warning about uninitialized variable.
The for loop should do at least two iterations
in a valid execution, hence initialize to an
error value.
Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
Restore the flash write proectction after disabling it for
flash write and erase shell commands.
Signed-off-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@nordicsemi.no>
Flash drivers are free to re-enable write protection after a write or
erase operation is complete. Therefore write protection has to be
disabled before any such operation.
Signed-off-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@nordicsemi.no>
The second argument of this foonction is a bool, so passing 0 and 1
is incorrect.
Coccinelle script:
@@
expression e;
@@
flash_write_protection_set(e,
(
- 0
+ false
|
- 1
+ true
)
)
Signed-off-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@nordicsemi.no>
To get a list of all supported shell commands user must hit the TAB
button. It may be awkward on some terminal emulators. This change
enhances the help command in a way it will in addition print all
supported commands.
Fixes: #28785
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordisemi.no>
Functions shell_help_subcmd_print and shell_help_cmd_print
are more generic. Now they can operate on command passed as an
argument not hard coded active_cmd.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordisemi.no>
Reused Linux bindings were using /* */ in some property description
fields.
This is not compatible with legacy device tree api which expands
these fields in commented sections of generated file
devicetree_legacy_unfixed.h resulting in compilation issue.
Seen when running tests/lib/devicetree/legacy_api.
Remove /* */ for now, waiting legacy api to be removed.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This patch fixes the ZeroDivisionError which can
occur during percantage of test execution reporting.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
The "tc" field which was holding the traffic class thread
priority is not used nor needed so remove it from the struct
to save some space.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Use the pytest test framework in the dtlib.py and edtlib.py test
suites (testdtlib.py and testedtlib.py respectively).
The goal here is not to change what is being tested. The existing test
suite is excellent and very thorough.
However, it is made up of executable scripts where all of the tests
are run using a hand-rolled framework in a single function per file.
This is a bit all-or-nothing and prevents various nice features
available in the de-facto standard pytest test framework from being
used.
In particular, pytest can:
- drop into a debugger (pdb) when there is a problem
- accept a pattern which specifies a subset of tests to run
- print very detailed error messages about the actual and expected
results in various traceback formats from brief to very verbose
- gather coverage data for the python scripts being tested (via plugin)
- run tests in parallel (via plugin)
- It's easy in pytest to run tests with temporary directories
using the tmp_path and other fixtures. This us avoid
temporarily dirtying the working tree as is done now.
Moving to pytest lets us leverage all of these things without any loss
in ease of use (in fact, some things are nicer in pytest):
- Any function that starts with "test_" is automatically picked up and
run. No need for rolling up lists of functions into a test suite.
- Tests are written using ordinary Python 'assert'
statements.
- Pytest magic unpacks the AST of failed asserts to print details on
what went wrong in really nice ways. For example, it will show you
exactly what parts of two strings that are expected to be equal
differ.
For the most part, this is a pretty mechanical conversion:
- extract helpers and test cases into separate functions
- insert temporary paths and adjust tests accordingly to not match
file names exactly
- use 'assert CONDITION' instead of 'if not CONDITION: fail()'
There are a few cases where making this happen required slightly
larger changes than that, but they are limited.
Move the checks from check_compliance.py to a new GitHub workflow,
removing hacks that are no longer needed.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Generalize io-channels and io-channel-names devicetree node properties
and move their definitions to base.yaml. Keep binding specific
description where relevant.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Changes the callbacks for periodic sync callbacks such that multiple
applications can register callbacks, similar to the connection and
scan callbacks.
This change will make it easier to support the PAST feature, as
PA syncs make be created by the controller which then notifies
the host, and thus the application (if callback registered).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Similarly to #28676 Joystick polarity and pull up/down
need to be review for all STM32 boards.
Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
1. clock: move the call for MSI hardware auto calibration enabling
before the control of MSI enable to ensure its execution in all
cases.
2. counter: add call for MSI hardware auto calibration enabling after
the LSE enabling and after possible backup domain reset that may
clear MSIPLLEN.
Signed-off-by: Giancarlo Stasi <giancarlo.stasi.co@gmail.com>
BT_HCI_ERR and BT_SECURITY_ERR both define success constants which can
be used to check the results and make the intended value domain clear.
Add the same for ATT error values.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Since the size of an enum can be undefined in certain compilations
environments, remove the BUILD_ASSERT that verifies that the enum is
16 bits.
Signed-off-by: Jett Rink <jettrink@google.com>
Described in ES096 2.14.7,
F101X8/B, F102X8/B, and F103X8/B
might not be able to enter i2c master mode on power-up.
Force reset help to mitigate this issue.
Signed-off-by: Yiyu Zhu <smallzzy@outlook.com>