Commit graph

15409 commits

Author SHA1 Message Date
Gerson Fernando Budke
6b05121e65 include: sys: util: Move macros from util to util_macro
The <sys/util.h>, in current form, can not be used with DTS as it
contains non-C pre-processor definitions which breake DTS interpreter.
This commit fixes the problem by moving most of preprocessor macros
from util.h to util_macro.h.  Since util_mcaro.h contains only
preprocessor macros, without include dependencies, it can be safely
included in DTS. It is similar way the
<dts/arm/<manufacturer>/pinctrl_<manufacturer>_<soc>.h files are
included.

This fix and align the extern "C" closing brack inside non assembly
block.

The issue was raised when try create a macro for pincrtl with a
variable length flag list.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-10-23 09:38:55 -05:00
Dominik Ermel
1241e67790 fs: Move fs_file_system_t declaration out of fs.h
The struct fs_file_system_t is only useful when defining file system
drivers and is not required for typical application development,
that is why it has been moved to separate file fs_sys.h.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-10-23 12:55:41 +02:00
Andrew Boie
933b420235 kernel: add context pointer to thread->fn_abort
For compatibility layers like CMSIS where thread objects
are drawn from a pool, provide a context pointer to the
exited thread object so it may be freed.

This is somewhat obscure and has no supporting APIs or
overview documentation and should be considered a private
kernel feature. Applications should really be using
k_thread_join() instead.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-10-22 23:32:37 -04:00
Andrew Boie
afe42bd129 arch_interface: update arch_mem_domain_thread_add
Implementations may assume the target thread isn't already
a member of the memory domain.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-10-22 16:47:07 -07:00
Andrew Boie
941322c49e userspace: document multiple mem domain init calls
k_mem_domain objects should not be initialized multiple times,
there's no support for memory domain life-cycles or freeing
memory that an arch_mem_domain_init() may have allocated.
Clearly document this.

The init function has to assume the provided domain is un-
initialized memory so it's not possible to robustly check
for this; a note is left in the arch_ definition to add an
assertion if feasible.

It's really unsafe to call an init function on any kernel
object more than once, but in this particular case if the
memory domain initialization resulted in the creation of
page tables or linked data structures really bad things can
happen. Currently no arch implements arch_mem_domain_init()
yet, but this is changing soon for x86.

One test case currently does this, it will be fixed in
a forthcoming patch.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-10-22 15:35:25 -04:00
Joakim Andersson
6ae68c48f4 Bluetooth: UUID: Document endianness in UUID helper macros
Improve the documentation of the UUID header by adding documentation
for all helper macros.
Be explicit in which macros that expects host endianness, and which
ones that expects little endian format.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-22 18:00:45 +03:00
Maximilian Bachmann
f219a982ff include: sys: use C linkage
add extern C when C++ is used to treat the code as C

Signed-off-by: Maximilian Bachmann <m.bachmann@acontis.com>
2020-10-22 07:49:07 -05:00
Trond Einar Snekvik
eca0141152 Bluetooth: Mesh: Isolate cryptographic material
This is a major refactoring of the handling of the cryptographic
material of both the network and transport layers. The aim is to
encapsulate the key object manipulation, and improve overall modularity.

Pulls Applications and Subnets out of the bt_mesh and into separate
modules, with static storage types on the data. This has several
side-effects:
- The Config Server no longer operates directly on the bt_mesh.subs and
  bt_mesh.apps lists, but goes through a public configuration interface,
  following the pattern set in #27908.
- All iteration through the keys is done through iteration APIs
- Key resolution on RX and TX is centralized.
- Changes to the keys triggers events the other modules can register
  handlers for.
- Friendship credentials are stored in the lpn and friend structures.

Part of #27842.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-10-22 14:36:02 +03:00
Emil Gydesen
44f00358a6 Bluetooth: host: PA sync receive enable/disable
Adds support for enabling/disabling PA sync receive,
which allows applications to control when to receive data
while a sync is established.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-10-22 13:28:41 +02:00
Anas Nashif
d2c71796af kernel: document k_sleep with K_FOREVER
When calling k_sleep with K_FOREVER as the timeout value, we consider
this as a suspend call.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-10-22 07:00:15 -04:00
Emil Hammarstrom
ec00feef35 net: lib: sockets: added ALPN extension option to TLS
Adds the socket option TLS_ALPN_LIST for SOL_TLS sockets

Passes the configured alpn list to the mbedtls config
on mbedtls init

Signed-off-by: Emil Hammarstrom <emil.hammarstrom@assaabloy.com>
2020-10-22 11:35:43 +03:00
Siddharth Chandrasekaran
d6437c1aa1 mgmt/osdp: CP: Unify osdp_cp_send_cmd_*() as osdp_cp_send_command()
Minimize number of exported methods by unifying all osdp_cp_send_cmd_*()
as osdp_cp_send_command().

Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
2020-10-21 17:36:16 +02:00
Emil Gydesen
8640eec822 Bluetooth: Added BT_UUID size macros
Added macros that denote the different allowed UUID sizes.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-10-21 16:31:25 +02:00
Emil Hammarstrom
746ba2dd9c logging: make log_backend_std header public
Exported header oftenly used when creating a logging
backend that inpects the log 'stream'.
Enables use in external Zephyr modules implementing the
logging backend interface.

Signed-off-by: Emil Hammarstrom <emil.hammarstrom@assaabloy.com>
2020-10-21 10:21:05 -04:00
Andy Ross
a8d5437799 soc/xtensa: Misc. checkpatch fixups
Code style fixes.  Kept separate from the original changes to permit
easier rebasing.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-10-21 06:38:53 -04:00
Andy Ross
0e83961b21 arch/xtensa: soc/xtensa/intel_adsp: Enable KERNEL_COHERENCE
Implement the kernel "coherence" API on top of the linker
cached/uncached mapping work.

Add Xtensa handling for the stack coherence API.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-10-21 06:38:53 -04:00
Andy Ross
f6d32ab0a4 kernel: Add cache coherence management framework
Zephyr SMP kernels need to be able to run on architectures with
incoherent caches.  Naive implementation of synchronization on such
architectures requires extensive cache flushing (e.g. flush+invalidate
everything on every spin lock operation, flush on every unlock!) and
is a performance problem.

Instead, many of these systems will have access to separate "coherent"
(usually uncached) and "incoherent" regions of memory.  Where this is
available, place all writable data sections by default into the
coherent region.  An "__incoherent" attribute flag is defined for data
regions that are known to be CPU-local and which should use the cache.
By default, this is used for stack memory.

Stack memory will be incoherent by default, as by definition it is
local to its current thread.  This requires special cache management
on context switch, so an arch API has been added for that.

Also, when enabled, add assertions to strategic places to ensure that
shared kernel data is indeed coherent.  We check thread objects, the
_kernel struct, waitq's, timeouts and spinlocks.  In practice almost
all kernel synchronization is built on top of these structures, and
any shared data structs will contain at least one of them.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-10-21 06:38:53 -04:00
Andrew Boie
9f87deafd2 userspace: fix k_mem_domain_destroy()
This deprecated API won't be removed for one more release,
ensure it doesn't put the kernel into a bad state as it
currently sets all the member thread domain assignment to
NULL which is not what we want.

Have it reassign all member threads to the default domain.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-10-20 09:37:49 -07:00
Damian Krolik
62a5179b7b openthread: add openthread_api_mutex_try_lock()
Existing openthread_api_mutex_lock()/unlock() functions are
crucial to assure thread safety of an application which
needs to use OT API directly, but some applications may also
require a non-blocking version of the former for less critical
OT-related tasks.

Add openthread_api_mutex_try_lock() which never waits and
exits immediately if the mutex is held by another thread.

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2020-10-20 16:39:22 +03:00
Emil Gydesen
68153f048d Bluetooth: controller: HCI stubs for BIG commands
Adds initial HCI stubs for the BIG commands to be used for
broadcast isochronous channels.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-10-19 18:59:49 +02:00
Jukka Rissanen
cc230815cb drivers: gsm: Add GSM modem device name
Application might need to know the GSM modem device name so
provide it in the header file.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-10-19 18:29:02 +02:00
Benjamin Lindqvist
54cb2bcd41 drivers: modem: gsm_ppp: Enable start/stop
These changes enable applications to restart the networking stack which
was previously not possible without rebooting the device. This was a
major show-stopper because it made power management impossible, and
furthermore made it impossible to recover from a bad modem state without
rebooting.

This has been verified to work on a SIMCOM7600E modem, both with and
without CONFIG_GSM_MUX enabled.

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2020-10-19 18:29:02 +02:00
Peter Bigot
327afd2c56 devicetree: add a name for an invalid node identifier
This can be used in factored code to determine that no devicetree node
was available.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-10-19 18:14:11 +02:00
Peter Bigot
3dd804fe91 sys: util: add identity macro
Several utility macros must be given the name of a macro to apply to
every element in a sequence to transform it.  When no transformation
is necessary a macro still needs to be provided.  That macro is
IDENTITY.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-10-19 18:14:11 +02:00
Henrik Brix Andersen
6187c8b8df devicetree: rename header to reflect that io-channels are not ADC-only
Rename the devicetree/adc.h header file to devicetree/io-channels.h to
reflect that io-channels are used for both ADC and DAC devicetree
phandles.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-10-19 17:21:33 +02:00
Marek Porwisz
886cf7a9f3 drivers: ieee802154: nrf5: Add support for failed rx notification
Thread implements couple of counters that require notification of failed
frame reception.
Implemented RX failed notification.

Signed-off-by: Marek Porwisz <marek.porwisz@nordicsemi.no>
2020-10-19 12:50:02 +03:00
Peter Bigot
56c3c11d6a bluetooth: add helper for advertising with identity
Document the distinction between the existing non-connectable
advertising configurations, and add one that uses identity which will
be the same for all beacons.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-10-15 22:22:16 +03:00
Mahesh Mahadevan
b50d0ebfcb include: Add NXP LPC clock control driver
DTS bindings file for NXP LPC clock control driver that
uses the MCUX SDK drivers

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-10-15 11:17:24 -05:00
Joakim Andersson
ea273100ef Bluetooth: host: Add advertising options to disable channel
Add advertising options to disable the individual advertising
channel 37, 38 and 39 per advertising instance.

Fixes: #26732

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-15 13:21:26 +03:00
Joakim Andersson
b322fa2f34 Bluetooth: GATT: Document use of attribute parameter in discovery cb
Document which fields in the attribute parameter in the discovery
callback contains valid information.
Document the type of the user_data so that the application can cast
this to a valid type in order to retrieve the information.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-15 11:08:48 +02:00
Joakim Andersson
24f62eeea1 Bluetooth: GATT: Use UUID of attribute to check for a characteristic
Update check in the bt_gatt_attr_value_handle API function to use the
UUID of the function, in case the attribute has been declared with a
different read handler, or the attribute is a temporary object
where the read attribute has not been set.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-15 11:08:48 +02:00
Joakim Andersson
da5ea438c7 Bluetooth: GATT: Add init macro for struct bt_gatt_chrc
Add init macro for struct bt_gatt_chrc so that it can be re-used
other places.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-15 11:08:48 +02:00
Rihards Skuja
576b3583ee lorawan,lora: fix C++ compilation/linking errors
The usual suspects: missing extern and assignments from void *.

Signed-off-by: Rihards Skuja <rihardssk@mikrotik.com>
2020-10-15 11:08:07 +02:00
Andrei Emeltchenko
5df906f06f pcie: Trivial documentation cleanup
Cleanup PCIE documentation.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-10-14 11:49:12 -07:00
Martí Bolívar
305379e944 devicetree: add first round of dependency ordinal info
Add the first API functions that directly deal with node dependency
ordinals as determined by edtlib:

- DT_DEP_ORD(node_id): node_id's ordinal
- DT_REQUIRES_DEP_ORDS(node_id): list of dep ordinals for node_id's
  direct dependencies
- DT_SUPPORTS_DEP_ORDS(node_id): list of dep ordinals for nodes
  depending directly on node_id
- DT_INST_ equivalents

This is not meant to be an exhaustive set of macros related to
dependency ordinals; rather, it's a starting out point meant to enable
initial struct device dependency tracking work. We can add more if
needed.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-14 13:18:44 -05:00
Joakim Andersson
1c21808808 Bluetooth: GATT: Fix alignment of bt_gatt_resubscribe parameters
Fix alignment of bt_gatt_resubscribe parameters.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-14 18:43:00 +02:00
Joakim Andersson
5c5cc87d74 Bluetooth: GATT: Move struct documentation inline
Move struct documentation of member variables to inline documentation,
which is consistent with the rest of the struct definitions.

Removes documentation of a struct variable that does not exist for
bt_gatt_ccc_cfg.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-14 18:43:00 +02:00
Joakim Andersson
e000c0a74a Bluetooth: GATT: Remove struct member variables alignment.
Remove struct member alignment that has become broken by the search
and replace of the uintX_t vs uX_t types.
Remove the alignment since maintaining this causes annoying whitespace
changes when a new variable is added with a longer type name.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-14 18:43:00 +02:00
Krzysztof Chruscinski
a348cec400 drivers: clock_control: Change clock_control_async_on parameters
Stable API change: modify parameters of clock_control_async_on which
previously took a structure which contains list node, callback and user
context. Removing list node and replacing structure with two parameters:
callback and user context. List node is removed because it has no use
in current API.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-10-14 14:06:56 +02:00
Maximilian Bachmann
fd059fe1f2 include/posix: fix extern "C" placement
both parts of extern "C" should be placed inside

Signed-off-by: Maximilian Bachmann <m.bachmann@acontis.com>
2020-10-13 10:05:30 -05:00
Dominik Ermel
81dc347b84 fs: Improve documentation for FS API
Simple improvements in text and formatting of the documentation
the the FS API.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-10-13 13:16:02 +02:00
Andrew Boie
95bbc742ba kernel: move kernel object APIs to own header
Part of an effort to break up the gigantic kernel.h.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-10-12 12:21:46 -04:00
Martí Bolívar
8165008f44 dts: remove legacy macro support
The legacy macros were first deprecated in Zephyr v2.3. Now that
Zephyr v2.4 has been released, that makes two releases where these
macros have been deprecated, so it's OK to remove them.

This leaves support for legacy binding syntax in place. Removing that
is left to future work.

We need to update various pieces of documentation related to flash
partitions that never got updated when the new API was introduced.
Consolidate this information in the flash_map.h API reference page,
since that's really where users will run into it. This also gives us
the opportunity to improve this documentation.

Adjust a couple of kconfigfunctions.py and sanitycheck bits to use
non-legacy edtlib APIs.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-09 08:45:38 -05:00
Peter Bigot
cbff3e34d7 doc: kernel: workqueue: correct documentation of delayed work API
The delayed work API has been changed to allow cancellation in
conditions not previously documented, but this feature can cause both
submission and cancellation to fail in the general case.  Summarize
the conditions and highlight the importance of checking result codes
for these functions.

Also explicitly note that no kernel API can reliably indicate that a
work item has been completed, and that doing so is the responsibility
of the code that provides the work handler.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-10-09 11:48:00 +02:00
Peter Bigot
923caadf3b kernel: delayed_work: update k_delayed_work_cancel documentation
Although the documentation states that only work items that have not
completed the delay can be cancelled, in fact pending items can also
be removed from a work queue.  Document that behavior

Also document the specific return value that will be obtained based on
the state of the work item at the time cancellation was attempted
using the current implementation.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-10-09 11:48:00 +02:00
Peter Bigot
16fe3af327 kernel: delayed_work: note restriction in re-using delayed work items
The delayed work work_q pointer is set on submission, and remains set
even after the work item completes.  Attempts to re-submit the
completed work item to a different queue will be rejected because the
code cannot distinguish a completed item from one that is still
waiting for a delay or to be processed.

Document this restriction.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-10-09 11:48:00 +02:00
Peter Bigot
8f9410a038 kernel: work: clarify effect of resubmitting pending items
Make more clear that submitting a work item to one queue while it is
pending on another queue has no effect.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-10-09 11:48:00 +02:00
Siddharth Chandrasekaran
7f4d2c741b mgmt/osdp: Add support for Secure Channel
This patch adds Secure Channel capabilities to osdp Control Panel and
Peripheral Device modes.

Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
2020-10-09 11:45:58 +02:00
Oliver Hitz
0c70877ceb net: IPv4 bcast address recognized as multicast
Modified net_ipv4_is_addr_mcast() to not wrongly classify an IPv4
broadcast address as a multicast address.

Signed-off-by: Oliver Hitz <oliver@net-track.ch>
2020-10-09 10:26:38 +03:00
Jakub Rzeszutko
c195529615 shell: documentation update
Updating documentation with dictionary commands description.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2020-10-08 10:12:25 -04:00