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

Subversion Repositories minsoc

[/] [minsoc/] [trunk/] [sw/] [support/] [tick.c] - Diff between revs 36 and 53

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 36 Rev 53
Line 1... Line 1...
 
#include "../support/or1200.h"
 
#include "../support/support.h"
 
#include "tick.h"
 
 
 
int tick_int;
 
 
 
void tick_ack(void)
 
{
 
        tick_int--;
 
}
 
 
 
void tick_init(void)
 
{
 
        mtspr(SPR_TTMR, 25000000 & SPR_TTMR_PERIOD);    //1s
 
        //mtspr(SPR_TTMR, 125000 & SPR_TTMR_PERIOD);    //5ms
 
 
 
        mtspr(SPR_TTMR, mfspr(SPR_TTMR) | SPR_TTMR_RT | SPR_TTMR_IE);   //restart after match, enable interrupt
 
        mtspr(SPR_TTMR, mfspr(SPR_TTMR) & ~(SPR_TTMR_IP));    //clears interrupt
 
 
 
        //set OR1200 to accept exceptions
 
        mtspr(SPR_SR, mfspr(SPR_SR) | SPR_SR_TEE);
 
 
 
        tick_int = 0;
 
}
 
 
 
void tick_except(void)
 
{
 
        tick_int++;
 
        mtspr(SPR_TTMR, mfspr(SPR_TTMR) & ~(SPR_TTMR_IP));    //clears interrupt
 
}
 
 
 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.