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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_47/] [or1ksim/] [testbench/] [uos/] [tick.c] - Rev 343

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

/* This file is part of test microkernel for OpenRISC 1000. */
/* (C) 2001 Simon Srot, srot@opencores.org */
 
#include "spr_defs.h"
#include "int.h"
#include "support.h"
 
/* Tick timer period */
unsigned long tick_period;
 
/* Inform of tick interrupt */
void (*tick_inf)();
 
/* Tick interrupt routine */
void tick_int()
{
  /* Call inf routine */
  (*tick_inf)();
 
  /* Set new counter period iand clear inet pending bit */
/*	mtspr(SPR_TTMR, SPR_TTMR_IE | SPR_TTMR_SR | (period & SPR_TTMR_PERIOD));*/
} 
 
/* Initialize routine */
int tick_init(unsigned long period, void (* inf)())
{
  /* Save tick timer period and inform routine */
  tick_period = period;
  tick_inf = inf;
 
  /* Add interrupt handler */
  int_add(V_TICK, tick_int, 0/*, INT_HIGH_PRI*/);
 
  /* Set counter period, enable timer and interrupt */
  mtspr(SPR_TTMR, SPR_TTMR_IE | SPR_TTMR_CR | (period & SPR_TTMR_PERIOD));
 
  return 0;
}
 

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

powered by: WebSVN 2.1.0

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