Commit Graph

111 Commits

Author SHA1 Message Date
Benedikt Streicher 0bd7020449 HwiP: added AUX software event interrupts
Added AUX_SWEV0 and AUX_SWEV1 interrupts to allow the Sensor Controller to
trigger these events and the System CPU to evaluate them. Also changed 
HwiP_Params_init and the enabling of interrupts in HwiP_construct to allow
interrupts to be constructed without directly enabling them. This is used
by the sensor controller interface when registering the interrupts.

Signed-off-by: Benedikt Streicher <streicher.b@posteo.de>
2024-04-09 18:05:48 +05:30
Fabio Baltieri b85f86e51f simplelink: slnetsock: fix sys/time.h include when sockets are enabled
This include is causing a nemspace collision between the picolibc and
the Zephyr select definitions. Looks like this was originally a '#ifndef
CONFIG_NET_SOCKETS_POSIX_NAMES' but got inverted as a positive condition
at some stage, which is now causing a build fail.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-14 22:02:03 +05:30
Florian Grandel 9fa5827c44 ClockP: fix us/ms <-> ticks conversion errors
Calculations based on the clock tick period produce series loss in
precision (~17250 ppm) when the system tick is based on the LF crystal.
This is inacceptable for most applications especially in the RF area and
leads to fatal timing errors there (e.g. the radio timer oversleeping
systematically during power down).

This change improves precision by rounding as late as possible. To this
end calculations are based on the precise tick frequency rather than
rounded tick periods.

While rounding later improves precision it will not completely remove
rounding error in most cases. Therefore an appropriate rounding approach
must be chosen for each individual use case.

Several helper functions with well-defined rounding semantics are
introduced and applied throughout the HAL to improve precision as much
as possible in the integers domain.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-09-08 23:07:01 +05:30
Florian Grandel b2d7eebd5a ClockP: fix clock resolution
TI's ClockP API requires clock timeout and period to be specified in
ticks rather than milliseconds.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-09-08 23:07:01 +05:30
Florian Grandel a2cc7b7d45 ClockP: remove cruft
Removes cruft from the ClockP implementation that seems to have
accumulated over time - especially with respect to the timer API.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-09-08 23:07:01 +05:30
Florian Grandel 92842003db stubs: remove unused header
Removes the unused stubs.h header.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-09-08 23:07:01 +05:30
Florian Grandel 40bd03db72 drivers: rf: RFCC26X2_multiMode: regression due to prior race fix
The fix of a race condition in the previous commit introduced a
regression in power management which disallowed transitions to
power-down state. This fixes the regression.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-08-10 23:29:43 +05:30
Florian Grandel a416134d7f drivers: rf: RFCC26X2_multiMode: fix power down/rat race
The driver had a race condition that would systematically try to
schedule the power down procedure while already powering down when a RAT
timer was active during power down.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-08-05 16:52:00 +05:30
Gerard Marull-Paretas ae1db23f32 zephyr: update SYS_INIT calls
Use the new call signature: int (*init_fn)(void);

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-11 23:05:21 +05:30
Vaishnav Achath 4e0e053f5e simplelink: ti: devices: Add CC13X2X7 and CC26X2X7 support
Add support for CC1352X7 device family in hal_ti, sources are fetched from latest
simplelink SDK simplelink_cc13xx_cc26xx_sdk_6_20_00_29 , should be able to merge
majority of the sources in the X1 and X7 directory. Tested on CC1352P7 launchpad.

Signed-off-by: Vaishnav Achath <vaishnav@beagleboard.org>
Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
2023-03-19 14:07:41 -04:00
Keith Packard 5e7d5cd584 simplelink: use 'errno' instead of '*__errno()' for picolibc compat
Picolibc doesn't always use an __errno function, preferring to use TLS
errno variable instead as that's more efficient. But, that means
applications shouldn't dig through the original errno abstraction to
use the underlying implementation directly.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-11-03 05:46:21 -04:00
Chris Friedt a5ffc6dc73 simplelink: wifi: avoid re-declaring pthread_self()
The normative spec says this returns `pthread_t`, not `void *`.
It's probably better to simply `#include <pthread.h>` outside
of this file explicitly (due to current non-standard prefixed
path in Zerphy) than to re-declare it with a potentially
conflicting signature.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2022-10-31 17:35:09 -04:00
Gerard Marull-Paretas 000b944a78 hal: use s/<zephyr/zephyr.h>/<zephyr/kernel.h>
<zephyr/zephyr.h> is just a shim to <zephyr/kernel.h>.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-25 14:52:48 +02:00
Stancu Florin b8f1aaf276 simplelink: cc13x2_cc26x2: include ADC driverlib sources
Used by Zephyr's TI CC13xx/CC26xx ADC driver which requires
additional functions not found inside the SOC ROM (e.g.,
`AUXADCEnableSync` errata workaround).

Signed-off-by: Stancu Florin <niflostancu@gmail.com>
2022-08-22 12:23:43 -05:00
Gerard Marull-Paretas 29af528900 hal: inject required definitions
The TI HAL requires certain definitions, e.g. DeviceFamily_XYZ to be
present when compiling, as some public headers require them. Instead of
manually injecting them to every file because one of its includes
requires it, just insert global level definitions. This makes sure
they'll be made available where necessary without the need of individual
hacks.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-28 10:43:22 +02:00
Stancu Florin b6ca1ace90 cc13x2_cc26x2: update to TI SimpleLink SDK 4.40.04.04
Update the HAL to TI SimpleLink SDK 4.40.
Retains Zephyr-specific patches.

Note: PRCMPowerDomainStatus was renamed to PRCMPowerDomainsAllOn, so Zephyr
drivers will require updating!

Signed-off-by: Stancu Florin <niflostancu@gmail.com>
2022-05-31 22:19:26 -04:00
Stancu Florin c54f72e1a6 zephyr: kconfig for CC13x2 / CC26x2 custom RF HWAttrs
Support `CONFIG_CC13X2_CC26X2_HAS_CUSTOM_RF_HWATTRS` required for
board-specific antenna switching.

Signed-off-by: Stancu Florin <niflostancu@gmail.com>
2022-05-27 08:39:12 -04:00
Stancu Florin bcc5286992 zephyr: kconfig for CC13x2P / CC26x2P variants
Adds the new SoC Kconfig vars (SOC_CC1352P and SOC_CC2652P) to family
conditions.

Signed-off-by: Stancu Florin <niflostancu@gmail.com>
2022-05-27 08:39:12 -04:00
Piotr Dymacz b00ac9bf52 simplelink: cc13x2_cc26x2: include flash driverlib sources
These sources are required for CC13xx/CC26xx on-chip flash driver which
makes use of TI's HAL functions and some of them are not inside ROM.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2022-05-26 09:04:49 -04:00
Gerard Marull-Paretas 905a5d4134 zephyr: use <zephyr/kernel.h>
<zephyr/zephyr.h> is a shim to the Kernel header, so let's use it
directly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-10 14:58:49 +02:00
Gerard Marull-Paretas 87cc2f469e zephyr: update include paths to use <zephyr/...>
Zephyr has prefixed all of its includes with <zephyr/...>. While the old
mode can still be used (CONFIG_LEGACY_INCLUDE_PATH) and is still enabled
by default, it's better to be prepared for its removal in the future.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-10 14:58:49 +02:00
Gerard Marull-Paretas 0e06d96fea power: migrate PM includes to <zephyr/...>
Zephyr has prefixed all of its includes with <zephyr/...>. While the old
mode can still be used (CONFIG_LEGACY_INCLUDE_PATH) and is still enabled
by default, it's better to be prepared for its removal in the future.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-09 22:17:05 +09:00
Keith Packard a29a32b806 simplelink: Use <errno.h> to get definition of errno
Use the C library errno header instead of assuming a particular
implementation.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-04-22 07:21:06 +09:00
Carlo Caione 67a0d8a2c0 hal: drivers: Use new state lock API.
Use new pm_policy_state_lock_get() and pm_policy_state_lock_put()
functions.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-04-22 07:18:34 +09:00
Christopher Friedt 92a7958fcb zephyr: remove posix prefix on standard time.h header
Instead of using `#include <posix/time.h>`, just use `#include <time.h>`.

Required-by zephyrproject-rtos/zephyr#43998

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2022-04-21 15:45:43 +02:00
Gerard Marull-Paretas 2a5891d874 hal: drivers: update Zephyr constraints API
The API has changed to:

pm_constraint_set: pm_policy_state_lock_get
pm_constraint_release: pm_policy_state_lock_put

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-10 19:49:34 +01:00
Gerard Marull-Paretas ba4823f6be hal: drivers: use Zephyr PM constraints API
The constraints API offered by TI HAL is meant to be used externally,
for example, when implementing a policy using their policy mechanism
(not used on Zephyr). The API is likely designed for systems where a
thin RTOS is used (e.g., FreeRTOS, TI-RTOS?), places where you basically
get a Kernel and a few services around, but not a system like Zephyr
where you also get, for example, a power management subsystem. This
means that it gets difficult for an RTOS like Zephyr to use such HAL
APIs while using its own constraints API. The first question is why we
allowed such kind of HAL code to be part of upstream Zephyr. It
certainly does useful things, but it is also uses a HAL infrastructure
which is hardly exportable to an RTOS like Zephyr. Part of the
Power_init() code, for example, should likely be in a clock controller
driver, where Zephyr APIs can be used.

This patch forwards PM state constraints to Zephyr, so that we don't
need hacks on the Zephyr side like allowing re-implementations of the
constraints API.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-25 10:03:49 +01:00
Carles Cufi 1992a4c536 dpl: Use dynamic interrupt binding
IRQ_CONNECT() requires that all parameters be known at compile-time, but
that is not the case with the interrupt priority. Instead, use
irq_connect_dynamic() which allows runtime arguments.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-08-09 16:33:33 +02:00
Anas Nashif 3da6fae25f zephyr: use k_ms_to_ticks_ceil32 instead of z_ms_to_ticks
z_ms_to_ticks is being deprecated and is private, so use
k_ms_to_ticks_ceil32 instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-15 20:22:28 -04:00
Christopher Friedt 277d70a65a simplelink: rf: use multi-protocol patch
Use the same multi-protocol patch for ble, 15.4, and subg.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-11-09 10:49:28 -06:00
Peter A. Bigot 405dfc8fab simplelink: dpl: update for Zephyr API change
All device objects are const-qualified; update the init function
signature to be compatible.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-09-08 08:06:36 -05:00
Vincent Wan deb246ade0 simplelink: dpl: Revert change to constant device instance
Temporarily revert the change from
9b56312f9a as zephyrproject-rtos#24873
is not yet merged, and without it, build errors would occur while
running sanitycheck.

Signed-off-by: Vincent Wan <vwan@ti.com>
2020-09-01 20:15:51 +02:00
Vincent Wan adb7027102 simplelink: net: tweaks to SlNetSock to prevent build errors/warnings
Minor tweaks to the SlNetSock code to avoid errors/warnings
when building for Zephyr, due to its stricter build flags and its
idiosyncrasies around its posix implementations.

Signed-off-by: Vincent Wan <vwan@ti.com>
2020-09-01 20:15:51 +02:00
Vincent Wan 13267bea30 simplelink: net: import SlNetSock
Bring in SlNetSock and its associated modules from the TI CC32xx
SimpleLink SDK 4.10.00.07. SlNetSock is a module that implements a
higher-level, BSD-socket-like abstraction that has the ability to
support multiple network interfaces. When used on top of the native
SimpleLink WiFi Host Driver API, it provides extra network-related
functionality such as getaddrinfo(), which is necessary for addressing
zephyrproject-rtos/zephyr#11890

Origin: Texas Instruments cc32xx SimpleLink SDK
License: BSD 3-Clause
URL: http://www.ti.com/tool/download/simplelink-cc32xx-sdk
Purpose: Provide access to SlNetSock functions for TI CC32XX SoC
Maintained-by: External

Signed-off-by: Vincent Wan <vwan@ti.com>
2020-09-01 20:15:51 +02:00
Tomasz Bursztyka b84ad97802 dpl: Device instance are all constant now
Switching device parameter to constant.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-08-04 08:18:21 -05:00
Christopher Friedt d151955235 simplelink: ble: rf patch file
Support for patching radio core for BLE

Also, correct use of
zephyr_sources_ifdef -> zephyr_library_sources_ifdef

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-06-16 20:50:15 -05:00
Christopher Friedt f9cc51a420 simplelink: drivers: resolve symbol Temperature_getTemperature
RFCC26X2_multiMode.c references Temperature_getTemperature()
but source/ti/drivers/temperature/TemperatureCC26X2.c was not
previously linked in.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-06-14 17:56:26 -05:00
Kumar Gala aabc6a04a8 simplelink: dpl: Convert from Zephyr to C99 types
Convert to use C99 types as we intend to deprecate the zephyr
specific integer types.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-03 10:22:12 -05:00
Vincent Wan 15b76302bf devices: cc13x2_cc26x2: Add RF patch for 802.15.4
Necessary to support the IEEE 802.15.4 driver.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-18 15:50:48 -05:00
Vincent Wan a95376bfee devices: cc13x2_cc26x2: add back rfc.c
rfc.c should be added back to the list of files in driverlib to be
compiled, as it is needed by IEEE 802.15.4 driver.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-18 15:50:48 -05:00
Vincent Wan c398cc7959 cc13x2_cc26x2: drivers: fix build warnings in PowerCC26X2.c
Fixing build warnings that are seen as an extra pair of braces is
missing around the initializer for a structure which first field
is another structure.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-07 00:54:55 -05:00
Vincent Wan 73a56862dd cc13x2_cc26x2: update to TI SimpleLink SDK 4.10.00.78
Update the HAL to new TI SimpleLink SDK, including driverlib, rf
patches and TI drivers.

Add the temperature driver in order to support new changes in the
Power Manager.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-07 00:54:55 -05:00
Carles Cufi ebf0a6f11c timeouts: Use the new timeout API
Port the code to use the new timeout API.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-04 19:46:58 +02:00
Vincent Wan 811363a384 cc32xx: update to TI SimpleLink SDK 4.10.00.07
Update the HAL to new TI SimpleLink SDK, including driverlib and TI
drivers.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-04-30 21:48:16 -05:00
Kumar Gala 7cdfe31375 msp432p4xx: replace DT_ARM_CORTEX_*_CLOCK_FREQUENCY with new dt macros
Replace DT_ARM_CORTEX_*_0_CLOCK_FREQUENCY with a PATH based reference
to cpu@0 (DT_PATH(cpus, cpu_0)) and than getting the clock_frequency
property:

    DT_ARM_CORTEX_*_CLOCK_FREQUENCY ->
        DT_PROP(DT_PATH(cpus, cpu_0), clock_frequency)

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 12:41:09 -05:00
Vincent Wan 7dcbff2d59 simplelink: drivers: wifi: include proper posix/time.h from Zephyr
Remove hacks that were introduced when it was not possible to include
this header earlier, and directly include the header from Zephyr. This
would allow new changes (such as the recent change to modify
clock_gettime() into a syscall) to be reflected in the HAL.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-04-25 04:48:54 -05:00
Vincent Wan b25d4b83b1 simplelink: dpl: Fix SemaphoreP initialization
When creating or constructing a semaphore, the count passed in is
incorrectly being ignored. We need to fix SemaphoreP_create/construct
to pass the initial count to k_sem_init().

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-02-10 21:11:31 -06:00
Vincent Wan ab9b289a10 simplelink: fix strict aliasing build warning in RF driver
Small fix to prevent strict aliasing warning, which becomes an error
on Shippable.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-02-04 15:56:17 -06:00
Vincent Wan e45a3f8ed2 simplelink: dpl: fix issues in ClockP
This commit fixes ClockP to use correct struct size, to set the correct
period and timeout in call to k_timer_start, and to deal with NULL
parameters in ClockP_construct.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-02-04 15:56:17 -06:00
Vincent Wan d3b9d78ea3 simplelink: dpl: Add support of INT_RFC_CPE_0 and INT_RFC_HW_COMB
HwiP_construct needs to support these interrupts in order for the RF
driver to work.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-02-04 15:56:17 -06:00