Internal macros like _LOG_XXXX0 use preprocessor ## and LOG_LEVEL_N
to conditionally generate code.
After addition of U suffixes to LOG_LEVEL_N macros the internal macros
also need update to versions with suffix i.e. _LOG_XXXX0U
Signed-off-by: Artur Lipowski <artur.lipowski@hidglobal.com>
Static analyzer (clang-tidy) complains about using signed integer
operand with a binary bitwise operator in LOG_XYZ macros.
Signed-off-by: Artur Lipowski <artur.lipowski@hidglobal.com>
The test of the absolute timeout feature was a simple whitebox test
that inspected the generated ticks field of different constructors for
identity. But it wasn't simple enough, because it was doing a
ticks->ms->ticks conversion (at compile time, sigh) on the input data,
which is obviously lossy on platforms where ticks are shorter than
milliseconds by non-integral factors.
Fix to do the conversion in just one direction.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This test sets a timer, busy waits for half the duration, and then
checks the remaining time is correct. And it correctly does all its
math in tick precision and aligns to a timer interrupt to eliminate
aliasing due to the tick stride.
But it's waiting using k_busy_wait(), not a timer: "half the duration"
in MICROSECONDS (for k_busy_wait()) is not necessarily representable
as an integer number of TICKS on all platforms. Because k_busy_wait()
always rounds up, we need one extra tick of buffer on those platforms.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Following the practice for i.MX decoding assume the 32-bit identifier
values need to be converted to big-endian representation for
device-independent interpretation.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Resources indicate that CFG2 holds the upper 32 bits, and CFG1 the
lower 32 bits, of a 64-bit unique identifier. Store it in big-endian
format so it reads correctly when accessed as a byte sequence.
https://community.nxp.com/docs/DOC-94459
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Fixes: #24576
The name of the symbolic link would be constructed using the full path
name to the target folder.
This is not needed and caused the issue raised in #24576.
This has been fixed by no longer using the toplevel target directory
in the link name, for example:
Old style: _project_zephyr_workspace_zephyr_include_sys
New style: include_sys
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The previous architecture proved unable to support user expectations,
so the API has been rebuilt from first principles. Backward
compatibility cannot be maintained for this change.
Key changes include:
* Formerly the service-provided transition functions were allowed to
sleep, and the manager took care to not invoke them from ISR
context, instead returning an error if unable to initiate a
transition. In the new architecture transition functions are
required to work regardless of calling context: it is the service's
responsibility to guarantee the transition will proceed even if it
needs to be transferred to a thread. This eliminates state machine
complexities related to calling context.
* Constants identifying the visible state of the manager are exposed
to clients through both notification callbacks and a new monitor API
that allows clients to be notified of all state changes.
* Formerly the release operation was async, and would be delayed for the
last release to ensure a client would exist to be notified of any
failures. It is now synchronous.
* Formerly the cancel operation would fail on the last client associated
with a transition. The cancel operation is now synchronous.
* A helper function is provided to safely synchronously release a
request regardless of whether it has completed or is in progress,
satisfying the use case underlying #22974.
* The user-data parameter to asynchronous notification callbacks has
been removed as user data can be retrieved from the CONTAINER_OF
the client data.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The DT_I2S_* defines can be removed as the driver is now utilizing the
new dt macros that don't require these defines.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit renames `samd.dtsi` to `samd2x.dtsi` since this DTS header
is specific to the SAM D2x series and its derivatives (e.g. SAM R21).
Note that the SAM D5x series uses a different DTS header file (i.e.
`samd5x.dtsi`) due to the vast differences, and the future SAM D1x will
have to use a separate DTS header to be sensible anyway.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
In some cases (eg at high baud rate, no HW flow control, and when BLE
radio/ints running) data could be lost between when enough characters
have been RX'd to fill the DMA buffer and when the ENDRX event was
fired, where the the STARTRX task is invoked to start filling the next
buffer (which is set up earlier, but I think will not be filled until
STARTRX).
To fix this, the SHORT is enabled between ENDRX and STARTRX whenever the
'next' buffer is available, so that STARTRX is invoked automatically and
subsequent chars go into the next buffer via EasyDMA.
To make this work properly, uarte_nrfx_isr_async() now handles the ENDRX
event _before_ the STARTRX event.
There was also an issue in rx_timeout() where the received character
count (rx_total_byte_count) could be incremented greater than the actual
buffer size. This arises from rx_total_byte_count value coming from the
counting the RXDRDY events (either by PPI/timer counter or counting the
RXDRDY ints themselves) and so if chars are received in the rx_timeout()
(or before ENDRX is handled) the rx_timeout() could increment rx_offset
past the length of the buffer. This could result the remaining 'len'
being calculated incorrectly (an underflow due to unsigned - signed ,
where signed > unsigned).
To fix this, we now store the lengths of the buffers and don't invoke
the UART_RX_RDY callback when the buffers are full; its handled by
ENDRX.
(Also note that the buffer size should be available via the RXD.MAXCNT
register on the nrf, but this register is not exposed through the nrfx
HAL and is also double buffered, so it seemed clearer to just track the
buffer lengths explicitly here in the driver).
Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
for fixup
Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
This patch fixes an issue with TCP options reading. Previous approach
was accessing the options with pointers (th + 1). This does not work if
TCP options span multiple net_pkt buffer fragments. Instead net_pkt
functions must be used.
Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
Convert driver to use new DT_INST macros throughout. This allows us to
also remove dts_fixup.h that are no longer used.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Replace macros of the form DT_CAVS_ICTL_x_IRQ with new dt form macro
DT_IRQN(DT_INST(x, intel_cavs_intc))
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Replace various drivers and soc code that use DT_CAVS_ICTL_BASE_ADDR
with DT_REG_ADDR(DT_NODELABEL(cavs0)).
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The ARM GCC `-march` compiler flag is completely redundant when the
`-mcpu` flag is specified, since the `-mcpu` selects the target ARM
architecture as well as CPU-specific optimisations.
In fact, it is disadvantageous to specify both `-march` and `-mcpu`
flags because the `-march` flag overrides and disables any CPU-specific
optimisations enabled by the `-mcpu` flag.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This operation is formally defined as rounding down a potential
stack pointer value to meet CPU and ABI requirments.
This was previously defined ad-hoc as STACK_ROUND_DOWN().
A new architecture constant ARCH_STACK_PTR_ALIGN is added.
Z_STACK_PTR_ALIGN() is defined in terms of it. This used to
be inconsistently specified as STACK_ALIGN or STACK_PTR_ALIGN;
in the latter case, STACK_ALIGN meant something else, typically
a required alignment for the base of a stack buffer.
STACK_ROUND_UP() only used in practice by Risc-V, delete
elsewhere.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The core kernel z_setup_new_thread() calls into arch_new_thread(),
which calls back into the core kernel via z_new_thread_init().
Move everything that doesn't have to be in z_new_thread_init() to
z_setup_new_thread() and convert to an inline function.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
There was a typo bug in the SRAM ranges property that causes the SRAM
nodes to appear at the wrong addresses.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Reworked i2c_sam_twi driver to utilize new DT_INST macros as part of
this rework we also now get pin ctrl/mux configuration information
from the device tree instead of via Kconfig and defines in soc_pinmap.h
We remove defines from dts_fixup.h and soc_pinmap.h and associated
Kconfig symbols that are no longer needed due to getting all that
information from devicetree.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Reworked i2c_sam_twi driver to utilize new DT_INST macros as part of
this rework we also now get pin ctrl/mux configuration information
from the device tree instead of via Kconfig and defines in soc_pinmap.h
We remove defines from dts_fixup.h and soc_pinmap.h and associated
Kconfig symbols that are no longer needed due to getting all that
information from devicetree.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add pinctl support for the SAM TWI and TWIHS I2C devices. We update
the TWI and TWIHS I2C bindings to have pinctrl-0 bindings that are
expected to have 2 phandles to the TWCK & TWD pinctrl nodes.
The pinctrl nodes will have an 'atmel,pins' property that describes the
GPIO port, pin and periphal configuration for that pin.
We update sam*-pinctrl.dtsi files with all the various pin ctrl
configuration operations supported by the given SoC family. These
files are based on data extracted from the Atmel ASF HAL
(in include/sam<FAMILY>/pio/*.h).
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add the following macro's to get clock info by name:
DT_CLOCKS_LABEL_BY_NAME
DT_CLOCKS_CELL_BY_NAME
DT_INST_CLOCKS_LABEL_BY_NAME
DT_INST_CLOCKS_CELL_BY_NAME
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Co-Authored-By: Marti Bolivar <marti.bolivar@nordicsemi.no>
We've had clocks in base.yaml but didn't have clock-names. Add it to
base.yaml with similar functionality to interrupt-names, reg-names, etc.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
During registration, first thing LWM2M does is trying to close a socket
indicated by sock_fd stored in its context. In case it is not
initialized to some invalid value (-1 in this case), LWM2M may close an
ambigous socket.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Given that nsim_em can run the tests instead of just building them as
with em_starterkit_em7d, make it a default platform instead of
em_starterkit_em7d to get most of the testing when nsim simulator is
installed on the developer machine.
Tests run are 1000x more useful than just building them, even if we do
not have a large installed base of nsim.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The parameter is integral milliseconds; K_NO_WAIT is not an acceptable
value to indicate no delay.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit adds the GCC `-mabi=lp64` flag to force the LP64 (64-bit
long and pointer) ABI, which is mandatory for running the Zephyr
AArch64 architecture port.
Note that this flag is, strictly speaking, not necessary in most cases
because the AArch64 GCC defaults to using the LP64 ABI. This flag is
required, however, if compiling Zephyr with a GCC that is configured
with `--with-abi=ilp32`, which makes ILP32 the default ABI.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
After #22013, bt_le_adv_param got additional fields which were passed to
the bluetooth API uninitialized in the BT Mesh module. This
zero-initializes the entire structure in all usages to avoid passing
uninitialized data now and in the future.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Following issue is addressed in this bugfix:
When using offloaded sockets with modem ublox_sara_r4,
the socket is only closed if it is in connected state
at the time of the function call. When using UDP sockets,
this leads to a socket never being closed.
Signed-off-by: Hans Wilmers <hans@wilmers.no>
Calculation of RSSI was done incorrectly for Sara U201.
When evaluating +CSQ command responses, the RSSI can be calculated
from the first value, which is <signal_strength>. Instead, the
RSSI was calculated from the second value, which is <qual>.
With the subsequent mapping to RSSI, this results in a wrong
value for RSSI.
This is now corrected by using value <signal_strength> to calculate
the RSSI.
Tested using Sara U201.
Signed-off-by: Hans Wilmers <hans@wilmers.no>
This commit references modem_pin() and modem_shell()
modem_pin(): use new gpio api
The existing pin driver does not respect gpio
configuration in device tree for active high / low
This commit allows for the device tree to determine the
active logic level.
modem_shell(): use correct string length
The ms_send macro uses iface.write() to send a string.
iface.write() requires the length of the string not the
size of the string.
This commit corrects the string length.
drivers: ublox-sara-r4: fix vint polling
This eliminates the implication that the enable and disable values can
be something other than 1 and 0, and fixes the code so it won't enter
an infinite loop if the GPIO read returns an error.
Signed-off-by: Steven Slupsky <sslupsky@gmail.com>
In order to avoid retransmissions from the peer's side
on active connection close, acknowledge the incoming FIN+ACK
in FIN_WAIT_1 state.
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
We cannot directly use the local address in net_context when
registering the connection as it is not proper type. So create
temp address variable for that purposes.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Avoid dynamic allocations and all the issues if we run out of
memory, by placing the connection endpoint directly to TCP
connection struct.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
When we build this driver with CONFIG_UART_ASYNC_API enabled we get the
following build error:
uart_sam0.c: In function 'uart_sam0_init':
uart_sam0.c:558:35: error: redefinition of 'dev_data'
558 | struct uart_sam0_dev_data *const dev_data = DEV_DATA(dev);
uart_sam0.c:498:35: note: previous definition of 'dev_data' was here
498 | struct uart_sam0_dev_data *const dev_data = DEV_DATA(dev);
Fix this be removnig the duplicate at line 558.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The params in the macro's were a bit confused in what was cell_name and
what was name. The order was correct and matched other _BY_NAME macros.
Rename the params to just 'name' and 'cell' to match other macro's and
fix any other minor issues associated with this confusion.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>