Provide a helper to extract the devicetree node_id for a GPIO
controller from a gpio phandle array. This can be used with
DEVICE_DT_GET() to directly reference the corresponding controller
device.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
When using a devicetree node as an identifier we know the identifier
used to define the device structure. This allows code to directly
reference that structure, avoiding the need to look it up by label at
runtime.
Change the macros so DEVICE_DT_* device objects are globally visible
using the node identifier as the object identifier.
Also add the necessary API to verify that a device that was captured
at build time successfully completed initialization and any other
steps necessary before it can be safely used.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Use the devicetree node as the source of object name and other
information used when defining the device structure.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Use the devicetree node as the source of object name and other
information used when defining the device structure.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Use the devicetree node as the source of object name and other
information used when defining the device structure.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Use the devicetree node as the source of object name and other
information used when defining the device structure.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Use the devicetree node as the source of object name and other
information used when defining the device structure.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Use the devicetree node as the source of object name and other
information used when defining the device structure.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Use the devicetree node as the source of object name and other
information used when defining the device structure.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Use the clock devicetree node as the source of object name and other
information used when defining the device structure.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
For devices defined using devicetree nodes we need to pass the
devicetree node, and to infer names for the device and the driver from
it. Devices defined in the classical way don't need this. Introduce
another level of private abstraction that accepts the information from
either source, falling back to the old parameters when the provided
node is invalid.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The dev_name is the canonical DT node identifier encoding the
devicetree path; the drv_name is the label of the corresponding node.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Originally, sys_read8 to the mapped address was added part of
the unmap API to protect OMAP mapping, i.e. in case of PCIe writes,
OMAP should not be overwritten before writes are completed.
Now that we have added dummy PCIe read in the common APIs, namely
pcie_ep_xfer_data_memcpy and pcie_ep_xfer_data_dma, for the purpose
of flushing PCIe writes; the purpose of protecting OMAP *also*
gets satisfied, randering PCIe read in the unmap useless,
so remove the same.
Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
Introduce common API to achieve data transfer using system DMA.
"System DMA" uses the outbound memory mapped Host address,
it cannot understand Host/PCIe address.
This API will take of mapping the Host address, completing
the data transfer to/from Host memory and unmapping the window;
thus providing abstraction to the user.
Since v1:
- refactored code for the cases where we have valid mapped_addr
to improve error management logic
Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
Once host memory is mapped to outbound memory, PL330 can be used to
transfer data between outbound memory and local memory.
Add API for the same, we get pl330 device as well as channels to be
used for tx/rx from DT and use DMA public APIs for data transfer.
Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
For a given PCIe EP device, data transfer to/from Host memory can be
achieved with "System DMA" between mapped Host memory
(PCIe outbound memory) and EP device's local memory if EP is equipped
with a "System DMA controller".
Add public API to enable such DMA transfers.
The term "System DMA" is used to clarify that we are not talking about
dedicated "PCIe DMA"; rather the one which does not understand PCIe
address directly, and uses the mapped Host memory.
Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
Add tx/rx pl330 channel IDs for the iProc PCIe client usage.
pl330 channel 0 is allocated for Tx DMA (Device to Host write) and
pl330 channel 1 is allocated for Rx DMA (Host to Device read).
Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
Add dma-cells property in pl330 dma binding document.
Currently only one integer cell with "channel" name is
added in order for the client to specify channel id
to be used for data transfer out of available channels.
Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
Windows does not default to an empty string when an env var is not
declared, like Linux does. Instead, explicitly default to one in order
for the .strip() call to work properly.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
mktime() was being used to convert from struct tm to time_t, but
Zephyr now has functions for that.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
time_t always measures as seconds since 1970-01-01T00:00:00Z. Fix a
comment that identified the wrong epoch year, and document what the
value of the offset means.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Verify if block tranfer is used and not an initial block when skipping
directly to data processing during FW update in PUSH mode.
This fixes a bug, which caused TLV not to be processed when the FW
object was updated as a whole, and actual resource number was encoded in
a TLV (for instance when writing FW Update URI).
Fixes#30135
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When ctr_drbg_initialize fails the function returns without unlock irq
that was previously locked.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
entropy_get_entropy return is not being checked what may result in a
vulnerability because tc_ctr_prng_reseed will not get proper entropy
data.
Fixes#29869
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Rework the bootstrap DELETE operation, to support deletion of multiple
resources.
Current implementation had several oversimplifications, making it not
spec-compliant:
* DELETE `/` removed only Security object instances (!= 0)
* DELETE `/x` was handled as DELETE `/x/0`, therefore not removing all
of the object instances.
Since the above is only supported during bootstrap and not regular
Device management, this functionality was implemented in the
`bootstrap_delete` function, which now will be called for all DELETE
operations initiated during bootstrap. The regular LwM2M DELETE handler
will only be called during regular Device management, as it has more
strict limitations on what can be deleted.
Additionally, handle empty URI Path option as `/`, therefore indicating
deletion of all resources.
Fixes#29964
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
So far ESP chip was configured directly into STA mode. This works fine,
but consumes lots of power because of enabled WiFi radio, even when it
is not actively used.
Enter NONE mode during initialization, so WiFi radio will be
disabled. Switch between NONE, STA, AP and STA+AP modes depending on
what driver is currently doing (e.g. enable STA only when scanning,
connecting and being connected to AP).
AT+CWAUTOCONN=0 command fails when in NONE mode, so workaround that by
entering temporarily into STA and then switching back to NONE.
Add also a warning log when switching mode was not successful, to ease
debugging possible issues.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
AT+CWMODE command controls in which mode (NONE, STA, AP, STA+AP) ESP
chip is operating. Add helper macros to replace usage of magic
numbers (0-3), hence improve readability. Add also a esp_mode_switch()
helper function, which allows to conveniently switch to chosen mode.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Change internal API operating on ESP driver flags to support multiple
bitwise ORed flags at once. This allows to improve resulting code when
multiple flags are read or modified at once.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
All except one invocations of modem_cmd_send() pass the same interface,
command handler and semaphore. Create a helper function in order to make
invocations slightly more readable.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
There is no point in clearing out command handlers if they were not
setup properly. Just skip to next instruction.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Command was sent first, then a semaphore was reset. This semaphore could
be released by received reply even before semaphore was reset. This is
quite unlikely, but possible result of race condition.
Move k_sem_reset() call before attempt to send command over modem
interface. This makes sure that receiving reply momentarily after
sending request will always be handled properly.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Semaphore argument is checked only after requested command is already
sent over modem interface. It makes little sense to return -EINVAL when
half of the requested operation (send) has already been done.
Check timeout and semaphore arguments just on the beginning of
function. Return -EINVAL early, before sending any data or taking any
locks.
Clear out 'sem' variable when there is no need to wait. Use this
variable later on as an indication to actually wait on semaphore or not.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
When defining system calls, it is very important to ensure that
access to the API’s private data is done exclusively through system
call interfaces. Private kernel data should never be made available
to user mode threads directly. For example, the k_queue APIs were
intentionally not made available as they store bookkeeping
information about the queue directly in the queue buffers which are
visible from user mode.
Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
There is no reason to clenaup members of net_context structure, as those
should be (and are) managed by net_context_put() implementation.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
There is no reason to clenaup members of net_context structure, as those
should be (and are) managed by net_context_put() implementation.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
The 2K alignment assembler directives should be under
'SECTION_SUBSEC_FUNC(exc_vector_table,_vector_table_section,_vector_table)'
Otherwise the _vector_table is actually 0x80 bytes aligned.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Fixes: #30232
This is a workaround for #30232.
During Zephyr CMake invocation a plain C compiler is used for DTS.
This results in the internal `CheckCompilerFlag.cmake` being included
by CMake
Later, when the full toolchain is configured, then
`CMakeCheckCompilerFlag.cmake` is included.
This overloads the `cmake_check_compiler_flag()` function, thus
causing #30232.
By manualy loading `CMakeCheckCompilerFlag.cmake` then
`CheckCompilerFlag.cmake` will overload the functions (and thus win the
battle), and because `include_guard(GLOBAL)` is used in
`CMakeCheckCompilerFlag.cmake` this file will not be re-included later.
It also prints a warning informing the user of the issue.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
If user has enabled DHCPv4, then allow to use its address instead
of giving error if static address cannot be set. Similar fix for
IPv6, so allow user to manually set an IPv6 address.
Because DHCPv4 has already set the IPv4 address to the network
interface, then zperf might not be able to add the pre-configured
address to it. So instead of returning immediately, try to use the
IP address that is already in the network interface. This way we
avoid this error print.
uart:~$ zperf udp download 5001
Setting IP address 2001:db8::1
Setting destination IP address 2001:db8::2
Cannot set IPv4 address 192.0.2.1
Unable to set IP
Setting destination IP address 192.0.2.2
Cannot set IPv4 address 192.0.2.1
Unable to set IPv4
Binding to 192.0.2.1
Cannot bind IPv4 UDP port 5001 (-2)
In this example, the network interface already had a proper and working
IPv4 address 192.168.0.2 in it.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Currently the code uses hw cycles and tries to convert them
to usec. I noticed some failures with this, for example the test
duration was sometimes missed meaning that instead of testing 5
seconds, we bailed out after 2 sec etc. After the kernel k_timeout_t
changes, which added APIs to support usec accuracy, we can use usec
and ticks here. This simplifies the code a bit.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The linker section for emulators (emulation drivers) is
incorrectly named "log_const_sections" possibly due to
simply copy-and-paste error. This section has nothing to
do with logging, so rename the emulators section.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
BUILD_WITH_TFM needs to depend on
ARM_TRUSTZONE_M, which is selected
by the SoC or Board definition. In
addition to that we add an imply
statement for INIT_ARCH_HW_AT_BOOT
because Zephyr will be chain-loaded
by TF-M, and needs to cleanup its
core ARCH registers that might be
left in non-reset state.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
When we select BUILD_WITH_TFM we do not
really need to enable by default the
options THREAD_NAME, THREAD_STACK_INFO,
INIT_STACKS and THREAD_MONITOR, so we can
clean them up. We also remove CMSIS_RTOS_V2
for the same reason.
We also cleanup the default value for
NUM_PREEMPT_PRIORITIES, which does not
seem to be needed.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
We did not check that user has supplied network interface index
in "net stats iface <idx>" command.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Both 'cb' and 'user_data' parameters for send/sendto were saved as
'send_cb' and 'send_user_data' members in socket information. None of
them are actually used, so drop them.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Add configurations to test shell feature sets. It will be helpful
both to users and for ensuring the flags continue to work.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>