Commit graph

15409 commits

Author SHA1 Message Date
Joakim Andersson
213dbf3ed7 Bluetooth: GATT: Remove wrong documentation for GATT write callback
Remove paragraph in documentation of GATT write callback which is
clearly wrong and was meant for the read callback.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-09-01 09:33:12 +02:00
Krzysztof Chruscinski
701e9befe4 drivers: clock_control: nrf: Move USB part to the USB driver
Removed all nrf_power/USB related stuff from clock control
driver to USB driver.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-08-31 12:40:47 +02:00
Ryan Erickson
eca8842b67 drivers: modem: add Sierra Wireless HL7800 Modem Driver
The driver utilizes the CONFIG_NET_OFFLOAD setting to avoid the
normal handling of IP packets, and instead uses a socket-like
UART interface to handle incoming and outgoing data via AT commands.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-08-31 10:46:33 +02:00
Chris Coleman
99a268fa16 arch: arm: Collect full register state in Cortex-M Exception Stack Frame
To debug hard-to-reproduce faults/panics, it's helpful to get the full
register state at the time a fault occurred. This enables recovering
full backtraces and the state of local variables at the time of a
crash.

This PR introduces a new Kconfig option, CONFIG_EXTRA_EXCEPTION_INFO,
to facilitate this use case. The option enables the capturing of the
callee-saved register state (r4-r11 & exc_return) during a fault. The
info is forwarded to `k_sys_fatal_error_handler` in the z_arch_esf_t
parameter. From there, the data can be saved for post-mortem analysis.

To test the functionality a new unit test was added to
tests/arch/arm_interrupt which verifies the register contents passed
in the argument match the state leading up to a crash.

Signed-off-by: Chris Coleman <chris@memfault.com>
2020-08-31 10:13:27 +02:00
Simon Guinot
b37ea90335 drivers: led: add driver for TI LP503x controllers
This patch adds support for the Texas Instruments LP5030 and LP5036
I2C LED controllers. They are respectively providing up to 30 and 36
channels (i.e. 10 or 12 RGB LEDs).

In addition to the channel/color registers this LED controller provides
a per-LED brigthness register. This driver implements both LED-based and
channel-based API methods:

- led_on
- led_off
- led_get_info
- led_set_brightness
- led_set_color
- led_set_channel
- led_write_channels

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2020-08-28 15:04:35 +02:00
Simon Guinot
f59abf5916 drivers: led: introduce channel-dedicated syscalls
Some LED controllers are connected to a large number of LEDs (i.e.
array/strip of LEDs). A user may need to set several LEDs at the same
time. The LED oriented syscalls are not adapted to this task. Indeed a
call per LED is needed to configure a group of LEDs. To that end, this
patch adds the led_set_channel and led_write_channels syscalls to the
LED API. They offer direct access to the raw channels. They respectively
allow to set a single channel and to write several contiguous channels
(and therefore to configure a group of LEDs).

Moreover the addition of the led_write_channels syscall also aims at
closing the gap with the LED strip API.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
Signed-off-by: Maxime Bittan <maxime.bittan@seagate.com>
2020-08-28 15:04:35 +02:00
Simon Guinot
4f5583bf33 drivers: led: make more API callbacks optional
For the LED controller without any hardware blinking capability this
doesn't really make sense to make the blink callback mandatory. It is
better to let it undefined. This way this will allow the LED API to
fall back to a common software blink implementation.

In addition some controllers with RGB LEDs don't have the capability
to configure the LED brightness but only the channel/color levels.
Their drivers may only implement the set_color callback.

That's why this patch makes the blink and set_brightness LED API
callbacks optional.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2020-08-28 15:04:35 +02:00
Simon Guinot
2e26262451 drivers: led: introduce led_set_color syscall
The led_set_color syscall adds support for multicolor (i.e.
multi-channel) LEDs to the LED API. It allows a user to set all the
colors/channels of a LED at once by passing a color array. Note that
this array must provide an entry per color/channel and must also be
ordered following the color mapping of the LED. This color mapping can
be either retrieved from the "color-mapping" DT property or from the LED
driver itself (by using the led_get_info syscall).

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2020-08-28 15:04:35 +02:00
Simon Guinot
713809f0ce drivers: led: introduce led_get_info syscall
When supported by the driver the led_get_info syscall allows a user
to retrieve the following information about each LED available:

- The LED label.
- The number of colors/channels.
- And for a multicolor LED a pointer to a channel-color mapping.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
Signed-off-by: Maxime Bittan <maxime.bittan@seagate.com>
2020-08-28 15:04:35 +02:00
Simon Guinot
745d5ac7e1 led: move API functions to LED objects
Actually the LED API functions are handling channel objects. The "led"
parameter passed to the functions is defined as a channel number. This
patch redefines it as a LED number instead.

Note that this patch doesn't change anything for the drivers handling
mono-color (or single channel) LEDs. For the drivers handling multicolor
(or multi-channel) LEDs, such as the lp5562, then the API is broken.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2020-08-28 15:04:35 +02:00
Simon Guinot
9d729acc37 dts: introduce binding for LED controllers
The led-controller DT binding gathers some common properties for LED
controllers and for the LED child nodes.

One notable property is "color-mapping" which allows to define a channel
to color mapping for multicolor LEDs.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
Signed-off-by: Maxime Bittan <maxime.bittan@seagate.com>
2020-08-28 15:04:35 +02:00
Asbjørn Sæbø
65f5046d70 Bluetooth: Bugfix - correct UUID defines
This fixes an error introduced in commit
9b2e9eda89

It seems that in a couple of instances, the "_VAL" suffix was
forgotten.  One of these broke the le-audio build.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2020-08-28 10:38:16 +02:00
Ryan Erickson
2ce87da252 net: lib: lwm2m: add new sensor objects
Add generic, humidity and pressure sensor objects.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-08-27 11:01:09 +03:00
Jukka Rissanen
e6672f848a net: ip: sockaddr_ll_ptr is larger than sockaddr_in6_ptr
Make sure that the largest sockaddr_xx_ptr length is defined
last. Otherwise we might copy wrong amount of data.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-27 10:56:06 +03:00
Jukka Rissanen
a50f4900d6 net: eth: Add ETH_P_TSN type
The ETH_P_TSN is used in TSN (IEEE 1722) packets.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-27 10:56:06 +03:00
Andrew Boie
00f71b0d63 kernel: add CONFIG_ARCH_MEM_DOMAIN_SYNCHRONOUS_API
Saves us a few bytes of program text on arches that don't need
these implemented, currently all uniprocessor MPU-based systems.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-26 20:35:02 -04:00
Andrew Boie
f1d12aa45b userspace: deprecate k_mem_domain_remove_thread()
This is just equivalent to calling k_mem_domain_add_thread()
on the default memory domain now.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-26 20:35:02 -04:00
Andrew Boie
9bfc8d82d0 userspace: introduce default memory domain
We make a policy change here: all threads are members of a
memory domain, never NULL. We introduce a default memory domain
for threads that haven't been assigned to or inherited another one.

Primary motivation for this change is better MMU support, as
one common configuration will be to maintain page tables at
the memory domain level.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-26 20:35:02 -04:00
Andrew Boie
1a9f490353 userspace: deprecate k_mem_domain_destroy()
We don't have use-cases and it introduces complexities with
allocating page tables on MMU systems.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-26 20:35:02 -04:00
Peter Bigot
7a8a4c9b3e drivers: spi: document expectation on spi config parameter
Most if not all drivers use an internal function
spi_context_configured() to bypass reconfiguring the SPI peripheral
when nothing has changed.  That function determines change based on
comparing the struct spi_config pointer that was last used.  This does
not work if a user changes fields within the pointed-to structure.

Document that pointer comparison may be used to detect changes.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-26 12:25:06 +02:00
Kwon Tae-young
2aeed81202 drivers: dac: Added driver for TI DACx0508
TI's DACx0508 is a DAC chip that supports SPI.
Gain and Reference can be set through the register.

Signed-off-by: Kwon Tae-young <tykwon@m2i.co.kr>
2020-08-26 12:24:43 +02:00
Andrew Boie
38e17b68e3 x86: paging code rewrite
The x86 paging code has been rewritten to support another paging mode
and non-identity virtual mappings.

 - Paging code now uses an array of paging level characteristics and
   walks tables using for loops. This is opposed to having different
   functions for every paging level and lots of #ifdefs. The code is
   now more concise and adding new paging modes should be trivial.

 - We now support 32-bit, PAE, and IA-32e page tables.

 - The page tables created by gen_mmu.py are now installed at early
   boot. There are no longer separate "flat" page tables. These tables
   are mutable at any time.

 - The x86_mmu code now has a private header. Many definitions that did
   not need to be in public scope have been moved out of mmustructs.h
   and either placed in the C file or in the private header.

 - Improvements to dumping page table information, with the physical
   mapping and flags all shown

 - arch_mem_map() implemented

 - x86 userspace/memory domain code ported to use the new
   infrastructure.

 - add logic for physical -> virtual instruction pointer transition,
   including cleaning up identity mappings after this takes place.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-25 15:49:59 -04:00
Andrew Boie
bcc69f944d mem_manage: add private conversion APIs
Private macros/function for converting a virtual address
to a physical address. Only works for a specific range
of virtual addresses (the permanent SRAM mappings).

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-25 15:49:59 -04:00
Kamil Piszczek
e86d728c58 bluetooth: conn: fix init macro for PHY params
Fixed initialization macro for PHY parameters.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2020-08-25 16:10:21 +03:00
Joakim Andersson
fb757498bb Bluetooth: UUID: Add encode utility macro for 16 and 32 bit UUIDs
Add encode utility mocre for 16 and 32 bits UUIDs that can be
used to in combination with BT_DATA_BYTES to include UUIDs
in advertising data.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-08-25 16:09:22 +03:00
Joakim Andersson
9b2e9eda89 Bluetooth: UUID: Add defines for UUID values
Add defines for UUID values so that they can be used without
declaring a full bt_uuid struct.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-08-25 16:09:22 +03:00
Martí Bolívar
bd86078376 sys/util.h: add FOR_EACH_NONEMPTY_TERM
This is an extension to the existing FOR_EACH family of macros that
has a couple of twists that make it more useful in certain contexts,
as explained in the docstring.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-08-24 20:29:11 -04:00
Flavio Ceolin
0aaae4a039 guideline: Make explicit fallthrough cases
-Wimplicit-fallthrough=2 requires a fallthrough comment or a compiler
to tells gcc that this happens intentionally.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-08-24 20:28:47 -04:00
Flavio Ceolin
f0ec286759 toolchain: gcc: Add macro to fallthrough attribute
This macro is intended to be used in intentional fallthroughs on
switch / case statements.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-08-24 20:28:47 -04:00
Daniel Leung
181d07321f coredump: add support for ARM Cortex-M
This adds the necessary bits in arch code, and Python scripts
to enable coredump support for ARM Cortex-M.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-24 20:28:24 -04:00
Daniel Leung
8fbb14ef50 coredump: add support for x86 and x86_64
This adds the necessary bits to enable coredump for x86
and x86_64.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-24 20:28:24 -04:00
Daniel Leung
49206a86ff debug/coredump: add a primitive coredump mechanism
This adds a very primitive coredump mechanism under subsys/debug
where during fatal error, register and memory content can be
dumped to coredump backend. One such backend utilizing log
module for output is included. Once the coredump log is converted
to a binary file, it can be used with the ELF output file as
inputs to an overly simplified implementation of a GDB server.
This GDB server can be attached via the target remote command of
GDB and will be serving register and memory content. This allows
using GDB to examine stack and memory where the fatal error
occurred.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-24 20:28:24 -04:00
Peter Bigot
4f8f286a2a drivers: i2c: document speed levels
Many developers will be unfamiliar with UM10204 so document the rates
that are associated with the standard, fast, etc. speed names.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-24 16:23:43 -05:00
Anas Nashif
390537bf68 tracing: trace mutex/semaphore using dedicated calls
Instead of using generic trace calls, use dedicated functions for
tracing sempahores and mutexes.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Anas Nashif
a45c403c56 tracing: arc: depend on CONFIG_TRACING_ISR for ISRs
Use CONFIG_TRACING_ISR to exclude tracing ISRs just like other
architectures.

Also, z_sys_trace_isr_exit was not defined (It was renamed some time ago
and this was forgotten...)

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Anas Nashif
5c31d00a6a tracing: trace k_sleep
Trace when k_sleep is called.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Philip Serbin
b7b73d0160 net: ipv6: added interface multicast group filtering
Added additonal checks in net_ipv6_input to ensure that multicasts
are only passed to the upper layer if the originating interface
actually joined the destination multicast group.

Signed-off-by: Philip Serbin <philip.serbin@lemonbeat.com>
2020-08-24 13:53:15 +03:00
Joakim Andersson
c7ad66157d Bluetooth: host: Elevate security to L4 when SC only is enabled
Elevate connections always to security mode 1 level 4 when
Secure Connections Only Mode has been enabled in the Security Manager.

Elevate connections always to security mode 1 level 3 when
Legacy pairing with OOB only has been enabled in the Security Manager.

Fixes: #27338

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-08-24 10:16:51 +02:00
Jukka Rissanen
34ddb8cfa8 net: includes: Fix indentation in header files
The indentation went wrong when the integer types was changed
from the type "u8_t" to type "uint8_t". This changed the length
of the type and caused the code to look bad in places.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-21 13:56:13 -04:00
Martí Bolívar
af4566b21e devicetree: spi: fix typo in docstring
s/one/none/ in a critical place.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-08-20 19:40:03 -04:00
Andrew Boie
6f32dd7110 x86: add missing memory domain checks
These macros are used to validate that regions aren't
programmed that allow both writes and execution.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-20 13:58:54 -04:00
Andrew Boie
86ad13d960 userspace: clarify some mem domain doxyen
Make a few miscellaneous comments clearer.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-20 13:58:54 -04:00
Andrew Boie
bc35b0b780 userspace: add optional member to memory domains
Some systems may need to associate arch-specific data to
a memory domain. Add a Kconfig and `arch` field for this,
and a new arch API to initialize it.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-20 13:58:54 -04:00
Andrew Boie
f8d743a1cb userspace: fix ifdef for k_mem_partition
Wrap the entire definition around CONFIG_MEMORY_PROTECTION.
Add incomplete declaration for IS_ENABLED() purposes.

Some arch code uses struct k_mem_partition internally for
MPU management, even if userspace isn't enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-20 13:58:54 -04:00
Andrew Boie
ca1921aaa3 userspace: fix ifdef for k_mem_domain
ifdef the entire struct k_mem_domain around CONFIG_USERSPACE,
this is specifically and only a userspace feature.

Add an incomplete definition for purposes of allowing the APIs
to be used with IS_ENABLED().

Prevents accidental useless instatiation of k_mem_domain structs.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-20 13:58:54 -04:00
Andrew Boie
75d5c0bc4b userspace: move mem domain defines
This now has its own header instead of kernel.h. The code is
unchanged other than a forward declaration of k_tid_t.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-20 13:58:54 -04:00
Marcin Niestroj
f74feca027 mgmt: smp: shell: initialize SMP before feeding with received bytes
So far SMP shell transport was initialized in APPLICATION run level, but
shell over UART was initialized in POST_KERNEL. This could end up in
situation when received frames were scheduled for further processing in
SMP layer, when it was not initialized yet.

Export smp_shell_init() function declaration and call it before shell is
initialized with all its receive data handlers. This prevents situation
when data is scheduled for processing in SMP layer, when that one is not
ready yet.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-08-19 09:51:45 -04:00
Jan Georgi
5931a29979 net: route: multicast routing feature
net: route: Add prefix-based ipv6 multicast forwarding

This adds/reenables the feature of multicast routing/forwarding.
The forwarding decision is based on the added multicast routes
and the new network interface flag:
NET_IF_FORWARD_MULTICASTS.

Signed-off-by: Jan Georgi <jan.georgi@lemonbeat.com>
2020-08-19 09:46:25 -04:00
Emil Gydesen
b9f09d785b Bluetooth: Att: Added define for max attribute length
Added a #define for the maximum attribute length defined
by the core spec. Usefull for GATT servers and clients that
deals with long values.

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
2020-08-18 15:55:14 -04:00
Marcin Niestroj
a542de46ac net: l2: ppp: add initial support for PAP authentication
This patch implements optional authentication phase, which is done
between link establishment and network phases. It is part of LCP option
negotiation to decide whether authentication is needed and which
protocol will be used. For now we add only PAP support and try to
negotiate it when some other protocol (e.g. CHAP or EAP) is proposed
earlier. For simplicity reason we only add one way authentication
support, which means that we try to authenticate to the other peer, but
do not require authentication from it.

This is an important step to make PPP work with cellular network modems,
because most of them require to provide username and password within PPP
authentication phase. Those credentials are used by modem to login to
cellular network. In most cases however it is enough to provide dummy
values, because they are not verified. For this reason and simplicity of
this patch we hardcode PAP Peer-ID and Password now.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-08-18 20:03:05 +03:00