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

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_2_x/] [or1ksim/] [testbench/] [uos/] [tick.c] - Blame information for rev 1646

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

Line No. Rev Author Line
1 222 markom
/* This file is part of test microkernel for OpenRISC 1000. */
2
/* (C) 2001 Simon Srot, srot@opencores.org */
3
 
4
#include "spr_defs.h"
5 343 erez
#include "support.h"
6 222 markom
 
7
/* Tick timer period */
8
unsigned long tick_period;
9
 
10
/* Inform of tick interrupt */
11
void (*tick_inf)();
12
 
13
/* Tick interrupt routine */
14
void tick_int()
15
{
16
  /* Call inf routine */
17
  (*tick_inf)();
18
 
19
  /* Set new counter period iand clear inet pending bit */
20 600 simons
        mtspr(SPR_TTMR, SPR_TTMR_IE | SPR_TTMR_RT | (tick_period & SPR_TTMR_PERIOD));
21 222 markom
}
22
 
23
/* Initialize routine */
24
int tick_init(unsigned long period, void (* inf)())
25
{
26
  /* Save tick timer period and inform routine */
27
  tick_period = period;
28
  tick_inf = inf;
29
 
30
  /* Set counter period, enable timer and interrupt */
31 600 simons
  mtspr(SPR_TTMR, SPR_TTMR_IE | SPR_TTMR_RT | (period & SPR_TTMR_PERIOD));
32 222 markom
 
33
  return 0;
34
}

powered by: WebSVN 2.1.0

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