From 8e585f02f82c17cc66cd229dbf0fd3066bbbf658 Mon Sep 17 00:00:00 2001 From: TsiChung Liew Date: Mon, 18 Jun 2007 13:50:13 -0500 Subject: Added M5329AFEE and M5329BFEE Platforms Added board/freescale/m5329evb, cpu/mcf532x, drivers/net, drivers/serial, immap_5329.h, m5329.h, mcfrtc.h, include/configs/M5329EVB.h, lib_m68k/interrupts.c, and rtc/mcfrtc.c Modified CREDITS, MAKEFILE, Makefile, README, common/cmd_bdinfo.c, common/cmd_mii.c, include/asm-m68k/byteorder.h, include/asm-m68k/fec.h, include/asm-m68k/io.h, include/asm-m68k/mcftimer.h, include/asm-m68k/mcfuart.h, include/asm-m68k/ptrace.h, include/asm-m68k/u-boot.h, lib_m68k/Makefile, lib_m68k/board.c, lib_m68k/time.c, net/eth.c and rtc/Makefile Signed-off-by: TsiChung Liew --- lib_m68k/interrupts.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 lib_m68k/interrupts.c (limited to 'lib_m68k/interrupts.c') diff --git a/lib_m68k/interrupts.c b/lib_m68k/interrupts.c new file mode 100644 index 0000000..6b3ce89 --- /dev/null +++ b/lib_m68k/interrupts.c @@ -0,0 +1,118 @@ +/* + * (C) Copyright 2000-2004 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * (C) Copyright 2007 + * TsiChung Liew (Tsi-Chung.Liew@freescale.com) + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include +#include +#include + +#ifdef CONFIG_MCFINTC +#define NR_IRQS (CFG_NUM_IRQS) + +/* + * Interrupt vector functions. + */ +struct interrupt_action { + interrupt_handler_t *handler; + void *arg; +}; + +static struct interrupt_action irq_vecs[NR_IRQS]; + +static __inline__ unsigned short get_sr (void) +{ + unsigned short sr; + + asm volatile ("move.w %%sr,%0":"=r" (sr):); + + return sr; +} + +static __inline__ void set_sr (unsigned short sr) +{ + asm volatile ("move.w %0,%%sr"::"r" (sr)); +} + +/************************************************************************/ +/* + * Install and free an interrupt handler + */ +void irq_install_handler (int vec, interrupt_handler_t * handler, void *arg) +{ + if ((vec < 0) || (vec > NR_IRQS)) { + printf ("irq_install_handler: wrong interrupt vector %d\n", + vec); + return; + } + + irq_vecs[vec].handler = handler; + irq_vecs[vec].arg = arg; +} + +void irq_free_handler (int vec) +{ + if ((vec < 0) || (vec > NR_IRQS)) { + return; + } + + irq_vecs[vec].handler = NULL; + irq_vecs[vec].arg = NULL; +} + +void enable_interrupts (void) +{ + unsigned short sr; + + sr = get_sr (); + set_sr (sr & ~0x0700); +} + +int disable_interrupts (void) +{ + unsigned short sr; + + sr = get_sr (); + set_sr (sr | 0x0700); + + return ((sr & 0x0700) == 0); /* return TRUE, if interrupts were enabled before */ +} + +void int_handler (struct pt_regs *fp) +{ + int vec; + + vec = (fp->vector >> 2) & 0xff; + if (vec > 0x40) + vec -= 0x40; + else + return; + + if (irq_vecs[vec].handler != NULL) { + irq_vecs[vec].handler (irq_vecs[vec].arg); + } else { + printf ("\nBogus External Interrupt Vector %d\n", vec); + } +} +#endif /* CONFIG_MCFINTC */ \ No newline at end of file -- cgit v1.1 From 45a25bfd0c52f8a3fa137216bc94d32f90bedc5d Mon Sep 17 00:00:00 2001 From: TsiChungLiew Date: Thu, 5 Jul 2007 23:27:40 -0500 Subject: Update header file and clean up Include immap.h Signed-off-by: TsiChungLiew --- lib_m68k/interrupts.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib_m68k/interrupts.c') diff --git a/lib_m68k/interrupts.c b/lib_m68k/interrupts.c index 6b3ce89..8919c0e 100644 --- a/lib_m68k/interrupts.c +++ b/lib_m68k/interrupts.c @@ -2,7 +2,7 @@ * (C) Copyright 2000-2004 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * - * (C) Copyright 2007 + * (C) Copyright 2007 Freescale Semiconductor Inc * TsiChung Liew (Tsi-Chung.Liew@freescale.com) * * See file CREDITS for list of people who contributed to this @@ -27,8 +27,8 @@ #include #include #include +#include -#ifdef CONFIG_MCFINTC #define NR_IRQS (CFG_NUM_IRQS) /* @@ -115,4 +115,3 @@ void int_handler (struct pt_regs *fp) printf ("\nBogus External Interrupt Vector %d\n", vec); } } -#endif /* CONFIG_MCFINTC */ \ No newline at end of file -- cgit v1.1 From a1436a842654a8d3927d082a8ae9ee0a10da62d7 Mon Sep 17 00:00:00 2001 From: TsiChungLiew Date: Thu, 16 Aug 2007 13:20:50 -0500 Subject: ColdFire: Add M5253EVBE platform for MCF52x2 Signed-off-by: TsiChungLiew --- lib_m68k/interrupts.c | 2 -- 1 file changed, 2 deletions(-) mode change 100644 => 100755 lib_m68k/interrupts.c (limited to 'lib_m68k/interrupts.c') diff --git a/lib_m68k/interrupts.c b/lib_m68k/interrupts.c old mode 100644 new mode 100755 index 8919c0e..1635d6f --- a/lib_m68k/interrupts.c +++ b/lib_m68k/interrupts.c @@ -106,8 +106,6 @@ void int_handler (struct pt_regs *fp) vec = (fp->vector >> 2) & 0xff; if (vec > 0x40) vec -= 0x40; - else - return; if (irq_vecs[vec].handler != NULL) { irq_vecs[vec].handler (irq_vecs[vec].arg); -- cgit v1.1 From 8ae158cd87a4a25722b27835261b6ff0fa2aa6a7 Mon Sep 17 00:00:00 2001 From: TsiChungLiew Date: Thu, 16 Aug 2007 15:05:11 -0500 Subject: ColdFire: Add M54455EVB for MCF5445x Signed-off-by: TsiChungLiew --- lib_m68k/interrupts.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 lib_m68k/interrupts.c (limited to 'lib_m68k/interrupts.c') diff --git a/lib_m68k/interrupts.c b/lib_m68k/interrupts.c old mode 100755 new mode 100644 -- cgit v1.1