Wi-Fi bands are regulated by a governing body depending on operating
country, add support for the user to provide a country of operation as a
hint to the Wi-Fi chipset.
Ideally if the chipset supports this is all handled internally, in that
case "get" is useful but for testing and other usecases add a "set" as
well, similar to "iw reg set" or "country_code=" configuration in
hostapd/wpa_supplicant in Linux world.
This add a new offload API operation "reg_domain" that can be used to
either get or set the regulatory information.
The validation is left to the underlying chipset, shell only does basic
validation, (XY/00).
This is just a regulatory hint to the chipset, there could be other
regulatory hints e.g., beacon that can override this configuration, so,
an additional option to force this setting despite other hints is also
given for testing purposes.
FYI, the standard database used is [1].
[1] - https://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git/tree/db.txt
Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
Add the ability to change supported contexts in PACS.
Enhance the context command in the shell module to make it configurable.
Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
BOOT_MAGIC_SZ and BOOT_MAX_ALIGN were used in the header without
including bootutil/bootutil_public.h. This change remove the need of
the inclusion by making the dependency private.
Fixes#52095
Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
While nPM1100 is to be operated in fixed configuration for some
applications, it has some degree of configuration via GPIOs. For
example, mode (auto/PWM) can be configured via MODE pin. VBUS current
can also be adjusted using ISET pin, even though there is no API yet to
limit the PMIC input current.
This patch adds a new regulator class driver for nPM1100 PMIC, so that
it can be used with the standard regulator API when needed.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
In some case, we may need to describe a domain clock for a device
while there is no way to configure it (ex: USB clock set on PLL_Q output
on F405 devices > It is not selectable).
Then, configuring a device clock domain in the clock_control driver
will allow to retrieve its subsys rate.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
The CP app sends PD a "command" and the PD responds to it. Some times,
the PD has something that it wants to tell the PD which it does so in
response to POLL command. Both CP and PD apps need a way to exchange
these info over the OSDP bus. To archive this we will introduce what are
called "events" that allow the PD app to enqueue and CP app to get
notified.
This is analogous to the incumbent "commands" abstraction where, the CP
app enqueues a command and the PD app gets notified of it.
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
Define the index where arch specific faults start. This is a specific
number to avoid arch specific fault values changing each time a new
generic fault is added.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This allows enum values to be referenced in architecture `arch.h` files
without circular dependencies.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Pending state flag was only used by the UDC nRF USBD driver.
With the introduction of busy state flag it is no longer needed
and can be removed.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Will be replaced by APIs:
- openthread_state_changed_cb_register
- openthread_state_changed_cb_unregister
Signed-off-by: Nick Ward <nick.ward@ftpsolutions.com.au>
Add a new callback list structure for state change information.
These APIs are meant to eventually replace the single callback API
provided by openthread_set_state_changed_cb().
This will allow multiple users to gain information about
OpenThread stage changes.
Note CONFIG_OPENTHREAD_MAX_STATECHANGE_HANDLERS
with OpenThread's otSetStateChangedCallback() API can also be
used to enable registration of multiple callbacks of this type but this
cannot be modified if a certified OpenThread binary is used in the
build.
Signed-off-by: Nick Ward <nick.ward@ftpsolutions.com.au>
Add IS_BIT_MASK() macro for determining whether a value is set bits
continuously from the LSB.
This macro is not dependent on bit-width and works in contrast to
BIT_MASK() and BIT64_MASK().
IS_SHIFTED_BIT_MASK() is a version of IS_BIT_MASK() that allows setting
the start bit of continuous bits.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
Improves the documentation when OR'ing multiple events of the same
group together to describe that this is only supported for events
that are part of the same group, giving example of correct and
incorrect usage.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
After adopting the `<sys/stat.h>` header from picolibc, there is
a possibility that the following types are not defined.
```cpp
typedef int dev_t;
typedef int ino_t;
typedef unsigned short nlink_t;
typedef unsigned short uid_t;
typedef unsigned short gid_t;
typedef unsigned long blksize_t;
typedef unsigned long blkcnt_t;
```
Of the above missing types, the oonly ones that are used today
in Zephyr are `blksize_t` and `blkcnt_t`.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
The original format of this file as imported from PicoLibC was not
compatible with Zephyr's coding stytle. This change fixes
compliance issues listed below:
- whitespace formatting
- block comment formatting
- named parameters
Introduction of new typedefs should be considered false-negatives
as these are existing standard POSIX types.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
This may be getting ahead of the curve a bit, but here we adopt
the `<sys/stat.h>` header from picolibc. It is mostly the same
as that of newlib but the picolibc variant seemed to be slightly
more "inclusive".
Removed the `<_ansi.h>` include.
The commit immediately following this declares a few missing types
only if they are not already declared.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Previously, `<sys/stat.h>` was declaring the following constants
which should be declared in `<fcntl.h>` according to POSIX.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
The remaining types that needed to be harmonized between
Newlib and Zephyr's POSIX definitions are:
* `struct sched_param`
- don't re-define if using minimal libc
* `pthread_attr_t`
- convert to `struct pthread_attr`
- define type if using minimal libc
- assert acceptible object size
* `pthread_mutexattr_t`
- convert to `struct pthread_mutexattr`
- define type if using minimal libc
- assert acceptible object size
* `pthred_condattr_t`
- convert to `struct pthread_condattr`
- define type if using minimal libc
- assert acceptible object size
* `pthread_once_t`
- adopt newlib definition
- define type if using minimal libc
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Zephyr's `SCHED_RR` and `SCHED_FIFO` definitions were slightly
different than Newlib's. Additionally, the test had hard-coded
magic numbers instead of using symbolic values.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Part of the POSIX Roadmap for LTSv3 is to adopt POSIX-related
headers from Newlib. The strategy to get there is to first make
the existing POSIX subsystem work in the presence of Newlib POSIX
types.
Part of the strategy involved adopting Newlib's `uint32_t`
abstraction for some Zephyr POSIX types.
However, some types are declared as structures. Luckily, the API
only passes those structures around in the form of pointers, and
the API only mutates those structures via global functions. With
that, we are able to alias Newlib POSIX types as Zephyr POSIX
structures.
One of the caveats to doing that without introducing stack
corruption is to ensure that the Zephyr POSIX types are <= their
respective Newlib counterparts.
There was only one Zephyr structure for which that requirement
did not hold: `pthread_attr_t`. We left `pthread_attr_t` as the
Newlib definition, and named the Zephyr variant
`struct pthread_attr`.
On 32-bit machines, both structures were 32-bytes.
```
sizeof(pthread_attr_t): 32 sizeof(struct pthread_attr): 32
```
However, on 64-bit machines, `pthread_attr_t` was 40 bytes, while
`struct pthread_attr` was 48 bytes.
```
sizeof(pthread_attr_t): 40 sizeof(struct pthread_attr): 48
```
That triggered the following assertion.
```
BUILD_ASSERT(sizeof(pthread_attr_t)
>= sizeof(struct pthread_attr));
```
The `stacksize` field was subsequently changed from `size_t` to
`uint32_t`, and that reduced the latter to 40 bytes as well,
solving the last real problem.
```
sizeof(pthread_attr_t): 40 sizeof(struct pthread_attr): 40
```
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Define `PTHREAD_CREATE_DETACHED` and
`PTHREAD_CREATE_JOINABLE` to be compatible with the Newlib
definitions.
This is a temporary workaround for #51211 until Newlib
headers are pulled in.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
The `fcntl.h` header has never been a part of ISO C so move it to
`include/zephyr/posix`.
To ensure a smooth migration, a header was left in
`lib/libc/minimal/include` that prints a deprecation warning.
Users should either include `<zephyr/posix/fcntl.h>` or switch to
`CONFIG_POSIX_API=y`.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
The `sys/stat.h` header has never been a part of ISO C so move it
to `zephyr/include/posix/sys/`.
To ensure a smooth migration, leave a stub header in
`lib/libc/minimal/include/sys/` that prints a deprecation warning
suggesting developers either include `<zephyr/posix/sys/stat.h>`
or use `CONFIG_POSIX_API=y`.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
RISC-V has a modular design. Some hardware with a custom interrupt
controller needs a bit more work to lock / unlock IRQs.
Account for this hardware by introducing a set of new
z_soc_irq_* functions that can override the default behaviour.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Some regulators are enabled by default, however, such condition cannot
be captured now by the regulator driver API. Refactor
regulator_common_init_enable to regulator_common_init (enable removed,
as it also sets mode) and add a new argument to specify such condition.
With this change, regulator_disable() and regulator_is_enabled() work as
expected without a first call to regulator_enable().
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Added UUIDs for Telephony and Media Audio Service
(0x1855) and Public Broadcast Announcement (0x1856).
Fixes#53488
Signed-off-by: Mark Watson <markus.c.watson@gmail.com>
Some RISC-V SoCs implement a mechanism for hardware supported stacking /
unstacking of registers during ISR / exceptions. What happens is that on
ISR / exception entry part of the context is automatically saved by the
hardware on the stack without software intervention, and the same part
of the context is restored by the hardware usually on mret.
This is currently not yet supported by Zephyr, where the full context
must be saved by software in the full fledged ESF. This patcheset is
trying to address exactly this case.
At least three things are needed to support in a general fashion this
problem: (1) a way to store in software only the part of the ESF not
already stacked by hardware, (2) a way to restore in software only the
part of the context that is not going to be restored by hardware and (3)
a way to define a custom ESF.
Point (3) is important because the full ESF frame is now composed by a
custom part depending on the hardware (that can choose which register to
stack / unstack and the order they are saved onto the stack) and a part
defined in software for the remaining part of the context.
In this patch a new CONFIG_RISCV_SOC_HAS_ISR_STACKING is introduced that
enables the code path supporting the three points by the mean of three
macros that must be implemented by the user in a soc_stacking.h file:
SOC_ISR_SW_STACKING, SOC_ISR_SW_UNSTACKING and SOC_ISR_STACKING_ESF
(refer to the symbol help for more details).
This is an example of soc_isr_stacking.h for an hardware that doesn't do
any hardware stacking / unstacking but everything is managed in
software:
#ifndef __SOC_ISR_STACKING
#define __SOC_ISR_STACKING
#if !defined(_ASMLANGUAGE)
#define SOC_ISR_STACKING_ESF_DECLARE \
struct __esf { \
unsigned long ra; \
unsigned long t0; \
unsigned long t1; \
unsigned long t2; \
unsigned long t3; \
unsigned long t4; \
unsigned long t5; \
unsigned long t6; \
unsigned long a0; \
unsigned long a1; \
unsigned long a2; \
unsigned long a3; \
unsigned long a4; \
unsigned long a5; \
unsigned long a6; \
unsigned long a7; \
unsigned long mepc; \
unsigned long mstatus; \
unsigned long s0; \
} __aligned(16)
#else
#define SOC_ISR_SW_STACKING \
addi sp, sp, -__z_arch_esf_t_SIZEOF; \
DO_CALLER_SAVED(sr);
#define SOC_ISR_SW_UNSTACKING \
DO_CALLER_SAVED(lr);
#endif /* _ASMLANGUAGE */
#endif /* __SOC_ISR_STACKING */
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Add fuel_gauge_set_property function to the fuel gauge API with starting
writable property of SBS specific manufactuer access.
Signed-off-by: Aaron Massey <aaronmassey@google.com>