Commit graph

15409 commits

Author SHA1 Message Date
Henrik Brix Andersen
f1f97a2bcc drivers: reset: add casts required by C++
Add casts required for C++ compilation. Use explicit NULL checks.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-12 09:55:27 +02:00
Henrik Brix Andersen
f561013827 drivers: espi: emul: include needed header
Include drivers/espi.h in drivers/espi_emul.h to satisfy dependencies.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-12 09:55:27 +02:00
Henrik Brix Andersen
24dc527fc1 drivers: edac: add casts required by C++
Add casts required for C++ compilation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-12 09:55:27 +02:00
Henrik Brix Andersen
4cdb6eebb4 drivers: dma: add casts required by C++
Add casts required for C++ compilation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-12 09:55:27 +02:00
honglin leng
215efc02c2 include: fix the function pointer error
fix incorrect function pointer judgment in video_stream_stop

Signed-off-by: honglin leng <hlleng@listenai.com>
2022-04-11 11:14:13 -05:00
Lingao Meng
37e561f42e Bluetooth: Host: Add choice select whether BT RX
Change CONFIG_BT_RECV_IS_RX_THREAD into a
choice:CONFIG_BT_RECV_CONTEXT with the following options
(names can be discussed further of course):

    CONFIG_BT_RECV_BLOCKING
    CONFIG_BT_RECV_WORKQ_BT
    CONFIG_BT_RECV_WORKQ_SYS

This way users would be able to choose what to run most of
the BLE stack on, they wouldn't be forced to a single model.

We would default to CONFIG_BT_RECV_BLOCKING so that we wouldn't
need to change the system workqueue stack size by default, instead
asking users to do so if they select the CONFIG_BT_RECV_WORKQ_SYS option

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-04-11 10:58:09 +02:00
Mohan Kumar Kumar
f105ea6ef5 net: add sndbuf socket option
Introduce set/get SO_SNDBUF option using the setsockopt
function. In addition, for TCP, check the sndbuf value
before queuing data.

Signed-off-by: Mohan Kumar Kumar <mohankm@fb.com>
2022-04-11 10:23:31 +02:00
Yuval Peress
53ef68d459 include: Prefix includes to use a scope
Move include paths and add new target_include_directories to support
backwards compatibility:
* /include -> /include/zephyr
  example: <irq.h> -> <zephyr/irq.h>

Issue #41543

Signed-off-by: Yuval Peress <peress@google.com>
2022-04-08 19:03:32 +02:00
Jiafei Pan
7c441aec12 divers: clock_control: redefine mcux ccm clock IDs
Redefine clock IDs to support multple instances of peripheral.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-04-08 10:31:04 -05:00
Mateusz Sierszulski
e0274e2c54 drivers: fpga: change retval description
This commit fixes the description of the values
returned by the get_status() function.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2022-04-08 09:11:08 -05:00
Dominik Ermel
6bddb0305a mgmt/mcumgr: Switch cbor_nb_reader to zcbor
The commit removes cbor_decoder_reader from cbo_nb_reader and
adds zcbor state variable to the structure.
All the code that has been supporting the cbor_decder_reader
has been removed and/or replaced with zcbor/net_buf specific.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-08 13:49:55 +02:00
Dominik Ermel
bff015feff mgmt/mcumgr/lib: Remove cbor_encoder_writer from usage
With transition to zcbor, the cbor_encoder_writer structure of
TinyCBOR is no longer used.
This commit replaces the structure with cbor_nb_writer, which
gathers zcbor processing structure with netbuf into one object.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-08 13:49:55 +02:00
Dominik Ermel
c883c45752 mgmt/mcumgr: Add zcbor support for sending responses
The commit modifies cbor_nb_writer to handle zcbor.
Proper initialization code has been added to cbor_nb_writer_init.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-08 13:49:55 +02:00
Abe Kohandel
f1e75dea50 bluetooth: ots: notify application prior to object name change
This change augments the application object name change notification to
occur prior to the actual name change done by the OTS layer.

Notifying prior to the actual name change makes it possible to inform the
application of the current name of the object as well as the new name.

Signed-off-by: Abe Kohandel <abe.kohandel@gmail.com>
2022-04-08 09:31:31 +02:00
Nicolas Pitre
563a8d11a4 arm64: refer to the link register as "lr" rather than "x30"
In ARM parlance, the subroutine call return address is stored in the
"link register" or simply lr. Refer to it as lr which is clearer than
the anonymous x30 designation.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2022-04-07 16:31:30 -05:00
Mariusz Skamra
db59647c0a Bluetooth: has: Add initial Hearing Access Service client
This adds initial support for Hearing Access Service client. The client
performs GATT discovery to find and read HAS related characteristics and
subscribe for characteristic value notifications/indications.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-04-07 09:37:53 +02:00
Lingao Meng
20ff55e234 Bluetooth: host: Optimize L2CAP resource usage
Making sure struct bt_l2cap_chan has absolutely no members related
to dynamic channels.

That way we ensure that there is no overhead for a build where only
fixed channels are used.

It's not enough that the dynamic channel-related members are put behind
ifdefs - they should be completely moved out from the struct definition.

Furthermore, the public l2cap.h header file already has a struct
that's meant to be used for dynamic channels: struct bt_l2cap_le_chan!

However, currently dynamic channel support is a mess - it's a mix
between these two structs. The bt_l2cap_le_chan struct should really
be an extension of the bt_l2cap_chan struct, i.e. the former should
contain as a member the latter.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-04-07 09:37:12 +02:00
Gerard Marull-Paretas
60045c52d5 drivers: pwm: check if pulse > period
Calling pwm_pin_set_cycles with a pulse > period doesn't make sense. By
definition, pulse ranges from 0 up to the period value.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-07 09:35:05 +02:00
Gerard Marull-Paretas
c2208e213d dt: pwm: add period set helpers
The period cell in the PWM specifier needs to be provided in nanoseconds.
However, in some applications it is more convenient to use another scale
such as milliseconds. This patch introduces 3 helpers to allow using
seconds, milliseconds and microseconds scales.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-06 07:58:16 -07:00
Casper Bonde
52843f7f9d Bluetooth: BAP: use codec configuration parameters for LC3 processing
Replace hardcoded LC3 codec config with the selected configuration
used in the GATT profiles.
The selected codec configuration on the client will be used on both
sides for LC3 encode/decode.
This required completing the LC3 macroes for building codec
cababilities and codec configuration as they were not setting the
max_frames_per_sdu and frames_per_sdu values.
So as a side effect this change adds the capability to pack multiple
audio frames into a single SDU - tested with 2 frames every 20ms.

Signed-off-by: Casper Bonde <casper_bonde@bose.com>
2022-04-06 11:00:20 +02:00
Casper Bonde
4d6b0ee47d Bluetooth: Stream: Add functions to parse codec parameters
This is the opesite of the macros to build codec configurations.
As some information was not up-to-date with the adopted
specification this change also includes alignment of the assigned
numbers in the Generic Audio section.
The codec config macros currently in lc3.h have moved from LC3
codec config parameters in the older specification to generic
codec configuration parameters in the adbpted specification.
This is why these additions have been made in the audio.h API
file rather in lc3.h. It is the expectation that lc3.h will be
merged into audio .h at some point.

Signed-off-by: Casper Bonde <casper_bonde@bose.com>
2022-04-06 11:00:20 +02:00
Emil Gydesen
04cfb06875 Bluetooth: ISO: Add ISO recv timestamp flag
Add a flag that is set when the timestamp is supplied
by the controller when receiving ISO packets.

Previously we used 0 to indicate this, but a timestamp
value of 0 is a valid value, and should not be used
to indicate that it is not present.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-04-06 11:00:10 +02:00
Emil Gydesen
ffedee6e39 Bluetooth: ISO: Change ISO recv flags to bitfield
Change the receive flags in the struct bt_iso_recv_info
to a bitfield instead of a single value. This will allow
us to extend the flags with more options.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-04-06 11:00:10 +02:00
Krzysztof Chruscinski
653cda5029 logging: Fix LOG_OVERRIDE_LEVEL option
When option is set whole logs shall be set to minimum
of CONFIG_LOG_OVERRIDE_LEVEL. However, module was not
registered when module specific level was set to NONE.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-04-06 10:59:57 +02:00
Marcin Szkudlinski
033dbae787 lib/mem_blocks: add allocation for contiguous memory blocks
Added allocation and freeing of a contiguous memory blocks

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2022-04-05 14:29:33 -04:00
Marcin Szkudlinski
297321a9e1 lib/os: sys_mem_blocks_get added
memory block should allow not only allocate memory but also
getting an arbitrary chosen part of memory.
Mixing of allocate and get, however possible, may be dangerous
because alloc may get any of memory. So be careful.

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2022-04-05 14:29:33 -04:00
Marcin Szkudlinski
6c6a16d3b9 lib: bitarray: sys_bitarray_test_and_set_region added
a method to check and set/clear a chosen region in a bitmap
if not previously set/cleared in a single atomic operation.
Useful for keeping track of resources usage, like memory banks

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2022-04-05 14:29:33 -04:00
Jose Alberto Meza
b8e1ce7f98 include: drivers: espi: Add additional peripheral notifications
Expand API to allow additional eSPI driver callbacks coming from
eSPI peripheral channel.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-04-05 11:19:03 +02:00
Gerard Marull-Paretas
c925b5991a include: remove unnecessary autoconf.h includes
The autoconf.h header is not required because the definitions present in
the file are exposed using the compiler `-imacros` flag.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-05 11:18:20 +02:00
Jiafei Pan
227d1ea1bb arm64: mmu: provide more memory mapping types for z_phys_map()
ARM64 supports more memory mapping types for device memory (nGnRnE,
nGnRE, GRE), add these mapping support for os common mapping API
function z_phys_map().

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-04-05 11:17:47 +02:00
Carlo Caione
b91d21d32c dt: mpu: Generate MPU regions from DT nodes
Currently the only way for a BOARD/SOC to configure at compile time the
MPU regions is to add, in a soc-specific file, the 'mpu_config' struct
adding static entries for the new regions with the needed attributes
(cacheable, non-cacheable, etc...). This exported struct is then read by
the MPU driver at boot time and used to properly setup the MPU regions.

At the same time it is now possible to introduce new memory regions in
the DT using the newly introduced 'zephyr,memory-region' attribute.

What is missing is the link between these two solutions: that is how to
declare the memory regions in the DT and automatically configure these
regions in the MPU with the correct attributes.

This patch is trying to address exactly this problem.

It is now possible to declare the memory regions in the DT and define
the MPU attributes for the regions using the 'zephyr,memory-region-mpu'
property. When this new property is present together with the
'zephyr,memory-region' property and a the 'zephyr,memory-region'
compatible, the 'mpu_config' struct is automatically extended at
compile-time to host the DT defined regions with the correct MPU
attributes.

So for example in the DT we can now have:

       sram_cache: memory@20200000 {
                compatible = "zephyr,memory-region", "mmio-sram";
                reg = <0x20200000 0x100000>;
                zephyr,memory-region = "SRAM_CACHE";
                zephyr,memory-region-mpu = "RAM";
        };

and a new region will be created called "SRAM_CACHE" and a new MPU
region will be configure at boot time with the attribute
"REGION_RAM_ATTR".

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-04-05 11:16:31 +02:00
Anders Storrø
7963c819f2 Shell: String to numeric conversion utils
Adds string to numeric conversion utility for shell.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2022-04-05 09:21:52 +02:00
Maureen Helm
e8a369e7da drivers: spi: Fix SPI_DT_SPEC initializer for XCC toolchain
XCC (which is based on GCC 4.2) needs the initializer of one of the
union elements to be enclosed in brackets.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-04-04 14:40:19 -07:00
Carlo Caione
cd51657ed1 devicetree_regions: Fix fallback on token
Fix the wrong fallback on token and add a new test to catch this kind of
errors early.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-04-04 14:02:25 -07:00
Yuval Peress
5416abfe5f util: convert wait_for macro to uppercase
This macro conflicts with C++'s std::condition_variable::wait_for
and makes it very difficult to use Zephyr with C++. Replace it with
an all uppercase name which fits the naming standard better.

Signed-off-by: Yuval Peress <peress@google.com>
2022-04-04 09:50:28 -05:00
Davide Bortolami
9ae5f64c8c usb: hid: Fix USB HID Doxygen doc
The documentation mistakenly mentioned ret_bytes instead of max_data_len
Corrected to match usb_dc_ep_read

Signed-off-by: Davide Bortolami <davide.bortolami@thinksmartbox.com>
2022-04-04 09:43:30 -05:00
Herman Berget
40237f3e99 Bluetooth: Host: Make bt_eatt_count public
bt_eatt_count returns the number of EATT channels connected for a given
connection.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-04-04 14:22:22 +02:00
Herman Berget
a4a6e7a042 Bluetooth: Host: Make bt_eatt_connect connect up to BT_EATT_MAX channels
bt_eatt_connect may now send multiple credit based connection requests.
Previously it would only send one and thus only allow 5 EATT channels to
be connected.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-04-04 14:22:22 +02:00
Gerard Marull-Paretas
ee91cd5665 drivers: pwm: add Doxygen in/out tags to parameters
Indicate wether pointer parameters are input or output. This information
is useful for API users.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-01 21:26:34 +02:00
Gerard Marull-Paretas
f0f541e6cb drivers: pwm: improve some Doxygen docstrings
Make some docstrings a bit more clear/concise.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-01 21:26:34 +02:00
Gerard Marull-Paretas
cc2411f644 drivers: pwm: use UINT32_MAX for overflow checks
Some values are limited to 32-bit, UINT32_MAX can be used to check if
they overflow.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-01 21:26:34 +02:00
Gerard Marull-Paretas
ab71d26a87 drivers: pwm: improve include list
- sort includes (libc, zephyr)
- make header self-contained
- remove redundant includes

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-01 21:26:34 +02:00
Gerard Marull-Paretas
59ecdcef02 drivers: pwm: improve formatting
Improve formatting (parameters alignment, declarations, etc.).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-01 21:26:34 +02:00
Gerard Marull-Paretas
a7706c5d44 drivers: pwm: group all capture APIs together
Group all capture APIs together for better readability. Previous to this
patch, get_cycles() as placed at the end.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-01 21:26:34 +02:00
Gerard Marull-Paretas
149e863c18 drivers: pwm: use essentially boolean expressions
s/if (err)/if (err < 0)

Ref. MISRA rule 10.1.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-01 21:26:34 +02:00
Gerard Marull-Paretas
14a2c584d4 drivers: pwm: improve error handling code and docs
Do not convert get_cycles_per_sec() failures to -EIO, just propagate the
failure code since the failure is not handled. As a consequence, all
Doxygen docstrings have been updated.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-01 21:26:34 +02:00
Gerard Marull-Paretas
0edd98af49 drivers: pwm: make API dereferencing homogeneous
Always use const pointer (dev->api is const)

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-01 21:26:34 +02:00
Gerard Marull-Paretas
42c05b7f38 drivers: pwm: hide API ops from public documentation
Hide all API ops (typedefs and struct) under INTERNAL_HIDDEN. This is
information required by drivers only, not API clients.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-01 21:26:34 +02:00
Gerard Marull-Paretas
48ecf514cd drivers: pwm: improve some Doxygen aspects
- remove redundant @typedef
- remove redundant @a (function with () automatically resolves)
- use @see instead of "See..."

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-01 21:26:34 +02:00
Sjors Hettinga
951983191b drivers: net: loopback: Add interface to simulate packet drop
To allow for high level robustness tests on protocols, add an interface
to control the packet drop rate. A rate of 0 means no packet dropped, a
rate of 1 means all packets being dropped.

Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
2022-04-01 12:36:14 -05:00