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

Subversion Repositories or1k_old

[/] [or1k_old/] [tags/] [rel-0-3-0-rc3/] [or1ksim/] [tick/] [tick.c] - Diff between revs 1560 and 1649

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

Rev 1560 Rev 1649
Line 64... Line 64...
  cpu_state.sprs[SPR_TTMR] = 0;
  cpu_state.sprs[SPR_TTMR] = 0;
  tick_count = 0;
  tick_count = 0;
}
}
 
 
/* Raises a timer exception */
/* Raises a timer exception */
void tick_raise_except(void *dat)
static void tick_raise_except(void *dat)
{
{
  cpu_state.sprs[SPR_TTMR] |= SPR_TTMR_IP;
  cpu_state.sprs[SPR_TTMR] |= SPR_TTMR_IP;
 
 
  /* Reschedule unconditionally, since we have to raise the exception until
  /* Reschedule unconditionally, since we have to raise the exception until
   * TTMR_IP has been cleared */
   * TTMR_IP has been cleared */
Line 78... Line 78...
  if(cpu_state.sprs[SPR_SR] & SPR_SR_TEE)
  if(cpu_state.sprs[SPR_SR] & SPR_SR_TEE)
    except_handle(EXCEPT_TICK, cpu_state.sprs[SPR_EEAR_BASE]);
    except_handle(EXCEPT_TICK, cpu_state.sprs[SPR_EEAR_BASE]);
}
}
 
 
/* Restarts the tick timer */
/* Restarts the tick timer */
void tick_restart(void *dat)
static void tick_restart(void *dat)
{
{
  cpu_state.sprs[SPR_TTCR] = 0;
  cpu_state.sprs[SPR_TTCR] = 0;
  cycles_start = runtime.sim.cycles;
  cycles_start = runtime.sim.cycles;
  TRACE("Scheduleing timer restart job for %"PRIdREG"\n",
  TRACE("Scheduleing timer restart job for %"PRIdREG"\n",
        cpu_state.sprs[SPR_TTMR] & SPR_TTMR_PERIOD);
        cpu_state.sprs[SPR_TTMR] & SPR_TTMR_PERIOD);
  SCHED_ADD(tick_restart, NULL, cpu_state.sprs[SPR_TTMR] & SPR_TTMR_PERIOD);
  SCHED_ADD(tick_restart, NULL, cpu_state.sprs[SPR_TTMR] & SPR_TTMR_PERIOD);
}
}
 
 
/* Stops the timer */
/* Stops the timer */
void tick_one_shot(void *dat)
static void tick_one_shot(void *dat)
{
{
  TRACE("Stopping one-shot timer\n");
  TRACE("Stopping one-shot timer\n");
  cpu_state.sprs[SPR_TTCR] = cpu_state.sprs[SPR_TTMR] & SPR_TTMR_PERIOD;
  cpu_state.sprs[SPR_TTCR] = cpu_state.sprs[SPR_TTMR] & SPR_TTMR_PERIOD;
  tick_count = 0;
  tick_count = 0;
}
}

powered by: WebSVN 2.1.0

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