Commit graph

15409 commits

Author SHA1 Message Date
Jakub Rzeszutko
a8e45c4f1e shell: dictionary commands feature
Adding dictionary commands concept. It simplifies creation of multiple
commands that are handled by a one function handler.

This is a special kind of static commands. Dictionary commands can be
used every time you want to use a pair: (string <-> corresponding data)
in a command handler. The string is usually a verbal description
of a given data. The idea is to use the string as a command syntax that
can be prompted by the shell and corresponding data can be used to
process the command.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2020-10-08 10:12:25 -04:00
Manivannan Sadhasivam
88e3ea02ff include: Add LoRaWAN API
Add LoRaWAN API for Zephyr. Only config, join and send methods are
implemented.

Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-10-08 12:15:38 +02:00
Jennifer Williams
5bda586c64 logging: fix if else if constructs missing final else
The logging subsytsem had if else if constructs without final
else statement. This commit adds else {} to comply with
coding guideline 15.7.

Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
2020-10-07 23:05:18 -07:00
Kumar Gala
c22f7e5062 uart: Remove deprecated defines
The following defines have been deprecated for at least 2 releases so
remove them:

UART_ERROR_BREAK
LINE_CTRL_BAUD_RATE
LINE_CTRL_RTS
LINE_CTRL_DTR
LINE_CTRL_DCD
LINE_CTRL_DSR

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-10-07 15:13:32 -05:00
Vinayak Kariappa Chettimada
552fa84cc8 Bluetooth: HCI: Add the missing set per adv receive enable definition
Add the missing LE Set Periodic Advertising Receive Enable
command definition.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Dominik Ermel
d795f2dbfe fs: fs_seek and fs_tell return -ENOTSUP when not implemented
Simple change that makes fs_seek and fs_tell return -ENOTSUP when
file system does not implement the seek/tell.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-10-07 14:51:39 +02:00
Marcin Niestroj
79fa92229a mgmt: smp: shell: use net_buf API for storing UART SMP fragments
So far there was a simple char array used as buffer, with additional
variable representing number of bytes already written into it. After
full frame was written, a boolean flag was simply set to notify thread
about being ready to be processed. There was however no mechanism
implemented to prevent new incoming bytes from overwriting such buffer
before (or during) being processed.

Use net_buf to store temporary frame. Define dedicated net_buf_pool,
from which such buffer will be allocated and freed after being
processed. This will prevent from reusing the same buffer before having
it fully processed (and returning once again to available buffer pool)
in shell thread.

Define also fifo that will store buffers that are ready to be
processed. This will be the mechanism for notifying thread about new
UART SMP fragments.

net_buf pool and k_fifo are used on purpose, keeping in mind their
additional overhead (mostly in RAM/ROM usage). This makes the code ready
for increasing number of buffers if needed. In this commit however we
stick with only 1 buffer, to keep minimal changes in processing flow.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-07 14:51:06 +02:00
Andrew Boie
b95e960d10 kernel: move k_heap definition
Move it to where the rest of the k_heap APIs are defined.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-10-06 19:56:51 -04:00
Andrew Boie
b7e1e21b3c kernel: redefine struct k_spinlock_key
This is not intended to be public, all users are expected
to be using the opaque k_spinlock_key_t.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-10-06 19:56:51 -04:00
Andrew Boie
10fc01ee9b kernel: move spinlock defintion to spinlock.h
No need to define in a different quasi-private header.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-10-06 19:56:51 -04:00
Kumar Gala
014342a6f6 sys: ring_buffer: remove deprecated macros
Remove SYS_RING_BUF_DECLARE_POW2 and SYS_RING_BUF_DECLARE_SIZE as they
have been marked deprecated for at least 2 releases.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-10-06 14:58:42 -04:00
Eugeniy Paltsev
effd2fa834 toolchain: define __no_optimization attribute across toolchains
The __attribute__((optimize("-O0"))) attribute is used to disable
optimization of some test functions. ARC MWDT toolchain doesn't
support it, however it supports __attribute__((optnone)) with
similar functionality.

Define __no_optimization attribute across all toolchains so it
can be used in tests.

NOTE: we don't define __no_optimization for XCC as it includes
GCC header with __no_optimization defined.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2020-10-06 11:41:23 -04:00
Carlo Caione
2f3962534a arch: arm64: Remove new thread entry wrapper
Instead of having some special stack frame when first scheduling new
thread and a new thread entry wrapper to pull out the needed data, we
can reuse the context restore code by adapting the initial stack frame.

This reduces the lines of code and simplify the code at the expense of a
slightly bigger initial stack frame.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2020-10-06 10:25:56 -04:00
Jackie Ja
1bf00725dc net: websocket: Fix conflict flag
The message type flag will be set to
0x11(WEBSOCKET_FLAG_FINAL(0x01) | WEBSOCKET_FLAG_PING(0x10)) when
receiv PING with final fragment, it conficts with
WEBSOCKET_FLAG_PONG(0x11)

The WEBSOCKET_FLAG_PONG should be 0x20

Signed-off-by: Jackie Ja <qazq.jackie@gmail.com>
2020-10-06 12:02:06 +03:00
Robert Lubos
8880f254b3 net: lwm2m: Remove invalid doc entries
RD client APIs don't return anything, yet return values were documented.
Remove invalid docs.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-10-06 12:01:13 +03:00
Robert Lubos
f7a5638871 net: lwm2m: Make bootstrap optional
Currently, after `CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP` is enabled,
the LwM2M engine will initiate bootstrap procedure on each run. This
approach limits the flexibility of the application, as it's not always
necessary to go over the bootstrap procedure (for instance, the
application may decide to store the security object obtained during the
bootstrap in flash, and restore it on boot).

Fix this by introducing an additional `flags` parameter to the
`lwm2m_rd_client_start()` function, which provides information whether
to run bootstrap in the current session or not.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-10-06 12:01:13 +03:00
Toby Firth
680ec0bad7 queue: Fixed using incorrect init macro
k_queue uses a sflist.
The macro used for initialising the list is the slist not sflist macro.
This commit just changes the macro to use the sflist init macro.

Fixes #28912

Signed-off-by: Toby Firth <tobyjfirth@gmail.com>
2020-10-05 21:30:16 -04:00
Simon Glass
a1d8e55cad emul: spi: Add support for SPI emulators
Add an emulation controller which routes SPI traffic to an attached
emulator. Only one emulator is supported per bus at present, since
chip-selction functionality is not present.

This allows drivers for SPI peripherals to be tested on systems that
don't have that peripheral attached, with the emulator handling the SPI
traffic.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-05 15:33:00 -04:00
Erwan Gouriou
c3eef7744a include/devicetree.h: Add DT_ENUM_IDX_OR macro
In case a "required: False" enum binding doesn't mention a
default value, but a default value makes sense to be set in the code,
DT_ENUM_IDX_OR could be used to provide the default idx to be used.

New macro comes with appropriate tests.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-05 10:15:32 -05:00
Torstein Grindvik
84cdc6fd92 logging: Refactoring macro to avoid Coverity issue
Change a runtime log check such that Coverity does not report a
needless issue on every use of any log macro.

Before the change, this was used in log macros:

    else if(is_user_context || (_level <= LOG_RUNTIME_FILTER(_filter)))

If runtime filtering is not enabled, this expands to:

    else if(is_user_context || 1)

Because the level is compared to log level debug (4) and will always be,
equal or lower.
Coverity always reports this as a potential issue, since the
variable part (is_user_context) makes no difference.

After the change, a macro is used which expands into the original code
when runtime filtering is used, else it simply expands to:

    else if(true)

Which has equal semantics as the previous code but isn't flagged by
Coverity.

Signed-off-by: Torstein Grindvik <torstein.grindvik@nordicsemi.no>
2020-10-04 14:45:45 -07:00
Kumar Gala
c8b94f468a kernel: Remove deprecated APIs and MACROs from 2.3
Remove old K_ prefixed macros defined in kernel.h as well as the
following APIs:

k_uptime_delta_32
k_enable_sys_clock_always_on
k_disable_sys_clock_always_on

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-10-04 14:13:09 -07:00
Kumar Gala
d28f04110d kernel/sys_clock.h: Remove deprecated macros
Removed the following macros as they have been marked deprecated for at
least 2 releases:

__ticks_to_ms()
__ticks_to_us()
z_us_to_ticks()
sys_clock_hw_cycles_per_tick()
SYS_CLOCK_HW_CYCLES_TO_NS64()
SYS_CLOCK_HW_CYCLES_TO_NS()

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-10-04 14:12:27 -07:00
Jukka Rissanen
088589837e net: event: Add start/bound/stop events for DHCPv4
Application would need this information in order to know when
it is able to create sockets with proper IPv4 address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-10-03 17:15:15 +03:00
Jukka Rissanen
db889774c2 net: tc: Remove not used field from net_traffic_class struct
The "tc" field which was holding the traffic class thread
priority is not used nor needed so remove it from the struct
to save some space.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-10-02 13:20:17 +03:00
Emil Gydesen
8cc051ccac Bluetooth: host: Change PA sync callbacks to global callbacks
Changes the callbacks for periodic sync callbacks such that multiple
applications can register callbacks, similar to the connection and
scan callbacks.

This change will make it easier to support the PAST feature, as
PA syncs make be created by the controller which then notifies
the host, and thus the application (if callback registered).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-10-02 11:49:13 +02:00
Peter A. Bigot
776e0db03d bluetooth: att: provide named constant for successful result
BT_HCI_ERR and BT_SECURITY_ERR both define success constants which can
be used to check the results and make the intended value domain clear.
Add the same for ATT error values.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-10-02 11:45:03 +02:00
Jett Rink
c0f2720890 include: remove enum build assert
Since the size of an enum can be undefined in certain compilations
environments, remove the BUILD_ASSERT that verifies that the enum is
16 bits.

Signed-off-by: Jett Rink <jettrink@google.com>
2020-10-02 11:44:39 +02:00
Mulin Chao
be217e4a3a drivers: eSPI: add eSPI driver support for NPCX7 series.
In npcx7 series, all of them support the Intel Enhanced Serial
Peripheral Interface (eSPI) Revision 1.0. This specification provides a
path for migrating host sub-devices via LPC to a lower pin count, higher
bandwidth bus. In addition to Host communication via the peripheral
channel, it provides virtual wires support, out-of-band communication,
and device mastering option over the Chipset SPI flash.

Becisdes introducing eSPI device in npcx7, this CL also includes:

1. Add eSPI device tree declarations.
2. Add npcx7-espi-vws-map.dtsi to present the relationship between eSPI
   Virtual-Wire signals, eSPI registers, and wake-up input sources.
3. Zephyr eSPI api implementation.
4, Add OOB (Out of Band tunneled SMBus) support.
5. Add configuration files for eSPI test suites.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-10-02 11:33:15 +02:00
Eugeniy Paltsev
9b0ef4f19a ARC: MWDT: drop redundant stack checking
MWDT toolchain has Stackcheck_alloca option enabled by default.
So it adds stack checking in addition to Zephyr's stack checking.

As it is completely redundant let's drop it.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2020-10-02 11:32:12 +02:00
Yuguo Zou
df4b7803a1 arch: arc: unify different versions of MPU registers
Previously MPU registers macros are only defined within its own header
files and could not be used by other part of program. This commit unify
them together.

Signed-off-by: Yuguo Zou <yuguo.zou@synopsys.com>
2020-10-02 11:31:34 +02:00
YanBiao Hao
dc89bfcc7f Bluetooth: Mesh: Config Client network transmit set/get API
Get/Set network transmit parameter of a node.

Signed-off-by: YanBiao Hao <haoyanbiao@xiaomi.com>
2020-10-02 11:30:12 +02:00
Peter A. Bigot
82a98d75ef kernel: timer: clarification on k_timer_stop_t requirements
The documentation of the callback implies it is invoked from a thread,
but the documentation of the stop function states it can be called
from interrupt context.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-10-02 11:29:14 +02:00
Peter A. Bigot
f1b86caff3 kernel: timer: update k_timer API for const correctness
API that takes k_timer structures but doesn't change data in them is
updated to const-qualify the underlying object, allowing information
to be retrieved from contexts where the containing object is
immutable.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-10-02 11:29:14 +02:00
Peter A. Bigot
16a4081520 kernel: timer: update _timeout API for const correctness
API that takes _timeout structures but doesn't change data in them is
updated to const-qualify the underlying object, allowing information
to be retrieved from contexts where the containing object is
immutable.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-10-02 11:29:14 +02:00
Aastha Grover
83b9f69755 code-guideline: Fixing code violation 10.4 Rule
Both operands of an operator in the arithmetic conversions
performed shall have the same essential type category.

Changes are related to converting the integer constants to the
unsigned integer constants

Signed-off-by: Aastha Grover <aastha.grover@intel.com>
2020-10-01 17:13:29 -04:00
Tomasz Bursztyka
d98f7b1895 arch/x86: Optimize ACPI RSDP lookup
As well as normalizing its signature declaration through header.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-10-01 11:16:40 -07:00
Tomasz Bursztyka
4ff1885f69 arch/x86: Move ACPI structures to header file
Let's have all specified ACPI structures in the central header.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-10-01 11:16:40 -07:00
Tomasz Bursztyka
c7787c623e arch/x86: Cleanup ACPI structure attributes names
No need to mix super short version of names with other structures
having full name. Let's follow a more relevant naming where each and
every attribute name is self-documenting then. (such as s/id/apic_id
etc...)

Also make CONFIG_ACPI usable through IS_ENABLED by enclosing exposed
functions with ifdef CONFIG_ACPI.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-10-01 11:16:40 -07:00
Peter Bigot
88e756e05e kernel: document interrupt behavior of k_cpu_atomic_idle
The generic kernel API did not specify the effect of the call on the
interrupt lockout state.  The implementation forwards to
arch_cpu_atomic_idle() which does document that the state is restored
to the state specified in the passed key, which makes it have the
effect of invoking irq_unlock(key).

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-10-01 18:45:08 +02:00
Erwan Gouriou
029d749446 include/dt-bindings: Add include binding for st,stm32f1-pinctrl
Add header to allow use of STM32F1_PINMUX macros described
for st,stm32f1-pinctrl binding.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-01 11:08:42 -05:00
Erwan Gouriou
b023dbe8b3 include/dt-bindings/pinctrl: stm32f1: No pull-up/down on output mode
On stm32f1 series, in output mode, there is no way to enable
pull-up/down resistors.
Clean these settings from helper defines.

Additionally add helper define to shorten few lines.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-01 11:08:42 -05:00
Erwan Gouriou
e45757ffb1 include/dt-bindings/pinctrl: stm32: Move non F1 compatible definitions
Macro STM32_PINMUX and related definitions are not compatible with
stm32f1 series and then should not be provided in -common.h.
Move them to stm32-pinctrl.h

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-01 11:08:42 -05:00
Erwan Gouriou
e9eec5a5d1 include/dt-bindings/pinctrl: stm32: Rename stm32-pinctrlf1
Rename header file stm32-pinctrlf1.h to more appropriate
stm32f1-pinctrl.h

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-01 11:08:42 -05:00
Erwan Gouriou
b48ba090e4 include/dt-bindings: stm32: provide stm32-pinctrl-common.h binding
Provide stm32-pinctrl-common.h matching st,stm32-pinmux binding.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-01 11:08:42 -05:00
Kumar Gala
9c45673d8e net: sntp: Remove deprecated API function
Remove sntp_request as its been marked deprecated since at least Zephyr
2.3 release.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-10-01 07:14:08 -05:00
Luke Starrett
169e7c5e75 arch: arm64: Fix arm64 crash dump output
- x0/x1 register printing is reversed
- The error stack frame struct (z_arch_esf_t) had the SPSR and ELR in
  the wrong position, inconsistent with the order these regs are pushed
  to the stack in z_arm64_svc.  This caused all register printing to be
  skewed by two.
- Verified by writing known values (abcd0000 -> abcd000f) to x0 - x15
  and then forcing a data abort.

Signed-off-by: Luke Starrett <luke.starrett@gmail.com>
2020-10-01 07:29:27 -04:00
Andrew Boie
391935bea1 x86_64: add dedicated MEMORY area for locore
This had been hacked into the linker script, define
a proper MEMORY region for it.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-09-30 14:14:07 -07:00
Andrew Boie
7f4901b8a6 x86: 32-bit: remove mmu region list
This related to old infrastructure which has been removed
from Zephyr.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-09-30 14:14:07 -07:00
Andrew Boie
3807c51e4e x86: add common memory.ld
We need the same logic for each SOC, instead of copypasting
things just put this in a common file. This approach still
leaves the door open for custom memory layouts if desired.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-09-30 14:14:07 -07:00
Andrew Boie
27e00f497a x86: 32-bit: set _image_text_start properly
Strictly speaking, should bee a virtual, not physical address.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-09-30 14:14:07 -07:00