pkt->buffer is represented by 1+ net_buf. If some are unused, this will
deallocates them.
This situation can happen on TCP where net_pkt allocator evaluates the
header size to its maximum size. Which space might not be (fully) used
in the end. On fixed data size buffer, this might end up by having last
buffer(s) not bein used. So better removing those.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This will take into account the family and the protocol, as well as
existing buffer occupation, to return the available buffer space that
can be used for payload.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
The Kconfig symbol is CONFIG_LOG_DEFAULT_LEVEL not
CONFIG_LOG_DEFAULT_LOG_LEVEL. Fix references in comments to the actual
Kconfig symbol name.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit changes the names of SYS_POWER_DEEP_SLEEP* Kconfig
options in order to match SYS_POWER_LOW_POWER_STATE* naming
scheme.
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
The SYS_POWER_LOW_POWER_STATE_SUPPORTED and SYS_POWER_LOW_POWER_STATE
suggests one low power state but these options control multiple
low power state. This commit uses plural in the names to indicate
that.
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
Websocket was removed in 1cba0161ed so
remove dead Kconfig references to CONFIG_WEBSOCKET_CONSOLE and
associated dead code/files.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Part of Power Management API was incorrecty documented under
"Power Management Hook Interface" section. This commit fixes
that problem by introducing "System Power Management APIs".
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
At the moment application which chosen policy based power
management does not have an option to override decision
taken by the policy (it could only disable some power
states).
This commit adds the sys_pm_force_power_state() method,
which allow the application to choose power state used
when OS decide to suspend the SoC.
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
If we include this header files in cpp source code,
the compiler say"error: template with C linkage".
Include <device.h> must be moved outside the 'extern "C"' section.
Signed-off-by: Benoit Leforestier <benoit.leforestier@gmail.com>
When NEWLIB_LIBC=y, building the hwinfo drivers fails with:
In file included from ZEPHYR_ROOT/drivers/hwinfo/hwinfo_weak_impl.c:7:0:
ZEPHYR_ROOT/include/hwinfo.h:43:1: error: unknown type name '__syscall';
did you mean '__fastcall'?
__syscall ssize_t hwinfo_get_device_id(u8_t *buffer, size_t length);
^~~~~~~~~
__fastcall
ZEPHYR_ROOT/include/hwinfo.h:43:19: error: expected '=', ',', ';', 'asm'
or '__attribute__' before 'hwinfo_get_device_id'
__syscall ssize_t hwinfo_get_device_id(u8_t *buffer, size_t length);
^~~~~~~~~~~~~~~~~~~~
ZEPHYR_ROOT/drivers/hwinfo/hwinfo_weak_impl.c:9:16: error: expected '=',
',', ';', 'asm' or '__attribute__' before '_impl_hwinfo_get_device_id'
ssize_t __weak _impl_hwinfo_get_device_id(u8_t *buffer, size_t length)
^~~~~~~~~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
The <hwinfo.h> file uses __syscall and this symbols is defined by
<kernel.h>. This doesn't happen with the real drivers as they include
<device.h> and thus <kernel.h>.
Fix that by including <kernel.h> from <hwinfo.h>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This patch adds a JSON web token library that adds the capability
to sign JSON tokens. This was located in subsys due to the dependency
on MBEDTLS, which resides in /ext.
Signed-off-by: David Brown <david.brown@linaro.org>
Signed-off-by: Andy Gross <andy.gross@linaro.org>
Shell will store only pointer to the prompt string instead of
copying it to the RAM buffer. It will save RAM memory and
it will simplify implementation of a new feature: "select"
command. When a command will be selected than shell will
display command syntax as a prompt.
Removed obsolete ASSERT check in a static function.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
One spinlock per pipe object. Also removed some vestigial locking
around _ready_thread(). That call is internally synchronized now.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Straightforward port. Each struct k_queue object gets a spinlock to
control obvious data ownership.
Note that this port actually discovered a preexisting bug: the -ENOMEM
case in queue_insert() was failing to release the lock. But because
the tests that hit that path didn't rely on other threads being
scheduled, they ran to successful completion even with interrupts
disabled. The spinlock API detects that as a recursive lock when
asserts are enabled.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Spinlocks are written above the arch-provided _arch_irq_un/lock()
calls. But those aren't stubbed by the mocking layer, and as it's not
an "arch" I don't see an obvious place to put them. Handle them in
spinlock.h.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Each work_q object gets a separate spinlock to synchronize access
instead of the global lock. Note that there was a recursive lock
condition in k_delayed_work_cancel(), so that's been split out into an
internal unlocked version and the API entry point that wraps it with a
lock.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
The validation checking recently added to spinlocks is useful, but
requires kernel-internals like _current and _current_cpu in a header
context that tends to be needed before those are declared (or where we
don't want them declared), and is causing big header dependency
headaches.
Move it to C code, it's just a validation tool, not a performance
thing.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
We want a _Swap() variant that can atomically release/restore a
spinlock state in addition to the legacy irqlock. The function as it
was is now named "_Swap_irqlock()", while _Swap() now refers to a
spinlock and takes two arguments. The former will be going away once
existing users (not that many! Swap() is an internal API, and the
long port away from legacy irqlocking is going to be happening mostly
in drivers) are ported to spinlocks.
Obviously on uniprocessor setups, these produce identical code. But
SMP requires that the correct API be used to maintain the global lock.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Since we know do DTS before Kconfig we should try and remove dts from
creating Kconfig namespaced symbols and leave that to Kconfig. So
rename CONFIG_CCM_<FOO> to DT_CCM_<FOO>.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add HID Device associated with the instance of the HID. This allows to
create several HID instances for multifunction composite device.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Add new status callback with usb_cfg_data parameter to be able to
identify instance callback.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Add interface parameter to interface configuration callback to be able
to configure several instances of the same class.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
CONFIG_APPLICATION_MEMORY doesn't exist anymore, so the bit of code in
arm_core_mpu_dev.h related to it is dead and should be removed.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Patch introduces flash_map subsystem to operate on flash
image instead of direct operation using flash_driver API.
Changes allows to support operation on the image in any flash
device.
flash_map was not available when this subsystem was introduced.
Signed-off-by: Findlay Feng <i@fengch.me>
Patch introduces flash_map subsystem to operate on flash
footprint instead of direct operation using flash_driver API.
Flash area ID is used in API instead of direct flash-bank-offsets.
Changes allows to support operation on the partition in any flash
device.
flash_map was not available when this subsystem was introduced.
Signed-off-by: Findlay Feng <i@fengch.me>
The power management framework used two different abstractions
to describe power states. The SYS_PM_* given coarse information
what kind of power state (low power or deep sleep) was used,
while the SYS_POWER_STATE_* abstraction provided information
about particular power mode.
This commit removes the SYS_PM_* abstraction as the same
information is already carried in SYS_POWER_STATE_*.
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
The convention is that implementation of any Socket API function
lives in zsock_*(), and then it's optionally aliased to bare POSIX
name if requested. This convention must be followed to get proper
integration into the general POSIX subsystem.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This commits adds a new MQTT transport. The purpose is to be able to
connect to a MQTT broker through a SOCKS5 proxy.
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
The transport number is used to pick elements of an array which is
initialized using #if defined macros. Having explicit numeration in this
enum leads to situations where the array index is different than the
enum value.
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
This was never a long-term solution, more of a gross hack
to get test cases working until we could figure out a good
end-to-end solution for memory domains that generated
appropriate linker sections. Now that we have this with
the app shared memory feature, and have converted all tests
to remove it, delete this feature.
To date all userspace APIs have been tagged as 'experimental'
which sidesteps deprecation policies.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
* Newlib now defines a special z_newlib_partition containing
all globals relevant to newlib. Most of these are in libc.a
with a heap tracking variable in newlib's hooks.
* Both C libraries now expose a k_mem_partition containing the
bounds of the malloc heap arena. Threads that want to use
libc malloc() will need to add this to their memory domain.
* z_newlib_get_heap_bounds has been removed, in favor of the
memory partition for the heap arena
* ztest now includes the C library partitions in its memory
domain.
* The mem_alloc test now runs in user mode to prove that this
all works for both C libraries.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
* K_APP_DMEM_SECTION/K_MEM_BMEM_SECTION macros now exist
to specifically define the name of the sections for data
and bss respectively.
* All boards now use the gen_app_partitions.py script, the
padding hacks for non-power-of-two arches didn't work right
in all cases. Linker scripts have been updated.
* The defined k_mem_partition is now completely initialized
at build time. The region data structures now only exist
to zero BSS.
Based on some work submitted by Adithya Baglody
<adithya.baglody@intel.com>
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This is a separate data section which needs to be copied into
RAM.
Most arches just use the kernel's _data_copy(), but x86 has its
own optimized copying code.
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The function to set channel alarm is called counter_set_channel_alarm.
To match the name of the function performing the reverse operation this
commit renames counter_disable_channel_alarm() function to
counter_cancel_channel_alarm().
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
Implemented via Zephyr's net_hostname_get(). As support for that call
is configurable and by default off, while many POSIX applications
assume that hostname is always available, we need a default value
in case CONFIG_NET_HOSTNAME_ENABLE is "n". Initial version of this
patch added that on the level of gethostname() call, but of was
suggested to move that down to net_hostname_get() instead.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
The scatter/gather API for I2C assumes that all SoC implementations are
capable of supporting such operations, in particular performing a single
write (read) transaction that transfers from (to) multiple addresses in
memory. This is not the case: for some driver implementations a write
of a device register address followed by a write of data to be stored in
that register will produce two bus transactions and be mis-interpreted
by the receiving device.
Extend the documentation of the I2C message flags to provide more
information about the breadth of implementation variation in their
interpretation.
i2c_burst_write cannot be deprecated because we have no replacement.
Clarify in the description that the behavior is not portable.
i2c_burst_read is not being deprecated because it is in use throughout
Zephyr. The description is updated to reflect that it can be replaced
by i2c_write_read().
Deprecate unused convenience wrappers that depended on the burst APIs
but were never used in the tree.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
It is commonly necessary to execute a pair of I2C transactions where the
first is a write transaction that identifies information held on the
device and a second is a read transaction that retrieves the identified
information.
Add API that performs this operation generically, without restricting
the type or size of the identification or content messages. Follow the
argument order of the existing i2c_write and i2c_read methods.
This reduces the need to explicitly construct buffers for i2c_transfer,
or to use more restrictive API functions that perform a gather write
that is not reliable on all I2C bus driver implementations.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Renamed:
- counter_set_wrap to counter_set_top_value
- counter_get_wrap to counter_get_top_value
- counter_get_max_wrap to counter_get_max_top_value
Updated nRF implementations and counter test.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Modify alarm callback to return user_data and channel_id.
Set_alarm and disable_alarm updated accordingly. Renamed
counter_*_ch_alarm to counter_*_channel_alarm. Updated test
and nrf implementations.
Updated doxygen comments.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
counter_callback_t has been previously prefixed with __deprecated
but it is used in prototype of deprecated function (counter_set_alarm).
It seems that compiler generates the warning even though function is
not used. Removed __deprecated prefix from the typedef, keeping it for
the function only.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Deprecating counter legacy API and renaming new counter_set_alarm
to coutner_set_ch_alarm. Deprecating rtc API and modifying rtc
API to call new counter API (compatibility layer).
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
counter.h and rtc.h API's share almost the same functionality.
They are unified as a new counter.h. rtc.h will be deprecated.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Adds a new entry in the pixel format enum for RGB 565. This will be used
for the lcd display on the mimxrt1050_evk and mimxrt1060_evk boards.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Replace Cortex-M3 with Cortex-M architecture family
in the header documentation of kernel_arch_data.h and
kernel_arch_func.h, which are generic header files for
the entire familty of ARM Cortex-M CPUs. The commit
adds some more minor style fixes in functions'
documentation.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit improves the documentation of internal ARM core
function _arch_irq_lock(..), adding a more detailed description
of its impact on the different Cortex-M processors.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This Patch add functionality for automatic generation of the flash map
using DTS description. Automatic generation allows to replace
C-hardcoded flash_map.
We generate a set of defines based on the index of a partiion:
#define DT_FLASH_AREA_<IDX>_OFFSET 0
#define DT_FLASH_AREA_<IDX>_SIZE 131072
#define DT_FLASH_AREA_<IDX>_DEV "FLASH_CTRL"
#define DT_FLASH_AREA_<IDX>_LABEL MCUBOOT
Additionally we also define:
#define DT_FLASH_AREA_NUM 4
and:
#define DT_FLASH_AREA_<PARTNAME>_ID 0
Signed-off-by: Findlay Feng <i@fengch.me>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
It is possible to set the filter in user application and that
information is passed to the CANBUS device driver.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
As the value 0 is a valid network interface index, we cannot use
unsigned value for interface index as that would not allow to
distinguish an invalid value. So make interface index a signed
8-bit value which is ok as we do not expect to have more than 127
network interfaces in the system.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This is basically a dummy layer that just passes data through.
It is needed so that we can create CANBUS type network interface
to the system.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This allows user to create a CAN socket and to read/write data
from it. From the user point of view, the BSD socket CAN support
works same way as in Linux.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit adds PF_CAN and AF_CAN protocol family identifiers
that are used by BSD socket CAN support code.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Vipin Anand <vipin.anand@intel.com>
This commit adds basic packet socket support to net_context and
allows application to receive or send network packets in raw
format.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Various defines and helpers for supporting packet sockets.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Add ETH_P_xxx protocol types if they are missing. After this
we can use the protocol types when working with BSD sockets.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Translate HCI error codes to POSIX error codes in order to be able to
distinguish reason of connectable advertising start failure.
Signed-off-by: Filip Kubicz <filip.kubicz@nordicsemi.no>
This commit enables fine-grained power state locking.
Now, each power state could be independently enabled or disabled.
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
add the handling of APP_SHARED_MEM.
privileged threads can access all the mem
explictly defined in user mode, i.e., APP_MEM & APP_SHARED_MEM
Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
This reverts commit eb6ea28649.
Reverting this to avoid confusion in using the gpio callbacks.
Fixes#11565
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This patch increases the amount of slab memory per item for the shell
history to match the maximum command input buffer size plus the
accounting information for the dnode list item.
Signed-off-by: Andy Gross <andy.gross@linaro.org>
PAE tables introduce the NX bit which is very desirable
from a security perspetive, back in 1995.
PAE tables are larger, but we are not targeting x86 memory
protection for RAM constrained devices.
Remove the old style 32-bit tables to make the x86 port
easier to maintain.
Renamed some verbosely named data structures, and fixed
incorrect number of entries for the page directory
pointer table.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The iterator over registered callbacks failed to account for the
possibility that the callback would remove itself from the list. If
this occurred any remaining callbacks would no longer be reachable from
the node. Switch to the slist iterator that is safe for self-removal.
Note that the slist API remains unsafe for removal of subsequent nodes.
Even with the corrected code removal of the next callback registration
(cached in tmp) will result in it being called anyway, with the
remaining unremoved registrations not being called. If the next
callback were removed and re-registered on a different device, the
callbacks would be invoked for the wrong device.
Resolve this by a documentation change describing the conditions under
which a change to callback registration from within a callback are
permitted. Add a similar note regarding the effect of adding a
callback. The current event invocation behavior for callbacks added
within an event is explicitly left unspecified, though in the current
slist implementation newly added callbacks will not be invoked until the
next event.
Closes#10186
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This reverts the documentation component of commit
eb6ea28649.
The original change broke the API contract: drivers that use GPIOs need
to be able to configure callbacks without being aware of whether a
particular implementation expects to use a mask or a pin ordinal.
Revert the API documentation to its original format, and mark that the
added field should be removed when issue #11565 is resolved.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit re-works the NXP MPU driver implementation so that
it aligns with the implementation for ARMv7-M and ARMv8-M MPU
architectures.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit removes the unnecessary MPU region type definitions
from arm_core_mpu_dev.h, as they are not used any more in any of
the architecture-specific MPU implementations (ARMv7-M, NXP, and
ARMv8-M MPU).
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit removes obsolete ARM CORE MPU API definitions
and related implementation from arm_mpu.c, in the wake of
the transition to the new ARM MPU design.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit updates the ARM Core MPU API for memory domains,
to align with the principle of de-coupling the partitioning
and the access attribution with the architecture-specific
MPU driver implementation.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit introduces an internal ARM MPU API that allows the
user to re-configure a memory partition in run-time.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit introduces an ARM API that allows the user to
program a set of dynamic MPU regions at run-time. The API
function is invoked every time the memory map needs to be
re-programmed (for example at thread context-switch). The
functionality is implementated in arm_core_mpu.c.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit introduces and documents the internal ARM MPU
API to configure the dynamic memory regions at run-time.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit introduces and documents the internal ARM MPU
API to configure the static memory regions at boot time.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
The ARM core MPU API now uses solely k_mem_partition_attr_t
objects to represent memory region attributes. The objects
now include all attribution properties (including cache-
ability and share-ability). This commit updates the macro
definitions to comply with the new ARM Core MPU standard.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit introduces the generic ARM (core) API, which allows
the user to program a set of static (fixed) MPU regions at boot
time. The API function is invoked upon initialization, in the
ARM-specific call of _arch_switch_to_main_thread(). The API
implementation is provided in arm_core_mpu.c.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Extended shell to be able to process logs in place
(in the context of a log call). In order to achieve that,
shell was extended to support for TX blocking operations. If
CONFIG_LOG_INPLACE_PROCESS is enabled then shell instance
attempts to be initialized in blocking TX mode. If fails to
do so, shell log backend is disabled. If successfully enabled
logs are processed and printed in the context of the call.
Due to that change, user may expirience interleaved output as
shell has no means to multiplex shell output with logger output.
In extreme, huge amount of log messages may prevent shell thread
execution and shell may become unresponsive.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
While k_uptime_get() and k_uptime_get32() return time in
milliseconds, they don't need to have millisecond resolution.
Resolution with default Zephyr settings in 10ms.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
As we are removing net_app and net_pkt based libraries and
applications, CoAP legacy based libraries and apps are moved
to socket based implementations. So removing legacy CoAP.
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Currently each SoC has to define own list of power states.
However all these definitions have to be the same, as common power
management code uses them.
This commit replaces per-soc power state list by global definition.
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
This commit adds a new hardware info API.
With this API it is possible to read out the device ID.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
Replaced forever loop in assert with call to a function.
In post_assert_action() function, k_panic is called.
Forever loop was preventing logs to be printed and had behavior
ependent on the context (low prioriy thread - system continue to
ork, irq - system is blocked).
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This adds a simple implementation of SMP CPU affinity to Zephyr. The
API is simple and doesn't try to invent abstractions like "cpu sets".
Each thread has an enable/disable flag associated with each CPU in the
system, and the bits can be turned on and off (for threads that are
not currently runnable, of course) using an easy three-function API.
Because the implementation picked requires enumerating runnable
threads in priority order looking for one that match the current CPU,
this is not a good fit for the SCALABLE or MULTIQ scheduler backends,
so it currently can be enabled only for SCHED_DUMB (which is the
default anyway). Fancier algorithms do exist, but even the best of
them scale as O(N_CPUS), so aren't quite constant time and often
require significant memory overhead to keep separate lists for
different cpus/sets.
The intended use here is for apps that want to "pin" threads to
specific CPUs for latency control, or conversely to prevent certain
threads from taking time on specific CPUs to leave them free for fast
response.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This allows to place instances of the class one after another in the
linker section.
Fixes#12908
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Something is going wrong with code generation here, potentially the
inline assembly generated by _arch_irq_un/lock(), and these calls are
not being inlined by gcc. So what should be a ~3 instruction sequence
on most uniprocessor architectures is turning into 8-20 cycles worth
of work to implement the API as written.
Use an ALWAYS_INLINE, which is sort of ugly semantically but produces
much better code.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
The sys_dlist_insert_*() functions had a behavior where a NULL
argument for the insertion position to sys_dlist_insert_after/before()
was interpreted as "the end of the list". We never used that
convention (except in one spot internal to dlist.h which was not
itself used anywhere), and of course already have an API for appending
and prepending to a list.
In practice this was a performance disaster. The NULL check is
virtually never provable statically by the compiler, so that test and
branch is present always. And worse, the check and call to another
function was pushing this beyond the complexity limit for gcc to
inline a function (at -Os optimization anyway), forcing us to use
function calls for what should be a ~8 instruction sequence. The
upshot is that dlist insertions were 2-3x slower than they needed to
be.
Deprecate these older APIs and introduce a new sys_dlist_insert() call
which can be much better optimized.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Its been at least 2 releases since we marked a number of watchdog APIs
as deprecated. Lets remove them.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The gpio_port_ functions provided by the gpio API do not provide
currently a mask parameter. As such they operate on a full port only.
In practice such functions are not useful. This commit deprecates them
to allow adding port functions with support for a mask parameter in the
future.
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
This commit implements a CTF-backend for Zephyr's tracing API.
The CTF-backend itself is split in a middle-layer and a bottom-layer.
- Middle-layer decides the payload in event transactions,
- Bottom-layer implements the IO transport.
A simple POSIX bottom-layer is provided so far.
Signed-off-by: François Delawarde <fnde@oticon.com>
If status is 0, both ip_hdr and proto_hdr will own a pointer to the
relevant IP and Protocol headers. In order to know which of ipv4/ipv6
and udp/tcp one will need to use respectively net_pkt_family(pkt) and
net_context_get_ip_proto(context).
Having access to those headers directly, many callbacks will not need
to parse the packet again no get the src/dst addresses or the src/dst
ports. This will be change after this commit.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Though these are currently used by the core only, it will be then used
by net_context as well. This one of the steps to get rid of net_pkt's
appdata/appdatalen attributes.
Also normalizing all ip/proto parameters name to ip_hdr and proto_hdr.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
These will be specifically needed in TCP, as well as being used in
context internally.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Also, store the actual next_hdr value and not it's position.
This permits to reduce net_pkt from some bytes.
Such field was unused until now, but it will be soon.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
It's not anymore up to user to provide the pkt. Context will build the
packet according to its metadata and provided buffer and length.
It currently supports only IPv4 and UDP.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
These ones would support linearizing non-contiguous area, however
requiring a bit more complex type as an "accessor".
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Adding a cursor into net_pkt. This is used to read/write data in a much
simpler way, for pre-allocated buffers in net_pkt. This avoids API users
to deal with net_buf below directly.
However, to be used - as for the new allocators - it will require deep
net stack core and API changes.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
These struct net_pkt allocators will give the possibility to allocate at
once the net_pkt and the buffer associated with, taking care of the
header space and MTU relevantly.
This enables to use the variable length allocator from net_buf. However,
it is not yet the default and is set as experimental.
As it is provided in parallel to existing allocators, it has to keep a
slab per-direction and thus a pointer in net_pkt, as well as appdata,
appdatalen etc... Resulting in "bloating" net_pkt. This will be solved
when, finally, former allocators will be removed.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
All as static inline functions to let the compiler check the types
etc... And use ARG_UNUSED() always where relevant.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
The net-app API is removed. Users should use the BSD socket API
for application development.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Now that the security data can be loaded into and used from the
security / server objects, we can add support for LwM2M bootstrap.
This is a mode where initially a connection can be made to a server
which can update several LwM2M (including security and server
data) and then trigger a "bootstrap complete". Once this happens
the client will start it's connection process over but now with
the new information.
Signed-off-by: Michael Scott <mike@foundries.io>
In order to support bootstrap mode, we need to store server data
in the security / server objects. Once the connection to the
bootstrap server is made, it will clear these objects and add
new server connection data.
Signed-off-by: Michael Scott <mike@foundries.io>
net_app contexts save the remote address and we use this during
observe notifications and pending handling. If we move to another
network layer such as sockets, then the remote address becomes
harder to reference. Let's save it as a part of the client
context.
Signed-off-by: Michael Scott <mike@foundries.io>
As part of the migration from net_app APIs to socket APIs, let's
stop referencing the net_pkt fragments throughout the LwM2M library.
Establish a msg_data flat buffer inside lwm2m_message and use that
instead.
NOTE: As a part of this change we remove the COAP_NET_PKT setting.
The COAP library reverts to COAP_SOCK behavior.
This doesn't mean we use sockets in LwM2M (yet), it only means we
use the socket-compatible COAP library which parses flat buffers
instead of net_pkt fragments.
Signed-off-by: Michael Scott <mike@foundries.io>
This board is unmaintained and unsupported. It is not known to work and
has lots of conditional code across the tree that makes code
unmaintainable.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
If the net_context functions are accessed from preemptive priority,
then we need to protect various internal resources.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The original SNTP client library was designed for the net-app API, for
which it makes sense to have a callback function, which is called
asynchronously when an answer is received.
For the socket based interface, the callback is called just before
sntp_request() returns. It gets the status and the epoch_time in
parameter, however the status is already returned by sntp_request(). It
therefore make sense to replace the callback function by a pointer to
epoch_time.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
There are no longer per-partition initialization functions.
Instead, we iterate over all of them at boot to set up the
derived k_mem_partitions properly.
Some ARC-specific hacks that should never have been applied
have been removed from the userspace test.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The public APIs for application shared memory are now
properly documented and conform to zephyr naming
conventions.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Create a reference page for each peripheral and move doxygen API
reference to the main documentation page.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
There was an existing validation layer in the spinlock implementation,
but it was only enabled when both SMP and CONFIG_DEBUG were enabled,
which meant that nothing was using it. Replace it with a more
elaborate framework that ensures that every lock taken is not already
taken by the current CPU and is released on the same CPU by the same
thread.
This catches the much more common goof of locking a spinlock
recursively, which would "work" on uniprocessor setups but have the
side effect of releasing the lock prematurely at the end of the inner
lock. We've done that in two spots already.
Note that this patch causes k_spinlock_t to have non-zero size on
builds with CONFIG_ASSERT, so expect a little data and code size
increase. Worth it IMHO.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Leftovers from legacy MQTT removal commit, now all traces of the
old MQTT implementation are gone.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
It is the macro name that matters, not its value. Here, that will help
to save 1 bit in struct net_pkt later on.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Added display text management to shell_fprintf function.
Now it can be used from diffrent threads with not risk that
displayed lines will overlay.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Removed foreground command functionality from shell source files.
Removed associated example.
Removed enter/exit command functions from the Bluetooth example
Updated project config files.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
CONFIG_NET_CONTEXT_NET_PKT_POOL is used by Zephyr's TCP stack as
a way of keeping the original packet data when compression and
other l2 specific actions make the data unusable for retries.
LwM2M uses UDP and this option was never used.
Signed-off-by: Michael Scott <mike@foundries.io>
The app shared memory macros for declaring domains provide
no value, despite the stated intentions.
Just declare memory domains using the standard APIs for it.
To support this, symbols declared for app shared memory
partitions now are struct k_mem_partition, which can be
passed to the k_mem_domain APIs as normal, instead of the
app_region structs which are of no interest to the end
user.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
As networking libraries and protocols are moving to socket
based implementation, reworked SNTP client library to use sockets.
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Added functions for processing log string and hexdump. Details
are passed as function parameters and not as log_msg. Those
functions can be used when logger works in synchronous mode
and log messages are not created.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Changed 'in place' mode to bypass logger system and directly
call active backends. With this approach memory footprint of
the logger can be significantly reduced in terms of RAM and ROM.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
The Bluetooth 5.1 specification was recently released, and has a new
version identifier (10) assigned to it in the Bluetooth Assigned
Numbers.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
It has been observed that some network drivers, f.ex. the SAM E70 GMAC,
call net_pkt_unref from inside the interrupt that signals the successful
transmission of a packet. This conflicts with the net_pkt_unref call
made by ethernet_send after the packet has been given to the driver.
We fix this by using an atomic_t to hold the reference count as there
might be other, difficult to find cases of net_pkt_(un)ref being used
across threads and interrupts.
The name of the element has been changed from "ref" to "atomic_ref" to
cause a compile error when code still has not been converted to use the
atomic_* functions.
Fixes#12708
Signed-off-by: Daniel Glöckner <dg@emlix.com>
This commit introduces a concept of mesh-local IPv6 addresses. Such
addresses should only be used for mesh-local communication, therefore
should not be used to communicate with different subnets (i. e.
destinations outside the mesh).
As `addr_type` field already holds different kind of information
(whether address was created automatically/manually) it was not used in
this case.
Instead a mesh_local flag was added, so that we do not lose information
on how address was created. Address with such flag set will only be
selected as a source address automatically if the destination address
is within the same subnet it belongs to.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
A recent change in how the fixup mechanism works caused several
regressions. See
https://github.com/zephyrproject-rtos/zephyr/pull/12680 for more
details about the regressions.
The core of the matter is that using defines to pass on include paths
causes interopability issues when integrating with external build
systems.
To resolve this we re-write the fixup mechanism to instead generate an
aggregated fixup file that is ready to be included at build time. Then
no paths are passed through defines and we resolve the regressions
reported.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This is the same as net_buf_pull(), except that instead of returning
the new buf->data it returns the old buf->data. This was recently
discussed in github issue #12562.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
In some cases the Friendship & Low Power Node features aren't
available or feasible, however power saving is nevertheless required.
This patch introduces two new APIs to suspend and resume the Mesh
network. Currently, what this impacts is the LE scanning, the
ability to allocate new outgoing buffers, as well as the model
publishing, beacon and heartbeat timers.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add missing linker section to avoid warning about orphans when building
with host compiler.
Fixes#12719
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Several places in the code have constructions like this:
if (bool_variable) {
atomic_set_bit(flags, FLAG);
} else {
atomic_clear_bit(flags, FLAG);
}
To reduce the amount of code for such situations, introduce a new
atomic_set_bit_to() helper which lets you condense the above five
lines to a single one:
atomic_set_bit_to(flags, FLAG, bool_variable);
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add a level 2 interrupt controller for the RV32M1 SoC. This uses the
INTMUX peripheral.
As a first customer, convert the timer driver over to using this,
adding nodes for the LPTMR peripherals. This lets users select the
timer instance they want to use, and what intmux channel they want to
route its interrupt to, using DT overlays.
Signed-off-by: Marti Bolivar <marti@foundries.io>
Signed-off-by: Mike Scott <mike@foundries.io>
It's not an error if a driver does not implement callback related
function. Let's return -ENOTSUP relevantly.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
The old legacy APIs use net-app library and as that is being
removed, then the dependencies need to be removed also.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If we include this headers files in cpp source code,
the compiler say"error: template with C linkage".
Includes must be moved outside the 'extern "C"' section.
Signed-off-by: Benoit Leforestier <benoit.leforestier@sekurity.fr>