#define OSMR0 0x00 /* OS Timer 0 Match Register */ #define OSMR1 0x04 /* OS Timer 1 Match Register */ #define OSMR2 0x08 /* OS Timer 2 Match Register */ #define OSMR3 0x0C /* OS Timer 3 Match Register */
#define OSCR 0x10 /* OS Timer Counter Register */ #define OSSR 0x14 /* OS Timer Status Register */ #define OWER 0x18 /* OS Timer Watchdog Enable Register */ #define OIER 0x1C /* OS Timer Interrupt Enable Register */
#define OSSR_M3 (1 << 3) /* Match status channel 3 */ #define OSSR_M2 (1 << 2) /* Match status channel 2 */ #define OSSR_M1 (1 << 1) /* Match status channel 1 */ #define OSSR_M0 (1 << 0) /* Match status channel 0 */
/* * This is PXA's sched_clock implementation. This has a resolution * of at least 308 ns and a maximum value of 208 days. * * The return value is guaranteed to be monotonic in that range as * long as there is always less than 582 seconds between successive * calls to sched_clock() which should always be the case in practice.
*/
staticvoid pxa_timer_resume(struct clock_event_device *cedev)
{ /* * Ensure that we have at least MIN_OSCR_DELTA between match * register 0 and the OSCR, to guarantee that we will receive * the one-shot timer interrupt. We adjust OSMR0 in preference * to OSCR to guarantee that OSCR is monotonically incrementing.
*/ if (osmr[0] - oscr < MIN_OSCR_DELTA)
osmr[0] += MIN_OSCR_DELTA;
/* timer registers are shared with watchdog timer */
timer_base = of_iomap(np, 0); if (!timer_base) {
pr_err("%pOFn: unable to map resource\n", np); return -ENXIO;
}
clk = of_clk_get(np, 0); if (IS_ERR(clk)) {
pr_crit("%pOFn: unable to get clk\n", np); return PTR_ERR(clk);
}
ret = clk_prepare_enable(clk); if (ret) {
pr_crit("Failed to prepare clock\n"); return ret;
}
/* we are only interested in OS-timer0 irq */
irq = irq_of_parse_and_map(np, 0); if (irq <= 0) {
pr_crit("%pOFn: unable to parse OS-timer0 irq\n", np); return -EINVAL;
}
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.