OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [sw/] [drivers/] [or1200/] [or1200-utils.c] - Diff between revs 488 and 505

Show entire file | Details | Blame | View Log

Rev 488 Rev 505
Line 96... Line 96...
cpu_get_timer_ticks(void)
cpu_get_timer_ticks(void)
{
{
  return timer_ticks;
  return timer_ticks;
}
}
 
 
/* Wait for 10ms */
/* Wait for 10ms, assumes CLK_HZ is 100, which it usually is.
 
   Will be slightly inaccurate!*/
void
void
cpu_sleep_10ms(void)
cpu_sleep_10ms(void)
{
{
 
  unsigned long ttcr = mfspr(SPR_TTCR) & SPR_TTCR_PERIOD;
  unsigned long first_time = cpu_get_timer_ticks();
  unsigned long first_time = cpu_get_timer_ticks();
  while (first_time == cpu_get_timer_ticks());
  while (first_time == cpu_get_timer_ticks()); // Wait for tick to occur
 
  // Now wait until we're past the tick value we read before to know we've
 
  // gone at least enough
 
  while(ttcr > (mfspr(SPR_TTCR) & SPR_TTCR_PERIOD));
 
 
}
}
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.