From 3ee8f6d23056b96d8f390d1f14ce550fffd03f67 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sun, 1 Feb 2026 18:56:40 +0100 Subject: [PATCH] moves tx_timer_interrupt to threadx port --- port/moonlight/trap_non_vectored.c | 7 +++++-- port/threadx/CMakeLists.txt | 1 - port/threadx/inc/nx_port.h | 5 ++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/port/moonlight/trap_non_vectored.c b/port/moonlight/trap_non_vectored.c index d25d4ff..513778c 100644 --- a/port/moonlight/trap_non_vectored.c +++ b/port/moonlight/trap_non_vectored.c @@ -1,9 +1,9 @@ #include "hwtimer.h" +#include "riscv-traps.h" #include +#include #include #include -#include -#include "riscv-traps.h" #if __riscv_xlen == 64 #define INTERRUPT_BIT 0x8000000000000000ull @@ -33,6 +33,9 @@ void trap_handler(uintptr_t mcause, uintptr_t mepc, uintptr_t mtval) { unsigned irq_id = mcause&(__riscv_xlen-1); switch(irq_id){ case RISCV_INT_MTI: +#ifdef NX_DEBUG + printf("Timer interrupt being handled (pc=%lx)\n", mepc); +#endif hwtimer_handler(); _tx_timer_interrupt(); break; diff --git a/port/threadx/CMakeLists.txt b/port/threadx/CMakeLists.txt index 637e49f..e9c2e6a 100644 --- a/port/threadx/CMakeLists.txt +++ b/port/threadx/CMakeLists.txt @@ -5,7 +5,6 @@ target_sources(${PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}/src/tx_initialize_low_level.S ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_context_restore.S ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_context_save.S - #${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_interrupt_control.S ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_schedule.S ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_stack_build.S ${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_system_return.S diff --git a/port/threadx/inc/nx_port.h b/port/threadx/inc/nx_port.h index 618c384..3461cfc 100644 --- a/port/threadx/inc/nx_port.h +++ b/port/threadx/inc/nx_port.h @@ -66,8 +66,7 @@ #ifndef NX_IP_PERIODIC_RATE #ifdef TX_TIMER_TICKS_PER_SECOND -/* it seems this needs to be smaller than the timer ticks per second. Otherwise no time is left for other tasks*/ -#define NX_IP_PERIODIC_RATE (TX_TIMER_TICKS_PER_SECOND / 10) +#define NX_IP_PERIODIC_RATE TX_TIMER_TICKS_PER_SECOND #else #define NX_IP_PERIODIC_RATE 10 #endif @@ -191,4 +190,4 @@ CHAR _nx_version_id[] = "Copyright (c) 2024 Microsoft Corporation. * NetX Duo PI extern CHAR _nx_version_id[]; #endif -#endif \ No newline at end of file +#endif