!385 fix: 修复cortex-m系列系统提供的timer在低频下时间不准的问题
Merge pull request !385 from zhushengle/timer
This commit is contained in:
commit
72928ca12e
|
@ -85,10 +85,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
|||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
|
|
@ -84,10 +84,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
|||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
|
|
@ -84,10 +84,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
|||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
|
|
@ -84,10 +84,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
|||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
|
|
@ -84,10 +84,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
|||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINTPTR intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
|
|
@ -84,10 +84,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
|||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINTPTR intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
|
|
@ -85,10 +85,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
|||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
|
|
@ -85,10 +85,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
|||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
|
|
@ -84,10 +84,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
|||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
|
|
@ -84,10 +84,13 @@ WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
|
|||
|
||||
WEAK UINT64 HalGetTickCycle(UINT32 *period)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINT32 hwCycle = 0;
|
||||
UINT32 intSave = LOS_IntLock();
|
||||
UINT32 val = SysTick->VAL;
|
||||
*period = SysTick->LOAD;
|
||||
hwCycle = *period - SysTick->VAL;
|
||||
if (val != 0) {
|
||||
hwCycle = *period - val;
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
return (UINT64)hwCycle;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue