Commit graph

47616 commits

Author SHA1 Message Date
Jian Kang bf55de2d67 kernel: timer: Add some testcases to testing timer and clock
Add some error condition or testing cases to verify whether the
robustness of API. Such as give a NULL to some API and check
the response if get result that we were expacted.

Signed-off-by: Jian Kang <jianx.kang@intel.com>
2021-01-19 09:06:28 -05:00
Henrik Brix Andersen 1491fb9de1 drivers: pwm: remove dw and pca9685 drivers
Remove DW and PCA9685 PWM controller drivers as they are unmaintained
and broken.

Both drivers lack support for the pwm_get_cycles_per_sec_t API function
which was introduced in commit 56e0b53c6e
in 2016.

Fixes #18607, #18608

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-01-19 09:04:52 -05:00
Jordan Yates 875f6a5302 lorawan: fix premature return in lorawan_send
Fixes an issue where `lorawan_send` would return prematurely when
`LORAWAN_MSG_CONFIRMED` is mixed with unconfirmed messages.

All calls to `LoRaMacMcpsRequest` result in `McpsConfirm` being run,
where the semaphore `mcps_confirm_sem` is given. However this semaphore
is only taken when `LORAWAN_MSG_CONFIRMED` is set.

Therefore if an unconfirmed message is sent, any following confirmed
messages will return from `lorawan_send` immediately as the semaphore
will be available from the previous send. The return value would also
be wrong for the same reasons.

Fixed by only giving the semaphore in situations when it is being
blocked on.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-01-19 09:02:43 -05:00
Anas Nashif f862972f35 doc: add documentation for condition variables
Add documentation for condition variables in the synchronization section
of the kernel.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-01-19 08:55:47 -05:00
Anas Nashif 989ebf6c35 kernel: add vrfy hooks to support userspace with condvar
Add needed vrfy hooks for userspace support.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-01-19 08:55:47 -05:00
Anas Nashif 930789dbe7 samples: kernel: add condition variable samples
Add a few samples for using condition variables..

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-01-19 08:55:47 -05:00
Anas Nashif 6d53606777 tests: kernel: add test for condition variables
add a test for condition variables.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-01-19 08:55:47 -05:00
Anas Nashif 06eb489c45 kernel: add condition variables
Introduce condition variables similar to how they are done in POSIX with
a mutex.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-01-19 08:55:47 -05:00
Henrik Brix Andersen 69258775ec drivers: pwm: clean up the PWM capture API documentation
Clean up the PWM capture API documentation a bit:
- Turn simple comments on PWM_CAPTURE_MODE_* into documentation comments
- Callback signature is always available, but note that PWM capture
  support is optional
- Remove double @a
- Document return codes from pwm_pin_{enable,disable}_capture()
- Change wording to reflect that pwm_pin_capture_*() returns a single
  result

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-01-19 08:09:16 -05:00
Andrzej Głąbek 02819489a2 scripts: module: Add missing uses of the module name field
This is a follow-up to commit f24f88324c.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-01-19 10:17:56 +01:00
Alexander Wachter f0145f9f3e doc: CAN: Fix code in CAN API documentation
Fix code sections in the doc.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-01-18 23:26:30 -05:00
Alexander Wachter c8cbf0177a doc: can_api: Update the CAN documentation after API update
This commit is the documentation update after the API rework.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-01-18 23:26:30 -05:00
Robert Lubos c563736bd3 net: coap: Randomize initial ACK timeout
Add Kconfig option to randomize the initial ACK timeout, as specified in
RFC 7252. The option is enabled by default.

Additionally, finetune the default value of COAP_INIT_ACK_TIMEOUT_MS
option, to match the default ACK_TIMEOUT value specified by the RFC
7252. The RFC does not specify the minimum/maximum value of the
ACK_TIMEOUT parameter, but only suggests it should be no lower than 1
second, so adjust the option range to reflect this.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-01-18 23:22:37 -05:00
Robert Lubos 538e19ee2e net: coap: Rework pending retransmission logic
Introduce retransmission counter to the coap_pending structure. This
allows to simplify the retransmission logic and allows to keep track of
the number of remaining retranmissions.

Additionally, extend the `coap_pending_init()` function with `retries`
parameter, which allows to set the retransmission count individually for
each confirmable transaction.

Fixes #28117

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-01-18 23:22:37 -05:00
Ying ming 812914ff5d test: kheap: add testcase
Add testcase when use kheap api in isr context.

Signed-off-by: Ying ming <mingx.ying@intel.com>
2021-01-18 23:19:33 -05:00
Ningx Zhao 66c55d9b75 kernel: queue: develop the code coverage
Add some testcases to test some failure scenario
to enhance the coverage of queue's source code.
And add the fatal error function to handler the
fatal error by ourself.

Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
2021-01-18 23:14:12 -05:00
Ningx Zhao 36d83a5156 tests: ringbuffer: code coverage improvements
Add double macros to remove the __week function
when calculating coverage.

Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
2021-01-18 23:12:47 -05:00
Jian Kang 1a369f5cdd kernel: semaphore: Add some error case testing for semaphore
Add some error case tesing such as invoke k_sem_take with duration
timeout or set input to NULL. This is check if API robust in error
condition handing.

Signed-off-by: Jian Kang <jianx.kang@intel.com>
2021-01-18 22:10:09 -05:00
Ying ming c77ae15c99 test: scheduling: add configuration item
When using Red/black tree ready queue as scheduling algorithm,
there are no limit to the number of priority levels. So set the
CONFIG_NUM_COOP_PRIORITIES to 30, testcase test_bad_prooritiesi()
will prove both cooperative and preemptive thread have no quantitative
limit.

Signed-off-by: Ying ming <mingx.ying@intel.com>
2021-01-18 17:22:34 -05:00
Kumar Gala 49b1f31aed ci: update docker image to v0.11.12
Update to docker image v0.11.12 to get SDK 0.12.1

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-01-18 17:09:22 -05:00
Antonio Tessarolo f4acdc2729 NXP: Enable I2C for imx6sx
This commit add support for i2c on imx6sx.
I2C support is based on imx7d and requires NXP HAL.
The Device Tree binding is also changed to better reflect that i2c
driver support both imx6sx and imx7d.

Signed-off-by: Antonio Tessarolo <anthonytexdev@gmail.com>
2021-01-18 17:01:34 -05:00
Alexey Tsvetkov e87eb373bc bluetooth: update comment to LE Advertising Parameters struct
Update description to maximum and minimum values of interval_min and
interval_max fields of bt_le_adv_param struct according to
Bluetooth Core Specification 5.2

Signed-off-by: Alexey Tsvetkov <xeenych@gmail.com>
2021-01-18 17:00:03 -05:00
Dominik Ermel b493acedea scripts/requirements: Add required version to imgtool in extras
The minimal version of imgtool has been set at 1.7.1

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-01-18 16:59:29 -05:00
Dominik Ermel 6c60414059 mgmt: mcumgr: Add support for enabling Direct-XIP app address check
The commit adds Kconfig option:
  CONFIG_IMG_MGMT_REJECT_DIRECT_XIP_MISMATCHED_SLOT
that enables verification of base address Direct-XIP binary, upon
upload, and rejects binaries that would not be able to start from
available address.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-01-18 16:59:29 -05:00
Dominik Ermel 561af04aad west.yml: Update mcumgr revision
The update includes support for the
  CONFIG_IMG_MGMT_REJECT_DIRECT_XIP_MISMATCHED_SLOT
Kconfig options that enables mcumgr to check uploaded image for correct
base addres of Direct-XIP application, and rejecting upload if
the upload would not be able to boot from offered slot.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-01-18 16:59:29 -05:00
Raveendra Padasalagi 21767248e2 dts: arm: Add devicetree node for iProc PAXDMA
Add device tree node for iProc PAXDMA device.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-01-18 16:58:55 -05:00
Raveendra Padasalagi 228a3cffd6 drivers: dma: Add iProc PAXDMA driver
Add PAX[PCIE<->AXI] DMA driver which supports DMA
transfers between host and target memory over PCIe link.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-01-18 16:58:55 -05:00
Raveendra Padasalagi e10ce51d92 dts: bindings: Add documentation for PAXDMA driver
Add documentation for PAXDMA driver

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-01-18 16:58:55 -05:00
Peter Bigot 855b39ecbd samples: drivers: jesd216: add support for Nordic QSPI driver
Remove the overlay and set up to enable the QSPI variant.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot 28447c84c3 drivers: flash: nrf_qspi: support JESD216 API
Refactor slightly so we can read SFDP tables with this driver.  Note
that the SFDP read command requires long frame mode transfers as data
exceeds 8 bytes.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot 2d375e23ea drivers: flash: nrf_qspi: cleanup JEDEC ID length
QSPI doesn't have a different length expectation than normal SPI, so
introducing a new name for an existing name is unnecessary.  Also
replace the constant with the actual buffer size where appropriate, in
somebody changes the the buffer definition.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot 3e46ae1acb drivers: flash: nrf_qspi: rework handling of quad-enable bit
Kconfig allowed selecting any bit in the status register as the QE
bit, and defaulted it to 6.  Devices need not require a QE bit at all,
and where JESD216 defines QE bit location the only place in first SR
byte that it can be is bit 6.  Further, the code unconditionally wrote
the value 0x40 without respecting configuration of other bits.  Some
of those bits control write protection of block-protected areas and
should not be changed.

Remove the Kconfig, instead using the jedec,jesd216-controlled
devicetree property.  Allow the driver to recognize whether or not
setting the bit is required, and when it is only use bit 6.  Only
update if the setting does not match the configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot 2bf39aead6 drivers: flash: nrf_qspi: shorten internal function names
These are so long they can mandate line length mitigation.  Avoid that.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot 2bfe69d020 drivers: flash: nrf_qspi: detect unsupported cinstr commands
The interface used to send commands supports only a command followed
by 8 bytes of data transfer.  Reject attempts to do more, as the
result will be a successful transfer of only the first 8 bytes.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot 60885270d1 drivers: flash: nrf_qspi: make cinstr wrapper more flexible
Not all special commands require that a write-enable be issued first.
Allow the caller to decide.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot 5fd3246a62 drivers: flash: jesd216: add support for DW16 decoding
DW16 provides information on mechanisms to enter and exit 4-Byte
address modes, returning the device to reset state, and how to
manipulate the values in the first status register.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot 52545411d2 drivers: flash: jesd216: add support for DW15 decoding
DW15 provides information on entry and exit from QSPI modes.  In
particular, it specifies whether and how the status register must be
updated for this feature.

Add a JESD216 devicetree property for the Quad Enable Requirements
value.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot 3911380c54 samples: jesd216: fix bound on BFP DW parsing
DW indexes start from 1, so the proper upper bound includes the value
of len_dw.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Xinrong Han a1450d31a7 samples: sensor: mcp9808: add error checks in trigger_handler()
Validate that sensor_sample_fetch() and sensor_channel_get() are on
success.

Fixes #29945

Signed-off-by: Xinrong Han <hanxr19@mails.tsinghua.edu.cn>
2021-01-18 16:56:57 -05:00
Marc Herbert 38eed65b2a scripts: move pip pykwalify from requirements-build-test to -base
... because zephyr_module needs it.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-01-18 16:56:24 -05:00
Torsten Rasmussen 2a9d803a98 doc: documenting the depends feature in Zephyr modules
Fixes: #29549

This commit documents the Zephyr module `depends` feature.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-01-18 21:53:20 +01:00
Torsten Rasmussen 3b57841497 doc: Zephyr modules naming
Adding documentation regarding how Zephyr modules are named.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-01-18 21:53:20 +01:00
Torsten Rasmussen f24f88324c scripts: module: support for name field in zephyr/module.yml
The folder name of a Zephyr module is also used as its module name
when integrating it into the build system.

This means that a Zephyr module, BAR, located in:
<workspace>/modules/foo
                    |--- zephyr
                          |--- CMakeLists.txt
                          |--- Kconfig

will be referred to as FOO in the build system, that is:
ZEPHYR_FOO_MODULE_DIR==<workspace>/modules/foo
ZEPHYR_FOO_CMAKE_DIR==<workspace>/modules/foo/zephyr

The `name` field allows the module to specify its module name,
independent of its location like:

<workspace>/modules/foo/zephyr/module.yml
```
name: bar
build:
  cmake: zephyr
```

will instead be referred to as BAR in the build system, that is:
ZEPHYR_BAR_MODULE_DIR==<workspace>/modules/foo
ZEPHYR_BAR_CMAKE_DIR==<workspace>/modules/foo/zephyr

This allows for greater flexibility of relocating Zephyr modules in
other folders and at the same time be guaranteed that other modules
depending on `ZEPHYR_BAR_MODULE_DIR` is still working.

If `name` field is not specified in `module.yml`, then the existing
behavior of using the folder name will be used.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-01-18 21:53:20 +01:00
Johan Hedberg 0970e42334 boards: x86: ehl_crb: Add board variant for Slim Bootloader
When using Slim Bootloader the UART configuration isn't quite the same
as with the UEFI BIOS. In particular, UART2 is hidden in PCIe and is
instead accessible using a fixed MMIO address. Interrupts are also not
supported for this UART currently.

The simplest way to create builds against this special BIOS/bootloader
setup seems to be to create a new board variant/definition which lets
us provide a custom device tree overlay as well a dedicated Kconfig
default configuration.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-01-18 15:45:58 -05:00
Johan Hedberg 415271651c boards: x86: ehl_crb: Remove unnecessary Bluetooth references
The bt-uart, uart-pipe and bt-mon-uart DT chosen values are all
Bluetooth specific. Since Bluetooth isn't supported on the ehl_crb
board currently just remove these.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-01-18 15:45:58 -05:00
Johan Hedberg dd7ce03897 soc: x86: elkhart_lake: Add early serial support for fixed MMIO
Add support for fixed MMIO (non-PCIe) UART devices for the early
serial. All we need to do is to detect if the device is on PCIe and
set the right register address define based on that.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-01-18 15:45:58 -05:00
Johan Hedberg 7173f1b977 soc: x86: elkhart_lake: Update UART definitions
Add definitions for UART1/2 when they're accessible through fixed MMIO
addresses (instead of PCIe), and mark all UARTs not normally available
with the UEFI BIOS as "disabled".

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-01-18 15:45:58 -05:00
Johan Hedberg 4fa0a9b4b2 drivers: serial: ns16550: Remove hard-coded max instance count
Instead of having a hard-coded maximum instance count, introduce a
Kconfig variable for it. The inclusion of the per-instance header
files is solved by having them chain-include each other with a
pre-processor condition that checks if the current header file is the
last one or not.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-01-18 15:45:58 -05:00
Johan Hedberg 048dcea54b drivers: serial: ns16550: Remove reg-shift instance count assumption
The reg-shift support was quite broken in that the code only looked
for this property on instance 0. Now we support the property on any
node which might declare it.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-01-18 15:45:58 -05:00
Johan Hedberg 0cb118968d drivers: serial: ns16550: Remove DLF & PCP instance count assumptions
Take advantage of DT_INST_FOREACH_STATUS_OKAY() to look for DLF and
PCP properties on any matching nodes with "okay" status.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-01-18 15:45:58 -05:00