Commit graph

427 commits

Author SHA1 Message Date
Johann Fischer
13766dd417 samples: cdc_acm: enable optional new USB device support
Add code and configuration to enable new USB device support.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-02 12:55:18 +01:00
Johann Fischer
f5ef4c4288 samples: usb: add shell sample for new USB support
The sample enables new experimental USB device support
and the shell function.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-02 12:55:18 +01:00
Anas Nashif
ba7d730e9b tests/samples: use integration_plaforms in more tests/samples
integration_platforms help us control what get built/executed in CI and
for each PR submitted. They do not filter out platforms, instead they
just minimize the amount of builds/testing for a particular
tests/sample.
Tests still run on all supported platforms when not in integration mode.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-29 16:03:23 +01:00
Johann Fischer
1c4011ff6e usb: remove usb_pid.Kconfig file
Remove Kconfig file samples/subsys/usb/usb_pid.Kconfig added in
the commit e5cbe6a9e7 ("usb: cdc: Add unique PIDs for each sample")
with the motivation to have a separate ID for each sample supposedly
to be recognizable by the host.

The new USB support does not use the options, VID/PID is set
directly in the application. As a note, it is not necessary to have
unique PID for each sample, especially for the well known USB classes.

Replace the individual Kconfig options in the documentation
by a table with the references to the samples and PIDs.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-11-22 11:09:21 +01:00
Gerson Fernando Budke
92ca06577f samples: usb: mass: Add support to TFM NS boards
This add TFM cmake definitions to build mass storage sample for non
secure firmware boards versions. The stm32l562e_dk_ns board was used
to demonstrate. It uses SDMMC/SD with TFM profile large. Tests were
conducted using a 2GB transflash card with FAT-32 partition.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2022-11-10 11:26:11 +00:00
Gerson Fernando Budke
151e145b44 boards: arm: stm32l562e_dk: Enable usb tags for tests
This enables usb and usb_device tag for tests. It explicitly disable
samples/subsys/usb/dfu for non-secure version of this board due to
building errors, which can be explored in future.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2022-11-10 11:26:11 +00:00
Maciej Perkowski
15afd31862 tests: usb: Make tests for usb mass sample more robust
It was found that the existing regex check was not enough to validate
correctness of execution of mass samples. Tests would pass even when
a filesystem failed to be mounted. An additional line to check is added
to validate the setup of a filesystem.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2022-11-08 10:45:08 +01:00
Johann Fischer
b26fca430c drivers: flashdisk: remove all DISK_FLASH* Kconfig options
Remove all obsolete DISK_FLASH* Kconfig options.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-10-28 12:45:58 +02:00
Tomasz Moń
51c46e98c7 samples: usb: mass: add disk description to overlays
Add flash disk description to overlays. Specify custom flashdisk
partition for fat fs api test to match the Kconfig values, because
native posix storage partition is too small for FatFS filesystem.

Co-authored-by: Johann Fischer <johann.fischer@nordicsemi.no>
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-10-28 12:45:58 +02:00
Fabio Baltieri
b1715156dd samples: usb: dfu: exclude lpcxpresso55s69_cpu0
Exclude lpcxpresso55s69_cpu0 from the USB DFU tests, this triggers a
build assert due to unsupported flash write block size (512 bytes,
mcuboot supports 8 to 32).

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-09-23 11:31:52 +00:00
Dominik Ermel
80e34e2a24 samples: usb: mass: Switch to FIXED_PARTITION_ macros
The commit switches flash area access from FLASH_AREA_ macros
to FIXED_PARTITION_ macros and to usage of DTS node labels,
to identify partitions, instead of label property.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-09-06 09:56:37 +02:00
Gerard Marull-Paretas
79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Mahesh Mahadevan
e1818f16fa samples: usb: Exclude frdm_kl25z from USB DFU test
Flash is disabled on frdm_kl25z

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-09-01 12:36:01 -05:00
Gerard Marull-Paretas
a202341958 devices: constify device pointers initialized at compile time
Many device pointers are initialized at compile and never changed. This
means that the device pointer can be constified (immutable).

Automated using:

```
perl -i -pe 's/const struct device \*(?!const)(.*)= DEVICE/const struct
device *const $1= DEVICE/g' **/*.c
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-22 17:08:26 +02:00
Gerard Marull-Paretas
dee062bf0b samples: usb: audio: initialize devices at compile time
Initialize devices at compile time, allowing to constify device pointer.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Francois Ramu
31b9a6acc6 samples: usb: audio application uses static dev declaration
This change the applications to get device from the
compatible of the zephyr_udc0 node.
It is defined by the DTC_OVERLAY_FILE="app.overlay"

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-21 13:24:24 -05:00
Kumar Gala
6f5e75ba31 samples: usb: dfu: Fix building of sample on a few platforms
Fix building this sample on bl5340_dvk_cpuapp_ns and
pinnacle_100_dvk.  On these boards the NORDIC_QSPI_NOR
driver needs to be enabled for the sample to build.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 15:29:41 +00:00
Kumar Gala
28143b1cdc samples: subsys: Remove label property from devicetree overlays
"label" properties are not required.  Remove them from samples.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 10:30:20 +02:00
Kumar Gala
cbc848f328 dts: bindings: device labels are now optional
All in tree device drivers use some form of DEVICE_DT_GET
so we no longer need to require label properties.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-18 10:39:14 +00:00
Maciej Perkowski
d224d7fcd5 sample: usb: Change integration_platforms to platform_allow
The sample proviades required overlays only for 3 platforms.
Therefore, flash scenarios can only work on those 3 platforms.
To reflect this, platform_allow has to be used instead of
integration_platforms, so boards without overlays are not picked up
into a scope.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2022-07-07 10:11:44 +02:00
Kumar Gala
6a177e0a31 samples: usb: hid-cdc: Convert to use gpio_dt_spec
Move sample to use gpio_dt_spec for GPIO access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-07 10:11:29 +02:00
Johann Fischer
6a102eeffd samples: usb: add integration platforms to flash tests in USB MSC sample
Add integration platforms to mass_flash_fatfs and mass_flash_littlefs
tests as these options are tuned for specific platforms.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-07-04 16:57:48 +02:00
Johann Fischer
fbe7a1067d samples: usb: fix flash test subsections in USB MSC sample
Test sections, mass_flash_fatfs and mass_flash_littlefs,
and corresponding Kconfig options are mixed up.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-07-04 16:57:48 +02:00
Jordan Yates
75680f7ae0 treewide: update flash_area name retrieval
Update usage of `flash_area->fa_dev_name` to `flash_area->fa_dev->name`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-07-02 16:04:16 +02:00
Gerard Marull-Paretas
c7b5b3c419 samples: migrate includes to contain <zephyr/...> prefix
In order to bring consistency in-tree, migrate all samples to the use
the new prefix <zephyr/...>. Note that the conversion has been scripted:

```python
from pathlib import Path
import re

EXTENSIONS = ("c", "h", "cpp", "rst")

for p in Path(".").glob("samples/**/*"):
    if not p.is_file() or p.suffix and p.suffix[1:] not in EXTENSIONS:
        continue

    content = ""
    with open(p) as f:
        for line in f:
            m = re.match(r"^(.*)#include <(.*)>(.*)$", line)
            if (m and
                not m.group(2).startswith("zephyr/") and
                (Path(".") / "include" / "zephyr" / m.group(2)).exists()):
                content += (
                    m.group(1) +
                    "#include <zephyr/" + m.group(2) +">" +
                    m.group(3) + "\n"
                )
            else:
                content += line

    with open(p, "w") as f:
        f.write(content)
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 11:29:59 +02:00
Aleksandar Markovic
9760c83267 samples: cdc_acm_composite: Use proper type for variable 'read'
Function uart_fifo_read() returns 'int' (it may return negative values
in error cases). Its return value is stored in the variable 'read' that
is, however, of type 'size_t'.

Change the type of the variable 'read' from 'size_t' to 'int' to
accomodate proper handling of uart_fifo_read() invocation.

Coverity-CID: 248408

Signed-off-by: Aleksandar Markovic <aleksandar.markovic.sa@gmail.com>
2022-04-26 12:05:26 -04:00
Anas Nashif
2d97bdd85d samples: add module requirement into samples
Do not build those samples if the needed modules are not available in
the workspace.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-04-19 09:38:55 -04:00
Martijn Stommels
0b1f97031a usb: dfu: update sample README
Some information in the USB DFU sample was out of date.

Also added some example lines for the Permanent download and automatic
reboot features.

Signed-off-by: Martijn Stommels <martijn@martijnpc.nl>
2022-03-31 15:33:16 +02:00
Martijn Stommels
49cb6537be usb: dfu: add permanent download and automatic reboot
This commit adds the USB_DFU_PERMANENT_DOWNLOAD and USB_DFU_REBOOT and
symbols.When the permanent download symbol is enabled, slot 1 will be
marked as confirmed. With the reboot symbol enabled, the devices
automatically reboots after the download is completed.

The functionality is split into two symbols to allow the automatic
reboot without confirming the image. This enables image confirmation via
another channel. For example via the shell’s Mcuboot commands.

This functionality allows downloading an image to the device without the
user having to interact with the device. It is useful in cases where
ease of use is more important then safety. For example  when using USB
download for daily development. This is especially applicable for
devices with a closed case.

The changes were tested on an nrf52840dk. The following line can be used
to build the USB DFU example with the symbols enabled.

west build -b nrf52840dk_nrf52840 zephyr/samples/subsys/usb/dfu \
-d build-dfu -- -DCONFIG_BOOTLOADER_MCUBOOT=y \
-DOVERLAY_CONFIG=overlay-reboot-permanent.conf \
-DCONFIG_MCUBOOT_SIGNATURE_KEY_FILE\
=\"bootloader/mcuboot/root-rsa-2048.pem\"

Fixes #41921

Signed-off-by: Martijn Stommels <martijn@martijnpc.nl>
2022-03-31 15:33:16 +02:00
Nazar Kazakov
f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04:00
Henrik Brix Andersen
d4023b3c1b drivers: gpio: move non-standard dts flags to be soc specific
Reserve the upper 8 bits of gpio_dt_flags_t for SoC specific flags and
move the non-standard, hardware-specific GPIO devicetree flags (IO
voltage level, drive strength, debounce filter) from the generic
dt-bindings/gpio/gpio.h header to SoC specific dt-bindings headers.

Some of the SoC specific dt-bindings flags take up more bits than
necessary in order to retain backwards compatibility with the deprecated
GPIO flags. The width of these fields can be reduced/optimized once the
deprecated flags are removed.

Remove hardcoded use of GPIO_INT_DEBOUNCE in GPIO client drivers. This
flag can now be set in the devicetree for boards/SoCs with debounce
filter support. The SoC specific debounce flags have had the _INT part
of their name removed since these flag must be passed to
gpio_pin_configure(), not gpio_pin_interrupt_configure().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-10 13:46:34 -05:00
Gerard Marull-Paretas
260deccb6e doc: use :kconfig:option: domain role
Kconfig options now belong to the Kconfig domain, therefore, the
:kconfig:option: role needs to be used.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-02 09:28:37 +01:00
Johann Fischer
3b7807cc9b usb: dfu: disable USB DFU uploading by default
Firmware uploading to the host may not always be desired,
disable it by default.

Enable it for existing USB DFU sample to keep
the usual behavior, add note about new option to README.rst.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-02-18 09:32:22 -08:00
Daniel Leung
c955a44f13 usb: remove @return doc for void functions
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Piotr Golyzniak
22e82ecf6d samples: fix wrong extra_args definitions
Fix wrong extra_args definitions wich cause that this args were not used
by CMake during building this samples via Twister in CI.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2022-01-04 17:15:06 -05:00
Dominik Ermel
659fee4460 samples: subsys: dfu: Fix image signing tool executable name
It is imgtool.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-12-21 17:08:35 +01:00
Johann Fischer
5296339fde usb: rework to use macro STRUCT_SECTION_FOREACH
Replace deprecated macro USBD_CFG_DATA_DEFINE by
USBD_DEFINE_CFG_DATA which places usb_cfg_data structures
in specific iterable section.

Replace __usb_data_start, __usb_data_end usage patterns
  size_t size = (__usb_data_end - __usb_data_start);
  for (size_t i = 0; i < size; i++) {...}
by
  STRUCT_SECTION_FOREACH(usb_cfg_data, ...) {...}

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 07:22:15 -06:00
Johann Fischer
af620ef196 sample: dfu: exclude b_u585i_iot02a board
Exclude b_u585i_iot02a board from USB DFU sample since
it has no flash driver.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 12:47:10 +01:00
Jordan Yates
8e99db5801 Kconfig: net: deprecate NET_BUF_USER_DATA_LEN
As user data sizes are now set on a per pool basis, this Kconfig option
has no purpose.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-11-24 16:04:50 +02:00
Johann Fischer
cf8d7764da usb: fix bulk endpoint configuration for high-speed capable device
In the current USB device support, the sizes of bulk endpoint
are mostly configure through Kconfig and do not care if a device
is high-speed capable. The information if a USB device controller
supports high-speed comes from devicetree. Add a Kconfig option to
map this information and configure bulk endpoint sizes
accordingly.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-24 12:28:02 +01:00
Johann Fischer
67a265b0df samples: cdc_acm: check return value of uart_fifo_read()
uart_fifo_read() can return negative values in case
it is not implemented or CONFIG_UART_INTERRUPT_DRIVEN
is not enabled. Both cases can not actually happen in the
case of CDC ACM UART, check it anyway in case behavior
of the UART API changes unnoticed.

Align the code in RX path code of both camples and
enable TX interrupt only if data was received successfully.

Fixes: #39835
Fixes: #39824
Fixes: #39809
Coverity-CID: 240667
Coverity-CID: 240679
Coverity-CID: 240697

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-24 10:50:11 +01:00
Johann Fischer
0908a52d0d samples: usb: console: fix configuration
This sample uses console driver and therefore
Kconfig option CONFIG_CONSOLE and CONFIG_UART_CONSOLE
are required.

Kconfig option CONFIG_USB_UART_CONSOLE no longer has
any influence here and should be removed.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-18 14:29:18 +01:00
Johann Fischer
02c32d4474 usb: move USB_DEVICE_REMOTE_WAKEUP option to drivers
Kconfig USB_DEVICE_REMOTE_WAKEUP option depends only on
USB device controller capability, but is not controlled
by the USB device controller drivers configuration.
Move USB_DEVICE_REMOTE_WAKEUP option to drivers and
make it promptless.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-08 17:01:32 +01:00
Bartosz Bilas
865ff22b3f samples: subsys: dfu: update URL of the MCUboot zephyr readme
Switch to the new MCUboot zephyr documentation URL
since the old one returns error 404.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-11-02 13:25:43 +01:00
Henrik Brix Andersen
265cdf8dc6 cmake: use find_package() instead of literal include in tests and samples
Convert remaining tests and samples to using find_package() instead of
literally including the CMake boilerplate code.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-11-01 10:33:09 -04:00
Johann Fischer
fb454d09bb doc: usb: refactor USB device support documentation structure
Move related areas to their own files and order
documentation logically from lower to upper layer.
Fix gross errors and inconsistencies.

Co-authored-by: Carles Cufí <carles.cufi@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-10-06 11:51:07 +02:00
Christopher Friedt
650b111ba5 drivers: flash: Kconfig.sam: -depends on and +dfu sample exclude
The additional depends on SOC_FAMILY_SAM was redundant.

Add sam4l_ek to dfu sample exclude since it was failing on
arduino_due.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-09-02 13:23:47 -04:00
Hake Huang
cc760c5401 sample: usb: hid-cdc: add a sleep for cpu to response
add a sleep while the uart init is fail.
so cpu will have chance to output error message

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-08-24 16:37:44 -05:00
Johann Fischer
0f5490a004 samples: usb: console: convert README to RST file
Convert README to RST file.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Johann Fischer
c3f87d9247 samples: usb: console: get CDC ACM UART device from devicetree
Add app.overlay which contains chosen node and cdc-acm-uart node.
Rework sample to get CDC ACM UART device from devicetree.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Johann Fischer
020843f249 samples: usb: get CDC ACM UART device from devicetree
Add app.overlay which contains cdc-acm-uart nodes.
Rework CDC ACM and HID samples to get CDC ACM UART device
from devicetree.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Torsten Rasmussen
1cccc8a8fe cmake: increase minimal required version to 3.20.0
Move to CMake 3.20.0.

At the Toolchain WG it was decided to move to CMake 3.20.0.

The main reason for increasing CMake version is better toolchain
support.

Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-20 09:47:34 +02:00
Johann Fischer
976c5fee28 samples: usb-audio: add app.overlay and use zephyr_udc0
USB audio class samples are generic and can be built for any
board that supports USB device and isochronous endpoints.
Add app.overlay that uses reference to zephyr_udc0 and remove
board specific overlays.

Note: USB audio is still experimental and even though the sample can
be built for specific platform, it does not mean that it can be run
on it without issues.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-19 16:56:54 +02:00
Johann Fischer
e38e91ed16 Revert "samples: usb-audio: add app.overlay and remove board specific overlays"
This reverts commit e53371bbc0bc37d911884937199733f23c43fb21.
The "usbd0 aliases" approach has not proven to work.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-19 16:56:54 +02:00
Johann Fischer
63707e304a samples: webusb: return -ENOTSUP on host-to-device control requests
The sample only supports device-to-host control requests.
Return -ENOTSUP on host-to-device control requests.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-03 19:05:44 -04:00
Johann Fischer
946964e374 samples: remove USB configuration option
Remove USB configuration option, replace it where necessary
with USB_DEVICE_STACK.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-03 19:00:12 -04:00
Johann Fischer
759dac513a samples: usb: use new USB framework header
Replace all macros and types with the new ones from
usb/usb_ch9.h header.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-03 13:20:07 +02:00
Bernhard Krämer
c2d98a08f8 board: arm: fix failing test
Add exclude for teensy boards on test
samples/subsys/usb/dfu/sample.usb.dfu

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>
2021-08-02 16:12:26 -05:00
Erwan Gouriou
3e1443ccf9 scripts/pylib: expr_parser.py: Review dt_compat_enabled_with_label
Function used for filtering "dt_compat_enabled_with_label" was not
working as expected as it was not taking into account that we're
looking for a children/parent combination:
Provided "compat" with enabled status should be the one of the parent
of the node matching given label.

Function is then reworked to take this into account.
And to make it's usage clear:
- function name is changed to be clearer on the intention
- args order is reversed to be more logical wrt the intention

Users of the function are also updated to take the change into
account.

Fixes #36093

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-06-21 20:31:49 -04:00
Johann Fischer
fca499100d samples: usb-audio: add app.overlay and remove board specific overlays
USB audio class samples are generic and can be built for any
board that supports USB device and isochronous endpoints.
Add app.overlay that uses aliases and remove board specific overlays.

Note: USB audio is still experimental and even though the sample can
be built for specific platform, it does not mean that it can be run
on it without issues.

Fixes: #25313

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-05-21 18:16:25 -04:00
Jamie McCrae
f4350a9303 boards: arm: Add Laird Connectivity BL5340 DVK platform
This adds initial support for the Laird Connectivity BL5340
development kit hardware

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-05-07 09:06:27 +02:00
Martí Bolívar
c48bcaae0a samples: hid-mouse: various cleanups
Use the new GPIO_DT_SPEC_GET_OR() macro to clean up the node detection
code by eliminating conditional compilation. This increases code
coverage on platforms where not all the devicetree nodes are
available.

Clean up some whitespace while we're at it.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-05 20:46:43 +02:00
Kumar Gala
a5ea06d53f samples: usb: dfu: exclude platforms sample can't be built on
Several platforms don't have flash drivers and these platforms the DFU
sample will not build or even pass Kconfig on.  Exclude them until they
have flash driver support.

Fixes #33422

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-31 09:33:58 -05:00
Johann Fischer
98ce8dcfdc samples: mass: add SD card support
Add SD card support to USB MSC sample.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-23 12:16:01 +01:00
Johann Fischer
5070186f63 tests/boards/samples: fixup after sdmmc driver relocation
Fixup configuration.
Remove obsolete SDHC SPI configuration.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-23 12:16:01 +01:00
Johann Fischer
90d7322d8c sample: hid: fixup harness config regex
Fixup outdated harness config regex.

Fixes: #33542

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-22 10:40:25 -04:00
Johann Fischer
5ebb4214c9 samples: hid: set boot interface Protocol Code
Update sampele to show how to set boot interface Protocol Code.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 09:51:21 -04:00
Johann Fischer
6a2a26024a samples: hid: filter subsequent USB_DC_CONFIGURED events
Filter subsequent USB_DC_CONFIGURED events.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-17 11:34:42 +01:00
Johann Fischer
352f63d98b samples: hid: adjust LOG level
Adjust LOG level to hide repeating debugging outputs.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-17 11:34:42 +01:00
Johann Fischer
84e55414ad samples: hid: rework USB HID sample report descriptor
HID report descriptor in the sample has unnecessarily output report
which is not used anywhere. This patch removes unnecessary report.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-17 11:34:42 +01:00
Johann Fischer
0bf67d2c6e samples: hid: rework USB HID sample report and on_idle callback
HID sample has on_idle callback implementation present in the code,
but has not turned on USB_DEVICE_SOF and so does not have
corresponding code in sample self and class/hid/core.c covered.
Also on_idle implementation in HID sample has not taken into
account send_report() which also calls hid_int_ep_write().
This patch enables USB_DEVICE_SOF and revises both on_idle and
the regular report function.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-17 11:34:42 +01:00
Johann Fischer
896c29f494 sample: dfu: remove platform_allow
Remove platform_allow and allow sample to be build on
compatible platform only.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-15 10:15:44 -04:00
Johann Fischer
65678bb1d4 samples: hid: convert to use new common HID macros
Convert to use new common HID macros.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-02-28 16:50:24 -05:00
Maciej Perkowski
0fb58735f1 samples: tests: Fix usb.audio.headset test
The sample was failing twister test with a timeout because there was
no pass/fail criteria for it (nothing was tested). The fix adds
harness on consolse and some output that can be verified.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2021-02-11 13:57:31 -05:00
Maciej Perkowski
ce776f0c7e samples: tests: Fix usb.audio.headphones_microphone test
The sample was failing twister test with a timeout because there was
no pass/fail criteria for it (nothing was tested). The fix adds
harness on consolse and some output that can be verified.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2021-02-11 13:57:31 -05:00
Andrzej Puzdrowski
c7a626fc6c samples/subsys/usb/mass: Add fs_dir_t type variable initialization
The commit adds initialization of fs_dir_t variables in preparation
for fs_opendir function change that will require fs_dir_t object, passed
to the function, to be initialized before first usage.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-02-05 07:32:20 -05:00
Johann Fischer
5b8d79fe9a sample: usb: exlude native_posix platform
Exlude native_posix platform from USB samples but
add build-only test case.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-02-03 08:37:38 -05:00
Johann Fischer
070ee4bf37 samples: cdc_acm_composite: fix format specifier
Use %zu format specifier for size_t.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2021-02-03 08:37:38 -05:00
Johann Fischer
806e3c7d3f samples: usb: remove unnecessary GPIO dependency
Remove unnecessary GPIO dependency.

Fixes: #29034

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2021-02-03 08:37:38 -05:00
Andy Ross
fcd392f6ce kernel: subsys: lib: drivers: Use k_heap instead of z_mem_pool wrappers
Use the core k_heap API pervasively within our tree instead of the
z_mem_pool wrapper that provided compatibility with the older mempool
implementation.

Almost all of this is straightforward swapping of one alloc/free call
for another.  In a few cases where code was holding onto an old-style
"mem_block" a local compatibility struct with a single field has been
swapped in to keep the invasiveness of the changes down.

Note that not all the relevant changes in this patch have in-tree test
coverage, though I validated that it all builds.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-12-07 21:50:14 -05:00
Andy Ross
6965cf526d kernel: Deprecate k_mem_pool APIs
Mark all k_mem_pool APIs deprecated for future code.  Remaining
internal usage now uses equivalent "z_mem_pool" symbols instead.

Fixes #24358

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-12-07 21:50:14 -05:00
Johann Fischer
cec040503b samples: mass: rework disk and fs configuration
USB MSC sample has been expanded over time. Config overlays
for RAM disk and flash disks were added. Board specific overlays
followed. It was overlooked that they forced a specific
configuration for the nrf52840dk_nrf52840 board,
even if it was not explicitly desired
(for example RAM-disk). This also caused strange behaviour
during automatic MSC USB3CV tests (which explicit selects RAM-disk)
so that nrf5340dk_nrf5340_cpuapp board passed test
but nrf52840dk_nrf52840 failed.

Rework disk and file system configuration, and initialization
code, allow to use FAT file system on top of RAM disk.

This sample can be built with none or one of two supported
file systems, LittleFS or FATFS. Disk subsystem can be flash
or RAM based. LittleFS only works with flash disk.
There are four useful possibilities:
- RAM disk without any file system for testing (default)
- RAM disk with FAT file system
- flash disk with FAT file system
- flash disk with LittleFS
Flash disk configurations is only available (as before) for
nordic,qspi-nor compatible, but only need the device tree overlay
per platform without a config overlay.

This path also revises test cases.
Remove invalid "flash" tag from depends_on key.
Remove unnecessary gpio tag and exclude native platform.

Resolves: #26275

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2020-12-02 11:50:11 +01:00
Emil Obalski
312429be3c usb: samples: Add Extension descriptor to webUSB sample.
WebUSB sample is using BOS descriptor. Because of that
the bcdUSB field of device descriptor is set to 0x0210.
This requires for the BOS descriptor to have LPM support.
LPM support use additional descriptor that the HOST can
read by requesting BOS desc. The descriptor is called
Extension descriptor and is specified in `USB Link Power
Management ECN` document considered a part of USB 2.0
spec.

This patch adds missing part of the BOS descriptor and
fixes issue with webUSB sample not passing i'LPM L1 Suspend
Resume Test' from USB3CV test tool.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-10-30 15:56:13 +01:00
Emil Obalski
7a252b90dc usb: samples: Register BOS capabilities before USB enable.
BOS descriptor capabilities shall be registered before the USB
is enabled.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-10-30 15:56:13 +01:00
Martí Bolívar
8165008f44 dts: remove legacy macro support
The legacy macros were first deprecated in Zephyr v2.3. Now that
Zephyr v2.4 has been released, that makes two releases where these
macros have been deprecated, so it's OK to remove them.

This leaves support for legacy binding syntax in place. Removing that
is left to future work.

We need to update various pieces of documentation related to flash
partitions that never got updated when the new API was introduced.
Consolidate this information in the flash_map.h API reference page,
since that's really where users will run into it. This also gives us
the opportunity to improve this documentation.

Adjust a couple of kconfigfunctions.py and sanitycheck bits to use
non-legacy edtlib APIs.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-09 08:45:38 -05:00
Emil Obalski
c96cbde8c5 usb: mass: Fix main thread stack size overflow.
After HW stack protection option was globally enabled for
nRF SoCs turned out main stack size is too small for
USB mass storage sample. Increase to avoid overflow.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-10-05 14:53:32 -05:00
Anas Nashif
4fa08decc1 tests: usb: add fixture requirement
The test for this sample requires a usb connection to a secondary port,
output is not captured on the default usb port.

Fixes #28154

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-09-14 18:37:17 -05: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
Emil Obalski
c5b96cce6c usb: samples: audio: Add samples to sanitycheck
Add nrf5340dk_nrf5340_cpuapp platform to build in sanitycheck.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-09-03 21:50:03 +02:00
Emil Obalski
0728949948 samples: usb: Audio samples support for nRF53
This patch adds support for USB Audio class samples for
nRF5340dk.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-09-03 21:50:03 +02:00
Emil Obalski
d86c43fbb0 samples: usb: Software RNG for nRF53
nRF53 application core does not have RNG peripheral.
Software implementation must be used instead.
This patch adds config overlay for hid-cdc nRF5340 sample.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-09-03 21:50:03 +02:00
Tomasz Bursztyka
e18fcbba5a device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.

A coccinelle rule is used for this:

@r_const_dev_1
  disable optional_qualifier
@
@@
-struct device *
+const struct device *

@r_const_dev_2
 disable optional_qualifier
@
@@
-struct device * const
+const struct device *

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Gerard Marull-Paretas
c8cca16c20 samples: subsys: usb: mass: add support for Adafruit feather nRF52840
Add configuration and overlay files for Adafruit feather nRF52840.
README has also been updated and improved. Documentation related to
littlefs has been moved to an independent section as it could apply to
any sample.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-09-02 11:36:22 +02:00
Anas Nashif
dca317c730 sanitycheck: inclusive language
change whitelist -> allow.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-27 07:04:07 -04:00
Henrik Brix Andersen
01c6862ad7 samples: usb: mass: add usb_device dependency
Make the flash-backed USB mass storage sample depend on usb_device and
flash instead of just flash.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-08-26 12:32:27 +02:00
Emil Obalski
80a89ef799 console: usb: Remove obsolete Kconfig option.
This patch removes unused Kconfig option from console
subsystem. If application wants to wait until the console
port is connected, enabled and ready to receive data
it should use uart_line_ctrl_get() API function and
check for DTR flag.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-08-13 11:49:47 +02:00
Emil Obalski
b552e60765 samples: usb: Make USB console samples call usb_enable()
usb_enable() must be called once by the application.
The application may want to register usb_dc_status_callback
and trace usb status codes (usb_dc_status_code).

After this patch all pre APPLICATION messages will be dropped
as USB console device is enabled in the application.

Application waits for console device until its ready by checking DTR
flag - uart_line_ctrl_get(). This function could be dropped but then
some log messages that were generated before USB device is ready
could also be dropped.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-08-13 11:49:47 +02:00
Emil Obalski
27f207694c usb: hid: Allow to send data only if CONFIGURED.
USB device shall be able to send only in CONFIGURED state.
Zephyr USB HID device class allows to send the data no matter
of the USB state what is wrong. Attempting to write to endpoint
buffer in state != CONFIGURED may lead to driver error.

This patch introduces state tracing for USB HID class and
allows to send data using hid_int_ep_write() class API
only if the device remains in CONFIGURED state.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-08-13 11:45:31 +02:00
Martí Bolívar
5be0d00d41 treewide: remove unnecessary DT GPIO/PWM flags checks
Now that the relevant APIs generalize properly for bindings without
flags, we can remove some special case checks from the tree.

I couldn't find any more, but I did this kind of quickly, so it's
possible I missed some.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-08-04 07:35:26 -05:00
Tomasz Bursztyka
7d1af02410 uart: Fix uart_irq_callback_set usage
It was already using uart_irq_callback_user_data_set below, now it also
uses uart_irq_callback_user_data_t as callback type, so let's normalize
the callbacks.

Fixes #26923

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-07-30 09:43:12 +02:00
Tomasz Bursztyka
701869fc48 uart: Fix uart_irq_callback_user_data_set usage
Now providing the struct device * to the callback.

Fixes #26923

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-07-30 09:43:12 +02:00
Emil Obalski
4f42b4413b usb: Correct logging level in Audio class.
Configuration file was left unchanged after development
of USB Audio class. Deleted configs should never be present.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-07-07 19:28:14 -04:00
Peter Bigot
5ea2eaa765 samples: usb: mass: do application configuration before usb starts
USB access to the flash device is not synchronized with the
application, so if the application needs to create a new file system
USB may read configuration state that is incorrect.  Wait until the
the application is done with the flash before starting USB.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-24 09:46:56 -04:00
Kumar Gala
a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Peter Bigot
1af0428c3d samples: usb: mass: set storage device for FatFS
Left unset it becomes the first partition, which is not what's used
for littlefs, and specifically isn't on the external flash for
nrf52840dk_nrf52840.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-05 17:44:39 +02:00
Peter Bigot
d32b4bd210 samples: usb: mass: fix to support FatFS on external file system
The flash interface header needs to be available regardless of
selected filesystem implementation.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-05 17:44:39 +02:00
Marc Herbert
2cd51a33ce samples: make find_package(Zephyr...) REQUIRED
This provides a better error message when building with CMake and
forgetting ZEPHYR_BASE or not registering Zephyr in the CMake package
registry. See parent commit for more details (split from parent for
better readability).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Johann Fischer
8f4df1784a samples: usb: update PID in the samples documentation
Update PID and SerialNumber in the samples documentation.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-05-27 14:15:52 +02:00
Johann Fischer
3ce80c4d7a samples: wpanusb: assign next free sample PID
Assign next free sample PID to wpanusb sample.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-05-27 14:15:52 +02:00
Emil Obalski
44c153380b usb: doc: Add note about cdc+dfu Windows OS exception.
Add a note for composite (CDC+DFU) device overlay.
Composite device CDC+DFU may not work with Windows OS host.
Windows OS does not send reset after DFU_DETACH request
(does not re-enumerates) and thus make it unable for
the device to restart in DFU mode.

For more details refer to #23337.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-27 13:48:40 +02:00
Kumar Gala
2ef135dc23 samples: usb: audio: Fix building off sample with sanitycheck
The USB audio samples when added didn't have any tests: sections in the
sample.yaml so they would never get build on any platform as part of
sanitycheck.  Add the tests: section and limit the samples to build on
nrf52840dk_nrf52840 as that was the intended platform these samples
where initially developed for.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-21 16:55:27 +02:00
Kumar Gala
ff579a3af3 flash: Convert DT_FLASH_AREA to FLASH_AREA macros
Convert with a combo of scripts and by hand fixups:

git grep -l DT_FLASH_AREA_.*_ID | \
 xargs sed -i -r 's/DT_FLASH_AREA_(.*)_ID/FLASH_AREA_ID(\L\1)/'

git grep -l DT_FLASH_AREA_.*_OFFSET | \
 xargs sed -i -r 's/DT_FLASH_AREA_(.*)_OFFSET/FLASH_AREA_OFFSET(\L\1)/'

git grep -l DT_FLASH_AREA_.*_SIZE | \
 xargs sed -i -r 's/DT_FLASH_AREA_(.*)_SIZE/FLASH_AREA_SIZE(\L\1)/'

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-13 21:22:53 +02:00
Martí Bolívar
f83ecb7bc6 samples: hid-mouse: cleanups
Similar cleanups as done to other samples.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-13 19:51:01 +02:00
Martí Bolívar
59e63845d1 samples: hid-cdc: cleanups
Similar cleanups to other samples.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-13 19:51:01 +02:00
Emil Obalski
6789ecbd5e usb: samples: Add USB Audio Headset sample
This commit adds USB audio sample to the Zephyr project.

The sample configures one I/O device:
- Headset (2 channels, Fs=48kHz, PCM format)

Input data sstream is passed to output data stream.

For more details refer to README.rst.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-08 15:12:27 +02:00
Emil Obalski
8eefca2674 usb: samples: Add USB audio Headphones + Microphone sample
This commit adds USB audio sample for Zephyr project.

The sample configures two devices:
- Microphone (2 channels, Fs=48kHz, PCM format)
- Headphones (2 channels, Fs=48kHz, PCM format)

Input data stream is passed to output data stream.

For more details refer to README.rst.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-08 15:12:27 +02:00
Emil Obalski
45bdb23005 usb: Special return values for custom_handler
This commit introduces dedicated return type for custom_handler.
Relevant code is updated to fulfill the API documentation.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-07 11:20:27 +02:00
Peter A. Bigot
88c0545ea4 samples: usb: mass: add support for littlefs file systems
This allows mass storage exposure of a littlefs file system,
specifically one on the SPI NOR flash of the nrf52840dk_nrf52840.  In
combination with littlefs-fuse this allows a host system to examine
and change the local storage of a Zephyr application.

Note that it is critical that all parameters of the file system match
between what Zephyr is using and what littlefs-fuse is using.
Inconsistencies can produce confusing results where each system sees
different content.  The README has been updated with a detailed
example.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-05-06 11:31:44 +02:00
Peter A. Bigot
f128cbe80f samples: usb: mass: update nrf52840dk board configuration
Drop the old redefine-everything-in-a-special-conf approach and put
the customization appropriate for this board into the board directory
where it's handled automatically.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-05-06 11:31:44 +02:00
Kumar Gala
4e93b77552 samples: Convert DT_ALIAS_* to new DT_ALIAS() macro
Convert DT_ALIAS_* defines to use DT_ALIAS() plus other macros from
include/devicetree.h.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-04 15:28:20 -05:00
Luiz Augusto von Dentz
2534ab11c0 USB: Add driver and PID for Bluetooth H4
This adds USB_PID_BLE_HCI_H4_SAMPLE along with it driver which uses H4
over bulk endpoints.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-04-20 21:59:47 +03:00
Carles Cufi
233d6c87e6 boards: nrf52840_pca10059: Rename to nrf52840dongle_nrf52840
The board name for the nRF52840 Dongle, so far known as
nrf52840_pca10059, is renamed to nrf52840dongle_nrf52840. Its
documentation and all references to its name in the tree are updated
accordingly. Overlay and configuration files specific to this board are
also renamed, to match the new board name.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-04-06 13:09:07 +02:00
Andy Ross
32bb2395c2 timeout: Fix up API usage
Kernel timeouts have always been a 32 bit integer despite the
existence of generation macros, and existing code has been
inconsistent about using them.  Upcoming commits are going to make the
timeout arguments opaque, so fix things up to be rigorously correct.
Changes include:

+ Adding a K_TIMEOUT_EQ() macro for code that needs to compare timeout
  values for equality (e.g. with K_FOREVER or K_NO_WAIT).

+ Adding a k_msleep() synonym for k_sleep() which can continue to take
  integral arguments as k_sleep() moves away to timeout arguments.

+ Pervasively using the K_MSEC(), K_SECONDS(), et. al. macros to
  generate timeout arguments.

+ Removing the usage of K_NO_WAIT as the final argument to
  K_THREAD_DEFINE().  This is just a count of milliseconds and we need
  to use a zero.

This patch include no logic changes and should not affect generated
code at all.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-03-31 19:40:47 -04:00
Torsten Rasmussen
407b49b35c cmake: use find_package to locate Zephyr
Using find_package to locate Zephyr.

Old behavior was to use $ENV{ZEPHYR_BASE} for inclusion of boiler plate
code.

Whenever an automatic run of CMake happend by the build system / IDE
then it was required that ZEPHYR_BASE was defined.
Using ZEPHYR_BASE only to locate the Zephyr package allows CMake to
cache the base variable and thus allowing subsequent invocation even
if ZEPHYR_BASE is not set in the environment.

It also removes the risk of strange build results if a user switchs
between different Zephyr based project folders and forgetting to reset
ZEPHYR_BASE before running ninja / make.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Andrzej Głąbek
4253eae005 boards: nrf52840_pca10056: Rename board to nrf52840dk_nrf52840
The nRF52840 DK board target, so far known as nrf52840_pca10056,
is renamed to nrf52840dk_nrf52840.
Its documentation and all references to its name in the tree are
updated accordingly. Overlay and configuration files specific to
this board are also renamed, to match the new board name.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-03-27 09:14:08 +01:00
Martí Bolívar
6e57b42758 doc: dts: revisit documentation
This is joint work with Kumar Gala (see signed-off-by).

Document the changes to the generated node macros in macros.bnf,
moving the old file to legacy-macros.bnf and putting it in its own
section.

The actual generated macros are now a low-level detail, so rewrite the
foregoing sections as examples in terms of the new <devicetree.h> APIs.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-24 10:11:20 -05:00
Johann Fischer
b33627bc81 samples: hid-cdc: convert to new GPIO API
Convert hid-cdc sample to new GPIO API

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-02-05 12:00:36 +01:00
Andrzej Głąbek
0c10d5cc1f samples/subsys/usb/hid-mouse: Convert to use the new GPIO API
Convert the sample to use the new GPIO API and additionally:
- add some error messages for unsuccessful GPIO API calls
- correct the index of `def_val` element used in the `right_button`
  callback, to match the one used when the callback is installed
- use flags defined in devicetree for the pin that drives the LED
  (for consistency, as this does not make much difference for a pin
  that is only toggled)

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Ulf Magnusson
cf89ba33ea global: Fix up leading/trailing blank lines in files
To make the updated test in
https://github.com/zephyrproject-rtos/ci-tools/pull/121 clean, though it
only checks modified files.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-01-27 17:41:55 -06:00
Emil Obalski
2128750138 usb: api: Add user device status callback
By this commit user gets possibility to register USB
device satutus callback. This callback represents device state
and is added so user could know what happend to USB device.

Callback is registered by providing it to usb_enable()
USB api is extended by this callback handler.

Samples using using USB are by default provide no callback
and the usb_enable() is called with NULL parameter.

Status callback registered by hid class is deleted as now
USB device has global callback for all classes within device.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2019-12-19 13:08:55 +01:00
Emil Obalski
d65027d8c0 usb: samples: Application calling usb_enable by itself
User app is reponsible for issuing usb_enable and
making USB hardware operative.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2019-12-19 13:08:55 +01:00
Emil Obalski
797d463d82 usb: samples: Do not depend remote wakeup on SoCs
Remote wakeup for Nordic SoCs should always be enabled.
Thus do not depend it for each SoC. Instead depend it on
chosen driver.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2019-12-15 10:29:13 -05:00
Ulf Magnusson
984bfae831 global: Remove leading/trailing blank lines in files
Remove leading/trailing blank lines in .c, .h, .py, .rst, .yml, and
.yaml files.

Will avoid failures with the new CI test in
https://github.com/zephyrproject-rtos/ci-tools/pull/112, though it only
checks changed files.

Move the 'target-notes' target in boards/xtensa/odroid_go/doc/index.rst
to get rid of the trailing blank line there. It was probably misplaced.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-11 19:17:27 +01:00
Anas Nashif
70758c4374 tests: fix test identifiers
The seasonal overhaul of test identifiers aligning the terms being used
and creating a structure. This is hopefully the last time we do this,
plan is to document the identifiers and enforce syntax.

The end-goal is to be able to generate a testsuite description from the
existing tests and sync it frequently with the testsuite in Testrail.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-12-09 15:53:44 -05:00
Emil Obalski
c1f5e11bb6 usb: Cleanup for multiplied defines
Some of defines are present in several header files.
Those defines are the same with value but with different naming.

Common defines are brought to usb_common.h

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2019-12-09 12:48:13 -05:00
Emil Obalski
6c82c80a3c drivers: Add support for nRF52833 in several drivers
By adding new SoC to Zephyr drivers has to be updated.
Commit affects:
 - USB driver
	- support for nRF52833 added.
	- support for USB_DEVICE_REMOTE_WAKEUP in hid-mouse added.
 - SPI
 - IEEE 802.15.4
 - CLOCK CONTROL

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2019-11-13 10:33:38 -06:00
Peter A. Bigot
a58d8ebaa6 driver: uart: make deprecation effective
Several macros were documented as deprecated but lacked the
infrastructure to produce deprecation warnings.  Add the deprecation
marker, and fix the in-tree references to the deprecated spellings.

Note that one non-deprecated macro should have been deprecated, and
is, referring to a newly added line control bit.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-11-07 12:44:15 -06:00
Ulf Magnusson
bd6e04411e kconfig: Clean up header comments and make them consistent
Use this short header style in all Kconfig files:

    # <description>

    # <copyright>
    # <license>

    ...

Also change all <description>s from

    # Kconfig[.extension] - Foo-related options

to just

    # Foo-related options

It's clear enough that it's about Kconfig.

The <description> cleanup was done with this command, along with some
manual cleanup (big letter at the start, etc.)

    git ls-files '*Kconfig*' | \
        xargs sed -i -E '1 s/#\s*Kconfig[\w.-]*\s*-\s*/# /'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-04 17:31:27 -05:00
Kumar Gala
4cc91fdd00 sample/tests: replace DT_ define filters with dt_ functions
convert sample and test yaml filters that utilize a DT_ define to
instead use a dt_ function.  The intent is to remove the Kconfig
generated DT defines and just make directy queries into the device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-04 09:02:14 -05:00
Andrei Emeltchenko
3aac8e3e19 samples: usb: webusb: Update sample README
Add Requirements and Building instructions

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-10-09 17:16:41 -05:00
Peter Bigot
6e5db350b2 coccinelle: standardize k_sleep calls with integer timeouts
Re-run with updated script to convert integer literal delay arguments to
k_sleep to use the standard timeout macros.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-09 08:38:10 -04:00
Andrei Emeltchenko
e0fbac01a3 samples: usb: webusb: Update README and sample link
Update instructions and webusb sample link.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-10-01 18:11:13 -04:00
Kumar Gala
9958757c0f samples: cdc_acm_composite: rework sample logging
Match the logging changes made in samples/.../usb/cdc_acm to the
cdc_acm_composite sample.  This allows any device testing checks to work
properly.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-08-27 10:28:24 -04:00
Johann Fischer
6de84125d3 samples: cdc_acm: rework sample logging
Use  LOG_LEVEL_INF as defautl log level and use LOG_INF
for important messages. Relax while loop and
give CPU resources to low priority threads like logging.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-08-23 15:47:06 +02:00
Kumar Gala
6f473e9240 samples: usb: webusb: Mark harness as TBD
Mark harness as TBD as we haven't defined how to test/validate this
sample on real hardware.  As such marking it 'harness: TBD' will get it
skipped from being attempted to run on hardware via --device-testing

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-08-22 07:08:20 -04:00
Jukka Rissanen
303ef27535 samples: usb: hid-cdc: Use proper value in k_busy_wait()
The wait time value should be in microseconds.

Fixes #18059

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-07 12:24:23 +02:00
Anas Nashif
578ae40761 boards: remove quarl_se_c1000
This board and SoC was discontinued some time ago and is currently not
maintained in the zephyr tree.
Remove all associated configurations and variants from the tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-29 21:30:25 -07:00
Anas Nashif
ffaba63b10 boards: remove arduino 101 and related boards
This board and SoC was discontinued some time ago and is currently not
maintained in the zephyr tree.
Remove all associated configurations and variants from the tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-29 21:30:25 -07:00
Carles Cufi
ff0b76ea4a samples: usb: console: Remove overlay file
After the removal of the virtualcom DT node in 5071eee, using the chosen
node is no longer functional. Instead the Kconfig
CONFIG_UART_CONSOLE_ON_DEV_NAME is used to locate the correct UART.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-07-22 16:20:11 +02:00
Nicolas Pitre
6609c12516 tests: enable native_posix_64 testing
Whenever conditions are applied to native_posix, they should apply to
native_posix_64 too.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-16 10:41:11 -07:00