feat: L0支持systick动态调频

Close #I4YXW9
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I052fe71e507f76184c8ac5d6349e368494033cde
This commit is contained in:
zhushengle
2022-03-22 09:40:23 +08:00
parent e703376d68
commit 390a488a97
6 changed files with 196 additions and 35 deletions

View File

@@ -89,6 +89,8 @@ BOOL OsSchedTaskSwitch(VOID);
LosTaskCB *OsGetTopTask(VOID);
VOID OsSchedTimeConvertFreq(UINT32 oldFreq);
STATIC INLINE UINT64 OsGetCurrSchedTimeCycle(VOID)
{
return LOS_SysCycleGet();

View File

@@ -78,9 +78,9 @@ STATIC INLINE VOID OsDeleteNodeSortLink(SortLinkList *sortList)
SET_SORTLIST_VALUE(sortList, OS_SORT_LINK_INVALID_TIME);
}
STATIC INLINE UINT64 GetSortLinkNextExpireTime(SortLinkAttribute *sortHeader, UINT64 startTime, UINT32 tickPrecision)
STATIC INLINE UINT64 GetSortLinkNextExpireTime(SortLinkAttribute *sortHead, UINT64 startTime, UINT32 tickPrecision)
{
LOS_DL_LIST *head = &sortHeader->sortLink;
LOS_DL_LIST *head = &sortHead->sortLink;
LOS_DL_LIST *list = head->pstNext;
if (LOS_ListEmpty(head)) {
@@ -103,11 +103,13 @@ STATIC INLINE UINT64 OsGetNextExpireTime(UINT64 startTime, UINT32 tickPrecision)
}
SortLinkAttribute *OsGetSortLinkAttribute(SortLinkType type);
UINT32 OsSortLinkInit(SortLinkAttribute *sortLinkHeader);
UINT32 OsSortLinkInit(SortLinkAttribute *sortLinkHead);
VOID OsAdd2SortLink(SortLinkList *node, UINT64 startTime, UINT32 waitTicks, SortLinkType type);
VOID OsDeleteSortLink(SortLinkList *node);
UINT64 OsSortLinkGetTargetExpireTime(UINT64 currTime, const SortLinkList *targetSortList);
UINT64 OsSortLinkGetNextExpireTime(const SortLinkAttribute *sortLinkHeader);
UINT64 OsSortLinkGetNextExpireTime(const SortLinkAttribute *sortLinkHead);
VOID OsSortLinkResponseTimeConvertFreq(UINT32 oldFreq);
#ifdef __cplusplus
#if __cplusplus

View File

@@ -261,6 +261,58 @@ UINT32 OsTickTimerInit(VOID);
VOID OsTickSysTimerStartTimeSet(UINT64 currTime);
STATIC INLINE UINT64 OsTimeConvertFreq(UINT64 time, UINT32 oldFreq, UINT32 newFreq)
{
if (oldFreq >= newFreq) {
return (time / (oldFreq / newFreq));
}
return (time * (newFreq / oldFreq));
}
/**
* @ingroup los_tick
* @brief Adjust the system tick timer clock frequency function hooks.
*
* @par Description:
* This API is used to adjust the system tick timer clock frequency.
* @attention
* <ul>
* <li>None</li>
* </ul>
*
* @param param [IN] Function parameters.
*
* @retval 0: Adjust the system tick timer clock frequency failed.
* @retval more than zero: Adjust after the system tick timer clock frequency.
* @par Dependency:
* <ul><li>los_tick.h: the header file that contains the API declaration.</li></ul>
* @see None
*/
typedef UINT32 (*SYS_TICK_FREQ_ADJUST_FUNC)(UINTPTR param);
/**
* @ingroup los_tick
* @brief Adjust the system tick timer clock frequency.
*
* @par Description:
* This API is used to adjust the system tick timer clock frequency.
* @attention
* <ul>
* <li>This function needs to be invoked only when the clock frequency of the system tick timer adjust as a result of
* changing the CPU frequency.</li>
* </ul>
*
* @param handler [IN] Adjust the system tick timer clock frequency function hooks.
* @param param [IN] Function parameters.
*
* @retval LOS_OK or Error code.
* @par Dependency:
* <ul><li>los_tick.h: the header file that contains the API declaration.</li></ul>
* @see None
*/
extern UINT32 LOS_SysTickClockFreqAdjust(const SYS_TICK_FREQ_ADJUST_FUNC handler, UINTPTR param);
/**
* @ingroup los_tick
* @brief Obtain the number of Ticks.