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;
|
|
|