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

Subversion Repositories or1k_old

[/] [or1k_old/] [tags/] [stable_0_2_0_rc3/] [or1ksim/] [pic/] [pic.c] - Diff between revs 1478 and 1496

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

Rev 1478 Rev 1496
Line 56... Line 56...
 
 
/* Handles the reporting of an interrupt if it had to be delayed */
/* Handles the reporting of an interrupt if it had to be delayed */
void pic_clock(void *dat)
void pic_clock(void *dat)
{
{
  /* Don't do anything if interrupts not currently enabled */
  /* Don't do anything if interrupts not currently enabled */
  if(testsprbits (SPR_SR, SPR_SR_IEE))
  if(testsprbits (SPR_SR, SPR_SR_IEE)) {
 
    TRACE("Delivering interrupt on cycle %lli\n", runtime.sim.cycles);
    except_handle(EXCEPT_INT, mfspr(SPR_EEAR_BASE));
    except_handle(EXCEPT_INT, mfspr(SPR_EEAR_BASE));
  else
  } else if(testsprbits (SPR_PICSR, (int)dat))
    SCHED_ADD(pic_clock, NULL, 1);
    /* Reschedule only if the interrupt hasn't been cleared */
 
    SCHED_ADD(pic_clock, dat, 1);
}
}
 
 
/* WARNING: Don't eaven try and call this function *during* a simulated
/* WARNING: Don't eaven try and call this function *during* a simulated
 * instruction!! (as in during a read_mem or write_mem callback).  except_handle
 * instruction!! (as in during a read_mem or write_mem callback).  except_handle
 * assumes that this is the case, it breaks otherwise. */
 * assumes that this is the case, it breaks otherwise. */
Line 83... Line 85...
    if (testsprbits (SPR_SR, SPR_SR_IEE)) {
    if (testsprbits (SPR_SR, SPR_SR_IEE)) {
      TRACE("Delivering interrupt on cycle %lli\n", runtime.sim.cycles);
      TRACE("Delivering interrupt on cycle %lli\n", runtime.sim.cycles);
      except_handle(EXCEPT_INT, mfspr(SPR_EEAR_BASE));
      except_handle(EXCEPT_INT, mfspr(SPR_EEAR_BASE));
    } else
    } else
      /* Interrupts not currently enabled, retry next clock cycle */
      /* Interrupts not currently enabled, retry next clock cycle */
      SCHED_ADD(pic_clock, NULL, 1);
      SCHED_ADD(pic_clock, (void *)line, 1);
  }
  }
}
}
 
 
 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.