Skip to content

Commit

Permalink
rename user_code_insert_to_systick_handler as perfc_port_insert_to_sy…
Browse files Browse the repository at this point in the history
…stem_timer_insert_ovf_handler
  • Loading branch information
GorgonMeducer committed Jan 27, 2024
1 parent c743567 commit 322de17
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
...
}
```
Expand Down
2 changes: 1 addition & 1 deletion perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions perf_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__()
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions perfc_port_pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;
Expand All @@ -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();
}
}

Expand Down
2 changes: 1 addition & 1 deletion perfc_port_pmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion systick_wrapper_gcc.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion systick_wrapper_gnu.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions systick_wrapper_ual.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 322de17

Please sign in to comment.