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 * See file CREDITS for list of people who contributed to this
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 #include <asm/processor.h>
34 /* Implemented by SPARC CPUs */
35 extern int interrupt_init_cpu(void);
36 extern void timer_interrupt_cpu(void *arg);
37 extern int timer_interrupt_init_cpu(void);
45 /* set PIL to 15 ==> no pending interrupts will interrupt CPU */
51 void intUnlock(int oldLevel)
56 void enable_interrupts(void)
58 set_pil(0); /* enable all interrupts */
61 int disable_interrupts(void)
66 int interrupt_init(void)
70 /* call cpu specific function from $(CPU)/interrupts.c */
71 ret = interrupt_init_cpu();
73 /* enable global interrupts */
79 /* timer interrupt/overflow counter */
80 static volatile ulong timestamp = 0;
82 /* regs can not be used here! regs is actually the pointer given in
85 void timer_interrupt(struct pt_regs *regs)
87 /* call cpu specific function from $(CPU)/interrupts.c */
88 timer_interrupt_cpu((void *)regs);
93 void reset_timer(void)
98 ulong get_timer(ulong base)
100 return (timestamp - base);
103 void set_timer(ulong t)
108 void timer_interrupt_init(void)
114 irq = timer_interrupt_init_cpu();
117 /* cpu specific code handled the interrupt registration it self */
120 /* register interrupt handler for timer */
121 irq_install_handler(irq, (void (*)(void *))timer_interrupt, NULL);