예제 #1
0
/****************************************************************************
*
* Get the time from the Generic Timer Counter Register.
*
* @param	Pointer to the location to be updated with the time.
*
* @return	None.
*
* @note		None.
*
****************************************************************************/
void XTime_GetTime(XTime *Xtime_Global)
{
	/* Start global timer counter, it will only be enabled if it is disabled */
	XTime_StartTimer();

	*Xtime_Global = arch_counter_get_cntvct();
}
예제 #2
0
static void sleep_common(u32 n, u32 count)
{
	XTime tEnd, tCur;
	/* Start global timer counter, it will only be enabled if it is disabled */
	XTime_StartTimer();

	tCur = mfcp(CNTPCT_EL0);
	tEnd = tCur + (((XTime) n) * count);
	do {
		tCur = mfcp(CNTPCT_EL0);
	} while (tCur < tEnd);
}
예제 #3
0
/**
*
* This API gives a delay in microseconds
*
* @param	useconds requested
*
* @return	0 if the delay can be achieved, -1 if the requested delay
*		is out of range
*
* @note		None.
*
****************************************************************************/
s32 usleep(u32 useconds)
{
	XTime tEnd, tCur;
	/* Start global timer counter, it will only be enabled if it is disabled */
#if !GUEST
	XTime_StartTimer();
#endif

	tCur = mfcp(CNTPCT_EL0);
	tEnd = tCur + (((XTime) useconds) * COUNTS_PER_USECOND);
	do
	{
		tCur = mfcp(CNTPCT_EL0);
	} while (tCur < tEnd);

	return 0;
}