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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [bootloaders/] [orpmon/] [drivers/] [tick.c] - Blame information for rev 796

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 marcus.erl
 
2
#include "common.h"
3
#include "support.h"
4 246 julius
#include "spr-defs.h"
5 2 marcus.erl
 
6
void tick_init(void)
7
{
8
  mtspr(SPR_SR, SPR_SR_TEE | mfspr(SPR_SR));
9
  mtspr(SPR_TTMR, SPR_TTMR_IE | SPR_TTMR_RT | ((IN_CLK/TICKS_PER_SEC) & SPR_TTMR_PERIOD));
10
}
11
 
12 355 julius
// No longer called - timpstamp variable incremented in vector code in reset.S
13 2 marcus.erl
void tick_interrupt(void)
14
{
15
  timestamp++;
16
  mtspr(SPR_TTMR, SPR_TTMR_IE | SPR_TTMR_RT | ((IN_CLK/TICKS_PER_SEC) & SPR_TTMR_PERIOD));
17 467 julius
 
18 2 marcus.erl
}
19
 
20
/*
21
  sleep for n timer-ticks
22
*/
23
void sleep(unsigned long sleep_time)
24
{
25
  unsigned long start_time;
26
 
27
  start_time = timestamp;
28
 
29
  while ( (timestamp - start_time) < sleep_time)
30
  ; /* do nothing */
31
}
32
 

powered by: WebSVN 2.1.0

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