kernel: add function to calculate delta between two cycle timestamps

This commit is contained in:
2023-04-28 21:04:50 +01:00
parent 72d8facd47
commit 6b1b4a2416
2 changed files with 6 additions and 0 deletions

View File

@@ -36,6 +36,10 @@ extern void cpu_set_available(unsigned int cpu_id);
extern void cpu_set_online(unsigned int cpu_id);
extern cycles_t get_cycles(void);
static inline cycles_t cycles_diff(cycles_t then, cycles_t now)
{
return now >= then ? now - then : (CYCLES_MAX - then) + now;
}
#define irq_enable() ml_int_enable()
#define irq_disable() ml_int_disable()