mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-22 04:52:39 +02:00
Add arm/counter.h with armGetSystemTick (supersedes svcGetSystemTick)
This commit is contained in:
parent
d255fe730b
commit
0589b39f7a
@ -17,6 +17,8 @@ extern "C" {
|
|||||||
|
|
||||||
#include "switch/arm/tls.h"
|
#include "switch/arm/tls.h"
|
||||||
#include "switch/arm/cache.h"
|
#include "switch/arm/cache.h"
|
||||||
|
#include "switch/arm/atomics.h"
|
||||||
|
#include "switch/arm/counter.h"
|
||||||
|
|
||||||
#include "switch/kernel/svc.h"
|
#include "switch/kernel/svc.h"
|
||||||
#include "switch/kernel/tmem.h"
|
#include "switch/kernel/tmem.h"
|
||||||
|
18
nx/include/switch/arm/counter.h
Normal file
18
nx/include/switch/arm/counter.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* @file counter.h
|
||||||
|
* @brief AArch64 system counter-timer.
|
||||||
|
* @author fincs
|
||||||
|
* @copyright libnx Authors
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include "../types.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the current system tick.
|
||||||
|
* @return The current system tick.
|
||||||
|
*/
|
||||||
|
static inline u64 armGetSystemTick(void) {
|
||||||
|
u64 ret;
|
||||||
|
__asm__ __volatile__ ("mrs %x[data], cntpct_el0" : [data] "=r" (ret));
|
||||||
|
return ret;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user