Commit graph

8409 commits

Author SHA1 Message Date
TOKITA Hiroshi
949d4b91d9 drivers: pinctrl: Support pinctrl with GD32VF103
Change the settings to support pinctrl on the GD32VF103.

- Split soc/arm/gigadevice/common/pinctrl_soc.h
  and put it into include/dt-bindings.
- Leave some definitions that can't handle with device tree compiler
  in pinctrl_soc.h.
- Remove dependency to SOC_FAMILY_GD32 because always enabled it
  if GD32_HAS_AF(IO)_PINMAX was selected.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2021-12-20 17:51:30 +01:00
TOKITA Hiroshi
d79d4f0bea riscv_machine_timer: Enable to use divided clock for the machine timer
GD32V SoC uses divided clock from core-clock for machine timer clock.
Add config of clock divide factor to support GD32V.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2021-12-20 17:51:30 +01:00
Hou Zhiqiang
2fafd8559f net: socket: packet: Add EtherCAT protocol support
Add EtherCAT protocol support, now applications can
transmit/receive EtherCAT packets via RAW socket.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2021-12-20 17:49:10 +01:00
Lukas Gehreke
53dea67733 drivers: modem: Added simcom sim7080 modem driver.
Implemented driver for the simcom sim7080 modem.
This driver features Socket offloading, TCP, UDP, DNS,
SMS, GPS and FTP.

Signed-off-by: Lukas Gehreke <lk.gehreke@gmail.com>
2021-12-20 17:48:47 +01:00
Martí Bolívar
4f8f55e0d9 device.h: clean up doxygen comments
The doxygen comments contain errors, grammar problems, and other
issues. Additionally, some internal macros have doxygen comments
instead of "plain" C comments. The docstrings also sometimes omit
important information.

Give the header a once-over to try to improve the situation.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-12-20 17:42:08 +01:00
Jedrzej Ciupis
26e297572a drivers: timer: extend nrf_rtc_timer
This commit introduces the following changes:

* nrf_rtc_timer is extended with a capability to handle RTC overflow,
allowing it to operate on absolute RTC ticks, rather than relative
ticks.
* overflow handling is ZLI-proof and relies on the sys clock
handler being executed twice every RTC counter's overflow.
* callbacks are given an absolute RTC tick value as a parameter instead
of CC register's value. The absolute RTC tick value is the RTC counter
value set during CC channel configuration extended to 64 bits.
* in case the timer's target time is in the past or is the current tick,
the timer fires as soon as possible, however still from the RTC's ISR
context.
* in case an active timer is set again with the same target time, it is
not scheduled again - only its event data is updated. Otherwise, the
timer is scheduled as usual.
* a scheduled timer can be aborted.
* system clock functions are now using 64 bit values internally.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Paweł Kwiek <pawel.kwiek@nordicsemi.no>
2021-12-20 16:25:49 +01:00
Damian Krolik
3aedda9852 lib: os: add heap event listener
* add generic heap event listener module that can be used
  for notifying an application of heap-related events
* use the listener module in newlib libc hooks
* add a unit test

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2021-12-18 07:49:15 -05:00
Jimmy Johnson
5c28b218fa drivers: sensor: add ti tmp108 driver support
Adding support for the TI TMP108 temperature sensor. This includes
over/under temp interrupt support as well as one shot, continuous
conversion and power down modes.

Signed-off-by: Jimmy Johnson <catch22@fastmail.net>
2021-12-17 21:15:25 +01:00
Gerard Marull-Paretas
14860d8a97 devicetree: add DT_INST_PARENT helper
Provide the instance based version of the DT_PARENT macro.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 11:10:01 -06:00
Gerard Marull-Paretas
91b8abfb4d pm: device_runtime: suspend device on enable
The pm_device_runtime_enable did not suspend devices, so it assumed that
the device was in a physically suspended state. This change makes sure
that device is left in a suspended state if the device is initially
active.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
Gerard Marull-Paretas
d6ebab55f3 pm: device_runtime: add pm_device_runtime_init_suspended
By default device state is initialized to PM_DEVICE_STATE_ACTIVE. In
general, this makes sense because the device initialization function
will resume and configure a device, leaving it operational. However,
when device runtime PM is enabled, the device may not be resumed and the
init function will just enable device runtime PM. If that is the case,
this function can be used to set the initial device state to
PM_DEVICE_STATE_SUSPENDED.

Documentation has been updated to comment on this case, and example code
has been adjusted accordingly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
Gerard Marull-Paretas
59b455eb9c pm: device_runtime: simplify error handling for get/put
In case runtime PM is not enabled (or not built-in), the get/put
functions always return 0 (instead of -ENOTSUP/-ENOSYS). When runtime PM
is disabled, a device is left into active state. Similarly, when device
runtime PM is not built-in, it is safe to assume that a device will
be active when it is called. If a user implements a custom solution, it
is its responsability to make sure that a device is active when using
it. For all these reasons, the -ENOTSUP/-ENOSYS are error codes that
should always be ignored by devices using get/put, since in practice it
means that: device is active, function is a no-op. The example below
illustrates how error handling is simplified:

```c
/* before: safe to ignore -ENOSYS/-ENOTSUP since device is active (we
 * can continue)
 */
ret = pm_device_runtime_get(dev);
if ((ret < 0) && (ret != -ENOSYS) && (ret != -ENOTSUP)) {
	return ret;
}

/* now */
ret = pm_device_runtime_get(dev);
if (ret < 0) {
	return ret;
}
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
Michał Narajowski
ef1fcd0e82 Bluetooth: Mesh: Fix Config/Health Client async API
The previous PR was not fully baked, so this PR fixes issues by:
- Adding checks when dereferncing pointers stored in params.
- Clearing ack context if a return argument is NULL to not block and
wait for response.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-12-16 10:15:36 +01:00
Tom Burdick
0513b242d4 docs: Adds syscall tracing to tracing docs
Tracing guide in the docs was missing references to the added tracing
syscall macro hooks. This adds those.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2021-12-15 16:51:31 -05:00
Andy Ross
6dfb16a3d9 arch/xtensa: Fix cache.h include dependency
This file started using ALWAYS_INLINE from <toolchain.h> but didn't
include it.  Transitive inclusions were hiding the problem most
places, but at least one test case exposes it.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-12-15 16:50:11 -05:00
Flavio Ceolin
94647d8e67 pm: device: Account state locked in action_run
Similar what is done in pm_device_state_set, checking if the power
state for a given device in pm_device_action_run is locked.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-12-15 16:47:01 -05:00
Chris Trowbridge
ac28f8ddde boards: arm: Add NXP i.MX8M Plus EVK board support
Add board support for NXP i.MX8M Plus EVK. This board has the following
features:

Processor    : i.MX8M Plus Quad applications processor
Memory       : 32-bit LPDDR4 w/6 GB
               eMMC 5.0/5.1 w/32 GB
               SD/MMC connector
               QSPI w/32 MB
Connectivity : MIMO 2x2 Wi-Fi 802.11b/g/n/ac and BT 4.2
               2x Ethernet (1x w/ TSN)
               PCIe M.2
               2x CAN FD DB9 Female connectors
USB          : USB 3.0 Type C for Power
               USB 3.0 Type A
               USB 3.0 Type C
Debug        : JTAG connector
               MicroUSB for debug console

More information about this board can be found in NXP website: https://www.nxp.com/design/development-boards/i-mx-evaluation-and-development-boards/evaluation-kit-for-the-i-mx-8m-plus-applications-processor:8MPLUSLPD4-EVK

Signed-off-by: Chris Trowbridge <chris.trowbridge@lairdconnect.com>
2021-12-15 13:15:00 -06:00
Gerard Marull-Paretas
4cc018bcd6 pm: policy: header cleanup
Include just the necessary headers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-15 11:27:39 +01:00
Andy Ross
79746d701b arch/xtensa: Make cache utilities ALWAYS_INLINE
These are tiny functions always declared as "inline" per C99, but
that's just a hint.  In practice, they tend to be (c.f. intel_asdp)
called from very early boot circumstances where main application
symbols aren't yet available.  That obviously doesn't work, or even
link.

Make them ALWAYS_INLINE.  In practice they're so small that we don't
want them called anyway just for stack space reasons.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-12-14 18:43:05 -06:00
Flavio Ceolin
18b932f10d pm: device_runtime: Return possible error on enable
Change the function pm_device_runtime_enable() to return 0 on
success or an error code in case of error.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-12-14 19:23:05 -05:00
Flavio Ceolin
0a32eadd13 pm: Account device pm state lock
Do not execute pm operations on devices that the device pm state is
locked.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-12-14 19:23:05 -05:00
Flavio Ceolin
097e08c71a pm: device: Add device pm state lock
Add a new API to lock a device pm state.

When the device has its state locked, the kernel will no longer
suspend / resume devices when the system goes to sleep and device
runtime power management operations will fail.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-12-14 19:23:05 -05:00
Bartosz Bilas
0bd304f9d9 drivers: sensor: ina23x: add support for INA237
Add the new driver for INA237 variant which is
quite similar to the already supported INA230.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-12-14 13:48:54 -06:00
Bartosz Bilas
2df7140947 drivers: sensor: ina230: driver refactoring
Create an explicit ina230 driver which is supposed to
work with 230 and 231 variants. While at it switch
to i2c_dt_spec helpers and change device-tree node
names to use - instead of _ in order to follow
convention.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-12-14 13:48:54 -06:00
Yuval Peress
7b86137b6c fatal: fix missing extern "C"
This was causing an error when building with pigweed as a module.

Signed-off-by: Yuval Peress <peress@google.com>
2021-12-14 11:47:13 -06:00
Yuval Peress
56beca3828 sys: cbprintf: Fix unused arg warning
Missed unused arg, throws warning when compiling with
-Wunused-parameter.

Signed-off-by: Yuval Peress <peress@google.com>
2021-12-14 11:47:13 -06:00
Yuval Peress
9103bf8230 assert: Add missing include
printk is used if CONFIG_ASSERT_VERBOSE is set but was missing an import

Signed-off-by: Yuval Peress <peress@google.com>
2021-12-14 11:47:13 -06:00
Yuval Peress
e84a48d8b8 cbprintf: Fix unused arg warning
This was found when building with `-Wextra` enabled.

Signed-off-by: Yuval Peress <peress@google.com>
2021-12-14 11:47:13 -06:00
Yuval Peress
50a89ce287 zephyr: fix errors when building with -Wundef
Several points check the value of CONFIG_s without first checking that
they're defined. This causes an warning when adding -Wundef to the
build.

Signed-off-by: Yuval Peress <peress@google.com>
2021-12-14 11:47:13 -06:00
Yuval Peress
8aa2c3f3d1 sys: Fix warning for stripped const qualifier
This causes an issue when compiling with `-Werror=cast-qual`

Signed-off-by: Yuval Peress <peress@google.com>
2021-12-14 11:47:13 -06:00
David Leach
5e36939664 pm: device: fix comment reference to DT_INVALID_NODE
Comment block for Z_PM_DEVICE_DEFINE had an incorrect
reference to DT_INVALID_NODE. Using DT_NODE_INVALID
which isn't defined.

Signed-off-by: David Leach <david.leach@nxp.com>
2021-12-14 08:36:03 -06:00
Ederson de Souza
bdaac354f4 kernel: Bring back object tracking
When CONFIG_TRACING_OBJECT_TRACKING is enabled, the kernel will keep
lists of some objects (detailed below), so that debuggers or other tools
can keep track of them.

The lists of objects are:

struct k_timer *_track_list_k_timer;
struct k_mem_slab *_track_list_k_mem_slab;
struct k_sem *_track_list_k_sem;
struct k_mutex *_track_list_k_mutex;
struct k_stack *_track_list_k_stack;
struct k_msgq *_track_list_k_msgq;
struct k_mbox *_track_list_k_mbox;
struct k_pipe *_track_list_k_pipe;
struct k_queue *_track_list_k_queue;

Note that while CONFIG_TRACING is needed, one can always use
CONFIG_TRACE_NONE=y. Also, tracking will only be done for objects that
are also being traced (so, to prevent tracking of some type of object,
such as k_timer, just make CONFIG_TRACING_TIMER=n).

Some simple "sanity checking" tests are also added in this patch.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2021-12-14 07:42:31 -05:00
Lauren Murphy
c1711997bc debug: coredump: add xtensa coredump
Adds Xtensa as supported architecture for coredump. Fixes
a few typos in documentation, Kconfig and a C file. Dumps
minimal set of registers shown by 'info registers' in GDB
for the sample_controller and ESP32 SOCs. Updates tests.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2021-12-14 07:40:55 -05:00
Peter Mitsis
f8b76f3b03 kernel: add 'static' keyword to select routines
Applies the 'static' keyword to the following inlined routines:
    z_priq_dumb_add()
    z_priq_mq_add()
    z_priq_mq_remove()
As those routines are only used in one place, they no longer have
externally visible declarations.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2021-12-13 17:21:58 -05:00
Johann Fischer
02d1fd9ad7 linker: remove unused usb_data data section in RAM
Remove unused usb_data data section in RAM which is
replaced by iterable section usb_cfg_data.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 07:22:15 -06:00
Johann Fischer
b1356e969d include: usb: add iterable section in ram for usb_cfg_data
Add iterable section in ram for struct usb_cfg_data and
new makro USBD_DEFINE_CFG_DATA which should be used to
define usb_cfg_date structures.

Deprecate makro USBD_CFG_DATA_DEFINE.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 07:22:15 -06:00
Johann Fischer
dfb7a5952f include: usb: add alignment attribute to macro USBD_CFG_DATA_DEFINE
It could be observed on native_posix_64 platform that
without alignment attribute the usb_cfg_data structures
are placed with a gap or padding in specified RAM section.
This breaks the possibility to iterate over the structures.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 07:22:15 -06:00
Carles Cufi
944a02d18a include: Add a macro to check pointer alignment
Add a new macro, IS_PTR_ALIGNED() that verifies if a pointer is aligned
sufficiently for a particular data type provided as an argument.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Kent Hall
c67b44c96a drivers: counter: Added get_freq to API
Optional counter API function which allows for a driver to determine
counter frequency at runtime; if set, this supersedes whatever is set
statically in the counter_config_info struct.

Signed-off-by: Kent Hall <kjh2166@columbia.edu>
2021-12-09 19:55:17 -05:00
Piotr Pryga
a26ee7ce73 Bluetooth: host: Add IQ reports handing in DF connecte mode
Add reception of IQ sample report from controller.
Add applications notification about received reports.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-12-09 19:44:15 -05:00
Piotr Pryga
f18637fe30 Bluetooh: host: Add CTE RX and sample enable for conn mode
Add enable of CTE reception and sampling in connected mode.

The implementation allows an application to decide what type
of CTE is expected to be reported. Bluetooth Core specification
does not provide such functionality, so it is provided as part
of host implementation. Host will filter out all reports for not
enabled CTE types.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-12-09 19:44:15 -05:00
Gerard Marull-Paretas
4ec7cf33dc include: remove deprecated <power/power.h> header
<power/power.h> was deprecated in 2.6 in favor of <pm/pm.h>.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-09 14:43:06 -05:00
Gerard Marull-Paretas
0a1e8dc44b include: remove deprecated <power/reboot.h> header
<power/reboot.h> was deprecated in 2.6 in favor of <sys/reboot.h>

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-09 14:43:06 -05:00
Emil Gydesen
815dd27d8c Bluetooth: buf: Update BT_BUF_RX_SIZE with ISO
The BT_BUF_RX_SIZE did not take the CONFIG_BT_ISO_RX_MTU
into account. Add BT_BUF_ISO_RX_SIZE which
depend on CONFIG_BT_ISO and use that for the
BT_BUF_RX_SIZE macro.

Furthermore, move the BT_BUF_RX_COUNT macro definitions
into buf.h and update that to account for ISO RX as well.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-12-09 12:38:12 -05:00
Henrik Brix Andersen
1fb6c6387e drivers: can: fix doxygen comment formatting
Fix the formatting of a few doxygen comments.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-09 12:37:40 -05:00
Henrik Brix Andersen
1004901bb3 drivers: can: exclude deprecated APIs from the documentation
Move the deprecated CAN APIs to the bottom of the include file and
exclude them from the documentation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-09 12:37:40 -05:00
Henrik Brix Andersen
f499559434 drivers: can: deprecate the use of CAN-specific error return values
Deprecate the use of CAN-specific error return values and replace them
with standard errno values.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-09 12:37:40 -05:00
Krzysztof Chruscinski
9ddc45884d logging: Improve instance logging filtering
Instance logging allows to set independent severity level for
each instance (static and runtime). However, so far when runtime
filtering was disabled, static level was not taken into account
and instance messages were only compile time filtered based on
module level.

Improved logging macros to use static instance level to determine
if message shall be created. It enables instance filtering also
when runtime filtering is disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-09 16:56:40 +01:00
Jordan Yates
7b2a388d1d linker: remove manual name specification
As memory region names are now derived purely from devicetree, remove
the `name` parameter from `DT_REGION_FROM_NODE_STATUS_OKAY`. Name is
`zephyr,linker-region` if it exists, otherwise the node path.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-12-09 16:23:03 +01:00
Jordan Yates
024ecdd672 devicetree: LINKER_DT_NODE_REGION_NAME added
Adds a macro to convert a devicetree node to the name of a linker memory
region.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-12-09 16:23:03 +01:00