cmcu为stm32h743IIt6
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

39 lines
798 B

/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2023-07-10 xqyjlj The first version.
*/
#include "gtimer.h"
#include "ktime.h"
static volatile unsigned long _init_cnt = 0;
unsigned long rt_ktime_cputimer_getres(void)
{
return ((1000UL * 1000 * 1000) * RT_KTIME_RESMUL) / rt_hw_get_gtimer_frq();
}
unsigned long rt_ktime_cputimer_getfrq(void)
{
return rt_hw_get_gtimer_frq();
}
unsigned long rt_ktime_cputimer_getcnt(void)
{
return rt_hw_get_cntpct_val() - _init_cnt;
}
unsigned long rt_ktime_cputimer_getstep(void)
{
return rt_ktime_cputimer_getfrq() / RT_TICK_PER_SECOND;
}
void rt_ktime_cputimer_init(void)
{
_init_cnt = rt_hw_get_cntpct_val();
}