add get_second/tick for 3568

This commit is contained in:
lr 2024-07-23 17:30:42 +08:00
parent fbd7aa46f5
commit d78d5bb36a
3 changed files with 18 additions and 1 deletions

View File

@ -64,7 +64,7 @@ static uint64_t _get_tick()
static uint64_t _get_second()
{
return 0;
return _get_tick() / r_cntfrq_el0();
}
static bool _is_timer_expired()

View File

@ -101,6 +101,20 @@ int show_cpu()
return syscall(SYSCALL_SYS_STATE, SYS_STATE_SHOW_CPU_INFO, 0, 0, 0);
}
uintptr_t get_second()
{
sys_state_info info;
syscall(SYSCALL_SYS_STATE, SYS_STATE_GET_CURRENT_SECOND, (intptr_t)&info, 0, 0);
return info.current_second;
}
uintptr_t get_tick()
{
sys_state_info info;
syscall(SYSCALL_SYS_STATE, SYS_STATE_GET_CURRENT_TICK, (intptr_t)&info, 0, 0);
return info.current_tick;
}
uintptr_t mmap(uintptr_t vaddr, uintptr_t paddr, int len, bool is_dev)
{
uintptr_t vaddr_inner = vaddr, paddr_inner = paddr;

View File

@ -99,6 +99,9 @@ int show_task();
int show_mem();
int show_cpu();
uintptr_t get_second();
uintptr_t get_tick();
int semaphore_new(int val);
bool semaphore_free(int sem_id);
bool semaphore_wait(int sem_id);