Commit graph

21541 commits

Author SHA1 Message Date
Luiz Augusto von Dentz
b5a46db6c6 Bluetooth: ISO: Use CHECKIF instead of __ASSERT_NO_MSG
CHECKIF is preferred as it handles full runtime error handling in
addition to just asserts.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2021-03-23 17:49:08 -04:00
Luiz Augusto von Dentz
af0fc963d8 Bluetooth: ISO: Fix cleanup connection
This fixes bt_iso_cleanup when there are still channels bound to the
ACL connection.

On top of it introduce bt_iso_chan_unbind which can be used to unbind
channels and thus release the reference to the ACL connection if that
has not been disconnected in which case the channels are unbind
automatically.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2021-03-23 17:49:08 -04:00
Luiz Augusto von Dentz
7ffbd55ecf Bluetooth: ISO: Fix revert direction when setting SDU
s_sdu refers to rx/input and m_sdu refers to tx/output.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2021-03-23 17:49:08 -04:00
Luiz Augusto von Dentz
151e93b78d Bluetooth: ISO: Fix not calling channel disconnected
When the channel has just been bound but is not connected yet there is
no need to send any command over the air but the disconnected callback
shall still be called in order to notify the channel owner that it has
reached disconnected state.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2021-03-23 17:49:08 -04:00
Luiz Augusto von Dentz
84811d5726 Bluetooth: conn: Fix invalid state transition
When initiating a disconnection conn_disconnect would be called to send
HCI_Disconnect but the controller may be quick enough to send Disconnect
Complete event before setting BT_CONN_DISCONNECT which will then cause
the invalid transition from BT_CONN_DISCONNECTED to BT_CONN_DISCONNECT
and the connection won't be freed properly.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2021-03-23 17:49:08 -04:00
Luiz Augusto von Dentz
a0d6f30895 Bluetooth: conn: Fix unbalance reference when an ISO has been connected
This fixes a regression introduced by 4350021f09 which prevents
references to be properly release when there is an ISO connection.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2021-03-23 17:49:08 -04:00
Marcin Niestroj
c1f7b9f45a net: l2: ethernet: fix k_work API usage in carrier on/off handling
net_eth_carrier_on() and net_eth_carrier_off() call k_work_init() on
work item that can be pending or still be processed in another thread.
This results in undefined behavior.

Initialize work item once and use an atomic flag to switch between
up/down carrier state. Submit work to workqueue whenever up/down carrier
state changes, so that last state is always properly propagated to
network interface layer.

While at it, save network interface pointer during ethernet context
initialization, so that is becomes static (and thread-safe) during whole
ethernet context lifetime.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-03-23 16:18:29 +02:00
Marcin Niestroj
e3a41194f7 net: l2: ppp: fix k_work API usage in carrier on/off handling
net_ppp_carrier_on() and net_ppp_carrier_off() call k_work_init() on
work item that can be pending or still be processed in another thread.
This results in undefined behavior.

Initialize work item once and use an atomic flag to switch between
up/down carrier state. Submit work to workqueue whenever up/down carrier
state changes, so that last state is always properly propagated to
network interface layer.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-03-23 16:18:29 +02:00
Krzysztof Chruscinski
34decfd408 logging: Add name to the mode choice in kconfig
Adding name allows to modify default choice by other modules.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-23 13:00:33 +01:00
Robert Lubos
02a1168475 net: sockets: tls: Implement MSG_TRUNC flag
Add implementation of MSG_TRUNC `recv()` flag for DTLS sockets.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-03-23 13:16:30 +02:00
Robert Lubos
833517f994 net: sockets: Implement MSG_TRUNC flag
Add implementation of MSG_TRUNC `recv()` flag for UDP sockets.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-03-23 13:16:30 +02:00
Johann Fischer
f205e94f9e include: move disk_access.h to storage
Zephyr already has a directory for storage API relevant headers.
Move disk_access.h header to include/storage where it fits better
structurally.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-23 12:16:01 +01:00
Johann Fischer
03101e75d8 disk: move disk and sdmmc controller drivers to drivers/disk
The files disk_access_usdhc.c, disk_access_spi_sdhc.c,
disk_access_stm32_sdmmc.c, disk_access_ram.c and
disk_access_flash.c are actually drivers for block devices and SD/MMC
controllers. This patch moves this drivers to drivers/disk and
reworks the configuration so that the drivers are selected when
the corresponding node is enabled.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-23 12:16:01 +01:00
Anas Nashif
5d6c219210 drivers: device: do not reuse tag name 'device'
Do not reuse tag name (misra rule 5.7).

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-22 19:48:14 -04:00
Anas Nashif
2976e12946 logging : do not reuse tag name log_output
Do not reuse tag name (misra rule 5.7).

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-22 19:48:14 -04:00
Reto Schneider
c59cf6008b tests: ztest: Fix assert hook dependency
Without this fix, ztest_set_assert_valid() can only be used when
CONFIG_ZTEST_FATAL_HOOK is set.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2021-03-22 15:59:25 -04:00
Anas Nashif
3704a408f6 pm: fix header guard
Fix header guard.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-22 13:46:03 -04:00
Anas Nashif
1aca2fbf4f ztest: fix header guard
rename __ZTEST_H__ -> ZEPHYR_TESTSUITE_INCLUDE_ZTEST_H_

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-22 13:46:03 -04:00
Jukka Rissanen
0af89fc4ec net: Remove legacy TCP stack
Remove legacy TCP stack as it is replaced by the new TCP2 stack.
The TCP2 stack has been the default stack since 2.4 release.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-03-22 13:06:54 -04:00
Emil Gydesen
ed2162c700 Bluetooth: Audio: Volume Offset Control Service and Client
This commit implements the secondary service
Volume Offset Control Service (VOCS) server and client.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-03-22 13:05:56 -04:00
Andrzej Puzdrowski
eb9454628e logging/log_backend_fs: support any directory
Added procedure which is able to create nested log director.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-22 13:04:23 -04:00
Andrzej Puzdrowski
6b18e6992d subsys/loggin/log_backend_fs: added recovery after file lost
Added recovery for case when log file was lost somehow.
Back-end will try to create new file if possible.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-22 13:04:23 -04:00
Mateusz Syc
fe5f602606 susbys: logging: Added logging to flash backend
New backend is based on littleFS. After init, there is created new file
with continuous numeration. When max size of file is reached, system
creates another one. File size is limited by Kconfig option.
There is possibility to overwrite old files or drop new ones.
FS backend logging to file if the FS location is available.
Otherwise log messages are drooped.

User can also change the name of log files.

Signed-off-by: Mateusz Syc <Mateusz.Syc@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <Andrzej.Puzdrowski@nordicsemi.no>
2021-03-22 13:04:23 -04:00
Flavio Ceolin
87c6311d99 power: Send exit notification after post_ops callback
Currently notification about exiting an idle state is sent before
post_ops and with interruptions locked. Change it to be sent after
exit_pos_ops callback be called.

Unfortunately it is not possible to just change the order these
functions are called since the idle thread can be scheduled out just
after irqs be unlocked and before has the chance to send the
notification, so we are locking the scheduler and unlocking it only
after the notification be sent.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-22 12:42:30 -04:00
Flavio Ceolin
6091f0f116 power: Avoid duplicated code
Just call the function instead of replicate the logic.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-22 12:42:30 -04:00
Flavio Ceolin
220848c863 power: pm_power_state_exit_post_ops has to unlock irqs
The kernel expects irqs be unlocked after this function be called.
Add it to the weak function in case of the SoC or application has not
implemented it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-22 12:42:30 -04:00
Josh Gao
16d2ab790c usb: dfu: give wait_for_usb_dfu an argument
Allow callers to wait for an arbitrary amount of time, instead of always
waiting for a compile-time fixed period.

Signed-off-by: Josh Gao <josh@jmgao.dev>
2021-03-22 12:55:56 +01:00
Anas Nashif
c076d94eec kernel: remove tickless idle
This feature predated the tickless kernel and has been in legacy mode
for a while. We now have no drivers or systems that do not support
tickless, so remove this option and cleanup the code to only use
tickless.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-19 11:22:17 -04:00
Anas Nashif
a518f48796 clock: renmae z_timeout_end_calc -> sys_clock_timeout_end_calc
Do not use z_ for internal APIs, z_ is for private APIs within one
subsystem only.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-19 11:22:17 -04:00
Anas Nashif
fe0872c0ab clocks: rename z_tick_get -> sys_clock_tick_get
Do not use z_ for internal APIs, z_ is for private APIs within one
subsystem only.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-19 11:22:17 -04:00
Anas Nashif
12b53d121e clock: rename z_timer_cycle_get_32 -> sys_clock_cycle_get_32
This is another API that is being used in all timer drivers and is not
internal to the clock subsystem. Remove the leading z_ and make promote
it to a cross-subsystem API.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-19 11:22:17 -04:00
Anas Nashif
9c1efe6b4b clock: remove z_ from semi-public APIs
The clock/timer APIs are not application facing APIs, however, similar
to arch_ and a few other APIs they are available to implement drivers
and add support for new hardware and are documented and available to be
used outside of the clock/kernel subsystems.

Remove the leading z_ and provide them as clock_* APIs for someone
writing a new timer driver to use.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-19 11:22:17 -04:00
Johann Fischer
f943a5581d modbus: rework RS-485 transceiver DE,RE GPIO configuration
Follow modern way to configure DE,RE GPIO using
struct gpio_dt_spec.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00
Johann Fischer
6394298960 modbus: add raw ADU support
MODBUS raw ADU support allows to implement
MODBUS messaging service over TCP or UDP.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00
Johann Fischer
4ff616b647 modbus: rework interface configuration
Use commot parameter structure to configure server
or client interfaces.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00
Johann Fischer
55204d504e modbus: document return values of internal functions
Document return values of internal functions.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00
Johann Fischer
144a3a5ba2 modbus: return ETIMEDOUT on timeout instead of EIO
Return ETIMEDOUT on timeout instead of EIO.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00
Johann Fischer
0bf4916efd modbus: move some RX/TX ADU related code to the core
Let the core call the modbus_tx_adu() to make
the process more comprehensible.
Move tx-wait-for-rx handling outside of client code.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00
Johann Fischer
e3c630d25f modbus: rename internal designations and do few minor fixups
Prefix internal functions and structs with modbus_.
Use unit_id consistently instead of node_addr.
Fix mbm_ remainder and rename to mbc_.
Rename struct modbus_frame to modbus_adu since
ADU is closer to what the structure represents.

Let the compiler/linker do the job and
remove ifdef around mbc_validate_fc03fp_response().

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00
Johann Fischer
669d3e9e91 modbus: make MODBUS support over serial line optional
Make MODBUS support over serial line optional.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00
Johann Fischer
b132ab556c modbus: move serial line config outside context
Move serial line config outside context.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00
Johann Fischer
3ddb47cc43 modbus: move MODBUS over serial line code to own file
Move MODBUS over serial line code to own source file.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00
Johann Fischer
19d0b474c1 modbus: use enum for MODBUS mode
Use enum for MODBUS mode.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00
Johann Fischer
9792a6c43e modbus: rename mb_rtu_ to modbus_
Rename mb_rtu_ to modbus_.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00
Johann Fischer
699b2cdf9b modbus: remove RTU from configuration and headers
Remove RTU from configuration and headers

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00
Johann Fischer
ed0629f623 modbus: rename MODBUS RTU API to common MODBUS API
Rename MODBUS RTU API to common MODBUS API.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00
Johann Fischer
ac487727df modbus: reset buffer after reception
Reset buffer after reception, even if an error occurs.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00
Johann Fischer
a9690e0862 modbus: fix ASCII frame reception and add test for ASCII mode
Fix ASCII frame reception and add test for ASCII mode.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00
Johann Fischer
b0518d6100 modbus: get interface index according to interface name
Add function to get Modbus RTU interface index according
to interface name. This can be used to clearly identify
interfaces in the application.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00
Johann Fischer
c96aeff785 modbus: add control for DE/nRE RS-485 transceiver signals
Add support to control DE/nRE RS-485 transceiver signals
over GPIO pins. Useful if the UART controller does not
support RS-485 mode.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-19 15:50:21 +01:00