!480 feat: 内核提供tick timer框架,支持多架构多平台通用化
Merge pull request !480 from zhushengle/timer
This commit is contained in:
@@ -115,10 +115,6 @@ extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef LOSCFG_BASE_CORE_TICK_HW_TIME
|
||||
#define LOSCFG_BASE_CORE_TICK_HW_TIME 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* System timer is a 64/128 bit timer
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#include "los_task.h"
|
||||
#include "los_interrupt.h"
|
||||
#include "los_timer.h"
|
||||
#include "los_tick.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -53,15 +53,11 @@ extern UINT64 g_sysSchedStartTime;
|
||||
|
||||
VOID OsSchedResetSchedResponseTime(UINT64 responseTime);
|
||||
|
||||
VOID OsSchedUpdateSchedTimeBase(VOID);
|
||||
|
||||
UINT64 OsGetCurrSysTimeCycle(VOID);
|
||||
|
||||
VOID OsSchedSetIdleTaskSchedParam(LosTaskCB *idleTask);
|
||||
|
||||
UINT32 OsSchedSwtmrScanRegister(SchedScan func);
|
||||
|
||||
VOID OsSchedUpdateExpireTime(UINT64 startTime, BOOL timeUpdate);
|
||||
VOID OsSchedUpdateExpireTime(UINT64 startTime);
|
||||
|
||||
VOID OsSchedTaskDeQueue(LosTaskCB *taskCB);
|
||||
|
||||
@@ -95,12 +91,10 @@ LosTaskCB *OsGetTopTask(VOID);
|
||||
|
||||
UINT32 OsSchedRealSleepTimeSet(VOID (*func)(UINT64));
|
||||
|
||||
VOID OsSchedTimerBaseReset(UINT64 currTime);
|
||||
|
||||
STATIC INLINE UINT64 OsGetCurrSchedTimeCycle(VOID)
|
||||
{
|
||||
if (g_sysSchedStartTime != OS_64BIT_MAX) {
|
||||
return (OsGetCurrSysTimeCycle() - g_sysSchedStartTime);
|
||||
return (LOS_SysCycleGet() - g_sysSchedStartTime);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#define _LOS_TICK_H
|
||||
|
||||
#include "los_error.h"
|
||||
#include "los_timer.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -58,7 +59,7 @@ extern "C" {
|
||||
|
||||
/**
|
||||
* @ingroup los_tick
|
||||
* Tick error code: This error code is not in use temporarily.
|
||||
* Tick error code: The system tick timer uninitialized.
|
||||
*
|
||||
* Value: 0x02000401
|
||||
*
|
||||
@@ -180,6 +181,36 @@ extern UINT64 LOS_SysCycleGet(VOID);
|
||||
*/
|
||||
#define LOS_ERRNO_SYS_HOOK_IS_FULL LOS_ERRNO_OS_ERROR(LOS_MOD_SYS, 0x14)
|
||||
|
||||
/**
|
||||
* @ingroup los_tick
|
||||
* System time error code: The Tick Timer must be registered before kernel initialization.
|
||||
*
|
||||
* Value: 0x02000015
|
||||
*
|
||||
* Solution: None.
|
||||
*/
|
||||
#define LOS_ERRNO_SYS_TIMER_IS_RUNNING LOS_ERRNO_OS_ERROR(LOS_MOD_SYS, 0x15)
|
||||
|
||||
/**
|
||||
* @ingroup los_tick
|
||||
* System time error code: The tick timer method is NULL.
|
||||
*
|
||||
* Value: 0x02000016
|
||||
*
|
||||
* Solution: None.
|
||||
*/
|
||||
#define LOS_ERRNO_SYS_HOOK_IS_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_SYS, 0x16)
|
||||
|
||||
/**
|
||||
* @ingroup los_tick
|
||||
* System time error code: The tick timer addr fault.
|
||||
*
|
||||
* Value: 0x02000017
|
||||
*
|
||||
* Solution: None.
|
||||
*/
|
||||
#define LOS_ERRNO_SYS_TIMER_ADDR_FAULT LOS_ERRNO_OS_ERROR(LOS_MOD_SYS, 0x16)
|
||||
|
||||
/**
|
||||
* @ingroup los_tick
|
||||
* system time structure.
|
||||
@@ -194,6 +225,14 @@ typedef struct TagSysTime {
|
||||
UINT8 ucWeek; /**< value 0 - 6 */
|
||||
} SYS_TIME_S;
|
||||
|
||||
VOID OsTickTimerReload(UINT64 responseTime);
|
||||
|
||||
#if (LOSCFG_BASE_CORE_TICK_WTIMER == 0)
|
||||
VOID OsTickTimerBaseReset(UINT64 currTime);
|
||||
#endif
|
||||
|
||||
UINT32 OsTickTimerInit(VOID);
|
||||
|
||||
/**
|
||||
* @ingroup los_tick
|
||||
* @brief Obtain the number of Ticks.
|
||||
@@ -276,6 +315,24 @@ extern UINT32 LOS_Tick2MS(UINT32 ticks);
|
||||
*/
|
||||
extern UINT32 LOS_MS2Tick(UINT32 millisec);
|
||||
|
||||
/**
|
||||
* @ingroup los_tick
|
||||
* @brief Re-initializes the system tick timer.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to re-initialize the system Tick timer.
|
||||
* @attention
|
||||
*
|
||||
* @param timer [IN] Specify the tick timer.
|
||||
* @param tickHandler [IN] Tick Interrupts the execution of the hook function.
|
||||
*
|
||||
* @retval LOS_OK or Error code.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_tick.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see
|
||||
*/
|
||||
extern UINT32 LOS_TickTimerRegister(const ArchTickTimer *timer, const HWI_PROC_FUNC tickHandler);
|
||||
|
||||
/**
|
||||
* @ingroup los_tick
|
||||
* Ticks per second
|
||||
|
||||
Reference in New Issue
Block a user