Our application (posix-naive/debug) ran into segmentaion faults,
because the socket was closed between the "wait for sockets" and the
second if in the first loop. Added the check also to line 690
and 720.
The other uses of sock_ctx[i] are already checked against NULL
Signed-off-by: Peter Tönz <peter.tonz@husqvarnagroup.com>
According to Core 5.3 Vol 4, Part E, section 7.8.82 slot_durations,
switch_pattern_len and ant_ids are used only for AoA and do not affect
reception of AoD CTE.
To improve interoperability checking of correctness of these parameters
is not required. It will not affect lower link layer in case the AoA
CTE reception feature is not enabled in Kconfig.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
This function exposes list pointer, so that it allows the user to modify
the internal list. This adds bt_audio_foreach_capability iterator finction
that can be used instead.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The LLDN frame has been obsoleted in IEEE 802.15.4-2015f. This change
removes it from the code, introduces frame types from current spec
levels and updates the frame validation rules in accordance with the
spec.
Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
Several attributes in the ieee802154_context struct may potentially be
accessed from different threads and/or ISR context. Only some of these
attributes were properly guarded against race conditions.
This may not have been to problematic in the past but as other changes
in this PR introduce additional attributes and mutate several attributes
in a single atomic transaction, leaving such changes unprotected seems
dangerous.
This change therefore introduces systematic locking of the
ieee802154_context structure.
Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
IEEE 802.15.4 short address support is incomplete in several places.
This change improves short address support without claiming to fix
it everywhere. Future iterations will have to continue where this change
leaves off.
The purpose of this change was to:
* use the short address returned by association responses,
* automatically bind IEEE 802.15.4 datagram sockets to the short
address if available,
* use the short address in outgoing packages where applicable,
* improve validation of association/disassociation frames,
* model association more closely to the spec by tying it to the
existence of a short address in the MAC PIB thereby removing
redundancy in the PIB (which makes race conditions less probable),
* keep both, the short and extended addresses, of the coordinator.
Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
This changes fixes several bugs and inconsistencies in the IEEE 802.15.4
L2 implementation. These bugs were revealed while documenting intended
endianness of driver, IP, socket and L2 attributes (see previous
changes).
Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
This is a preparatory change that fixes one aspect of short address
handling before fixing endianness so that the endianness fix can be
applied consistently in this method.
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>
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>
Changes in device_service have triggered MISRA 5.7 violation CI error
(Tag name should be unique). Renamed shell to sh, same as some other
modules.
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>
This is a follow up to commit bb86f8b967.
Also custom IEEE 802.15.4 based L2 implementations may need to use
packet handling without the IP layer. Add support for such cases.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
By using CONFIG_LWM2M_VERSION_1_0, the function
lwm2m_engine_get_binding() returns the binding
and the queue mode bytes. Therefore the buffer
must be tree bytes long.
The issue is caused by the two inconsistent defines:
lwm2m_registry.c:
#define BINDING_OPT_MAX_LEN 3 /* "UQ" */
lwm2m_rd_client.c:
#define CLIENT_BINDING_LEN sizeof("U")
Signed-off-by: Peter Tönz <peter.tonz@husqvarnagroup.com>
Enable the statistics subsystem shell by default if both statistics and
shell are enabled.
Have the statistics shell imply enabling named statistics as this takes out
a lot of guesswork regarding which statistics counter is which.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
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>
The sys* ops like sys_clear_bit are indirectly included via arch CPU
header. Other stuff like find_msb_set end up included via this header as
well.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This was all done as part of the soc and called from the soc. Define
this type of console under drivers/console and use it in the SoCs
supporting that via SYS_INIT instead of calling the console code
directly.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
If a file write was attempted with a file that does not exist, over
the shell/UART when logging was enabled, it would output a fs_unlink
error, this works around the issue by checking if the file exists and
needs truncating before performing that action. It also imrproves
flash endurance slightly by performing a truncate operation instead
of a delete, but will fall back to a delete if the truncation
operation fails. This issue can be also be mitigated by altering
logging settings or adjusting the SMP thread priority.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
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>
I need to register a service for the pull-context so I can
safely close the socket context. Otherwise the socket loop
would crash, because context would be closed while going through
the list where it was located.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Minor change, the semaphore is freed by a caller so it was always
free, but just for being correct, it should be a blocking call,
so any errors would clearly block.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
CoAP layer handles retrying so having a second layer of retry
in the pull-context does not make sense. If we need more retrying
it should be done in CoAP layer.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
When URI is written, we must first set the state to DOWNLOADING
so when any error happens on the initialization phase, the
result written on a callbacks are correctly reflected and the state
changes correctly IDLE -> DOWNLOADING -> IDLE (result written).
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Allowing locking the registry from commandline allows
us to test composite observation and observation of
object instances, etc. where multiple values are changed
before the notify message triggers.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
For some reason, running sys-t with catalog message on
Cortex-M0 would result in hard fault in mipi_catalog_formatter()
if log_output_syst.c is complied before the backends (and weird
enough, only with SIZE optimization). This new ordering was
introduced in commit f5587552bb
as it was to group all backend source files under a single
directory.
Workaround the issue by compiling file later after backends
as this issue is causing CI failures. Actual root-cause is TBD.
Relates #50941
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
- Account for the added random delay when updating remaining duration
- Re-worked JIT re-scheduling update a bit to keep the random delay
information and remaining duration correct
Signed-off-by: Troels Nilsson <trnn@demant.com>
- Remaining duration is now in us instead of ticks to avoid
overflow when ticks have higher resolution
- First advertising event should not reduce remain duration
Signed-off-by: Troels Nilsson <trnn@demant.com>
Add EVENT_OVERHEAD_START_US to ticks_anchor when enabling
advertising, so the first advertising event is not late due
to calculations for aux packets etc.
Signed-off-by: Troels Nilsson <trnn@demant.com>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Tune the EVENT_OVERHEAD_START_US for typical usecases on
nRF52833 SoC using the central_gatt_write and
peripheral_gatt_write samples.
Manually run the samples for over 30 mins without any
assertions and use the actual profiled value that would
otherwise be printed on assertion.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When ticks_to_expire is in the past, i.e. ticks_to_expire is
0, perform an explicit trigger of ticker worker instead of
setting up the compare which delays the trigger by the
minimum ticks offset margin. The changes reduce latencies
of the O(n) ticker_resolve_collision by upto the minimum
ticks offset margin (3 for nRF SoCs) for each resolution.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When an event's prepare is delayed due to ULL scheduling or
ISR latencies, check and have a verbose assertion that logs
the actual EVENT_OVERHEAD_START_US required.
Signed-off-by: Vinayak Kariappa Chettimada <vich@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>
Instead of using "select" on certain EC configurations, which is
considered unsafe for various reasons, use a "depends on" and rely on
the user to set a proper configuration in the config file.
Update the respective project configurations to comply with the new
configuration scheme.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Conditional compile ticker interfaces like ticker_update
which are not required when individual state or role samples
are build.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix the BIG event counter calculation from stored payload
counter. Event latency should not be multiplied by burst
count.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing includes and rearrange header includes to be able
to build a full feature set Controller.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This is a follow-up to commit a418ad4bb4.
Since the path to zephyr_mbedtls_priv.h is added to include directories
only when CONFIG_MBEDTLS_BUILTIN is enabled, the inclusion of the file
needs to be done under the same condition. Otherwise, an error occurs
when socket_tls.c is compiled without CONFIG_MBEDTLS_BUILTIN.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
added `audio start_sine` and `audio stop_sine` to start/stop
sending an LC3 encoded sine tone.
This code is heavily inspired from the sine tone implementation
from the unicast_client sample implementation.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add printing of the broadcast source advertising address in the
scan callback. Also rename the scan callback to make
it more clear that it is for broadcast scanning.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>