Commit graph

6268 commits

Author SHA1 Message Date
Eugeniy Paltsev 3f544ca5b2 ARC: replace NOP ASM inlines with builtin
NOP instruction is available via builtin for ARC so get rid of all
ASM inlines with NOP/NOP_S instructions.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2020-07-24 12:05:12 +02:00
Eugeniy Paltsev 79a55ae7a4 ARC: use generic lsb/msb implementation instead of ASM code
Zephyr has generic find_msb_set and find_lsb_set implementations.
They are based on builtins so they are optimized enough.
Drop custom ASM implementation.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2020-07-24 12:05:12 +02:00
Raveendra Padasalagi 306980816a dma: Support 64bit source/dest address
Add 64bit source_address/dest_address fields support.
This is needed in situation where DMA controller is capable
of handling more than 32bit source and destination addresses.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2020-07-24 11:54:31 +02:00
Simon Glass 49a3e49936 include: drivers: sensor: Add more channels for batteries
Add some more channels useful for batteries with fuel gauges.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-23 12:12:09 -04:00
Andrew Boie 7df42d7c25 include: libc-hooks: add comments
Clarify in documentation under what conditions this partition
is available.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-23 11:01:42 +02:00
Peter Bigot a1babb7f1f drivers: eeprom_slave: add const qualifier to read-only data
The EEPROM device doesn't mutate the source data it's given, so update
the API signature to reflect this fact.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-22 21:41:12 +02:00
Jukka Rissanen 2705a9d61b net: if: Network interface was missing for offloaded drivers
The NET_IF_OFFLOAD_INIT() macro was not converted to use
Z_STRUCT_SECTION_ITERABLE() macros in commit 62580748e5
("net: Use section foreach macros"). This meant that for those boards
that use offloaded network stack, the network interface was not created
and network connectivity was lost.

Fixes #27037

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-07-22 14:17:37 -04:00
Michael Hope 62a236e546 usb: cdc_acm: add a DTE rate changed callback
This is called when the USB host changes the virtual baud rate.

This is used by Arduino style boards to signal that the board should
reset into the bootloader.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-22 13:24:37 +02:00
Peter Bigot 0d480e78f8 settings: disallow modifying the content of a subtree name
There may be value in being able to rename a subtree, but there is no
identified need to be able modify the text of an assigned subtree
name.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-21 21:54:40 -04:00
Tomasz Bursztyka 922325992d spi: Make all API functions available
Removing ifdef around conditional API to follow zephyr coding style.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-07-20 17:32:42 -04:00
Eugeniy Paltsev 3eee762e08 ARC: NSIM: switch to ns16550 UART model
Switch nSIM from custom ARC UART to ns16550 model. That will
allow us to use zephyr images built for nSIM on other platforms
like HAPS, QEMU, etc...

This patch do:
 * switch nSIM board to ns16550 UART usage
 * change nSIM simulator configuration to use ns16550 UART model
 * drop checks for CONFIG_UART_NSIM in ARC code
 * update nSIM documentation

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2020-07-20 13:34:34 -04:00
Jukka Rissanen 4746a13324 net: Remove special alignment
The Z_STRUCT_SECTION_ITERABLE() provides an alignment so remove
the 32 byte alignment for net_if and ppp_protocol_handler structs.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-07-20 08:32:46 -07:00
Jukka Rissanen 62580748e5 net: Use section foreach macros
Use system provided Z_STRUCT_SECTION_FOREACH() and
Z_STRUCT_SECTION_ITERABLE() macros instead of manually coding
everything for network sections.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-07-20 08:32:46 -07:00
Krzysztof Chruscinski 6f01c0bc79 drivers: clock_control: nrf: Add onoff service support
Updated nrf clock control driver to use onoff service for managing
multiple users.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-07-20 16:22:21 +02:00
Andrew Boie 354053441d userspace: mark z_app_regions as const
These are read-only structures used to clear the various
BSS regions. Mark as constant data.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-20 13:47:10 +02:00
Trond Einar Snekvik f8663774de Bluetooth: Mesh: Document shell commands
Adds a high-level documentation page for the Bluetooth Mesh Shell
subsystem, documenting all available commands and their parameters.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-07-20 12:47:31 +02:00
Emil Gydesen 5b59c002f6 Bluetooth: Gatt: Automatic discover of CCC when subscribing
Added a feature that allows an application to request
automatic discovery of the CCCD handle when subscriping
to a characteristic. In order to preserver RAM, the application
is expected to provide the discovery parameters, and it's up
to the application whether or not it wants to reuse the
discovery parameters or use one for each characteristic.

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
2020-07-20 12:46:18 +02:00
Marcin Niestroj 071e8400ad net: l2: ppp: fsm: use packet work object instead of shared one
Single work object for whole fsm was not being able to handle more than
single packet at a time. Because of that we have overwritten already
scheduled packets, resulting in fsm timeout and net_pkt leak.

Use net_pkt work object instead, so we can safely schedule more than a
single packet.

This commit also drops workaround for qemu_x86 unit testing.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-20 13:19:28 +03:00
Marcin Niestroj aec0b5ae84 mgmt: smp: add missing kernel.h include statement
There is following error when compiling applications using smp:

  /zephyr/include/mgmt/smp.h:77:16: error: field 'zst_work' has \
  incomplete type
     77 |  struct k_work zst_work;
        |                ^~~~~~~~
  /zephyr/include/mgmt/smp.h:80:16: error: field 'zst_fifo' has \
  incomplete type
     80 |  struct k_fifo zst_fifo;
        |                ^~~~~~~~

Fix that by adding missing kernel.h include statement in mgmt/smp.h.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-18 08:43:18 -04:00
Krzysztof Chruscinski 88be2ea2d2 drivers: uart: Make all API function available
Conditional API was removed by preprocessor which violates zephyr
coding style. Removed ifdefs around conditional API.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-07-17 13:00:52 -05:00
Andrew Boie ee3c50ba6d x86: apic: use device MMIO APIs
A hack was required for the loapic code due to the address
range not being in DTS. A bug was filed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-17 11:38:18 +02:00
Andrew Boie db0ca08fb7 kernel: add macros for device MMIO management
Three variants provided:

- Drivers with one MMIO region to manage
- Drivers with multiple MMIO regions to manage
- Drivers or driver-like code which doesn't use Zephyr's device
  model

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-17 11:38:18 +02:00
Andrew Boie 06cf6d27f7 kernel: add k_mem_map() and related defines
This will be the interface for mapping memory in the kernel's
part of the address space, which is guaranteed to be persistent
regardless of what thread is scheduled.

Further code for specifically managing virtual memory will end up in
kernel/mmu.c.

Further defintions for memory management in general will end up
in sys/mem_manage.h.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-17 11:38:18 +02:00
Anas Nashif 0ff33d1ae7 doc: fix usage of :c:type
Fixing issues with recent versions of breathe 4.19.2:

 WARNING: Unparseable C cross-reference: 'struct device'
 Invalid C declaration: Expected identifier in nested name, got keyword:
 struct [error at 6]
   struct device
     ------^

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-07-16 15:44:50 -04:00
Joakim Andersson 71ab1ec5a7 Bluetooth: host: Add bond_deleted callback
Add bond_deleted callback so that the application can keep track
of when bond information is deleted in the stack.
Bond information can be deleted by the application through bt_unpair
or automatically by the stack in some cases, e.g when
CONFIG_BT_KEYS_OVERWRITE_OLDEST is enabled and the oldest bond
is overwritten.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-16 12:09:57 +02:00
Aastha Grover 97ecad69f0 include: Implement API's for cache flush and cache invalidate
arch: arc: core: Add Cache Implementation function & prototype for arc

Signed-off-by: Aastha Grover <aastha.grover@intel.com>
2020-07-15 15:53:26 -07:00
Anas Nashif 568211738d doc: replace lifo/fifo with LIFO/FIFO
Replace all occurances of lifo/fifo with LIFO/FIFO to be consistent.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-07-15 14:01:33 -04:00
Eug Krashtan ad59e7fec5 net: ip: Fix IPv6 RS message doesn't comply RFC4291
Current implementation of net_ipv6_send_rs() uses
net_ipv6_addr_create_ll_allnodes_mcast() for creating RS packet.
As result we send RS packet to all-nodes destination [FF02::1],
but RFC4291 requires all-routers destination [FF02::2] for RS packets.

Signed-off-by: Eug Krashtan <eug.krashtan@gmail.com>
2020-07-15 13:26:58 +02:00
Rafał Kuźnia 89bf746ebe arch/arm/aarch32: add IRQ relay mechanism to ARMv7/8-M
This patch allows the `SW_VECTOR_RELAY` and
`SW_VECTOR_RELAY_CLIENT` pair to be
enabled on the ARMv7-M and ARMv8-M architectures
and covers all additional interrupt vectors.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-07-14 16:17:30 +02:00
Robert Lubos fddeb59911 net: lwm2m: Protect send() calls with a mutex
Although LwM2M engine uses cooperative threads, the internal `send()`
implementation might trigger context switch when it calls a kernel
function, therefore resulting in `send()` call being entered from both
the LwM2M thread and the retransmit work.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-07-14 13:04:37 +02:00
Johann Fischer b95558dd9f drivers: usb: unify endpoint helper macros
Unify endpoint index and direction helper macros
across all usb device drivers.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-07-10 11:45:46 +02:00
Krzysztof Chruscinski 2809cad50e logging: Add fields initialization in z_log_msg_std_alloc
Added initialization of ids fields in the log message in
z_log_msg_std_alloc(). If user space is enabled then msg_free()
function is reading log level and previously it may have been
uninitialized.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-07-09 13:46:07 +02:00
Peter Bigot a0f025995d drivers: watchdog: update API to reflect additional return code
Allow feed operations that would stall due to internal peripheral
delays to complete immediately with -EAGAIN indicating that the feed
did not occur as expected.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-09 06:44:59 -04:00
Krzysztof Chruscinski 16fa71276a sys: util: Document limitation of IS_EMPTY macro
IS_EMPTY macro does not accept all type of arguments.
Added clarification.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-07-08 23:25:27 -04:00
Flavio Ceolin c4f7faea10 random: Include header where it is used
Unit tests were failing to build because random header was included by
kernel_includes.h. The problem is that rand32.h includes a generated
file that is either not generated or not included when building unit
tests. Also, it is better to limit the scope of this file to where it is
used.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-07-08 21:05:36 -04:00
Flavio Ceolin 6216c6cf5b random: Add syscalls for random subsystem
Create syscalls to make possible using random APIs from user mode
threads. These APIs can have different implementations, like using
entropy driver or Xoroshiro128. Some of these implementations also have
some globals to preserve state between calls.

Make it run entire in user space would require user adding these globals
to their memeory domains and/or grant access to entropy device. Syscalls
simplify its usage.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-07-08 21:05:36 -04:00
Peter Bigot 7da5f15e15 bluetooth: mesh: cdb: fix include files and add language directive
Include the files that provide the types and macros used by the
header.  Ensure that all declarations use C language linkage when
included from a file using C++.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-08 16:47:10 +03:00
Peter Bigot 247161dcb9 bluetooth: mesh: access: avoid C99 features unavailable in C++
C99 designated array initializers are not part of the C++ language,
and are not supported in GNU G++.  Replace their use with invocations
of the Zephyr listify macro utility, with ancillary helper functions.

Also fix the initialization order to match declaration order (which
C++ also requires).

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-08 16:47:10 +03:00
Peter Bigot 4729e4300f bluetooth: mesh: access: fix initialization order in macros
C++ requires that designated initializers be provided in declaration
order.  Fix the macros that violate this requirement.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-08 16:47:10 +03:00
Andy Ross 43d84147d9 drivers/pcie: Fix BAR address size limitation
The PCI API was originally limited to 32 bit addresses.  Even though
it had code to skip over the high word in 64 bit BAR entries, it
refused to use it and returned a 32 bit value.  Some devices in the
wild have default mappings from the firmware for devices above 4G.

Also remove the "iobar" API.  It's dead code, we don't call it and we
don't test it.  IO space BAR entries are a legacy feature from way,
way back in PCI history (I genuinely have never heard of a real device
that uses them!).  And there's no difference in format between one of
these and a 32 bit "memory" BAR anyway, someone who actually had this
requirement could just use the existing API without worry.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-07-08 12:34:09 +02:00
Andy Ross 83464f11e1 sys/sys_io.h: Memory mapped I/O APIs must be pointer-sized, not 32 bit!
The mm_reg_t type used to represent a MMIO address (e.g. in the
sys_write*() APIs) was defined to a uint32_t, which is obviously wrong
on 64 bit systems where devices can be mapped anywhere.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-07-08 12:34:09 +02:00
Peter Bigot e37c785356 kernel: fix timer initializer field order
Recent changes to struct _timeout changed the declaration order to
avoid alignment padding.  While this has no effect to C99 code C++
requires that designated initializes appear in declaration order.
Update the initializer macro so it can be used in C++ code.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-07 19:27:32 -04:00
Simon Glass 740b99c937 tests: shell: shell_flash: Add a test for 'flash read'
Add a simple test for this command to check that the output is as
expected.

This requires a larger output buffer in shell_dummy, so update that
too.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-07 17:19:26 -04:00
Simon Glass 84e9c7c63d shell: Export shell_hexdump_line()
This function is useful for other code. Export it along with the
default line length in bytes.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-07 17:19:26 -04:00
Marcin Niestroj e2e2a2bd94 net: http_client: add missing kernel.h include statement
There is following error when compiling applications using http_client:

  /zephyr/include/net/http_client.h:157:24: error: field 'work' has \
  incomplete type
    157 |  struct k_delayed_work work;
        |                        ^~~~
  /zephyr/include/net/http_client.h:177:2: error: unknown type name \
  'k_timeout_t'
    177 |  k_timeout_t timeout;
        |  ^~~~~~~~~~~

Fix that by adding missing kernel.h include statement in http_client.h.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-07 16:00:42 -04:00
Marcin Niestroj 03c774e58c net: l2: ppp: drop ppp_context's is_network_up
There is already a variable 'network_protos_up', which stores number of
network protocols being up. Additionally each network protocol has its
own state represented by is_ip{,v6}cp_up. Use the latter in FSM up() and
down() callbacks.

This fixes a case when both IPCP and IPv6CP protocols are going
down. When using ctx->is_network_up only one of them (the first) was
deinitialized correctly, second stayed always up (at least partially,
e.g. not calling ppp_network_down()).

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-06 17:55:44 -04:00
Joakim Andersson 4be66bd33d Bluetooth: Fix host RX thread deadlock
Fix host RX thread being deadlocked. The deadlock occurs because the
RX thread is stuck waiting in conn_tx_alloc with K_FOREVER but if the
connection is disconnected only the RX thread can unblock it in the
handling of the disconnect event.

This commit fixes this deadlock by splitting the processing of the
disconnected event into two parts.
The part needed to unblock the RX is to release resources held by
unack'ed TX packets and mark the connection state as not connected
anymore.
The RX thread waiting for free_tx fifo and the TX thread waiting for
the bt_dev.le.pkts semaphore will both check the connected state after
having acquired them and will abort if disconnected.
The rest of the processing will be handled at normal RX thread
priority like normal.

Move the bt_recv_prio handling to the Bluetooth host when the host
has defined its own RX thread (CONFIG_BT_RECV_IS_RX_THREAD=n).
If the HCI driver has the RX thread (CONFIG_BT_RECV_IS_RX_THREAD=y),
then the responsibility to call bt_recv and bt_recv_prio correctly
falls to the HCI driver.
The helper function bt_hci_evt_is_prio() is replaced with
bt_hci_evt_get_flags() so that the HCI driver can do this correctly.
This decision to replace was made so that existing HCI drivers
maintained out-of-tree will fail at compile time with the new system.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>

Bluetooth: host: Move bt_recv_prio to host when RX thread is defined

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-06 11:15:39 +02:00
Xavier Chapron a94c8bb02b net: buf.h: Add static initialiser to net_buf_struct
This is necessary to avoid collision between drivers that calls
NET_BUF_POOL_DEFINE with the same name.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-07-04 07:08:33 -04:00
Kamil Piszczek ffa31bb99c bluetooth: uuid: add bond management uuids
Added UUIDs definitions that are used in the Bond Management Service.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2020-07-02 08:50:50 -04:00
Lukasz Maciejonczyk ddb9f290e1 net: l2: openthread: Implement enable API function
It fixes #issues/26220.

openthread_start function is called when L2 enable(iface, true) is
called. openthread_stop is called when L2 enable(iface, false) is
called. openthread_stop makes the device to leave the OpenThread
network.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2020-07-02 08:43:45 -04:00