📄 gettimerstatistics.c
字号:
/*
* File : GetTimerStatistics
*
* Description : This file defines RZKGetTimerStatistics routine
*
* Dependencies : None.
*
* Copyright 2004 ZiLOG Inc. ALL RIGHTS RESERVED.
*
* This file contains unpublished confidential and proprietary information
* of ZiLOG, Inc.
* NO PART OF THIS WORK MAY BE DUPLICATED, STORED, PUBLISHED OR DISCLOSED
* IN ANY FORM WITHOUT THE PRIOR WRITTEN CONSENT OF ZiLOG, INC.
* This is not a license and no use of any kind of this work is authorized
* in the absence of a written license granted by ZiLOG, Inc. in ZiLOG's
* sole discretion
*/
#include "ZSysgen.h"
#include "ZTypes.h"
#include "ZTimer.h"
#include "ZTimerStatistics.h"
/*
* Function : RZKGetTimerStatistics
*
* Description : This function returns the Timer statistics
* i.e Jitter and Drift.
*
* Inputs : pTimer- Specifies the timer handle
* pTimerStatistics - Specifies the structure of timer statistics
*
* Outputs : returns the Timer statistics.
*/
RZK_STATUS_t RZKGetTimerStatistics
(
RZK_TIMERHANDLE_t hTimer,
RZK_TIMERSTATISTICS_t *pTimerStatistics
)
{
// IAR int count;
UINT count;
#define pTimer ((RZK_TIMER_t*)hTimer)//for typecasting hTimer to RZK_TIMER_t* type
#ifdef RZK_DEBUG
if ((pTimer == NULL) || ( pTimer->uState == 0 ) || ( pTimer->magic_num != MAGIC_NUM_TIMER))
return RZKERR_INVALID_HANDLE;
if (pTimerStatistics == NULL)
return RZKERR_INVALID_ARGUMENTS;
#endif
#ifdef RZK_STATISTIC
pTimerStatistics->tJitter = (pTimer->tPeriod > pTimer->tMinTimeOfFuncEntry) ?
(pTimer->tPeriod - pTimer->tMinTimeOfFuncEntry):
(pTimer->tMaxTimeOfFuncEntry - pTimer->tPeriod);
count = (pTimer->tPeriod * pTimer->uFuncExecutionCount);
pTimerStatistics->tDrift = pTimer->tPrevTimeOfFuncEntry - count;
#endif
return RZKERR_SUCCESS;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -