Added performance counter

This commit is contained in:
Hedara 2024-08-29 15:36:05 +02:00 committed by Philipp AUER
parent f07189b1be
commit 2ab0dd77de

View file

@ -131,6 +131,31 @@
#define FEATURE_FLAG_ASSERT(flag, id) STATIC_ASSERT(flag > TEMP_FLAGS_END || flag == 0, id)
#ifndef NDEBUG
static inline void CycleCountStart()
{
REG_TM2CNT_H = 0;
REG_TM3CNT_H = 0;
REG_TM2CNT_L = 0;
REG_TM3CNT_L = 0;
// init timers (tim3 count up mode, tim2 every clock cycle)
REG_TM3CNT_H = TIMER_ENABLE | TIMER_COUNTUP;
REG_TM2CNT_H = TIMER_1CLK | TIMER_ENABLE;
}
static inline u32 CycleCountEnd()
{
// stop timers
REG_TM2CNT_H = 0;
REG_TM3CNT_H = 0;
// return result
return REG_TM2CNT_L | (REG_TM3CNT_L << 16u);
}
#endif
struct Coords8
{
s8 x;