2 * (C) Copyright 2000-2002
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6 * Gleb Natapov <gnatapov@mrv.com>
9 * Daniel Hellstrom, Gaisler Research, daniel@gaisler.com.
11 * SPDX-License-Identifier: GPL-2.0+
15 #include <asm/processor.h>
18 /* Implemented by SPARC CPUs */
19 extern int interrupt_init_cpu(void);
20 extern void timer_interrupt_cpu(void *arg);
21 extern int timer_interrupt_init_cpu(void);
29 /* set PIL to 15 ==> no pending interrupts will interrupt CPU */
35 void intUnlock(int oldLevel)
40 void enable_interrupts(void)
42 set_pil(0); /* enable all interrupts */
45 int disable_interrupts(void)
50 int interrupt_init(void)
54 /* call cpu specific function from $(CPU)/interrupts.c */
55 ret = interrupt_init_cpu();
57 /* enable global interrupts */
63 /* timer interrupt/overflow counter */
64 static volatile ulong timestamp = 0;
66 /* regs can not be used here! regs is actually the pointer given in
69 void timer_interrupt(struct pt_regs *regs)
71 /* call cpu specific function from $(CPU)/interrupts.c */
72 timer_interrupt_cpu((void *)regs);
77 ulong get_timer(ulong base)
79 return (timestamp - base);
82 void timer_interrupt_init(void)
88 irq = timer_interrupt_init_cpu();
91 /* cpu specific code handled the interrupt registration it self */
94 /* register interrupt handler for timer */
95 irq_install_handler(irq, (void (*)(void *))timer_interrupt, NULL);