From 9195ca3563e4a070167496b864e2366e917fb12f Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 4 Apr 2021 08:26:20 +0000 Subject: [PATCH] Added RT counter support to RP2 port. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14133 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- demos/RP/RT-RP2040-PICO/cfg/chconf.h | 2 +- os/common/ports/ARMv6-M-RP2/chcore.h | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/demos/RP/RT-RP2040-PICO/cfg/chconf.h b/demos/RP/RT-RP2040-PICO/cfg/chconf.h index ab5b434f9..04c41a001 100644 --- a/demos/RP/RT-RP2040-PICO/cfg/chconf.h +++ b/demos/RP/RT-RP2040-PICO/cfg/chconf.h @@ -177,7 +177,7 @@ * @note The default is @p TRUE. */ #if !defined(CH_CFG_USE_TM) -#define CH_CFG_USE_TM FALSE +#define CH_CFG_USE_TM TRUE #endif /** diff --git a/os/common/ports/ARMv6-M-RP2/chcore.h b/os/common/ports/ARMv6-M-RP2/chcore.h index 2f85735f1..9fc0f498b 100644 --- a/os/common/ports/ARMv6-M-RP2/chcore.h +++ b/os/common/ports/ARMv6-M-RP2/chcore.h @@ -63,7 +63,7 @@ * @name Port Capabilities and Constants * @{ */ -#define PORT_SUPPORTS_RT FALSE +#define PORT_SUPPORTS_RT TRUE /** * @brief Natural alignment constant. @@ -677,6 +677,18 @@ __STATIC_INLINE void port_wait_for_interrupt(void) { #endif } +/** + * @brief Returns the current value of the realtime counter. + * @note In this port the RT counter is the same counter used for + * system time in tick-less mode, resolution is always 1uS. + * + * @return The realtime counter value. + */ +__STATIC_FORCEINLINE rtcnt_t port_rt_get_counter_value(void) { + + return TIMER->TIMERAWL; +} + /** * @brief Returns a core index. * @return The core index.