Commit Graph

43838 Commits

Author SHA1 Message Date
Joakim Andersson 7ab35145fb Bluetooth: host: Add hardware error event handling
Add handling of the HCI_Hardware_Error event to log the hardware code.
This event was unmasked in set_event_mask.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-09-04 14:46:54 +02:00
Peter Bigot 1d026703c4 samples: posix: gettimeofday: incorporate libc time API tests
Use time(), localtime_r(), and asctime() to confirm that the
declarations required for these (newlib) libc functions are made
available in CONFIG_POSIX context.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-04 14:46:43 +02:00
Peter Bigot 3cb353c09f include/posix: incorporate toolchain-provided time.h header
Some of what's supposed to be in <time.h> was lost because this header
attempts to define everything using more primitive include files.
Instead incorporate the contents from the toolchain-provided header.
Any gaps should be picked up by the legacy content present in this
file, which should not conflict with the toolchain header.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-04 14:46:43 +02:00
Jordan Yates 4f54b4176d bluetooth: controller: add name to TX power choice
Add a name to the Kconfig choice that selects the controller TX power.
This allows board `*.defconfig` files to change the default TX power
as their certifications warrant. For example:

```
choice BT_CTLR_TX_PWR
	default BT_CTLR_TX_PWR_PLUS_4
endchoice
```

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-09-04 14:46:05 +02:00
Peter Bigot 13576962b8 doc: guides: dts: document inferred bindings for /zephyr,user
Identify the special case of /zephyr,user as a node for which property
values are generated without having to define a binding.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-04 07:41:19 -05:00
Peter Bigot 932532eb0f gen_defines: infer bindings for /zephyr,user
Tell the EDT instance that properties of the /zephyr,user node should
be generated based on the binding types inferred from the property
content.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-04 07:41:19 -05:00
Peter Bigot 32e6159f01 edtlib: support inferring binding from node content
Clean up of devicetree tooling removed generation of information
present in devicetree in nodes that have no compatible, or for extra
properties not defined by a binding.  Discussion proposed that these
properties should be allowed, but only in a defined node /zephyr,user.
For that node infer bindings based on the presence of properties.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-04 07:41:19 -05:00
Jordan Yates 1723e479ab Bluetooth: controller: preserve TX power
Preserve the TX power set with the `BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL`
command for advertising and scanning procedures. As the TX power is no
longer overwritten on procedure start, the TX powers can now be set
before starting the procedure. This eliminates the chance for the first
transmissions to use the default TX power instead of the request TX
power.

Similar changes are not made to the connection advertising powers as
changing the TX power for a connection to device A should not change
the TX power for a future connection to device B using the same
`struct lll_adv` instance.

Fixes #27921.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-09-04 14:37:57 +02:00
Andrzej Kaczmarek 48646e51d0 tests: Bluetooth: bsim_advx_test: Add some tests for scan response
This adds few tests for handling scan response in ext commands:
- trying to set scan response on non-scannable instance should fail
- it should be possible to create scannable instance, set scan data,
  enable and then disable set

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-09-04 14:30:21 +02:00
Andrzej Kaczmarek d8864d44f4 Bluetooth: controller: Add ADI support in AUX_SCAN_RSP
ADI field is optional in AUX_SCAN_RSP so by default it's disabled, but
now we'll have an option to include it.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-09-04 14:30:21 +02:00
Andrzej Kaczmarek 1b1ab16a64 Bluetooth: controller: Return current ADI when updating aux
When aux is upated, DID is changed and unlike SID it's only stored in
aux PDU. To allow quick access to new DID value, let's just optionally
return current ADI value after aux was updated. It will be useful e.g.
when updating scan response data if we want to put ADI there.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-09-04 14:30:21 +02:00
Andrzej Kaczmarek 09115429a1 Bluetooth: controller: Add non-connectable scannable
This enables processing of AUX_SCAN_REQ and sending back AUX_SCAN_RSP
on non-connectabe scannable advertising instances. Similar path will
be used for AUX_CONNECT_REQ so there are few references for connectable
as well, but this is not supported as for now.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-09-04 14:30:21 +02:00
Andrzej Kaczmarek b47df3cc21 Bluetooth: controller: Add scan response data setting restrictions
This adds restrictions for setting scan response data as specified by
Core spec:
* on legacy, only complete data can be set
* on legacy, data cannot be longer than 31 octets
* on ext, if non-scannable, data can only be discarded
* if ext enabled, only complete data can be set
* if ext enabled, data cannot be discarded

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-09-04 14:30:21 +02:00
Andrzej Kaczmarek 60b8df94e1 Bluetooth: controller: Add support to set scan response data on ext
This allows to set scan response data using ext adv commands.

New AUX_SCAN_RSP can be created without analyzing previous PDU since
the only value that need to be copied from previous PDU is AdvA which
is placed at fixed location. TxPower is omitted since, if enabled, it
is already present in AUX_ADV_IND and does not need to be presed in
other PDUs. ADI support is to be added later.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-09-04 14:30:21 +02:00
Andrzej Kaczmarek e49ef46677 Bluetooth: controller: Add AdvA to connectable and scannable aux
AdvA in aux is mandatory for any connectable and scannable set so make
sure it's always added.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-09-04 14:30:21 +02:00
Andrzej Kaczmarek c34bd1c2c4 Bluetooth: controller: Add aux for connectable and scannable
Connectable and scannable instances always have aux so we need to force
AuxPtr to be included in primary PDU and have aux allocated even if no
data are set.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-09-04 14:30:21 +02:00
Andrzej Kaczmarek bef663d5c0 Bluetooth: controller: Require aux for connectable or scannable
Connectable and scannable instances always have AuxPtr so we can return
error immediately if controller is configured with no aux.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-09-04 14:30:21 +02:00
Andrzej Kaczmarek 0274a6b26b Bluetooth: controller: Disallow setting AD on scannable instance
Scannable instance can only have scan response data set.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-09-04 14:30:21 +02:00
Morten Priess 8682e47eb0 Bluetooth: controller: Prevent incorrect lazy_current increment
Prevent redundant collision resolves and potential incorrect and harmful
increment of lazy_current.

During collision scenarios with high CPU load, the ticker_worker may be
called a second time before the ticker_job gets to run. This will cause
ticker operations on the previosly expired node (expected), and in some
cases increment lazy_current, even though the node was not sceduled to
execute via the req/ack mechanism.

By moving the request check before collision resolve, CPU time is saved,
and lazy_current will not incorrectly be incremented if node is in
collision.

The problem may be seen as a connection suddenly not receiving packets,
or MIC error on master, because the event counter goes out of sync.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2020-09-04 14:14:23 +02:00
Rubin Gerritsen 69867a48db bluetooth: controller: BT_CTLR_CONN_RSSI as a shared controller opt
Use a helper config BT_CTLR_CONN_RSSI_SUPPORT so that it is only
enabled when supported by the controller.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-09-04 14:03:20 +02:00
Ningx Zhao 505ea3ee20 tests: updata the rbtree testcase
add a new testcase to:
Verify some operations of rbree are running in
logarithmic time.
Verify an user defined structure contains rbtree node works.
verify "for each"style APIs work.

Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
2020-09-04 08:00:05 -04:00
Pavel Král 06342e3474 arch: arm: mpu: Removal of include path pollution
Removes unnecessary and incorrect directories from include path.

Signed-off-by: Pavel Král <pavel.kral@omsquare.com>
2020-09-04 13:58:38 +02:00
Andrei Emeltchenko 1971b14ca7 drivers: ipm-console: Remove unused config option
Remove now unused configuration option.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-09-04 07:55:52 -04:00
Andrei Emeltchenko 9f7a90332b sanitycheck: Allow to pass command with argument to ser_pty
By default, subprocess.Popen commands are supplied as a list of strings.
Using split() allows to use command with arguments, for example it is
possible to use following:

sanitycheck ... \
--device-serial-pty="set_ambient read_terminal.py" \
...

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-09-04 07:55:52 -04:00
Andrei Emeltchenko 3dfcfcd3c9 boards: up_squared_adsp: Add IPM console to device tree
Add IPM console to the board.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-09-04 07:55:52 -04:00
Andrei Emeltchenko 2c7aa82509 dts: Add binding for IPM console
Add IPM console DTS binding.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-09-04 07:55:52 -04:00
Andrei Emeltchenko 3b1775d0cc drivers: console: Add DTS defaults
Add default which takes the target device from DTS similar way to UART
console.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-09-04 07:55:52 -04:00
Andrei Emeltchenko 92a699155c soc: intel_apl_adsp: Tweak adsp initialization
Tweak ADSP initialization to catch early console output.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-09-04 07:55:52 -04:00
Andrei Emeltchenko a852416cc2 soc: intel_apl_adsp: Add defaults for IPM and IPM console
Add defaults for IPM and IPM_CONSOLE when IPM and CONSOLE are
enabled.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-09-04 07:55:52 -04:00
Andrei Emeltchenko 23a4040f77 boards: up_squared_adsp: Add IPM terminal tool
Add tool which can access ADSP console over IPM using Python device
library and polling Doorbell registers.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-09-04 07:55:52 -04:00
Andrei Emeltchenko 0b699e931a CODEOWNERS: Add ipm_console codeowner.
Add @finikorg as codeowner for ipm_console.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-09-04 07:55:52 -04:00
Andrei Emeltchenko 8d69832bfd console: ipm_console: Add console over IPM
Add console over Inter Processor Mailboxes (IPM).
This is useful for AMP processors like ADSP found on up_squared board.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-09-04 07:55:52 -04:00
Øyvind Rønningstad 77e75eab72 soc: arm: Kconfig: Add more nrf flash protection block sizes
Add
- NRF_MPU_FLASH_REGION_SIZE
- NRF_BPROT_FLASH_REGION_SIZE
- NRF_ACL_FLASH_REGION_SIZE

NRF_SPU_FLASH_REGION_SIZE is already available.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2020-09-04 13:38:38 +02:00
Andreas Sandberg 78cc7df60c drivers: lora: sx126x: Support software-managed RF switches
The SX126x supports using DIO2 to control an TX switch, but only if
the switch can be operated using a single control signal. Add support
for RF switches that are wired to a GPIO instead of the radio chip
itself. This makes it possible to use RF switches that require two
control signals (one for the RX port and one for the TX port) by
wiring them to two GPIOs on the MCU.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-09-04 12:36:53 +02:00
Emil Obalski 0d8bd579a5 usb: hid: All hid_ops callbacks get device pointer.
This commit extends USB hid API callbacks by adding
'const struct device *dev' parameter. If the application
configured more than one HID device then it must specify
separate hid_ops for each device as its unable to determine
for which device the callback was called.

This patch makes it possible to have only one hid_ops within
the application and the application is aware for which device
the callback was called because of explicit device pointer.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-09-04 12:27:44 +02:00
Erwin Rol 113b016b51 drivers: dma: stm32: change order of disabling and checking result
The stm32_dma_disable_stream first checked if the stream was
disabled and if so returned OK. If it wasn't disabled it
tried to disable it and returned -EAGAIN.

The function is used in loops that try to disable the stream
by calling this function and if it fails wait for 1ms and
retry.

Becuase this function the first time (if the stream wasn't
disabled already) fails there is always a 1 ms delay. For
the SPI driver, that has a RX and TX stream, this means
a 2ms delay between the last data and CS going high.

By first trying to disable the stream and than checking
if it succeded most of the time the first call disables
the stream and the 1ms delay isn't needed.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-04 12:00:37 +02:00
Erwin Rol 65434f58dd drivers: spi_ll_stm32: refactor DMA support
- Fix GPIO CS timing when using DMA. When using GPIO CS the
  CS select was enabled after the DMA started the transfer,
  resulting in the first few bits being transfered while
  CS was still disabled.

- Fix TX or RX only DMA transfers. When only a RX or only
  a TX transfer was requested the DMA never finished.

  For the RX only cause the size on the transfer was
  calculated by taking the TX buffer length (0), this
  caused problems.

  For the TX only transfer the RX buffer was set to NULL,
  this caused the DMA to acctually writing data to the
  adress 0x00000000. By using the dummy destination buffer
  it now only writes to valid memory.

- Add semaphore to signal that DMA is ready, instead of
  just busy waiting.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-04 12:00:37 +02:00
Henrik Brix Andersen 7e39e1d747 cmake: mcuboot: confirmed images needs to be padded
Add --pad to imgtool.py command line arguments when generating confirmed
images, otherwise the image contains no trailer magic for writing the
confirmed status.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-09-04 12:00:04 +02:00
Vinayak Kariappa Chettimada 42d59c95f2 Bluetooth: controller: Fix periodic advertising cond. compile
Fix missing conditional compilation around the periodic
advertising feature implementation.

Fixes #28017.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-04 11:59:23 +02:00
Emil Obalski 6a57928fd7 usb: Fix std iface/ep requests
This commits introduces check for standard interface and endpoint
requests. Not all requests shall be accepted. In particular those
which addresses not existing interfaces/endpoints should be STALLed.
This patch STALLes incorrect requests.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-09-04 11:59:06 +02:00
Ningx Zhao 9ef5a809dd tests: verify the time complexity of dlist
Add two test cases to verify the operations of accessing
head,tail,insert and remove in constant time by proving the time
complexity of the operations are O(1).

Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
2020-09-04 11:58:52 +02:00
Øyvind Rønningstad c00f33dcb0 arch: arm: cortex_m: Add tz_ns.h
Provide a TZ_SAFE_ENTRY_FUNC() macro for wrapping non-secure entry
functions in calls to k_sched_lock()/k_sched_unlock()

Provide a __TZ_WRAP_FUNC() macro which helps in creating a function
that "wraps" another in a preface and postface function call.

	int foo(char *arg); // Implemented somewhere else.
	int __attribute__((naked)) foo_wrapped(char *arg)
	{
		WRAP_FUNC(bar, foo, baz);
	}

is equivalent to

	int foo(char *arg); // Implemented somewhere else.
	int foo_wrapped(char *arg)
	{
		bar();
		int res = foo(arg);
		baz();
		return res;
	}

This commit also adds tests for __TZ_WRAP_FUNC().

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2020-09-04 11:58:41 +02:00
Marin Jurjevic d3f21af047 samples: drivers: Update sample overlay with sector size values
Updated overlay file for spi_flash_at45 sample on nrf9160 devkit.

Signed-off-by: Marin Jurjevic <marin.jurjevic@hotmail.com>
2020-09-04 11:58:22 +02:00
Marin Jurjevic d73e438ee4 drivers: spi_flash_at45: Replace hardcoded sector size
Replace hardcoded sector size value in sample with sector-size
property added in dts binding file

Signed-off-by: Marin Jurjevic <marin.jurjevic@hotmail.com>
2020-09-04 11:58:22 +02:00
Marin Jurjevic 5b7c008781 drivers: flash: Add sector-size property to at45.yaml
Add sector-size property to at45.yaml binding.
Different at45 flash memories have different sector sizes.

Signed-off-by: Marin Jurjevic <marin.jurjevic@hotmail.com>
2020-09-04 11:58:22 +02:00
Watson Zeng c1eff6510c board: hsdk: add 2 cores configuration for test
add 2 cores configuration for
* who want to use 2 cores
* sanitycheck tests, as we found there are
  difference between 2 cores and 4 cores, see
  report in issue #26794

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2020-09-04 11:58:04 +02:00
Wayne Ren 50d385f0ed boards: hsdk: let mdb runner connect cores according to configuration
let mdd runner connect connect cores according to CONFIG_MP_NUM_CPUS,
e.g.
   * CONFIG_MP_NUM_CPUS = 2, just connect 2 cores
   * CONFIG_MP_NUM_CPUS = 1, just connect 1 core
   * CONFIG_MP_NUM_CPUS = 4, connect all 4 cores

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-09-04 11:58:04 +02:00
Kumar Gala 94353845f5 drivers: flash: stm32wb: Fix build error
When building flash shell sample we get:

flash_stm32wbx.c:23:10: fatal error: shci.h: No such file or directory
   23 | #include "shci.h"

Fix this by adding ifdef protection around inclusion of shci.h.

Fixes #28036

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-09-04 11:53:02 +02:00
YanBiao Hao e877ee6088 Bluetooth: Mesh: Adds three Config Client API.
Those APIs are used for deleting appkey, unbinding an application
from SIG model, unbinding an application from vendor model on the
target node, with matching shell command.

Signed-off-by: YanBiao Hao <haoyanbiao@126.com>
2020-09-04 11:47:52 +02:00
Marin Jurjevic 1753fac49a net: lwm2m: Fix FOTA Pull firmware transfer when Package URI is empty
Fix for a problem in current lwm2m firmware object implementation.
Transfer should not begin when an empty string is received.

Signed-off-by: Marin Jurjevic <marin.jurjevic@hotmail.com>
2020-09-04 12:18:58 +03:00