From 322de17755923af53b8ba95021988d71e2135e55 Mon Sep 17 00:00:00 2001 From: Gabriel Wang Date: Sat, 27 Jan 2024 16:09:58 +0000 Subject: [PATCH] rename user_code_insert_to_systick_handler as perfc_port_insert_to_system_timer_insert_ovf_handler --- README.md | 4 ++-- perf_counter.c | 2 +- perf_counter.h | 8 ++++++-- perfc_port_pmu.c | 6 +++--- perfc_port_pmu.h | 2 +- systick_wrapper_gcc.S | 2 +- systick_wrapper_gnu.s | 2 +- systick_wrapper_ual.s | 4 ++-- 8 files changed, 17 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index da056e8..0c9c6d5 100644 --- a/README.md +++ b/README.md @@ -266,13 +266,13 @@ git clone https://github.com/GorgonMeducer/perf_counter.git 5. Make sure your system contains the CMSIS (with a version 5.7.0 or above) as `perf_counter.h` includes `cmsis_compiler.h`. -6. Call the function `user_code_insert_to_systick_handler()` in your `SysTick_Handler()` +6. Call the function `perfc_port_insert_to_system_timer_insert_ovf_handler()` in your `SysTick_Handler()` ```c void SysTick_Handler(void) { ... - user_code_insert_to_systick_handler(); + perfc_port_insert_to_system_timer_insert_ovf_handler(); ... } ``` diff --git a/perf_counter.c b/perf_counter.c index 341cc7f..504d430 100644 --- a/perf_counter.c +++ b/perf_counter.c @@ -99,7 +99,7 @@ void perfc_port_clear_system_timer_counter(void); /*============================ IMPLEMENTATION ================================*/ /*============================ INCLUDES ======================================*/ -void user_code_insert_to_systick_handler(void) +void perfc_port_insert_to_system_timer_insert_ovf_handler(void) { int64_t lLoad = perfc_port_get_system_timer_top() + 1; s_lSystemClockCounts += lLoad; diff --git a/perf_counter.h b/perf_counter.h index da5ea7a..6904ec0 100644 --- a/perf_counter.h +++ b/perf_counter.h @@ -313,6 +313,10 @@ extern "C" { # define __perf_counter_printf__ printf #endif +/* deprecated macro for backward compatibility */ +#define user_code_insert_to_systick_handler \ + perfc_port_insert_to_system_timer_insert_ovf_handler + #if __PLOOC_VA_NUM_ARGS() != 0 #warning Please enable GNU extensions, it is required by __cycleof__() and \ __super_loop_monitor__() @@ -909,7 +913,7 @@ extern bool init_cycle_counter(bool bIsSysTickOccupied); /*! - * \brief a system timer handler inserted to the SysTick_Handler + * \brief a system timer overflow handler * * \note - if you are using a compiler other than armcc or armclang, e.g. iar, * arm gcc etc, the systick_wrapper_ual.o doesn't work with the linker @@ -922,7 +926,7 @@ extern bool init_cycle_counter(bool bIsSysTickOccupied); * you do NOT have to insert this function into your SysTick_Handler, * the systick_wrapper_ual.s will do the work for you. */ -extern void user_code_insert_to_systick_handler(void); +extern void perfc_port_insert_to_system_timer_insert_ovf_handler(void); /*! * \brief update perf_counter as SystemCoreClock has been updated. diff --git a/perfc_port_pmu.c b/perfc_port_pmu.c index 5ac4b86..31897c3 100644 --- a/perfc_port_pmu.c +++ b/perfc_port_pmu.c @@ -1090,10 +1090,10 @@ void perfc_port_clear_system_timer_counter(void); __USED void DebugMon_Handler(void) { - perfc_port_pmu_insert_debug_monitor_handler(); + perfc_port_pmu_insert_to_debug_monitor_handler(); } -void perfc_port_pmu_insert_debug_monitor_handler(void) +void perfc_port_pmu_insert_to_debug_monitor_handler(void) { if (!(SCB->DFSR & SCB_DFSR_PMU_Msk)) { return ; @@ -1102,7 +1102,7 @@ void perfc_port_pmu_insert_debug_monitor_handler(void) if (perfc_port_is_system_timer_ovf_pending()) { perfc_port_clear_system_timer_ovf_pending(); - user_code_insert_to_systick_handler(); + perfc_port_insert_to_system_timer_insert_ovf_handler(); } } diff --git a/perfc_port_pmu.h b/perfc_port_pmu.h index 8592c31..91694d2 100644 --- a/perfc_port_pmu.h +++ b/perfc_port_pmu.h @@ -30,7 +30,7 @@ typedef uint32_t perfc_global_interrupt_status_t; /*============================ LOCAL VARIABLES ===============================*/ /*============================ PROTOTYPES ====================================*/ extern -void perfc_port_pmu_insert_debug_monitor_handler(void); +void perfc_port_pmu_insert_to_debug_monitor_handler(void); /*============================ IMPLEMENTATION ================================*/ __STATIC_INLINE diff --git a/systick_wrapper_gcc.S b/systick_wrapper_gcc.S index 2d13da1..822d321 100644 --- a/systick_wrapper_gcc.S +++ b/systick_wrapper_gcc.S @@ -29,7 +29,7 @@ __wrap_SysTick_Handler: push {r4, r5} push {r4, lr} - ldr R0, =user_code_insert_to_systick_handler + ldr R0, =perfc_port_insert_to_system_timer_insert_ovf_handler blx R0 pop {r4, r5} mov lr, r5 diff --git a/systick_wrapper_gnu.s b/systick_wrapper_gnu.s index 516118a..f7be081 100644 --- a/systick_wrapper_gnu.s +++ b/systick_wrapper_gnu.s @@ -35,7 +35,7 @@ $Sub$$SysTick_Handler: push {r4, r5} push {r4, lr} - ldr R0, =user_code_insert_to_systick_handler + ldr R0, =perfc_port_insert_to_system_timer_insert_ovf_handler blx R0 pop {r4, r5} mov lr, r5 diff --git a/systick_wrapper_ual.s b/systick_wrapper_ual.s index 9e7b64a..63878cc 100644 --- a/systick_wrapper_ual.s +++ b/systick_wrapper_ual.s @@ -22,11 +22,11 @@ |$Sub$$SysTick_Handler| PROC EXPORT |$Sub$$SysTick_Handler| - IMPORT user_code_insert_to_systick_handler + IMPORT perfc_port_insert_to_system_timer_insert_ovf_handler IMPORT |$Super$$SysTick_Handler| push {r4, r5} push {r4, lr} - LDR R0, =user_code_insert_to_systick_handler + LDR R0, =perfc_port_insert_to_system_timer_insert_ovf_handler BLX R0 pop {r4, r5} mov lr, r5