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

Subversion Repositories or1k

[/] [or1k/] [tags/] [stable_0_2_0_rc2/] [or1ksim/] [tick/] [tick.c] - Diff between revs 1559 and 1560

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

Rev 1559 Rev 1560
Line 103... Line 103...
  uorreg_t ttmr = cpu_state.sprs[SPR_TTMR];
  uorreg_t ttmr = cpu_state.sprs[SPR_TTMR];
  uint32_t match_time = ttmr & SPR_TTMR_PERIOD;
  uint32_t match_time = ttmr & SPR_TTMR_PERIOD;
  uint32_t ttcr_period = spr_read_ttcr() & SPR_TTCR_PERIOD;
  uint32_t ttcr_period = spr_read_ttcr() & SPR_TTCR_PERIOD;
 
 
  /* Remove previous jobs if they exists */
  /* Remove previous jobs if they exists */
  if(prev_ttmr & SPR_TTMR_IE)
  if((prev_ttmr & SPR_TTMR_IE) && !(ttmr & SPR_TTMR_IP))
    SCHED_FIND_REMOVE(tick_raise_except, NULL);
    SCHED_FIND_REMOVE(tick_raise_except, NULL);
 
 
  switch(prev_ttmr & SPR_TTMR_M) {
  switch(prev_ttmr & SPR_TTMR_M) {
  case SPR_TTMR_RT:
  case SPR_TTMR_RT:
    SCHED_FIND_REMOVE(tick_restart, NULL);
    SCHED_FIND_REMOVE(tick_restart, NULL);
Line 167... Line 167...
{
{
  uorreg_t value = cpu_state.sprs[SPR_TTMR];
  uorreg_t value = cpu_state.sprs[SPR_TTMR];
 
 
  TRACE("set ttmr = %"PRIxREG" (previous: %"PRIxREG")\n", value, prev_val);
  TRACE("set ttmr = %"PRIxREG" (previous: %"PRIxREG")\n", value, prev_val);
 
 
  if(value & SPR_TTMR_IP) {
 
    if(prev_val & SPR_TTMR_IP)
 
      /* SPR_TTMR_IP has not been cleared, continue sending timer interrupts */
 
      SCHED_ADD(tick_raise_except, NULL, 0);
 
    else
 
      /* Code running on or1k can't set SPR_TTMR_IP so make sure it isn't */
      /* Code running on or1k can't set SPR_TTMR_IP so make sure it isn't */
      cpu_state.sprs[SPR_TTMR] &= ~SPR_TTMR_IP;
      cpu_state.sprs[SPR_TTMR] &= ~SPR_TTMR_IP;
  }
 
 
 
  /* If the timer was already disabled, ttcr should not be updated */
  /* If the timer was already disabled, ttcr should not be updated */
  if(tick_count)
  if(tick_count)
    cpu_state.sprs[SPR_TTCR] = runtime.sim.cycles - cycles_start;
    cpu_state.sprs[SPR_TTCR] = runtime.sim.cycles - cycles_start;
 
 

powered by: WebSVN 2.1.0

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