This change introduces an additional function into the API that allows
to test and clear a net_if flag atomically. A similar function already
exists to test and set a flag. So this change actually improves symmetry
of the API.
The change is required in later commits of this PR.
Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
The IEEE 802.15.4 L2 code stores representation of attributes like
PAN id, short address and extended address in different encodings:
* big endian for extended address and CPU byte order for everything
else whenever such attributes enter user space (except for IP/socket
link layer addresses which are always big endian - even in case of
short addresses - to maintain POSIX compatibility).
* little endian for everything that is close to the radio driver as
IEEE 802.15.4 frames are little endian encoded.
Endianness was almost nowhere documented which led to several bugs and
inconsistencies where assignments of different byte order were not
converted (or sometimes converted, sometimes not).
This change documents endianness wherever possible within the realm of
the IEEE 802.15.4 L2 code. Conversion bugs and inconsistencies that were
revealed by the improved documentation will be fixed in a separate
commit.
Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
To maintain POSIX compatibility, link-layer addresses are encoded in big
endian in the IP stack and socket API.
The intended endianness was however not documented everywhere which led
to bugs and inconsistencies. The IEEE 802.15.4 L2 stack, for example,
sometimes stores addresses in little endian in structures that intend
them to be stored in POSIX-compliant big endian byte order.
This change documents intended endianness within the realm of the
IP and sockets stack. Conversion bugs are fixed in a separate commit.
Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
The IEEE 802.15.4 radio driver encodes attributes in:
* little endian for everything that is close to the protocol as
IEEE 802.15.4 frames are little endian encoded.
* mixed big and little endian in its configuration where extended
addresses are being represented. These inconsistencies are unfortunate
but cannot be easily fixed in a backwards compatible way so will be
left untouched in this change.
Endianness was almost nowhere documented which explains these
inconsistencies and led to several bugs where assignments of different
byte order are not converted (or sometimes converted, sometimes not).
This change documents intended endianness within the realm of the
IEEE 802.15.4 radio driver code. Conversion bugs are fixed in a separate
commit.
Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
Add support for setting the target mode for a PMIC regulator. Some
regulators support multiple modes, each with distinctive voltage and
current configuration data. This function allows the consumer to switch
the PMIC into a new mode. The PMIC can then be configured to use a new
set of voltages.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Update regulator binding definitions for PCA9420 to support mode setting
features. This will allow the 4 voltage modes present on the PCA9420 PMIC
to be utilized.
Note that bindings have also been updated to indicate the default
register value and target voltage for each regulator on the PCA9420.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Some minor housekeeping prior to adding an http server
implementation. There are already a number of http headers
and that number will likely increase with subsequent work.
Moving them into a common directory cleans up the
`include/net` directory a bit.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
Previously, HTTP method enumerations were only defined within
the `http_parser.h`, which may not be ideal for all use cases.
This commit moves the `enum http_method` definition to a
dedicated header in a dedicated `http` subdirectory.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
The can_set_timing_data() API function is optional and is not supported by
all CAN controller drivers.
On a board with only either classic CAN or CAN-FD capable controllers the
current behavior is fine, but on boards with a mix of classic CAN and
CAN-FD capable controllers/drivers, calling can_set_timing_data() on a
classic CAN controller will lead to a NULL pointer dereference.
To ensure a proper behavior when calling can_set_timing_data() on classic
CAN controller drivers, change the API wrapper function to return -ENOSYS
if the CAN driver does not implement CAN-FD support.
Note that the data phase timing calculation functions are fine as-is, as
the timing calculations will fail due to minimum/maximum data phase timing
parameters being all zeros for drivers only supporting classic CAN.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
All init entries are already prepended with `__init_`, there's no point
in pre-pending 2 prefixes.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Use the `init_id`, in line with recent device changes, as the argument
is being used as a unique identifier.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
- Create a sys_init entry, as init API is not strictly related to the
device model (device model re-uses it)
- Hide internals (Z_*) from public API docs.
- Give overview within the group definition of allowed levels, meaning,
etc.
- Properly document struct init_entry.
- Multiple style issues
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The _SYS_INIT_LEVEL* definitions were used to indicate the index entry
into the levels array defined in init.c (z_sys_init_run_level). init.c
uses this information internally, so there is no point in exposing this
in a public header. It has been replaced with an enum inside init.c. The
device shell was re-using the same defines to index its own array. This
is a fragile design, the shell needs to be responsible of its own data
indexing. A similar situation happened with some unit tests.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The function in charge of calling all init function was defined in
device.c, had a public prototype and was just used in init.c. Since this
is really an internal function tied to Kernel init code, move it to
init.c and make it static, there's no need to expose it publicly.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The `ARCH` init level was added to solve a specific problem, call init
code (SYS_INIT/devices) before `z_cstart` in the `intel_adsp` platform.
The documentation claims it runs before `z_cstart`, but this is only
true if the SoC/arch takes care of calling:
```c
z_sys_init_run_level(_SYS_INIT_LEVEL_ARCH);
```
Which is only true for `intel_adsp` nowadays. So in practice, we now
have a platform specific init level. This patch proposes to do things in
a slightly different way. First, level name is renamed to `EARLY`, to
emphasize it runs in the early stage of the boot process. Then, it is
handled by the Kernel (inside `z_cstart()` before calling
`arch_kernel_init()`). This means that any platform can now use this
level. For `intel_adsp`, there should be no changes, other than
`gcov_static_init()` will be called before (I assume this will allow to
obtain coverage for code called in EARLY?).
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Instead of hardcoding alignment size for pass 2 device handles, use
Z_DECL_ALIGN. This makes sure gen_handles.py is always in sync with the
type defined in device.h. The build assert in device.h can be removed as
a result, since we do not hardcode handles size anywhere else.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The file does not use any of the API/types defined in kernel.h or
types.h. Added stdint.h include as we're using int32_t, and stddef.h for
NULL.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Some platforms, e.g. NXP LPC, pollute the namespace with definitions
like ARRAY_SIZE, MIN, MAX, etc. Since they don't re-define if already
defined, we're lucky enough to be able to "fix" this problem by
re-ordering includes. This likely deserves a proper fix, either by
patching offending code or Zephyr using a namespace. The "don't
re-define" technique makes implementation dependent on the include
order, i.e. poor/bad solution.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Some headers made use of types defined in sys_clock.h (e.g. k_timeout_t)
without including it.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
With the incoming removal of kernel.h/types.h from init.h, lots of files
start to show compile errors because they relied on indirect
definitions, including errno.h.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
It turns out we could end up with a circular include dependency through
the following sequences:
zephyr/arch/arm/aarch32/irq.h:19 -> zephyr/irq.h
zephyr/arch/arm/aarch32/arch.h:27
zephyr/arch/cpu.h:19
zephyr/sys/arch_interface.h:33
zephyr/timing/timing.h:10
or
zephyr/arch/arm/aarch32/asm_inline_gcc.h:23 -> zephyr/irq.h
zephyr/arch/arm/aarch32/asm_inline.h
zephyr/arch/arm/aarch32/irq.h:19
zephyr/arch/arm/aarch32/arch.h:27
zephyr/arch/cpu.h:19
zephyr/sys/arch_interface.h:33
zephyr/timing/timing.h:10
The problem is that both aarch32 irq.h/asm_inline_gcc.h include
zephyr/irq.h (which in turn depends on the arch specific header, as it
should be). So arch_irq_connect_dynamic ended up being used before its
declaration.
This patch removes zephyr/irq.h from the aarch32 headers, as it makes no
sense to have such _reverse dependency_.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Doxygen comment containing <tt>__VA_ARGS__</tt> does not render
correctly, i.e. __VA_ARGS__ is completely missing from the html
output. The Markdown syntax `__VA_ARGS__` renders as expected.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
We have cases where some devices needs to be initialized very early and
before c_start is call, i.e. to setup very early console or to setup
memory. Traditionally this would be hardcoded as part of the soc layer
and not using device model or the init levels.
This patch adds a new level ARCH, which will be called in early
architecture code and before we jump to the kernel code.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Allows filling up struct lwm2m_obj_path by a macro.
For example:
struct lwm2m_obj_path p1 = LWM2M_OBJ(MY_OBJ);
struct lwm2m_obj_path p2 = LWM2M_OBJ(MY_OBJ, 0, RESOURCE);
Similarly, some function calls accept the structure, so it can
be initialized from stack and given by a pointer
lwm2m_notify_observer_path(&LWM2M_OBJ(obj_id, 0, RESOURCE_ID));
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Bring back Kconfig option which was previously removed by
9cd5086407 (previously named LOG_MSG_PKG_ALWAYS_ADD_RO_STRING_IDXS).
Renamed to shorten and be more descriptive. It can be useful for
external backends or frontends.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
They were basically using the wrong instructions to traverse the cache
by index: `dhi`, `dhwb` and `dhwbi` instead of `dii`, `diwb` and `diwbi`
variants.
Fixes#49112.
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
Follow up to e1e16640b5 adding model name
helpers to access generated macros based on a compatible's matching
entries in vendor prefixes.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
Added support for the AMS AS621x series of temperature sensors as a
variant of the TI TMP108 temperature sensor.
Signed-off-by: Jared Baumann <jared.baumann8@t-mobile.com>
Signed-off-by: James Johnson <james.johnson672@t-mobile.com>
To enable custom formatting of the log output while still using existing
backend, this commit adds the `log_output_custom` feature.
To use, register a commit with `log_custom_output_msg_set` then set the
log backend format set using `log_backend_format_set` with
`LOG_OUTPUT_CUSTOM`
Signed-off-by: Lucas Denefle <lucas.denefle@converge.io>
The direction is used to identify the list to append the registered
capabilities. There is no need to keep it in the bt_audio_capabilities,
it can be provided as a function parameter instead.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
New API for enable Historical data storage for LwM2M resource.
Data cache is only supported at resource which resource size is
static and well known.
Extend output writer for write cached data timestamp.
Enable cache support for Resource set and Read operation.
Added possibility for for drop latest or oldest data from cache.
Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
The iodev submission queue existed but wasn't easily constructed as
there was no macro to define it.
Adds a simple macro wrapper around RTIO_SPSC_DEFINE for creating
the RTIO IO Device Submission Queue enabling each IO device to
have its own pending queue of requests.
The sample has been updated to use the iodev submission queue rather
than a k_msgq.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
This is leftover from old PMP support that should have been deleted
in commit 554f24661f ("riscv: pmp: remove previous implementation").
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Gives the application a two way mapping between array index
and a per_adv_sync object instead of current only per_adv_sync
obj -> index using bt_le_per_adv_sync_get_index.
Signed-off-by: Jakob Krantz <jakob.krantz@u-blox.com>
Move the _static_thread_data created by K_THREAD_DEFINE to ROM. This
change also deletes the unused .init_abort field from the static
thread data.
Signed-off-by: Keith Short <keithshort@google.com>
Alters several provisioning related features to allow commands to be
functional with application defined Provisioning properties &
capabilities.
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>