Commit graph

7457 commits

Author SHA1 Message Date
Gerard Marull-Paretas
fad358c18e doc: predefine ATOMIC_DEFINE
Predefine ATOMIC_DEFINE in the Doxyfile so that documentation output is
generated correctly. In order to simplify the predefinition
ATOMIC_BITMAP_SIZE has been introduced.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-07 14:15:29 +02:00
Gerard Marull-Paretas
926ce3cefe net: ieee802154: remove duplicate definition
`IEEE802154_MAX_ADDR_LENGTH` was defined in 2 headers, keep one only.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-07 14:15:29 +02:00
Martin Jäger
0c8cb0586a canbus: isotp: add fixed addressing feature
Fixed addressing as specified in ISO 15765-2 encodes the source and
target address of a device or function inside the CAN ID according to
SAE J1939.

In order to allow to receive incoming requests from different nodes,
the CAN filter mask has to be set such that the source address is
ignored in the receive context. In addition to that, flow control
frames have to be sent back to the actual source of the request, which
requires adjustments to the TX CAN ID.

This commit implements above features and thus allows ISO-TP to be
used in a network based on SAE J1939 or NMEA-2000.

Signed-off-by: Martin Jäger <martin@libre.solar>
2021-04-06 16:44:34 -04:00
Daniel Leung
70d0a1b6ef timing: guard the header with CONFIG_TIMING_FUNCTIONS
The arch_timing_* are not defined if timing functions are not
enabled, which results in compiler warnings about implicit
function declarations. So guard the header with its own
kconfig so the header can be unconditionally included by
other enough though timing functions are not enabled.

Note this is done inside the doxygen @defgroup or else
doc build would fail as timing_api group cannot be found.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-06 16:43:55 -04:00
Daniel Leung
8eea5119d7 kernel: mmu: demand paging execution time histogram
This adds the bits to record execution time of eviction selection,
and backing store page-in/page-out in histograms.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-06 16:43:55 -04:00
Daniel Leung
ae86519819 kernel: mmu: collect more demand paging statistics
This adds more bits to gather statistics on demand paging,
e.g. clean vs dirty pages evicted, # page faults with
IRQ locked/unlocked, etc.

Also extends this to gather per-thread demand paging
statistics.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-06 16:43:55 -04:00
Joakim Andersson
9f7061a83d Bluetooth: host: Add discovery of standard descriptor values
Add discovery of standard descriptor values. This provides a shorthand
instead of doing a read by UUID, allowing the application discovery
procedure to re-use the discover parameters for simple descriptors.

Fixes: #21489

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-04-06 10:50:18 -04:00
Joakim Andersson
37ea9ac8a7 Bluetooth: host: Add Server Characteristic Configuration definitions
Add Server Characteristic Configuration definitions for bit values
and attribute value.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-04-06 10:50:18 -04:00
Flavio Ceolin
95cd021cea arch: arm: Fix 14.4 guideline violation
The controlling expression of an if statement has to be an
essentially boolean type.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-04-06 10:25:24 -04:00
Lyle Zhu
8fd1605372 Include: Bluetooth: Add GATT uuids
Add BT_UUID_IAS for Immediate Alert Service
Add BT_UUID_LLS for Link Loss Service
Add BT_UUID_HPS for HTTP Proxy Service
Add BT_UUID_ALERT_LEVEL for Alert Level
Add BT_UUID_URI for URI
Add BT_UUID_HTTP_HEADERS for HTTP Headers
Add BT_UUID_HTTP_STATUS_CODE for HTTP Status Code
Add BT_UUID_HTTP_ENTITY_BODY for HTTP Entity Body
Add BT_UUID_HTTP_CONTROL_POINT for HTTP Control Point
Add BT_UUID_HTTPS_SECURITY for HTTPS Security

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2021-04-06 15:29:59 +02:00
Trond Einar Snekvik
b84fee5190 Bluetooth: Mesh: Composition data page 0 traversal
Adds a parsing mechanism for Composition data page 0 in the Config
Client API, and uses it in the shell module to parse the incoming
composition data.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2021-04-06 16:19:13 +03:00
Trond Einar Snekvik
9259b199bb Bluetooth: Mesh: Rename bt_mesh_cfg_comp_data_get's status param to rsp
The first byte of the composition data status message is the returned
page index, not the status of the request. This is now reflected in the
API.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2021-04-06 16:19:13 +03:00
Jukka Rissanen
ce2abc26b5 net: capture: Catch sent and received packets
Create net_l2_send() function which will be called by each L2
sending function so that we can catch all the network packets
that are being sent. Some L2 layers send things a bit differently,
so in those cases call the net_capture_send() directly by the L2
layer.
Add network packet capture call in receive side after the pkt has
been received by the RX queue handler. This avoids calling the
net_capture_send() from ISR context.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-02 07:24:06 -04:00
Jukka Rissanen
e917d80473 net: capture: Add support for network packet capturing
Add infrastructure to allow user to configure the system so that
all the network packets, that are sent to or received from a specific
network interface, are sent to remote system for analysis.
The captured network packets are placed as a payload in UDP packet,
which is then sent inside a tunnel to a remote host. The host can
then receive the packets and for example show them in wireshark.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-02 07:24:06 -04:00
Jukka Rissanen
0501957f26 net: pkt: Add helper to store capture bit
Add get/set helpers to store information whether the net_pkt
is captured already or not. This bit is used to detect capture
loop and avoid recursion.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-02 07:24:06 -04:00
Jukka Rissanen
574b8725e0 net: l2: ipip: Add capability bit for IPIP tunnel
The IPIP tunnel capability bit helps to detect which network
interface supports IPIP tunneling.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-02 07:24:06 -04:00
Daniel Leung
9f0188daff kernel: prioritize C atomic functions if selected
Usually, GCC builtin or arch-specific atomic functions are being
used. The corresponding kconfigs are "selected" by architecture
or SoC kconfigs. CONFIG_ATOMIC_OPERATIONS_C is usually used to
override the GCC built-in or arch-specific atomic functions when
these two are not supported. So change the priority of #include
so that C version is included first if selected, and skips
the inline versions of the other two variants. Or else there
will be two compiled versions of atomic functions: inline version
and the compiled C version. Note that the arch-specific version
and builtin are swapped, so the builtin one is now the default.

Fixes #33857

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-02 07:23:33 -04:00
Daniel Leung
a06d54c65a kernel: remove C syscall include in builtin atomic header
The builtin atomic header file should not include the syscall
header that is generated from C version of atomic functions.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-02 07:23:33 -04:00
Robert Lubos
814fb71bf3 net: socket: Implement SO_BINDTODEVICE socket option
Implement SO_BINDTODEVICE socket option which allows to bind an open
socket to a particular network interface. Once bound, the socket will
only send and receive packets through that interface.

For the TX path, simply avoid overwriting the interface pointer by
net_context_bind() in case it's already bound to an interface with an
option. For the RX path, drop the packet in case the connection handler
detects that the net_context associated with that connection is bound to
a different interface that the packet origin interface.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-04-02 07:23:17 -04:00
Emil Lindqvist
3115610558 net: socket: dtls: add sockopt to set & get dtls handshake timeout
An option has been added which can be passed to setsockopt
which allows the user to set & get the dtls handshake timeout,
either before first handshake or online.

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2021-04-01 20:02:59 +03:00
Anas Nashif
5fa12073cb drivers: remove what appears to be code from comments
Some tools consider this as commented code because of the ifdef, so
remove that and fix a coding guideline violation.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-01 05:34:17 -04:00
Anas Nashif
0ec3774bde userspace: rename _is_user_context -> k_is_user_context
This functions is being called across the tree, no reason why it should
not be a public API.

The current usage violates a few MISRA rules.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-01 05:34:17 -04:00
Anas Nashif
25c87db860 kernel/arch: cleanup function definitions
make identifiers used in the declaration and definition identical. This
is based on MISRA rule 8.3.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-01 05:34:17 -04:00
Jani Hirsimäki
5d76e8aca8 net: ppp: dialup enablers
Introducing PPP dialup features to enable e.g. usage of nrf9160
based board as a dialup modem for transferring ip data over PPP
 (e.g. windows dial up), i.e. usage of Zephyr PPP as a server for
 providing MTU/MRU, IP address and DNS addresses for a PC:
- PPP LCP MRU option (configurable)
- PPP server: IPCP ip and dns address peer options to enable
providing IP and DNS addresses for PPP peer.

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2021-04-01 09:43:56 +03:00
Henrik Brix Andersen
a865b1bb49 soc: arm: nxp: ke1xf: use clock nodes for NXP Kinetis SCG clocks
Use a combination of fixed-clock and fixed-factor-clock devicetree
nodes for describing the clock dividers/multipliers of the NXP Kinetis
System Clock Generator (SCG) present in the KE1xF SoC series.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-03-31 11:56:13 -05:00
Carlo Caione
a43f3bade8 arm/arm64: Fix misc and trivials for ARM/ARM64 split
Fix the header guards, comments, github labeler, CODEOWNERS and
MAINTAINERS files.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-03-31 10:34:33 -05:00
Carlo Caione
3539c2fbb3 arm/arm64: Make ARM64 a standalone architecture
Split ARM and ARM64 architectures.

Details:

- CONFIG_ARM64 is decoupled from CONFIG_ARM (not a subset anymore)
- Arch and include AArch64 files are in a dedicated directory
  (arch/arm64 and include/arch/arm64)
- AArch64 boards and SoC are moved to soc/arm64 and boards/arm64
- AArch64-specific DTS files are moved to dts/arm64
- The A72 support for the bcm_vk/viper board is moved in the
  boards/bcm_vk/viper directory

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-03-31 10:34:33 -05:00
Anas Nashif
3aab352361 drivers: video: fix NOTSUP vs NOSYS usage
Return -ENOSYS when implementation is missing and -ENOTSUP if the
feature is not supported. Those are 2 things. Missing implementation
(-ENOSYS) means that the driver is lacking support for the feature,
-ENOTSUP means we have an implementation but some parameters or
conditions makes the request unsupported.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-30 10:50:14 -05:00
Anas Nashif
84f1cd6833 drivers: uart: fix NOTSUP vs NOSYS usage
Return -ENOSYS when implementation is missing and -ENOTSUP if the
feature is not supported. Those are 2 things. Missing implementation
(-ENOSYS) means that the driver is lacking support for the feature,
-ENOTSUP means we have an implementation but some parameters or
conditions makes the request unsupported.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-30 10:50:14 -05:00
Anas Nashif
75fd7bc0a5 drivers: sensor: fix NOTSUP vs NOSYS usage
Return -ENOSYS when implementation is missing and -ENOTSUP if the
feature is not supported. Those are 2 things. Missing implementation
(-ENOSYS) means that the driver is lacking support for the feature,
-ENOTSUP means we have an implementation but some parameters or
conditions makes the request unsupported.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-30 10:50:14 -05:00
Anas Nashif
0f92d760b0 drivers: pwm: fix NOTSUP vs NOSYS usage
Return -ENOSYS when implementation is missing and -ENOTSUP if the
feature is not supported. Those are 2 things. Missing implementation
(-ENOSYS) means that the driver is lacking support for the feature,
-ENOTSUP means we have an implementation but some parameters or
conditions makes the request unsupported.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-30 10:50:14 -05:00
Anas Nashif
44fb8c7276 drivers: ps2: fix NOTSUP vs NOSYS usage
Return -ENOSYS when implementation is missing and -ENOTSUP if the
feature is not supported. Those are 2 things. Missing implementation
(-ENOSYS) means that the driver is lacking support for the feature,
-ENOTSUP means we have an implementation but some parameters or
conditions makes the request unsupported.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-30 10:50:14 -05:00
Anas Nashif
ba4284bcc3 drivers: lora: fix NOTSUP vs NOSYS usage
Return -ENOSYS when implementation is missing and -ENOTSUP if the
feature is not supported. Those are 2 things. Missing implementation
(-ENOSYS) means that the driver is lacking support for the feature,
-ENOTSUP means we have an implementation but some parameters or
conditions makes the request unsupported.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-30 10:50:14 -05:00
Anas Nashif
7f3cf38f16 drivers: led: fix NOTSUP vs NOSYS usage
Return -ENOSYS when implementation is missing and -ENOTSUP if the
feature is not supported. Those are 2 things. Missing implementation
(-ENOSYS) means that the driver is lacking support for the feature,
-ENOTSUP means we have an implementation but some parameters or
conditions makes the request unsupported.

Also, explicitly check for NULL.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-30 10:50:14 -05:00
Anas Nashif
d24c4ef430 drivers: kscan: fix NOTSUP vs NOSYS usage
Return -ENOSYS when implementation is missing and -ENOTSUP if the
feature is not supported. Those are 2 things. Missing implementation
(-ENOSYS) means that the driver is lacking support for the feature,
-ENOTSUP means we have an implementation but some parameters or
conditions makes the request unsupported.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-30 10:50:14 -05:00
Anas Nashif
0e3b774b80 drivers: i2c: fix NOTSUP vs NOSYS usage
Return -ENOSYS when implementation is missing and -ENOTSUP if the
feature is not supported. Those are 2 things. Missing implementation
(-ENOSYS) means that the driver is lacking support for the feature,
-ENOTSUP means we have an implementation but some parameters or
conditions makes the request unsupported.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-30 10:50:14 -05:00
Anas Nashif
7f54c4dc31 drivers: clock_control: fix NOTSUP vs NOSYS usage
Return -ENOSYS when implementation is missing and -ENOTSUP if the
feature is not supported. Those are 2 things. Missing implementation
(-ENOSYS) means that the driver is lacking support for the feature,
-ENOTSUP means we have an implementation but some parameters or
conditions makes the request unsupported.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-30 10:50:14 -05:00
Dominik Ermel
81f842ef64 storage/flash_map: Add macro to get string label from DTS
The commit adds macro that, using the DTS identifier, allows to
extract flash area label from DTS.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-03-30 09:01:20 -05:00
Martí Bolívar
dbca294ac7 devicetree: spi: clean up DT_SPI_DEV_CS_GPIOS_CTLR
Write this in terms of DT_GPIO_CTLR_BY_IDX instead of the lower level
DT_PHANDLE_BY_IDX for clarity and parallelism with things like
DT_SPI_DEV_CS_GPIOS_PIN, which is written using DT_GPIO_PIN_BY_IDX
instead of DT_PHA_BY_IDX.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-30 07:06:48 -05:00
Andrzej Puzdrowski
f3109a7d61 include/drivers/flash: deprecation of flash_write_protection_set()
The API is deprecated as it was decided to build in the flash protection
service into write and erase procedures.
This is solution chosen for fix following issue:
  When two or more threads writes to flash device it is
  possible that flash protection will be enabled by one of
  threads despite another thread(s) still needs it disabled.

fixes #3127

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
59a79969e8 include/drivers/flash: make write_protection handler optional
Made write_protection handler not mandatory.
flash_write_protection_set() becomes no-operation.
If write_protection handler is provided by the driver implementation
it will be called within flash_writ() and flash_erase().

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Yasushi SHOJI
8466df0d22 include: toolchain: Fix typos in comments
Fix a few typos in the comment sections of the header file.

No functionality has been changed.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2021-03-29 11:42:23 -05:00
Martí Bolívar
005dbf1d79 device.h: DEVICE_DT_GET_ANY refactor
Rewrite this in terms of DT_COMPAT_GET_ANY_STATUS_OKAY().

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-29 16:33:51 +02:00
Martí Bolívar
12eece0b22 devicetree: add DT_COMPAT_GET_ANY_STATUS_OKAY()
This is a helper which allows you to skip the intricacies of instance
numbers to express the intent of "give me a random enabled node with
this compatible; I don't care which one".

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-29 16:33:51 +02:00
Martí Bolívar
c36637b491 devicetree: make @param compat docstrings consistent
Our description of 'compat' parameters is all over the place.
Make it consistent by picking one.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-29 16:33:51 +02:00
Krzysztof Chruscinski
6ce2fe061a lib: os: cbprintf: Fix legth field in static package
Byte value was written instead of word.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-29 14:08:41 +02:00
Krzysztof Chruscinski
65474d8d67 lib: os: cbprintf: Improvements for sparc
Unified define used for handling sparc case in static and
runtime packaging. Reworked macro for storing argument in
static packaging.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-29 14:08:41 +02:00
Krzysztof Chruscinski
c26e08a51f lib: os: cbprintf: Add alignment offset to packaging
Added parameter to CBPRINTF_STATIC_PACKAGE which indicates buffer
alignment offset compared to CBPRINTF_PACKAGE_ALIGNMENT. When offset
is set to 0, macro assumes that input buffer is aligned to
CBPRINTF_PACKAGE_ALIGNMENT. When offset is positive, macro assumes
that buffer address is shifted by given number of bytes to
CBPRINTF_PACKAGE_ALIGNMENT alignment.

Extended cbprintf_package to use len argument as alignment offset
indicator when calculating length only (package pointer is null).

Features are not available for xtensa platform which seems to
require 16 byte alignment from the package. It is only an assumption
due to lack of the documentation and may be fixed in the future.

Feature allows to avoid unnecessary padding when package is part of
a message and preceeded by a header of a known size. For example,
message header on 32 bit architecture has 12 bytes, long doubles are
not used so cbprintf requires 8 byte alignment. Without alignment
offset indicator, package containing just a string with one argument
would need 4 byte padding after the header and 4 byte padding after
the package. Message would be 32 bytes long. With alignment offset
indication both paddings are not needed and message is only 24 bytes
long.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-29 14:08:41 +02:00
Daniel Leung
21f6217313 toolchain: xcc: nullify __deprecated macro
XCC does not support using the deprecated attribute for enum
as it is based on old GCC 4.2. So nullify the macro to avoid
compilation errors.

Fixes #33548

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-03-29 07:53:23 -04:00
Jukka Rissanen
97bf53fdcf net: if: Add locking when setting/getting hoplimit or ttl
Locking was missing when setting or getting IPv6 hop limit
or IPv4 time-to-live values.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-29 07:40:24 -04:00