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

Subversion Repositories minsoc

[/] [minsoc/] [trunk/] [sw/] [support/] [tick.c] - Blame information for rev 75

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

Line No. Rev Author Line
1 64 rfajardo
#include "or1200.h"
2
#include "support.h"
3 36 rfajardo
#include "tick.h"
4
 
5
int tick_int;
6
 
7
void tick_ack(void)
8
{
9 53 ConX.
        tick_int--;
10 36 rfajardo
}
11
 
12
void tick_init(void)
13
{
14
        mtspr(SPR_TTMR, 25000000 & SPR_TTMR_PERIOD);    //1s
15 53 ConX.
        //mtspr(SPR_TTMR, 125000 & SPR_TTMR_PERIOD);    //5ms
16
 
17
        mtspr(SPR_TTMR, mfspr(SPR_TTMR) | SPR_TTMR_RT | SPR_TTMR_IE);   //restart after match, enable interrupt
18
        mtspr(SPR_TTMR, mfspr(SPR_TTMR) & ~(SPR_TTMR_IP));    //clears interrupt
19
 
20
        //set OR1200 to accept exceptions
21
        mtspr(SPR_SR, mfspr(SPR_SR) | SPR_SR_TEE);
22
 
23 36 rfajardo
        tick_int = 0;
24
}
25
 
26
void tick_except(void)
27
{
28
        tick_int++;
29
        mtspr(SPR_TTMR, mfspr(SPR_TTMR) & ~(SPR_TTMR_IP));    //clears interrupt
30
}

powered by: WebSVN 2.1.0

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