The vast majority of devicetree bindings for GPIO controllers are
expected to have "flags" cells in their respective GPIO specifiers,
but that's not required by the specification and we want to make sure
to support that.
However, so many drivers and applications initialize gpio_dt_flags_t
values that it's silly to require each and every one of them to check
for the flags value and fall back to the sensible default flags value
of 0 when it does not exist.
Make the API easier to use correctly by returning 0 in the devicetree
core API for accessing flags, whenever there are no flags defined.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add a variety of property and specifier cell accessors that fall back
on a default value supplied by the caller if the devicetree does not
contain the requested data.
This is useful for avoiding use of COND_CODE_1() and similarly tricky
macros in applications and drivers.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Reorder the instance number property access macros. The non-instance
number ones appear in this order: DT_PROP(), DT_PROP_LEN(),
DT_PROP_HAS_IDX(), DT_PROP_BY_IDX(), DT_LABEL().
Improves readability slightly by moving code around so INST versions
appear in the same order as non-INST versions.
No functional changes expected.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
API did not cover a case when uart_rx_buf_rsp is called when receiver
is already disabled. It may happen if uart_rx_buf_rsp is called too
late and active transfer is already finished. In that case -EACCES is
returned.
Some implementations already returned that error in that case.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
In order to be able to add more entries under 'subsys/mgmt', move the
current contents of it, which relate exclusively to MCUMgr, to its own
folder.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
These stacks are appropriate for threads that run purely in
supervisor mode, and also as stacks for interrupt and exception
handling.
Two new arch defines are introduced:
- ARCH_KERNEL_STACK_GUARD_SIZE
- ARCH_KERNEL_STACK_OBJ_ALIGN
New public declaration macros:
- K_KERNEL_STACK_RESERVED
- K_KERNEL_STACK_EXTERN
- K_KERNEL_STACK_DEFINE
- K_KERNEL_STACK_ARRAY_DEFINE
- K_KERNEL_STACK_MEMBER
- K_KERNEL_STACK_SIZEOF
If user mode is not enabled, K_KERNEL_STACK_* and K_THREAD_STACK_*
are equivalent.
Separately generated privilege elevation stacks are now declared
like kernel stacks, removing the need for K_PRIVILEGE_STACK_ALIGN.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This had been copy-pasted between linker scripts, create
a central header for it.
The linker scripts for xtensa and posix have very different
structure and have been left alone.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Thread objects were moved out of the stack a long time ago.
Replacing this incorrect information is some clarification
on acceptable size values to pass in.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The core kernel computes the initial stack pointer
for a thread, properly aligning it and subtracting out
any random offsets or thread-local storage areas.
arch_new_thread() no longer needs to make any calculations,
an initial stack frame may be placed at the bounds of
the new 'stack_ptr' parameter passed in. This parameter
replaces 'stack_size'.
thread->stack_info is now set before arch_new_thread()
is invoked, z_new_thread_init() has been removed.
The values populated may need to be adjusted on arches
which carve-out MPU guard space from the actual stack
buffer.
thread->stack_info now has a new member 'delta' which
indicates any offset applied for TLS or random offset.
It's used so the calculations don't need to be repeated
if the thread later drops to user mode.
CONFIG_INIT_STACKS logic is now performed inside
z_setup_new_thread(), before arch_new_thread() is called.
thread->stack_info is now defined as the canonical
user-accessible area within the stack object, including
random offsets and TLS. It will never include any
carved-out memory for MPU guards and must be updated at
runtime if guards are removed.
Available stack space is now optimized. Some arches may
need to significantly round up the buffer size to account
for page-level granularity or MPU power-of-two requirements.
This space is now accounted for and used by virtue of
the Z_THREAD_STACK_SIZE_ADJUST() call in z_setup_new_thread.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Define a macro which takes as input a requested stack buffer
size, and returns the size of the stack object needed to
contain it.
An optional architecture interface is provided, though many
arches will be fine with the default implementation.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Some forthcoming macros will need this. This may now
be individually defined by arch code instead of hanging
off of ARCH_THREAD_STACK_DEFINE.
Some additional details added to the documentation string.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This can be in inline function, which gains us some
type safety.
Temporarily define Z_STACK_PTR_ALIGN() in terms of it,
slated for removal once some other changes land.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
A new macro Z_THREAD_STACK_OBJ_ALIGN() defines the alignment
of the lowest memory address of a stack object.
Related is a new arch interface ARCH_THREAD_STACK_OBJ_ALIGN()
which lets arches specifiy this. ARCH_STACK_PTR_ALIGN or a
power-of-two ceiling is used if not defined.
The default stack macros now use this instead of hard-coding
ARCH_STACK_PTR_ALIGN.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The fs_open has been extended with support for open flags.
Currently supported flags are:
FS_O_READ -- open for read
FS_O_WRITE -- open for write
FS_O_CREATE -- create file if it does not exist
FS_O_APPEND -- move to the end of file before each write
The FAT FS and LittleFS front-ends within the Zephyr has also been
modified to utilize the flags.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Let's normalize the callback like it is done in other APIs.
This will avoid the need to do not so nice code (storing the ipm device
pointer as global, or else) and more importantly will help to move all
device instance to constant.
Fixes#26923
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Until now, each and every driver had to redeclare the type to store such
pointer, now they will be using this typedef.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Normalize callback like other APIs.
This clarifies the callback usage. It will also help to switch all
device instance to constants.
Fixes#26923
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
All other API provide the device pointer to the callback it's going to
call. So fixing this in UART.
This will avoid passing the actual device pointer as a user data (thus
enabling user data for something else).
Fixes#26923
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
All other API provide the device pointer to the callback it's going to
call. So fixing this in UART.
This will avoid passing the actual device pointer as a user data (thus
enabling user data for something else).
Fixes#26923
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
s/port/dev
dev is being used everywhere else so let's rename port to dev.
And the parameter documentation should be the same for all.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit adds basic support for the clock controller used in
lpc11u6x MCUs.
Signed-off-by: Maxime Bittan <maxime.bittan@seagate.com>
Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
This commit adds a bindings for the clock controller used in lpc11u6x
MCUs. It also adds a clock-controller node for the lpc11u6x soc series.
Signed-off-by: Maxime Bittan <maxime.bittan@seagate.com>
This patch adds the DT nodes and binding for the pinmux registers,
aka IOCON (I/O control), found on the LPC11U6x MCUs.
Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
Drop unused ppp_parse_options_array() function and 'struct
ppp_option_pkt' data type. Both were used in initial PPP implementation,
but are not longer needed after recent PPP refactoring.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Remove unused ppp context members ('my_accepted', 'peer_accepted'),
which were supposed to contain accepted options. Options are now
negotiated and stored in same place, which is 'my_options' and
'peer_options' structure members.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
So far there was no generalized way how to handle negotiation of "my
options" (those sent with Conf-Req packet to peer). Peer response for
proposed options and their values were not tracked in any way, so
rejected (by peer) options were sent over and over again in subsequent
Conf-Req packets. In case of IPCP it means that all sent options such as
IP_ADDRESS, DNS1, DNS2 were mandatory for being supported by peer in
order to successfully finish negotiation. For example if 'pppd' was the
configured peer (e.g. when using with QEMU and net-tools scripts),
without ms-dns being configured (which is the default), then "my
options" negotiation failed.
Introduce generalized mechanism for negotiating "my options", so it is
easier to maintain current set of supported options and easily add new
options to the implementation in future. FSM instance inititialization
function can provide information about supported "my options".
Information is is passed as a table of 'struct ppp_my_option_info'
containing:
* option code (type),
* callback for adding option to Conf-Req packet,
* callback for received Conf-Ack with that option,
* callback for received Conf-Nak with that option.
Store also runtime information about each negotiated option. First of
all remember which options have been rejected, so they are not sent to
peer once again in the next Conf-Req packet. This will solve issue with
IPCP negotiation when peer doesn't support DNS1 or DNS2 options. Keep
also track about which options have been acked, so such information can
be verified before bringing FSM instance up.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Use net_pkt API to assemble Configure-Req messages. Compared to net_buf
API it allows us to simplify code.
Remove append_to_buf() helper functions, as their functionality is now
totally replaced by net_pkt API. Additionally net_pkt API handles data
that wraps several net_buf packets, which was not the case with
append_to_buf().
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Use net_pkt instead of net_buf API for replying to Configure-Req. We use
the fact that for now we reply with either Configure-Ack or
Configure-Rej only. In both cases we can allocate net_pkt ahead, because
we know its maximum length (which is equal to length of received
Configure-Req packet).
Make also an improvement in generic FSM code and reply with
Configure-Rej to all Configure-Req for which there is no config_info_req
callback set. Use that to drop LCP specific Conf-Req handling code,
because there is no option properly supported there yet.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Make sure that only those threads that have been granted access
to net_if objects, can call the functions that modify net_if data.
The CONFIG_NET_IF_USERSPACE_ACCESS config option is also removed
as it is no longer needed after this change.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
OpenThread API is not thread safe, therefore it shall be protected
from being preempted by OT thread, or other thread issuing API calls.
The problem showed up after a recent OpenThread upmerge, where changes
in the Joiner class made this problem visible. W/o extra protection,
`otJoinerStart` call can be preempted by the OT thread, leading to an
unexpected behavior.
Introduce new function to allow to lock any API operations for others.
Anyone willing to call OT APIs, shall lock the mutex first to get
exclusive access to the stack.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
There may be value in being able to rename a subtree, but there is no
identified need to be able modify the text of an assigned subtree.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
is_init field is useless, because there is only single code path that
always sets it to true before using it.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
NOP instruction is available via builtin for ARC so get rid of all
ASM inlines with NOP/NOP_S instructions.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Zephyr has generic find_msb_set and find_lsb_set implementations.
They are based on builtins so they are optimized enough.
Drop custom ASM implementation.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Add 64bit source_address/dest_address fields support.
This is needed in situation where DMA controller is capable
of handling more than 32bit source and destination addresses.
Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
The EEPROM device doesn't mutate the source data it's given, so update
the API signature to reflect this fact.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The NET_IF_OFFLOAD_INIT() macro was not converted to use
Z_STRUCT_SECTION_ITERABLE() macros in commit 62580748e5
("net: Use section foreach macros"). This meant that for those boards
that use offloaded network stack, the network interface was not created
and network connectivity was lost.
Fixes#27037
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This is called when the USB host changes the virtual baud rate.
This is used by Arduino style boards to signal that the board should
reset into the bootloader.
Signed-off-by: Michael Hope <mlhx@google.com>
There may be value in being able to rename a subtree, but there is no
identified need to be able modify the text of an assigned subtree
name.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>