예제 #1
0
파일: timer.c 프로젝트: xwliu/open-ivi.MX53
/* GPTCNT is now supposed to tick 1 by 1 us. */
void udelay(unsigned long usec)
{
	unsigned long now, start, tmo;
	setup_gpt();

	tmo = usec * (CONFIG_MX53_CLK32 / 1000) / 1000;
	if (!tmo)
		tmo = 1;

	now = start = GPTCNT;

	while ((now - start) < tmo)
		now = GPTCNT;
}
예제 #2
0
파일: timer.c 프로젝트: AvalueAES/rev-sa01
/* GPTCNT is now supposed to tick 1 by 1 us. */
void udelay(unsigned long usec)
{
	ulong tmp;

	setup_gpt();

	tmp = get_timer_masked();	/* get current timestamp */

	/* if setting this forward will roll time stamp */
	if ((usec + tmp + 1) < tmp) {
		/* reset "advancing" timestamp to 0, set lastinc value */
		reset_timer_masked();
	} else {
		/* else, set advancing stamp wake up time */
		tmp += usec;
	}

	while (get_timer_masked() < tmp)	/* loop till event */
		 /*NOP*/;
}
예제 #3
0
파일: timer.c 프로젝트: AvalueAES/rev-sa01
int timer_init(void)
{
	setup_gpt();

	return 0;
}