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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [orpmon/] [drivers/] [int.c] - Diff between revs 855 and 858

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

Rev 855 Rev 858
Line 1... Line 1...
/* This file is part of test microkernel for OpenRISC 1000. */
/* This file is part of test microkernel for OpenRISC 1000. */
/* (C) 2001 Simon Srot, srot@opencores.org */
/* (C) 2001 Simon Srot, srot@opencores.org */
 
 
 
#include "common.h"
#include "support.h"
#include "support.h"
#include "spr_defs.h"
#include "spr_defs.h"
#include "int.h"
#include "int.h"
 
 
#ifdef OR1K
#ifdef OR1K
Line 26... Line 27...
int int_add(unsigned long vect, void (* handler)(void))
int int_add(unsigned long vect, void (* handler)(void))
{
{
  if(vect >= MAX_INT_HANDLERS) return -1;
  if(vect >= MAX_INT_HANDLERS) return -1;
 
 
  int_handlers[vect].handler = handler;
  int_handlers[vect].handler = handler;
 
  debug ("int_add %i: %08lx\n", vect, int_handlers[vect].handler);
 
 
  mtspr(SPR_PICMR, mfspr(SPR_PICMR) | (0x00000001L << vect));
  mtspr(SPR_PICMR, mfspr(SPR_PICMR) | (0x00000001L << vect));
  return 0;
  return 0;
}
}
 
 
Line 58... Line 60...
{
{
  unsigned long picsr = mfspr(SPR_PICSR);
  unsigned long picsr = mfspr(SPR_PICSR);
  unsigned long i = 0;
  unsigned long i = 0;
 
 
  mtspr(SPR_PICSR, 0);
  mtspr(SPR_PICSR, 0);
 
  debug ("int :%08lx\n", picsr);
 
 
  while(i < 32) {
  while(i < 32) {
    if((picsr & (0x01L << i)) && (int_handlers[i].handler != 0)) {
    if((picsr & (0x01L << i)) && (int_handlers[i].handler != 0)) {
      (*int_handlers[i].handler)();
      (*int_handlers[i].handler)();
      mtspr(SPR_PICSR, mfspr(SPR_PICSR) & ~(0x00000001L << i));
      mtspr(SPR_PICSR, mfspr(SPR_PICSR) & ~(0x00000001L << i));

powered by: WebSVN 2.1.0

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