/* Test the timer ticks to count, used in sync routine */ inlinevoid openrisc_timer_set(unsignedlong count)
{
mtspr(SPR_TTCR, count);
}
/* Set the timer to trigger in delta cycles */ inlinevoid openrisc_timer_set_next(unsignedlong delta)
{
u32 c;
/* Read 32-bit counter value, add delta, mask off the low 28 bits. *We'reguaranteeddeltawon'tbebiggerthan28bitsbecausethe *generictimekeepingcodeensuresthatforus.
*/
c = mfspr(SPR_TTCR);
c += delta;
c &= SPR_TTMR_TP;
/* Set counter and enable interrupt. *Keeptimerincontinuousmodealways.
*/
mtspr(SPR_TTMR, SPR_TTMR_CR | SPR_TTMR_IE | c);
}
/* This is the clock event device based on the OR1K tick timer. *Asthetimerisbeingusedasacontinuousclock-source(requiredforHR *timers)wecannotenablethePERIODICfeature.Theticktimercanrunusing *one-shotevents,sonoproblem.
*/ static DEFINE_PER_CPU(struct clock_event_device, clockevent_openrisc_timer);
/* We only have 28 bits */
clockevents_config_and_register(evt, cpuinfo->clock_frequency, 100, 0x0fffffff);
}
staticinlinevoid timer_ack(void)
{ /* Clear the IP bit and disable further interrupts */ /* This can be done very simply... we just need to keep the timer running,sojustmaintaintheCRbitswhileclearingtherest oftheregister
*/
mtspr(SPR_TTMR, SPR_TTMR_CR);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.