Commit graph

15409 commits

Author SHA1 Message Date
Henrik Brix Andersen
5d5249d85b drivers: can: unify spelling of CAN Flexible Data-rate abbreviation
Unify spelling of CAN Flexible Data-rate abbreviation to "CAN FD" instead
of "CAN-FD". The former aligns with the CAN in Automation (CiA)
recommendation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-11-01 11:17:17 +00:00
Bartosz Bilas
ea0a5548cd drivers: regulator: extend API about count/list for the current limits
Extend the regulator API about support of `count_current_limits`
and `list_current_limit` functions for the current limits.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2023-11-01 11:00:39 +00:00
TOKITA Hiroshi
a9e49918cf drivers: interrupt_controller: Add icu driver for Renesas RA series
To avoid complicating the initial code for supporting the SoC,
I have implemented only the bare minimum for now.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-11-01 10:56:46 +00:00
TOKITA Hiroshi
04b723e900 drivers: pinctrl: Add pinctrl driver for Renesas RA series
To avoid complicating the initial code for supporting the SoC,
I have implemented only the bare minimum for now.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-11-01 10:56:46 +00:00
TOKITA Hiroshi
1741b3a356 drivers: clock_control: Add clock driver for Renesas RA series
Add initial support for Renesas RA clock generation circuit.

It returns a fixed value to simplify the first commit to get the UART
working now.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-11-01 10:56:46 +00:00
Krzysztof Chruściński
67676d8fbc linker: Fix missing DEVNULL_REGION for XIP configuration
DEVNULL_REGION was created only for !CONFIG_XIP. Moved definition
outside of that #ifdef.
Removed condition which was repeated as it is present at the beginning
of the file.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-10-31 11:21:10 +00:00
Witold Lukasik
f14c061dd6 shell: fix SHELL_SUBCMD_COND_ADD with NULL as _handler parameter
In dummy_subcmd_##syntax statement, syntax keyword
should be replaced with _syntax, that is the argument name.

In dummy_##syntax##_handler There are two problems:
 - wrong syntax keyword
 - _handler is an argument

So if NULL is passed as an argument to _handler, and the syntax is abcd,
there is: dummy_##abcd##NULL, what causes a build error.

Signed-off-by: Witold Lukasik <witold.lukasik@nordicsemi.no>
2023-10-31 10:24:02 +01:00
Flavio Ceolin
3d9b6bb9b2 kernel: heap in k_heap_init is nonnull
Mark the parameter h as nonnull in k_heap_init.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-31 09:00:02 +01:00
Flavio Ceolin
1701eea20f kernel: heap in k_heap_alloc is nonnull
Mark the parameter h as nonnull in k_heap_alloc.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-31 09:00:02 +01:00
Flavio Ceolin
d8ef78d7af kernel: heap in k_heap_aligned_alloc is nonnull
Mark the parameter h as nonnull in k_heap_aligned_alloc.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-31 09:00:02 +01:00
Flavio Ceolin
ade41376a5 kernel: heap in k_heap_free is nonnull
Mark the parameter h as nonnull in k_heap_free.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-31 09:00:02 +01:00
Flavio Ceolin
32d7b3645a toolchain: Add nonnull attribute
Add a new macro for __attribute__((nonnull))). This attribute
allows functions to declare which parameters shouldn't be null.
This helps to catch errors like:

void test(void *a, void *b, void *c) __attribute_nonnull(1, 3);

/zephyrproject/zephyr/samples/hello_world/src/main.c:28:9: warning:
argument 3 null where non-null expected [-Wnonnull]
   28 |         test(a, NULL, NULL);
      |         ^~~~

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-31 09:00:02 +01:00
Benjamin Lemouzy
5690387462 drivers: audio: add errors management
Add audio_codec_clear_errors and audio_codec_register_errors_callback
functions to manage audio codec errors.
Callback has to be called from dedicated thread to allow I2C or SPI
operations.

Signed-off-by: Benjamin Lemouzy <blemouzy@centralp.fr>
2023-10-30 13:50:37 -04:00
Flavio Ceolin
ecc544d69f headers: arch/cache: Drop extern attr from functions
Drop extern attribute from function signature.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-30 12:51:04 -04:00
Flavio Ceolin
8aa215ff45 headers: syscall_handler: Drop extern attr from functions
Drop extern attribute from function signature.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-30 12:51:04 -04:00
Flavio Ceolin
9910702378 headers: sw_isr_table: Drop extern attr from functions
Drop extern attribute from function signature.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-30 12:51:04 -04:00
Flavio Ceolin
f1482c18c2 headers: posix/dirent: Drop extern attr from functions
Drop extern attribute from function signature.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-30 12:51:04 -04:00
Flavio Ceolin
079a83d7f1 headers: sys/printk: Drop extern attr from functions
Drop extern attribute from function signature.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-30 12:51:04 -04:00
Flavio Ceolin
b7c3965991 headers: kernel_structs: Drop extern attr from functions
Drop extern attribute from function signature.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-30 12:51:04 -04:00
Flavio Ceolin
49a2ff75d3 headers: kernel_version: Drop extern attr from functions
Drop extern attribute from function signature.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-30 12:51:04 -04:00
Flavio Ceolin
a629ac5fac headers: posix/unistd: Drop extern attr from functions
Drop extern attribute from function signature.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-30 12:51:04 -04:00
Flavio Ceolin
51754e3a53 headers: sys/atomic_arch: Drop extern attr from functions
Drop extern attribute from function signature.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-30 12:51:04 -04:00
Flavio Ceolin
a077079f45 headers: sys/atomic: Drop extern attr from functions
Drop extern attribute from function signature.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-30 12:51:04 -04:00
Flavio Ceolin
1f86454d1a headers: sys/reboot: Drop extern attr from functions
Drop extern attribute from function signature.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-30 12:51:04 -04:00
Flavio Ceolin
01d61ba18b headers: kernel: Drop extern attr from functions
Using extern attribute in function signatures is not
necessary and it is not consistently across Zephyr headers.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-30 12:51:04 -04:00
Andrej Butok
f289c3149b doc: kernel: Fix double "the" for k_thread_deadline_set()
Fix double "the" in the k_thread_deadline_set() description.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2023-10-30 11:50:16 -04:00
Yong Cong Sin
df2c0681d3 devicetree: encode multi-level interrupt number in C devicetree magic
The multi-level encoding of the interrupt number currently
happens in the `gen_defines.py`, which is called in the
`dts.cmake` module after `kconfig.cmake`. However, the number
of bits used by each level is defined in Kconfig and this means
that `gen_defines.py` will not be able to get that information
during build.

To fix this, do the multi-level encoding in C devicetree macro
magic instead of the python script. This ticks one of a
long-standing TODO item from the `gen_defines.py`.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-10-30 11:43:39 -04:00
Yong Cong Sin
d7302f417e irq: relocate multi-level irq out of irq.h
Relocate multi-level interrupts APIs out of `irq.h` into
a new file named `irq_multilevel.h` to provide cleaner
separation between typical irq & multilevel ones.

Added preprocessor versions of `irq_to_level_x` as `IRQ_TO_Lx`.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-10-30 11:43:39 -04:00
Bjarki Arge Andreasen
28f5f2d1ed drivers: Add GNSS API public header
This commit adds the public header for the GNSS API, along
with the initial GNSS Kconfig file and an entry in the
common linker file for registered GNSS data callbacks.

A very naive implementation of the GNSS data callback is
provided as well in drivers/gnss/gnss_publish.c

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-10-30 11:43:19 -04:00
Bjarki Arge Andreasen
ed92612689 data: Add navigation utils header
This commit adds the initial navigation data type and tools
which will lay the foundation to share and process navigation
data between the application and navigation systems like GNSS
and similar triangulation technologies.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-10-30 11:43:19 -04:00
Krzysztof Chruściński
b1c207b257 logging: Use optimization for simple messages only in kernel
Optimized version of logging for simple messages can work
only in kernel space. Do not use it in user space.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-10-30 10:15:49 -04:00
Deepti Deshatty
1816775466 drivers: flash: provide api to reset the flash registers
changes enable flash driver to provide api interface to send reset memory
spi command to the spi flash. The reset memory command would bring the
spi flash to its default power-on state and loose all the volatile register
settings.
Flash reset is needed when more than one controller access the flash chip
in a shared mode.

Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com>
2023-10-30 09:27:42 +01:00
Dawid Niedzwiecki
0aed42f2ee mgmt: ec_host_cmd: improve handling buffer sizes
Add the len_max rx structure member to indicate maximum number of bytes
possible to receive. It is needed to send information about our protocol
parameters to host.

Also, limit the maximum size of request/responses for backends that uses
buffers provided by the handler.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-10-27 13:26:00 -05:00
Tomasz Bursztyka
c294b7d270 lib/acpi: Fix the behavior to fit with how it used to be
z_acpi_get_cpu() used to retrieve the local apic on enabled CPU, where
n was about the n'th enabled CPU, not just the n'th local apic.
The system indeed keeps local apic info also about non-enabled CPU,
and we don't care about these as there is nothing to do about it.

This issue exists on up_squared board for instance, but it's a common
one anyway.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-10-27 17:36:31 +01:00
Henrik Brix Andersen
6ddde16bdb drivers: can: add missing documentation to can.h
Add missing doxygen documentation to the can.h header file.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-27 12:28:04 +02:00
Henrik Brix Andersen
2e2de9e5c2 drivers: eeprom: add missing documentation to eeprom.h
Add missing doxygen documentation to the eeprom.h header file.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-27 12:27:31 +02:00
Krzysztof Chruściński
78bf8ebf75 logging: Allow keeping module names in dedicated section
When CONFIG_LOG_FMT_SECTION is enabled then module name strings
are also placed in the dedicated section used for all logging
strings.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-10-27 11:42:21 +02:00
Krzysztof Chruściński
59abf921c1 logging: Add option to remove strings from binary
Add option to remove string literals which are constant and
never touched by the firmware. It can save significant amount
of RO memory.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-10-27 11:42:21 +02:00
Krzysztof Chruscinski
dfb3674c4c linker: Add devnull memory for cortex_m and riscv32
Added memory region which is intended to be removed from the final
binary but may be using in byproduct to extract data used by the
host tools (e.g. strings used by logging).

Add devnull region to Cortex-M and RISCV linker scripts.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-10-27 11:42:21 +02:00
Guennadi Liakhovetski
5064df0500 llext: copy complete string sections while parsing ELF
This has several advantages:

1. we don't need any hard assumptions about symbol length. The
current hard-coded limit of 32 characters might well be not true.
2. replaces a lot of code for reading those names with a single
call to a 1-line function to calculate string location.
3. eliminates the need to allocate buffers for exported symbol names
by replacing them with a simple pointer assignment.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-10-27 10:51:49 +02:00
Krzysztof Chruściński
a68cdb0558 logging: Optimize handling of simple and common log messages
Some compilers (e.g. riscv32) does not handle well complex macros
for logging. Generated code is bigger than expected (e.g. riscv32
code is almost twice bigger than cortex-m code). Use of logging can
lead to unexpected code increase.

To handle that an analysis of the zephyr code base was performed and
it shown that 75-80% of logs are simple strings with 0 arguments
(~45%), one 32 bit argument (~26%) or two 32 bit arguments (~6%).
Given that a set of dedicated macro were created which are applied
to those 3 cases which on 32 bit platform create very simple log
messages without padding or alignment needed.

Such dedicated macros save up to 40% of code (riscv32) and also
executes 30% faster (arm cortex and riscv32).

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-10-27 10:50:39 +02:00
Krzysztof Chruściński
182555b3df sys: cbprintf: Add macro for determining if argument fit in 32 bit word
Add Z_CBPRINTF_IS_WORD_NUM(x) which determines if argument is a
number that can fit in 32 bit word. It is used by logging macros
optimized for handling strings with numeric arguments.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-10-27 10:50:39 +02:00
Krzysztof Chruściński
900f9c3b24 logging: log_frontend: Add optional API for common messages
Extend frontend API with optional set of functions which can
be used when simplified log message handling is enabled. If this
mode is enabled then there are dedicated macros for processing the
most common messages (string + 0-2 word arguments). Using this API
can speed up the processing of messages that are the most common.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-10-27 10:50:39 +02:00
Krzysztof Chruściński
1a0e8d6f9e logging: log_msg: Add functions for handling simple log messages
In preparation for new feature which optimizes handling of
the most common log messages (0-2 32 bit word arguments) add
functions dedicated for that purpose.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-10-27 10:50:39 +02:00
Marc Desvaux
72aee4b90b drivers: clock_control: stm32: add an option to enable CRS for HSI48
for nucleo_stm32g0b1 board.
the HSI48 clock is the clock used by default for the USB controller,
however its default tolerance is not enough for the USB specification,
leading to some random errors depending on many factors, including the
upstream HUB or host.

this commit adds an option in the device tree to enable the STM32 Clock
recovery system (CRS) using USB SOF packet reception as a reference,
which brings the HSI48 within the required accuracy for USB transfers.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-10-26 09:47:48 +02:00
Ali Hozhabri
e2c0cb979f include: zephyr: drivers: modify SPI_CONFIG_DT to add CPOL, CPHA, HOLD_CS
Modify SPI_CONFIG_DT macro to config SPI clock polarity (CPOL),
clock phase (CPHA), and hold-cs.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2023-10-25 18:30:28 -07:00
Michael Arnold
aa08d5cc5c arch: Enable ramfunc support for other arch than arm
long_call is not supported on risc-v.
Enable long_call only on supported arm architecture.

Signed-off-by: Michael Arnold <marnold@baumer.com>
2023-10-25 17:35:07 +02:00
Anders Storrø
c51bb9c13b Bluetooth: Mesh: Update spec ref 1.0.1->1.1
Updates Bluetooth mesh specification references:

- Change "Profile" to "Protocol" since the main specification has
changed its name.
- Update/align formating of specification references. This will
make it easier to find spec references in the future.
- Change some section references to point to the correct section of the
newest version of the specification (v1.1).

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-10-25 14:50:14 +02:00
Yong Cong Sin
a068288091 shell: add new APIs to get the backend instances
Added some new APIs to get the backend instances more easily,
so that dev does not need to rely on `shell_backend_*_get_ptr`,
which looks more like a hack to access a local variable.

These APIs are basically copied from the log backend
implementation.

Added testcase for the APIs.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-10-25 09:57:29 +02:00
Yong Cong Sin
dd154406ba shell: make the backend thread name variable generic
Rename the shell backend `thread_name` variable to just `name`,
to be used for other things not specific to thread later.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-10-25 09:57:29 +02:00