The commit adds check, to flash_area_open, whether there is any
device driver attached and returns -ENODEV if there isn't any.
This works around a problem where flash_area_open succeeds but
consecutive read/write causes crash.
It is enough to check the condition, and return error, here as
the flash_area_open has to precede, and be checked for success,
any read/write operations.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Add a pseudo device diver with device tree bindings for coredump.
The device tree bindings exposes memory address/size values to be
included in any dump. And the driver exposes an API to add/remove
dump memory regions at runtime.
Signed-off-by: Mark Holden <mholden@fb.com>
Adds a function to query device handles that have been injected as a
dependency into a device.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Update the device handle array for injected devices to output device
handles, not device ordinals. This requires that the extra ordinals
provided to `DEVICE_DT_INST` map to an existing device in order to
appear in the final handle array.
This is required for the injected handles to be useful, no meaningful
operations can be done on device ordinals.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
AddBluetooth continuous glucose monitoring service (CGMS)-related uuid
BT_UUID_CGMS for Continuous Glucose Monitoring
BT_UUID_CGM_MEASUREMENT for CGM Measurement
BT_UUID_CGM_FEATURE for CGM Feature
BT_UUID_CGM_STATUS for CGM Status
BT_UUID_CGM_SESSION_START_TIME for CGM Session Start Time
BT_UUID_CGM_SESSION_RUN_TIME for CGM Session Run Time
BT_UUID_CGM_SPECIFIC_OPS_CONTROL_POINT for CGM Specific Ops Control Point
BT_UUID_RECORD_ACCESS_CONTROL_POINT for Record Access Control Point
Signed-off-by: Wentong LI <wentong.li@nordicsemi.no>
The unicast audio group can not have streams removed after the
CIG has been created as part of the QoS set procedure.
The bt_audio_unicast_group_remove_streams function may
leave the unicast group without streams, and thus the
check for "free" group was not correct, and has been replaced
with a simple boolean value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The ISO security implementation works by verifying
against the acl (bt_conn) sec_level field. The
bt_conn sec_level field is only available
if CONFIG_BT_SMP is enabled, so this commit
adds guards for all ISO security checks as well.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If the required_sec_level is lower than the
conn->sec_level, the central will now initialize the
security procecure to ensure that the CIS is encrypted
properly.
The algorithm implemented is as follows:
1) Check security levels for each (acl, iso) pair
2) For those with insufficient security,
call bt_conn_set_security
3) For those with sufficient security, connect the CIS
4) Once the ISO from 2) has been encrypted, connect the
CIS for the specific ACL
The idea behind this was to implement similar support
for autonomous encryption as we have for L2CAP.
It is more complex for ISO as we are dealing with
an array of (acl, iso) pairs, meaning more can go
wrong.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit globally defines the `Z_LIBC_DATA` macro, which is used to
place variables into the libc memory partition, so that it can be
re-used.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Add a new flag, indicating if packet has already been processed by L2 or
not. This can be used with AF_PACKET sockets, to select a proper socket
type for currently processed packet.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Adds few missing zephyr/ prefixes to leftover #include statements that
either got added recently or were using double quote format.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit adds `extern "C"` to `timing.h` so that C function names do
not get mangled when including this header file from a C++ source file.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit overrides the following toolchain type macros to match the
respective base types overridden by the `zephyr_stdint.h`:
* __INT_FAST32_TYPE__
* __INT_FAST64_TYPE__
* __UINT_FAST32_TYPE__
* __UINT_FAST64_TYPE__
* __INT_LEAST32_TYPE__
* __INT_LEAST64_TYPE__
* __UINT_LEAST32_TYPE__
* __UINT_LEAST64_TYPE__
This is in preparation for adding the `PRIx{FAST,LEAST}N` macros in the
Zephyr minimal libc `inttypes.h`, which assumes the types defined by
the `zephyr_stdint.h`.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Commit a36995e2a3 ("ring_buffer: fix designated initializer order
in RING_BUF_DECLARE") missed the RING_BUF_ITEM_DECLARE case.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Add Doxygen tags to dt-bindings/pwm/pwm.h so that the binding macros
show up on the documentation page.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
The instance based version macros were not added when the new
ADC_DT_SPEC* helpers were introduced. This means drivers are forced to
make usage of DT_DRV_INST(inst) macro to obtain a node identifier, the
parameter required by existing macros. Following other driver classes,
provide the ADC_DT_SPEC_INST* family of macros.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The instance based version macros were not added when the new
PWM_DT_SPEC* helpers were introduced. This means drivers are forced to
make usage of DT_DRV_INST(inst) macro to obtain a node identifier, what
is required by existing macros. Following other driver classes, provide
the PWM_DT_SPEC_INST* family of macros.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Before this change, the doc on `bt_gatt_discover_func_t` gives the
impression that the type of `user_data` depends on `attr->uuid`. That is
partially incorrect. It is more accurate to say that the type depends on
the discovery type because that determines the ATT operation, which in
turn determines if the data is available.
Add documentation on `user_data` for the discovery type
`BT_GATT_DISCOVER_STD_CHAR_DESC`.
Add a hint `bt_gatt_discover_func_t` that `bt_gatt_read` can do a
different kind of attribute lookup, read-by-type, which may be
more convenient in some cases.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Update the new API to use K_USER as the flags for both
CONFIG_USERSPACE and CONFIG_TEST_USERSPACE. Also, fix the linker
script to properly include the suites, tests, and rules.
Fixes#44108
Signed-off-by: Yuval Peress <peress@google.com>
IRQn_Type is compiled to int8_t if __NVIC_PRIO_BITS is not set. It
implies the maximum postive value of the peripheral irq is 127. This
would lead to an irq number turns into a nagtive value if it is greater
than 127.
For example:
The input argument `irq` of arch_irq_enable is 130. But the input
argument of NVIC_EnableIRQ becomes (IRQn_Type)130 = -126 and results
error.
```
void arch_irq_enable(unsigned int irq)
{
NVIC_EnableIRQ((IRQn_Type)irq);
}
```
By adding a maximum IRQ number, the bit width of IRQn_Type is guaranteed
to cover all IRQ numbers of the system.
Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
Seen in some Coverity runs that it was complaining about unused
variable. Variables are used only in one path of _Generic.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Use single fixed size on stack array instead of compile time fitting.
When compiler is optimizing it can pick smallest array but with no
optimization there is an increased stack usage.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
The StackGuard area is used to save the esf and run the exception code
resulting from a StackGuard trap. Size it appropriately.
Remove redundancy, clarify documentation, etc.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
There are legitimate cases where both ARCH_THREAD_STACK_SIZE_ADJUST()
and ARCH_THREAD_STACK_RESERVED() may be defined at the same time.
It is important for the former to be exposed to the later in that case,
so add K_THREAD_STACK_RESERVED to the argument instead of the result.
Similarly for Z_THREAD_STACK_OBJ_ALIGN() which needs the adjusted size
to provide the proper result. That's what K_THREAD_STACK_LEN() does
already anyway, so fold Z_THREAD_STACK_SIZE_ADJUST() into the definition
of Z_THREAD_STACK_OBJ_ALIGN() directly.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Change order of designated initializers for ring_buf struct in the
RING_BUF_DECLARE macro, to match the order in the struct definition.
This fixes compilation when using C++, which requires using the same
order as in the struct definition.
Fixes#45697
Signed-off-by: Jonas Otto <jonas@jonasotto.com>
chan_filter is used when a specified channel is required
so a specified channel needs to be returned,
otherwise it should return einval instead of the last channel tried
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Sometimes it is important to know when the backend fails to send out
data because no memory / buffers are available. Return -ENOMEM in that
case.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
When the loopback drops driver packets, the number of dropped
packets is counted and can be requested externally.
Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
Add a "subscribe" callback in the bt_gatt_subscribe params, and
deprecate the "write" callback.
The purpose of this is to be able to return the subscription
parameters in the callback. The write callback
- (in principle) returns write parameters
- in fact returns nothing - the pointer is set to NULL
Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
Return `-ENOTSUP` on calls to device_runtime functions if the underlying
device does not support power management.
Fixes#45648.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Doxygen comments were existing, but they were not rendered anywhere in
the docs. The code is located under DFU, but I think it makes sense
to document it under storage, next to similar flash-related APIs.
Signed-off-by: Martin Jäger <martin@libre.solar>
The application can get the information about can_send
and can_recv in the bt_iso_chan_get_info function.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Instead of relying only on the `tx` and `rx` qos pointers,
we extract further information from the
bt_hci_evt_le_cis_established event to properly determine if we
can actually send or receive data.
This is useful to help determine which data paths to setup,
and whether to reject requests to send.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add macros that allow reading configuration for ADC channels from
child nodes of ADC controllers in devicetree.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Add inclusions of header files with devicetree related ADC definitions
to the nRF SoC dtsi files so that those definitions can be used also
for nRF SoC based boards.
Provide definitions of nRF ADC and SAADC analog inputs suitable
for use in devicetree.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
The documentation has wrongly stated that the function uart_poll_in() is
also a blocking function. The uart_poll_out() is indeed a blocking
function but uart_poll_in() has never been since day one.
Make it clear that the uart_poll_in() is a NON-blocking function, and
uart_poll_out() IS a blocking.
This fixes#45468.
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
This extends client implementation with Read Presets Request operation
support.
The implementation can maintain up to BT_L2CAP_TX_BUF_COUNT control
point requests so that user could perform/queue another Control Point
Operation if one is ongoing. E.g. preset can be selected from Read Preset
Response notification context or perform multiple operations if EATT
enabled.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Renaming this reference got forgotten in
5f19c8160a [subsys/settings: Update
bluetooth module]
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
Add the ability to have multiple irq priority levels which are not
masked by irq_lock() by adding CONFIG_ZERO_LATENCY_LEVELS.
If CONFIG_ZERO_LATENCY_LEVELS is set to a value > 1 then multiple zero
latency irqs are reserved by the kernel (and not only one). The priority
of the zero-latency interrupt can be configured by IRQ_CONNECT.
To be backwards compatible the prio argument in IRQ_CONNECT is still
ignored and the target prio set to zero if CONFIG_ZERO_LATENCY_LEVELS
is 1 (default).
Implements #45276
Signed-off-by: Christoph Coenen <ccoenen@baumer.com>
Add a variety of missing `DT_INST` and `_OR` variants for working with
`STRING_TOKEN` and `STRING_UPPER_TOKEN` macros.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
For a library which already provides a multi-thread aware errno, use
that instead of creating our own internal value.
Signed-off-by: Keith Packard <keithp@keithp.com>