Commit graph

15409 commits

Author SHA1 Message Date
Jordan Yates
f02bafcf78 device: macros for obtaining struct init_entry
Add macros for obtaining the `struct init_entry` associated with a
device, either from the devicetree node or by name.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-07-06 10:44:50 +02:00
Jordan Yates
caced72012 init: add Z_INIT_ENTRY_NAME
Add `Z_INIT_ENTRY_NAME` as a helper macro to construct names of
`struct init_entry` instances.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-07-06 10:44:50 +02:00
Jordan Yates
52d035bde1 init: remove __COUNTER__ concat in SYS_INIT name
Remove the `__COUNTER__` value being appended to `struct init_entry`
names. This is no longer necessary with the addition of
`SYS_INIT_NAMED`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-07-06 10:44:35 +02:00
Jordan Yates
ef8c6d4e5a init: add SYS_INIT_NAMED
Add a variant of `SYS_INIT` that is explicitly given a name, instead of
using the function name. This allows multiple `SYS_INIT` entries to use
the same initialisation function, without needing the `__COUNTER__`
hack in `Z_SYS_NAME`.

The `__COUNTER__` hack is undesirable as it makes it impossible to
reconstruct the name of the `struct init_entry` instance from the macro
parameters.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-07-06 10:44:35 +02:00
Emil Gydesen
8e08d79676 Bluetooth: Audio: Rename MICP mic_dev disable to mute disable
Made it more clear that the disable functionality is to
disable the mute functionality, but and not disabling
the microphone device itself.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-06 10:41:52 +02:00
Emil Gydesen
28f6e37ba8 Bluetooth: Audio: Rename struct bt_micp and cleanup
Rename struct bt_micp to bt_mic_ctlr as it is only
used ofr microphone controller now.

This also allow cleanup of the bt_micp struct, thus
removing the common internal micp_internal.h header file
and reducing the size of the implementation by not
using a union of the structs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-06 10:41:52 +02:00
Emil Gydesen
c8a6a51566 Bluetooth: Audio: Remove bt_micp argument for MICP mic_dev API
Since there is a split API now, the mic_dev does not need
to take a bt_micp pointer.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-06 10:41:52 +02:00
Emil Gydesen
e95b640df6 Bluetooth: Audio: Specify MICP Mic Dev API
Modify the existing bt_micp API for the
MICP Microphone Device to be more specific
by adding mic_dev as an infix. This follows
the naming scheme used for the MICP microphone
controller (mic_ctlr).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-06 10:41:52 +02:00
Emil Gydesen
3cf59fae72 Bluetooth: Audio: Add separate API for MICP mic ctlr
Add a bt_micp_mic_ctlr API that is used only
for the MICP Microphone Controller (Client).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-06 10:41:52 +02:00
Emil Gydesen
ff509027c1 Bluetooth: Audio: Rename bt_micp_aics functions
The AICS functionality is also possible via the bt_aics
API, and this was just a way to ensure that the AICS
instance was part of a MICS.

Removing makes MICP much simpler, and we can expect user
to know the context of a AICS.

This also fixes a few bad/missing guards.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-06 10:41:52 +02:00
Emil Gydesen
9eb5d0795f Bluetooth: Audio: Rename MICS to MICP
Use the profile abbreviation, MICP, instead of the
service abbreviation, MICS, for the MICP implementation.

The server implementation will use MICP and the client
implementation will use MICP_CLIENT for now, as that will
be updated in a future commit.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-06 10:41:52 +02:00
Emil Gydesen
67e570ea7e Bluetooth: Audio: Rename mics.h the Kconfig to micp
Rename the files to match the name of the profile (MICP)
instead of the service (MICS).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-06 10:41:52 +02:00
Gerard Marull-Paretas
32b9934b0f pm: remove PM_DEVICE_ACTION_FORCE_SUSPEND
PM_DEVICE_ACTION_FORCE_SUSPEND has been equivalent to
PM_DEVICE_ACTION_SUSPEND for a while. Release notes for Zephyr 2.7
mentioned its removal (see 76702e8ff3) but
for some reason it was kept.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-06 10:30:14 +02:00
Andreas Chmielewski
363e2f3014 net: coap: make coap vars configurable
COAP_DEFAULT_MAX_RETRANSMIT and COAP_DEFAULT_ACK_RANDOM_FACTOR
should be configurable to determine the max transmission
timeout of a CoAP packet.

Signed-off-by: Andreas Chmielewski <andreas.chmielewski@grandcentrix.net>
2022-07-05 21:56:34 +00:00
Thomas Stranger
a9e422e82b drivers: sensor: extend with w1 api for ROM config
This commit adds a sensor attribute and helper functions such that
the unique ROM of 1-Wire devices can easily configured.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-05 23:06:45 +02:00
Thomas Stranger
bb4f7b5a31 drivers: w1 introduce 1-wire net layer api
This commit introduces a new api for the net layer of Dallas
1-wire protocol.
For single drop configurations w1_read_rom, and w1_skip_rom commands are
provided.
For multidrop configurations w1_match_rom, w1_resume_command,
w1_search_rom, and w1_search_alarm routines are provided as well.
Additionally, the reset_select routine, conditionally depending on the
bus configuration, either executes a match_rom, or a skip rom command.
A w1_write_read command simplifies the typical scenario of addressing
a device, writing a few bytes to the device and reading back the answer.

Additionally w1_crc8, and w1_crc16 are added as wrappers around the
zephyr in-tree crc8 and crc16_reflect implementations.
The former may be used to verify the validity of the rom id, while the
latter is used for integrity checking of many eeprom, and authenticator
commands.

The general search command does not support filtering on
the family code.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-05 23:06:45 +02:00
Thomas Stranger
d63cf82a46 drivers: w1 introduce 1-wire api and common code
This commit introduces a new api for the Dallas 1-wire protocol.
The api includes link functions for read and write operations on
bit, byte, and block level, as well as functions to reset and
lock the bus.

The bus configuration is derived from the device tree and can be
queried using w1_slave_count routine.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-05 23:06:45 +02:00
Aurelien Jarno
4e3fabada2 usb: cdc_acm: add Line Coding Structure constants
Add line Coding Structure constants from CDC spec 6.3.11, table 17.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-07-05 18:00:24 +02:00
Carlo Caione
8c4f98d263 linker: Fix _vector_end symbol location
The 219d5b5adb commit is breaking the STM32F0 platforms.

The problem is that the PR is changing the location the _vector_end
symbol is pointing to. These platforms require the symbol to be pointing
to a location in memory after the IRQ vector table.

Fix the issue by introducing a new _vector_end symbol when the IRQ
vector table is present that points to the correct location.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-07-05 15:40:55 +00:00
Teik Heng Chong
89075f42bb drivers: clock_control: Use Agile clock sub system as clock id
This patch is to direct use Agile clock sub system as clock id

Signed-off-by: Teik Heng Chong <teik.heng.chong@intel.com>
2022-07-05 15:38:54 +00:00
Carlo Caione
7a11d883cc riscv: Introduce RISCV_ALWAYS_SWITCH_THROUGH_ECALL
Some early RISC-V SoCs have a problem when an `mret` instruction is used
outside a trap handler.

After the latest Zephyr RISC-V huge rework, the arch_switch code is
indeed calling `mret` when not in handler mode, breaking some early
RISC-V platforms.

Optionally restore the old behavior by adding a new
CONFIG_RISCV_ALWAYS_SWITCH_THROUGH_ECALL symbol.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-07-04 18:18:10 +02:00
Alexandre Duchesne
b4034adec7 hal: gigadevice: Update gd32f4xx to firmware 3.0.0
Fix to support gd32f4xx update to firmware 3.0.0

Signed-off-by: Alexandre Duchesne <alexandre.duchesne@rtone.fr>
2022-07-04 18:07:51 +02:00
Thomas Stranger
61e2c29e9f dts: clock: stm32 common: bindings for pllp, pllq, pllr clock sources
This commit introduces bindings that allow socs compatible with the
stm32 common driver to use the pll outputs pll_p, pll_q, pll_r,
to be used as a clock source for peripherals.
These are to be used instead of the, now removed, STM32_SRC_PLLCLK.
Applies to: STM32G0, STM32G4, STM32L4, STM32L5, STM32WB, and STM32WL.

STM32F2, and STM32F4 are not considered: very similar but only very limited
configuration possible. Only I2S(EXTclock,PLL_R), MC01, MCO2,
PLL_Q for 48MHz clock, and PLL_P as PLLCLK.

Doesn't apply to STM32L0, and STM32L1 which only have PLLMUL and PLLDIV.

Doesn't apply to STM32F0, STM32F1, STM32F3 only having a PLLMUL,
and no divider.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Thomas Stranger
d5146e65c7 dt-bindings/clock: remove STM32_SRC_CLOCK_MIN / MAX definitions
The STM32_SRC_CLOCK_MIN and STM32_SRC_CLOCK_MAX defines
are not really needed because non valid clock sources are already
filtered out by the precompiler.

Only STM32_SRC_CLOCK_MIN was used once in code and can be replaced.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Emil Gydesen
4c471914b9 Bluetooth: Audio: Remove codec from bt_audio_broadcast_sink_sync
The codec (or rather codec configuration) is now taken from the
previously received BASE. This also means that the BASE (with
the codec configurations) is now also stored statically.

When the application attempts to synk to the broadcaster
the stack will lookup the codec configuration based on the
bis index, as a BASE may have multiple subgroups
with multiple codec configurations.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 16:08:52 +02:00
Emil Gydesen
bb6c0866d8 Bluetooth: Audio: Add PACS for broadcast sink
Add support for using PACS and/or capabilities for
the broadcast sink role. PACS and capabilities were
originally only supported for the unicast server
role, so the PACS callbacks were moved their own
struct, as if a device supports both the unicast
server role and the broadcast sink role, it will
only have a single PACS instance.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 15:59:09 +02:00
Emil Gydesen
3d8c3dfaa3 Bluetooth: Audio: Add parent service requirement if CSIS cnt > 1
If the number of CSIS instances on a device is
above 1, then each shall be included by another
service.

This creates a bit of a chicken and egg issue,
as we can't really register the "parant" service
before the CSIS instance has been registered,
and we thus can't verify if the parent service
pointer is actually another primary service on this
device. The best we can do is add the proper
type and a NULL check.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 15:52:58 +02:00
Emil Gydesen
de4b564754 zephyr: Fix n=0 for utf8_lcpy
The function used an assert if n was 0. Instead
of using an assert, the function will now just
not do anything. The documentation has also
been updated to reflect this.

The reasoning for this is that the strlcpy function
this (sort of) implements for utf8 works the same way.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 15:49:22 +02:00
TLIG Dhaou
0df7203aee include: zphyr: drivers: clock stm32 add HSISYS binding
Add the node HSISYS to the stm32 clock control driver.


Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-07-04 15:20:06 +02:00
HaiLong Yang
9bb8ae9f13 dts: introduce gd32 adc
Add support for gd32 adc.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2022-07-04 09:48:32 +02:00
Jordan Yates
4543f82c12 storage: flash_map: remove device_get_binding
Remove all usage of `device_get_binding` in the subsys by directly
storing the `const struct device*` in the `struct flash_area`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-07-02 16:04:16 +02:00
Christopher Friedt
3f6fbe1ab3 api: gpio: correct doxygen for return values in error cases
If a method is not supported by the driver, it should return
-ENOSYS, not -ENOTSUP.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-07-02 07:07:11 -04:00
Ryan Erickson
5495dae455 drivers: modem: hl7800: Add runtime control of log level
Default mode must be debug or it can't ever be enabled.
Allow debug log messages to be printed when using
mdm_hl7800_send_at_cmd API.
Add logging to active bands and network coverage commands.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-07-01 16:30:30 +02:00
Ryan Erickson
fb34a9749f logging: add log_source_id_get
Add API to get the logging module source ID from the
module name;

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-07-01 16:30:30 +02:00
Mariusz Skamra
cf30ac2bfc Bluetooth: has: Add support for Write Preset Name operation
This handles Write Preset Name operation that is used to change the
preset name. This covers as well changing the preset name by server.

Fixes: HAS/SR/CP/BV-04-C
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-07-01 11:37:02 +02:00
Krzysztof Chruscinski
abe1eb6ced toolchain: Add macro for keeping a symbol in the binary
Add LINKER_KEEP macro which can be used to prevent linker garbage
collector from removing unused symbol (function or variable).

Example use case is to use it for functions which are part of a test
application which has functions which are indirectly called by the
host test tools. Since they are not called explicitely by the
application so without marking them with LINKER_KEEP they would be
removed by the linker garbage collector.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-07-01 11:33:30 +02:00
Abramo Bagnara
795500bbe3 coding guidelines: comply with MISRA C:2012 Rule 9.3
MISRA C:2012 Rule 9.3 (Arrays shall not be partially initialized.)

Systematically use `{0}' to specify full 0 initialization
(not `{}', not `{0U}').

Signed-off-by: Abramo Bagnara <abramo.bagnara@bugseng.com>
Signed-off-by: Simon Hein <SHein@baumer.com>
2022-06-30 17:34:05 -04:00
Kumar Gala
29c993fc0f spi: Add SPI_CS_GPIOS_DT_SPEC_INST_GET macro
We didn't have an "INST" verion of SPI_CS_GPIOS_DT_SPEC_GET.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-30 19:42:14 +00:00
Giuliano Franchetto
5ca0bbac96 logging: hide logging from jetbrains idea
For now, the logging subsystem is hidden from CDT to prevent freezing of
the IDE.
CLion has the same issue, where the IDE becomes slow with big RAM spikes.
Fortunately, CLion automatically defines a macro __JETBRAINS_IDE__ that we
can use

Signed-off-by: Giuliano Franchetto <giuliano.franchetto@intellinium.com>
2022-06-30 11:26:26 +02:00
Thomas Stranger
87ed12d796 dts: bindings: clock: Fix STM32G4 device clk src selection definitions
Some device clock sources selection helpers were not correctly defined.

With this commit the definitions are updated to match the desciption
in the reference manual RM0453.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-06-30 10:34:51 +02:00
Keith Packard
bc234fb1af libc/picolibc: Rework malloc arena setup
Picolibc inherited its malloc arena configuration from newlib instead of
from minimal libc. This ended up making it a bit too fragile to run the
full set of zephyr tests. In particular:

 * Z_MALLOC_PARTITION_EXISTS would get set when not used

 * Setting an arena size depended on a bunch of other values, including
   whether the system had an MMU or MPU, and whether the MPU required
   power-of-two alignment or not.

This patch cleans things up so that there is a single heap size specifier,
PICOLIBC_HEAP_SIZE.

 * If PICOLIBC_HEAP_SIZE is positive, this sets the size of the heap. On
   MMU systems, picolibc will only use the remaining memory if that's
   smaller.

 * If PICOLIBC_HEAP_SIZE is zero, then there is no heap available and
   malloc will always fail. This also disables Z_MALLOC_PARTITION_EXISTS.

 * If PICOLIBC_HEAP_SIZE is negative, then picolibc uses all remaining
   memory for the malloc heap.

The defaults are designed to allow tests to work without requiring
additional settings.

 * For MMU enabled systems, the default value is 1048576. It would be nice
   to have this use 'all available memory', but that's difficult to manage
   as the API which returns free memory (k_mem_free_get) doesn't take into
   account the amount of free virtual address space.

 * For MPU enabled systems which require power-of-two aligned MPU regions,
   the default value is 64kB.

 * For other systems, the default value is -1, indicating that all
   available memory be used for the malloc arena.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-30 10:33:24 +02:00
Krzysztof Chruscinski
715ae32501 lib: os: spsc_pbuf: Add option to get maximum utilization
Add option to track maximum utilization of the packet buffer.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-30 10:30:49 +02:00
Krzysztof Chruscinski
fa055f743f lib: os: spsc_pbuf: Extend API with zero copy model
Added functions which allow to use zero copy model for handling
data within the packet buffer.

Additionally, added handling of cache by adding option to keep rd_idx
in different cache line than wr_idx and data.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-30 10:30:49 +02:00
Daniel Leung
73a940e3b7 lib: os/cbprintf: make char[] work in C++ and tagged arguments
Strings in C++ are usually of type char[] instead of char*.
Therefore, this needs to be taken into account when doing
tagged arguments or else char[] would be tagged as simple
pointer. So fix this by adding a way to get the type of
elements in an array to determine if it is a char array.

Fixes #46761

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-06-30 14:03:45 +09:00
Tom Burdick
88ca215eed i2c: Update API terminology
Updates the API and types to match updated I2C terminology. Replaces master
with controller and slave with target.

Updates all drivers to match the changed macros, types, and API signatures.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-06-29 17:51:31 +02:00
Tom Burdick
19f8ba6a04 docs: i2c: Documentation terminology updated
The i2c terminology has been updated as such master is now controller,
and slave is now target. Updates all doc comments and doc pages to use
updated terminology. Does not change types or API definitions.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-06-29 17:51:31 +02:00
Eugene Cohen
1f93ece43d arch: arm64: program TG[1] in mmu init
In performing a double check of Zephyr arm64 MMU config
against edk2, a different in the programming of the
Translation Control Register (TCR) was found.  TCR.TG[1]
should be set to address Cortex-A57 erratum 822227:

"Using unsupported 16K translation granules might cause
Cortex-A57 to incorrectly trigger a domain fault"

Signed-off-by: Eugene Cohen <quic_egmc@quicinc.com>
2022-06-29 10:27:33 +02:00
YanBiao Hao
5f5c97a905 Bluetooth: Mesh: model sub status async callback
model sub status async callback

Signed-off-by: YanBiao Hao <haoyanbiao@xiaomi.com>
2022-06-29 10:26:00 +02:00
Emil Gydesen
c5fc32756a Bluetooth: Audio: Remove hardcoded location and context for LC3 macros
The BT_CODEC_LC3_CONFIG_* macros had a hardcoded location
and context, which makes them a lot less usable.

Updates the macro, and the macros that used them.
This also removes the BT_CODEC_LC3_CONFIG and instead
just uses the BT_CODEC_LC3_CONFIG_N macro, which has
then been renamed to BT_CODEC_LC3_CONFIG.

As an addition, the macros and their input has
also been better documented.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-06-29 10:24:49 +02:00
Emil Gydesen
573f34317c Bluetooth: Audio: LC3 rename _context to _stream_context
In LE Audio we both have Stream Context and Preferred Context.
Rename to make it more explicit what context should be supplied
to those macros.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-06-29 10:24:49 +02:00