This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 3966097453 arch/arm/src/rp23xx: allow to use armv8m systick lowerhalf
3966097453 is described below

commit 3966097453030ff61c0901b42e0345c51af7a175
Author: Serg Podtynnyi <s...@podtynnyi.com>
AuthorDate: Sat May 10 22:17:13 2025 +0700

    arch/arm/src/rp23xx: allow to use armv8m systick lowerhalf
    
    Add ability to use arv8m systick lowerhalf driver
    Fix wrong macro for systick current register in initialize
    
    Signed-off-by: Serg Podtynnyi <s...@podtynnyi.com>
---
 arch/arm/src/rp23xx/Kconfig           |  9 +++++++++
 arch/arm/src/rp23xx/rp23xx_timerisr.c | 12 ++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/arch/arm/src/rp23xx/Kconfig b/arch/arm/src/rp23xx/Kconfig
index f85a049744..e53f6a5455 100644
--- a/arch/arm/src/rp23xx/Kconfig
+++ b/arch/arm/src/rp23xx/Kconfig
@@ -14,6 +14,15 @@ config RP23XX_DMAC
        default y
        select ARCH_DMA
 
+config RP23XX_SYSTIMER_SYSTICK
+       bool "SysTick System Timer"
+       default n
+       select TIMER_ARCH
+       select TIMER
+       select ARMV8M_SYSTICK
+       ---help---
+               Use ARM SysTick.
+
 #####################################################################
 #  UART Configuration
 #####################################################################
diff --git a/arch/arm/src/rp23xx/rp23xx_timerisr.c 
b/arch/arm/src/rp23xx/rp23xx_timerisr.c
index 87e8cb2a37..052d636aaf 100644
--- a/arch/arm/src/rp23xx/rp23xx_timerisr.c
+++ b/arch/arm/src/rp23xx/rp23xx_timerisr.c
@@ -31,12 +31,14 @@
 #include <debug.h>
 
 #include <nuttx/arch.h>
+#include <nuttx/timers/arch_timer.h>
 #include <arch/board/board.h>
 
 #include "nvic.h"
 #include "clock/clock.h"
 #include "arm_internal.h"
 #include "chip.h"
+#include "systick.h"
 
 /****************************************************************************
  * Pre-processor Definitions
@@ -74,7 +76,7 @@
  *   of the systems.
  *
  ****************************************************************************/
-
+#ifndef CONFIG_RP23XX_SYSTIMER_SYSTICK
 static int rp23xx_timerisr(int irq, uint32_t *regs, void *arg)
 {
   /* Process timer interrupt */
@@ -82,6 +84,7 @@ static int rp23xx_timerisr(int irq, uint32_t *regs, void *arg)
   nxsched_process_timer();
   return 0;
 }
+#endif
 
 /****************************************************************************
  * Public Functions
@@ -107,10 +110,14 @@ void up_timer_initialize(void)
   regval |= (NVIC_SYSH_PRIORITY_DEFAULT << NVIC_SYSH_PRIORITY_PR15_SHIFT);
   putreg32(regval, NVIC_SYSH12_15_PRIORITY);
 
+#ifdef CONFIG_RP23XX_SYSTIMER_SYSTICK
+  up_timer_set_lowerhalf(systick_initialize(true, SYSTICK_CLOCK, -1));
+#else
+
   /* Configure SysTick to interrupt at the requested rate */
 
   putreg32(SYSTICK_RELOAD, NVIC_SYSTICK_RELOAD);
-  putreg32(0, NVIC_SYSTICK_CURRENT_OFFSET);
+  putreg32(0, NVIC_SYSTICK_CURRENT);
 
   /* Attach the timer interrupt vector */
 
@@ -126,4 +133,5 @@ void up_timer_initialize(void)
   /* And enable the timer interrupt */
 
   up_enable_irq(RP23XX_IRQ_SYSTICK);
+#endif
 }

Reply via email to