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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [orpmon/] [drivers/] [tick.c] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 809 simons
 
2
#include "common.h"
3
#include "support.h"
4
#include "spr_defs.h"
5
 
6
void tick_init(void)
7
{
8
  mtspr(SPR_SR, SPR_SR_TEE | mfspr(SPR_SR));
9 833 simons
  mtspr(SPR_TTMR, SPR_TTMR_IE | SPR_TTMR_RT | ((IN_CLK/TICKS_PER_SEC) & SPR_TTMR_PERIOD));
10 809 simons
}
11
 
12
void tick_interrupt(void)
13
{
14
  timestamp++;
15 833 simons
  mtspr(SPR_TTMR, SPR_TTMR_IE | SPR_TTMR_RT | ((IN_CLK/TICKS_PER_SEC) & SPR_TTMR_PERIOD));
16 878 rherveille
}
17 809 simons
 
18 878 rherveille
/*
19
  sleep for n timer-ticks
20
*/
21
void sleep(unsigned long sleep_time)
22
{
23
  unsigned long start_time;
24 809 simons
 
25 878 rherveille
  start_time = timestamp;
26
 
27
  while ( (timestamp - start_time) < sleep_time)
28
  ; /* do nothing */
29
}
30
 

powered by: WebSVN 2.1.0

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