The stream_flash_erase_page would update stream_flash_ctx member
last_erased_page_start_offset, to page offset it attempted to erase,
even if such operation failed.
The commit changes this behaviour so that in case of failure the
last_erased_page_start_offset would still hold previously, successfully,
erase page offset.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Move the ticker job_guard reset to after
ticker_job_compare_update, so that the ticks_current and
ticks_slot_previous are updated before ticker_worker gets
to execute. Without this fix, there is a possibility that
ticker_worker will use incorrect ticks_slot_previous and
ticks_current value under race conditions.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ticker job to defer itself to avoid recursive
invocation to itself due to ticker interface calls from
inside the ticker operation callbacks.
The recursive use was exposed when using ticker stop
operation callback of stopping an auxiliary PDU to stop
the primary PDU scheduling as part of generation of
Advertising Terminate event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
In case the endpoint string provided by the application is longer or
equal to CLIENT_EP_LEN - 1, the strncpy() function will not add the NULL
terminator. As the endpoint buffer is treated as a C-string in other
places in the code, make sure it's NULL terminated by adding NULL
explicitly at the end of the buffer.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Make sure query string used by the lwm2m_rd_client is large enough to
encode any query string that can be sent during bootstrap/registration.
As the maximum query string length is related to the endpoint name,
which is limited by `CONFIG_LWM2M_RD_CLIENT_ENDPOINT_NAME_MAX_LENGTH`,
make the query string corellated to the value of this config.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit adds to network shell set of basic commands for UDP
protocol to receive and send datagrams.
Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The cmd_read function uses fs_open with FS_O_CREATE | FS_O_RDWR flags
to open file it will only read; the flags has been changed
to FS_O_READ.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This functionality is is enabled by setting CONFIG_SHELL_GETOPT.
It is not active by default.
User can call following functions inside command handlers:
- shell_getopt - getopt function based on freebsd implementation
- shell_getopt_status_get - returns getopt status
Beware when getopt functionality is enabled shell will not parse
command handler to look for "-h" or "--help" options and print
help message automatically.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Shell will not "steal" by default "-h" and "--help" each time
help functions are enabled.
This change is necessary to implement and use the getopt library.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Check NULL value when we are trying to print link address
because the link address can be null.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
As the input string can be allocated from stack, we need to use
log_strdup() in net_pkt_hexdump() to print the extra string.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Add a dependency on TEST_ARM_CORTEX_M switch, so it
only gets switched on when building tests, not samples,
as originally intended.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Remove inclusion of vendor specific internal LLL include
files in ULL source code.
Prefix `lll/` include file path to correctly include vendor
defined types and function implementation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Removed printk.h include from log_core.h.
Since LOG_PRINTK cannot be enabled with LOG_MINIMAL removed
support for both.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
usb_hid_descriptor struct is only used internally and
is not intended to be used by the USB HID device application.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Add a callback to notify applications when the datarate has changed.
This allows applications to know when payload sizes have changed without
needing to call `lorawan_get_payload_sizes` before each transmission.
This also enables:
* Monitoring of network conditions on the device
* Determining if a network connection has been lost
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Keep track of the current network datarate when ADR is enabled.
The datarate can change in two circumstances. Firstly, the datarate may
change as a result of a command from the LoRaWAN server as the link
budget varies. Secondly, the datarate may be changed due to not
receiving an expected ADRACKReq response. This necessitates querying the
datarate on both packet reception and transmission to provide timely
notifications to the application.
Due to querying the default region datarate at startup and validating
manual datarate parameters, when ADR is not enabled the datarate will
never be different from the value provided to `lorawan_set_datarate`.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Add a function to query the minimum possible datarate on the network.
This value may change over the lifetime of the connection as a result
of commands from the network server.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Add the ability for applications to query the maximum size of packets
that can be sent. This must be dynamically queried as the sizes change
with datarate, region, and as MAC commands are added by the stack.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
The default shell configuration has heavy flash and memory requirements,
requiring project maintainers to set many configuration options to "n"
to keep flash and memory requirements within reason.
This adds a new configuration option, CONFIG_SHELL_MINIMAL, which will
disable flash and memory heavy options by default, and allow project
maintainers to select/imply only the options they want.
On a quick test from an ARM board I'm working on, enabling this option
cut flash space requirements by ~8 KB, and memory requirements by ~1 KB.
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Allow NULL pointer to be passed to bt_id_get function so
that only count can be fetched.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
There's a prompt to set the TX stack size, that's documented as an
advanced setting, but attempts to override it it are rejected unless
you add another setting that allows it to be change. Tell the user
how to make changes work.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Remove compilation warning caused by currently not used
hci_df_set_conn_cte_tx_param function.
Code is sorrounded by #ifdef CONFIG_BT_CTLR_DF_CONN_CTE_RSP.
The CONFIG_BT_CTLR_DF_CONN_CTE_RSP is changed to be disabled
by default (until complete implementation of the feature is
provided).
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Change dfe-ant-num propert name to dfe-antenna-num.
The change is conde to keep the same naming style
for all properies, like dfe-pdu-antenna property.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Add initialization of GPIOs that are used for antenna switching.
GPIOs provided to DFE extension in Radio peripheral, to drive
antenna switching, should be initialized in GPIO peripheral beforehand.
The initialization is optional and may be disabled by Kconfig.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Antenna switching done by Radio with use of GPIOs provided in
PSEL.DFEGPIO registers. Registers were initialized once during
controller initialization.
At preparation of new radio event, Radio peripheral is powered
down and up to resset its registers. It is related with multi
protocol handling and possible leftovers in Radio registers.
Due to that, PSEL.DFEGPIO registers should be initialized
at the preparation of every event that will transmit
or receive CTE and run antenna switching.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Anternna switching should be disabled when CTE Rx is not supported
or disabled. Added missing dependency on BT_CTLR_DF_CTE_RX.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Add missing declarations of functions that are compiled in when
CONFIG_BT_CTLR_ADV_EXT_PDU_EXTRA_DATA_MEMORY is selected
Add missing include of header file.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Fix duplicate include of lll_test.c file under the
unsupported ISR profiling feature in OpenISA port.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use `#if defined(...)` instead of `#if IS_ENABLED(..)` when
conditional compilation of definitions in source code.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit prepares supporting sdmmc on
stm32l4+ devices. When trying to compile the
sdmmc driver there is a compilation error
because `HAL_SDEx_DriveTransceiver_1_8V_Callback`
is not implemented. We solve this by compiling
also `sd_ex` in cube as this function is implemented
there as weak.
Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
We should verify that the buffer has sufficient data before attempting
to parse the SDU length field. If we get a too short packet just
disconnect the channel.
Fixes#32497
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Fix array overrun of client features bitset, where CF_BYTE_LAST was
incorrectly defined as 2 using module instead of divide.
Also fix additional bit-logic when number of bits would exceed a byte:
- Inner for loop iterates from 0 to number of bits on a single byte.
- Same bitmask used for all bytes.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This returns the available contingous space in the packet starting from
the current cursor position.
Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
Don't auto-update the device name in the advertising data as that
would clear any other scan-response data set by the application.
Document the behavior of the advertise with device name option
and the need to update data by the application to make sure
advertising data does not get cleared.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix endianness issue in reading CPF descriptor not converting from
native endianess to little-endian on the 'unit' and 'description'
fields.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Use the definitions of UUID values instead of magic constants with
explanation in comment.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This makes cbprintf_nano.c much closer to the standard printf and
therefore more useful. The following are now implemented:
- right justification for everything (only for numbers previously)
- precision value for numbers, chars and strings
- width/precision passed as arguments with *
- "unlimited" padding length
- lower/uppercase hex output
- the #, + and ' ' flags are supported
And the code was heavily reworked to reduce its size as much as
possible to mitigate the size growth. Still, the binary resulting
from cbprintf_nano.c is now between 10% and 20% bigger depending on
the architecture. This is still far smaller than cbprintf_complete.c
which remains about twice as big on average even without FP support.
Many unit tests that were skipped with CONFIG_CBPRINTF_NANO are now
enabled, and a few more were added for good measure.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Check for associated Extended Advertising set to determine
whether Broadcast ISO Group instance has been already
created.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add association between extended advertising, periodic
advertising and broadcast ISO instance, so that attempts to
create and terminate BIG can detect error conditions.
Error conditions being, trying to create BIG without a valid
periodic advertising train, or terminating BIG without prior
creation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>