summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp')
-rw-r--r--c/src/lib/libbsp/powerpc/ChangeLog3
-rw-r--r--c/src/lib/libbsp/powerpc/acinclude.m42
-rw-r--r--c/src/lib/libbsp/powerpc/gen83xx/startup/bspstart.c4
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/ChangeLog13
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/INSTALL1
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/Makefile.am96
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/README55
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/bsp_specs13
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/bsp_specs.dl23
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/configure.ac40
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/dlentry/dlentry.S245
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/include/bsp.h103
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/include/coverhd.h133
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/include/tm27.h32
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/irq/irq.c212
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/irq/irq.h166
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/irq/irq_init.c89
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/preinstall.am87
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/startup/bspclean.c43
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c315
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/startup/linkcmds255
-rw-r--r--c/src/lib/libbsp/powerpc/shared/console/uart.c6
22 files changed, 1928 insertions, 8 deletions
diff --git a/c/src/lib/libbsp/powerpc/ChangeLog b/c/src/lib/libbsp/powerpc/ChangeLog
index edd3ee28d2..4d118f49d0 100644
--- a/c/src/lib/libbsp/powerpc/ChangeLog
+++ b/c/src/lib/libbsp/powerpc/ChangeLog
@@ -1,3 +1,6 @@
+2008-07-14 Thomas Doefler <Thomas.Doerfler@embedded-brains.de>
+ * haleakala: added new BSP
+
2008-07-11 Sebastian Huber <sebastian.huber@embedded-brains.de>
* ep1a/startup/bspstart.c, mvme3100/startup/bspstart.c,
diff --git a/c/src/lib/libbsp/powerpc/acinclude.m4 b/c/src/lib/libbsp/powerpc/acinclude.m4
index e3e9fecc16..0c46a901b4 100644
--- a/c/src/lib/libbsp/powerpc/acinclude.m4
+++ b/c/src/lib/libbsp/powerpc/acinclude.m4
@@ -8,6 +8,8 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR],
AC_CONFIG_SUBDIRS([gen5200]);;
gen83xx )
AC_CONFIG_SUBDIRS([gen83xx]);;
+ haleakala )
+ AC_CONFIG_SUBDIRS([haleakala]);;
mbx8xx )
AC_CONFIG_SUBDIRS([mbx8xx]);;
motorola_powerpc )
diff --git a/c/src/lib/libbsp/powerpc/gen83xx/startup/bspstart.c b/c/src/lib/libbsp/powerpc/gen83xx/startup/bspstart.c
index e4d35dbfd5..141fdb679c 100644
--- a/c/src/lib/libbsp/powerpc/gen83xx/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/gen83xx/startup/bspstart.c
@@ -18,11 +18,7 @@
\*===============================================================*/
/*
-<<<<<<< bspstart.c
* $Id$
-=======
- * $Id$
->>>>>>> 1.11
*/
#include <bsp.h>
diff --git a/c/src/lib/libbsp/powerpc/haleakala/ChangeLog b/c/src/lib/libbsp/powerpc/haleakala/ChangeLog
new file mode 100644
index 0000000000..91a7b1bad8
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/ChangeLog
@@ -0,0 +1,13 @@
+2008-07-14 Thomas Doerfler <thomas.doerfler@embedded-brains.de>
+
+ * README, bsp_specs, INSTALL, bsp_specs.dl, configure.ac,
+ * Makefile.am, preinstall.am, dlentry/dlentry.S,
+ * include/bsp.h, include/coverhd.h, include/tm27.h
+ * irq/irq.c, irq/irq.h, irq/irq_init.c,
+ * startup/bspclean.c, startup/bspstart.c, startup/linkcmds:
+
+ Added BSP contributed by Michael Hamel
+
+
+
+
diff --git a/c/src/lib/libbsp/powerpc/haleakala/INSTALL b/c/src/lib/libbsp/powerpc/haleakala/INSTALL
new file mode 100644
index 0000000000..91626b3a89
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/INSTALL
@@ -0,0 +1 @@
+<to be filled in >
diff --git a/c/src/lib/libbsp/powerpc/haleakala/Makefile.am b/c/src/lib/libbsp/powerpc/haleakala/Makefile.am
new file mode 100644
index 0000000000..be74e8d2a5
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/Makefile.am
@@ -0,0 +1,96 @@
+##
+## $Id$
+##
+
+ACLOCAL_AMFLAGS = -I ../../../../aclocal
+
+include $(top_srcdir)/../../../../automake/compile.am
+include $(top_srcdir)/../../bsp.am
+
+dist_project_lib_DATA = bsp_specs
+
+include_HEADERS = include/bsp.h
+include_HEADERS += include/tm27.h
+
+nodist_include_HEADERS = include/bspopts.h
+DISTCLEANFILES = include/bspopts.h
+
+noinst_PROGRAMS =
+
+include_bspdir = $(includedir)/bsp
+
+include_HEADERS += include/coverhd.h
+
+EXTRA_DIST = ../../powerpc/shared/start/rtems_crti.S
+rtems_crti.$(OBJEXT): ../../powerpc/shared/start/rtems_crti.S
+ $(CPPASCOMPILE) -o $@ -c $<
+project_lib_DATA = rtems_crti.$(OBJEXT)
+
+dist_project_lib_DATA += startup/linkcmds
+
+
+noinst_PROGRAMS += startup.rel
+startup_rel_SOURCES = startup/bspclean.c ../../shared/bsplibc.c \
+ ../../shared/bsppost.c startup/bspstart.c ../../shared/bootcard.c \
+ ../../shared/sbrk.c startup/setvec.c \
+ ../../shared/gnatinstallhandler.c
+startup_rel_CPPFLAGS = $(AM_CPPFLAGS)
+startup_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+
+noinst_PROGRAMS += dlentry.rel
+dlentry_rel_SOURCES = dlentry/dlentry.S
+dlentry_rel_CPPFLAGS = $(AM_CPPFLAGS)
+dlentry_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+include_bsp_HEADERS = ../../powerpc/shared/console/uart.h
+include_bsp_HEADERS += ../../powerpc/shared/console/consoleIo.h
+
+noinst_PROGRAMS += console.rel
+console_rel_SOURCES = ../../powerpc/shared/console/uart.c \
+ ../../powerpc/shared/console/console.c
+console_rel_CPPFLAGS = $(AM_CPPFLAGS)
+console_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+include_bsp_HEADERS += irq/irq.h \
+ ../../../libcpu/@RTEMS_CPU@/@exceptions@/bspsupport/vectors.h \
+ ../../../libcpu/@RTEMS_CPU@/@exceptions@/bspsupport/irq_supp.h \
+ ../../../libcpu/@RTEMS_CPU@/@exceptions@/bspsupport/ppc_exc_bspsupp.h
+
+noinst_PROGRAMS += irq.rel
+irq_rel_SOURCES = irq/irq_init.c irq/irq.c
+irq_rel_CPPFLAGS = $(AM_CPPFLAGS)
+irq_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+
+if HAS_NETWORKING
+network_CPPFLAGS = -D__INSIDE_RTEMS_BSD_TCPIP_STACK__
+noinst_PROGRAMS += network.rel
+network_rel_SOURCES = network/network.c
+network_rel_CPPFLAGS = $(AM_CPPFLAGS) $(network_CPPFLAGS)
+network_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+endif
+
+
+noinst_LIBRARIES = libbsp.a
+libbsp_a_SOURCES =
+
+libbsp_a_LIBADD = startup.rel dlentry.rel console.rel irq.rel
+
+if HAS_NETWORKING
+libbsp_a_LIBADD += network.rel
+endif
+
+libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/@exceptions@/rtems-cpu.rel \
+ ../../../libcpu/@RTEMS_CPU@/@exceptions@/raw_exception.rel \
+ ../../../libcpu/@RTEMS_CPU@/@exceptions@/exc_bspsupport.rel \
+ ../../../libcpu/@RTEMS_CPU@/@exceptions@/irq_bspsupport.rel \
+ ../../../libcpu/@RTEMS_CPU@/shared/cpuIdent.rel \
+ ../../../libcpu/@RTEMS_CPU@/ppc403/clock.rel \
+ ../../../libcpu/@RTEMS_CPU@/ppc403/timer.rel
+
+
+EXTRA_DIST += times
+
+include $(srcdir)/preinstall.am
+include $(top_srcdir)/../../../../automake/local.am
diff --git a/c/src/lib/libbsp/powerpc/haleakala/README b/c/src/lib/libbsp/powerpc/haleakala/README
new file mode 100644
index 0000000000..a17e582721
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/README
@@ -0,0 +1,55 @@
+#
+# $Id$
+#
+
+# Adapted from Virtex BSP
+
+BSP NAME: Haleakala
+BOARD: AMCC/UDTech Haleakala 405Exr eval board
+BUS: N/A
+CPU FAMILY: ppc
+CPU: PowerPC 405EXr
+COPROCESSORS: N/A
+MODE: 32 bit mode
+
+DEBUG MONITOR:
+
+PERIPHERALS
+===========
+TIMERS: 405EXr internal
+SERIAL PORTS: 405EXr internal
+REAL-TIME CLOCK: DS1338
+DMA: 405EXr internal
+VIDEO: none
+SCSI: none
+NETWORKING: 405EXr internal
+
+DRIVER INFORMATION
+==================
+CLOCK DRIVER: PPC Decrementer
+IOSUPP DRIVER: N/A
+SHMSUPP: N/A
+TIMER DRIVER: N/A
+TTY DRIVER: shared
+
+STDIO
+=====
+PORT: Console port 0
+ELECTRICAL: RS-232
+BAUD: 9600-115200
+BITS PER CHARACTER: 8
+PARITY: None
+STOP BITS: 1
+
+Notes
+=====
+
+Board description
+-----------------
+clock rate: 400 MHz
+ROM: 64MByte FLASH
+RAM: 256MByte DDR DRAM
+
+
+Porting
+-------
diff --git a/c/src/lib/libbsp/powerpc/haleakala/bsp_specs b/c/src/lib/libbsp/powerpc/haleakala/bsp_specs
new file mode 100644
index 0000000000..9102ad7442
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/bsp_specs
@@ -0,0 +1,13 @@
+%rename endfile old_endfile
+%rename startfile old_startfile
+%rename link old_link
+
+*startfile:
+%{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems: ecrti%O%s rtems_crti%O%s crtbegin.o%s}}
+
+*endfile:
+%{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s ecrtn.o%s}
+
+*link:
+%{!qrtems: %(old_link)} %{qrtems: -dc -dp -u __vectors -u download_entry -N }
+
diff --git a/c/src/lib/libbsp/powerpc/haleakala/bsp_specs.dl b/c/src/lib/libbsp/powerpc/haleakala/bsp_specs.dl
new file mode 100644
index 0000000000..24804479a0
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/bsp_specs.dl
@@ -0,0 +1,23 @@
+%rename cpp old_cpp
+%rename lib old_lib
+%rename endfile old_endfile
+%rename startfile old_startfile
+%rename link old_link
+
+*cpp:
+%(old_cpp) %{qrtems: -D__embedded__} -Asystem(embedded)
+
+*lib:
+%{!qrtems: %(old_lib)} %{qrtems: ecrti%O%s --start-group \
+%{!qrtems_debug: -lrtemsall} %{qrtems_debug: -lrtemsall_g} \
+-lc -lgcc --end-group \
+%{!qnolinkcmds: -T linkcmds%s}}
+
+*startfile:
+%{!qrtems: %(old_startfile)} %{qrtems: \
+%{!qrtems_debug: } \
+%{qrtems_debug: }}
+
+*link:
+%{!qrtems: %(old_link)} %{qrtems: -dc -dp -u __vectors -u download_entry -N }
+
diff --git a/c/src/lib/libbsp/powerpc/haleakala/configure.ac b/c/src/lib/libbsp/powerpc/haleakala/configure.ac
new file mode 100644
index 0000000000..f3e5214ca5
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/configure.ac
@@ -0,0 +1,40 @@
+dnl Process this file with autoconf to produce a configure script.
+dnl
+dnl $Id$
+
+AC_PREREQ(2.59)
+AC_INIT([rtems-c-src-lib-libbsp-powerpc-haleakala],[_RTEMS_VERSION],[rtems-bugs@rtems.com])
+AC_CONFIG_SRCDIR([bsp_specs])
+RTEMS_TOP(../../../../../..)
+
+RTEMS_CANONICAL_TARGET_CPU
+AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.9])
+RTEMS_BSP_CONFIGURE
+
+RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm])
+RTEMS_CANONICALIZE_TOOLS
+RTEMS_PROG_CCAS
+
+RTEMS_CHECK_NETWORKING
+
+AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
+
+RTEMS_BSPOPTS_SET([PPC_USE_SPRG],[*],[1])
+RTEMS_BSPOPTS_HELP([PPC_USE_SPRG],
+[If defined, then the PowerPC specific code in RTEMS will use some
+ of the special purpose registers to slightly optimize interrupt
+ response time. The use of these registers can conflict with
+ other tools like debuggers.])
+
+RTEMS_BSPOPTS_SET([PPC_VECTOR_FILE_BASE],[*],[0x0100])
+RTEMS_BSPOPTS_HELP([PPC_VECTOR_FILE_BASE],
+[This defines the base address of the exception table.
+ NOTE: Vectors are actually at 0xFFF00000 but file starts at offset.])
+
+
+# Explicitly list all Makefiles here
+AC_CONFIG_FILES([Makefile])
+
+RTEMS_PPC_EXCEPTIONS
+
+AC_OUTPUT
diff --git a/c/src/lib/libbsp/powerpc/haleakala/dlentry/dlentry.S b/c/src/lib/libbsp/powerpc/haleakala/dlentry/dlentry.S
new file mode 100644
index 0000000000..3eb321432b
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/dlentry/dlentry.S
@@ -0,0 +1,245 @@
+/* dlentry.s
+ *
+ * This file contains the entry code for RTEMS programs starting
+ * after download to RAM
+ *
+ * Author: Thomas Doerfler <td@imd.m.isar.de>
+ * IMD Ingenieurbuero fuer Microcomputertechnik
+ *
+ * COPYRIGHT (c) 1998 by IMD
+ *
+ * Changes from IMD are covered by the original distributions terms.
+ * This file has been derived from the papyrus BSP:
+ *
+ * This file contains the entry veneer for RTEMS programs
+ * downloaded to Papyrus.
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * $Id$
+ *
+ * derived from "helas403/dlentry.S":
+ *
+ * Further changes to derive for the PPC405CR/GP/GPr/EX/EXr
+ * by Michael Hamel ADInstruments Ltd 2008
+ *
+ *
+ * Id: dlentry.S,v 1.2 2000/08/02 16:30:57 joel Exp
+ */
+
+#include <rtems/asm.h>
+
+/*
+ * The virtex ELF link scripts support three special sections:
+ * .entry The actual entry point
+ * .vectors The section containing the interrupt entry veneers.
+ */
+
+/*
+ * Downloaded code loads the vectors separately to 0x00000100,
+ * so .entry can be over 256 bytes.
+ *
+ * The other sections are linked in the following order:
+ * .entry
+ * .text
+ * .data
+ * .bss
+ * see linker command file for section placement
+ *
+ * The initial stack is set to stack.end
+ *
+ * All the entry veneer has to do is to clear the BSS.
+ */
+
+/*
+ * GDB likes to have debugging information for the entry veneer.
+ * Here was some DWARF information. IMD removed it, because we
+ * could not check, whether it was still correct. Sorry.
+
+ */
+
+
+ .section .entry
+
+ PUBLIC_VAR (start)
+ PUBLIC_VAR (download_entry)
+ PUBLIC_VAR (__rtems_entry_point)
+
+SYM(start):
+SYM(download_entry):
+SYM(__rtems_entry_point):
+
+ .extern SYM (boot_card)
+
+ bl .startup /* First word is branch to reset_entry */
+
+
+/*---------------------------------------------------------------------------
+ * Parameters from linker
+ *--------------------------------------------------------------------------*/
+
+base_addr:
+toc_pointer:
+ .long s.got
+bss_length:
+ .long bss.size
+bss_addr:
+ .long bss.start
+sbss_length:
+ .long sbss.size
+sbss_addr:
+ .long sbss.start
+stack_top:
+ .long stack.end
+PUBLIC_VAR (text_addr)
+text_addr:
+ .long text.start
+PUBLIC_VAR (text_length)
+text_length:
+ .long text.size
+
+/*---------------------------------------------------------------------------
+ * Reset_entry.
+ *--------------------------------------------------------------------------*/
+.startup:
+ /* Get entrypoint address in R1 so we can find linker variables */
+ mflr r1
+
+ /* Initialise procesor registers generally */
+ bl init405
+
+ /* Clear .bss and .sbss */
+ bl bssclr
+
+ /*-------------------------------------------------------------------
+ * C_setup.
+ *------------------------------------------------------------------*/
+ lwz r1,stack_top - base_addr(r1) /* Now set R1 to stack_top */
+ addi r1,r1,-56-4 /* start stack at text_addr - 56 */
+ li r3,0
+ stw r3, 0(r1) /* Clear stack chain */
+ stw r3, 4(r1)
+ stw r3, 8(r1)
+ stw r3, 12(r1)
+
+ bl __eabi /* Initialise EABI: sets up r2 & r13 */
+
+ lis r5,environ@ha
+ la r5,environ@l(r5) /* environp */
+ li r4, 0 /* argv */
+ li r3, 0 /* argc */
+
+ b SYM (boot_card) /* call the first C routine */
+
+/*---------------------------------------------------------------------------
+ * bssclr.
+ *--------------------------------------------------------------------------*/
+bssclr: lwz r2,bss_addr-base_addr(r1) /* start of bss set by loader */
+ lwz r3,bss_length-base_addr(r1) /* bss length */
+ srwi. r3,r3,2 /* div 4 to get # of words */
+ li r0,0
+ beq dosbss /* no bss */
+ mtctr r3 /* set ctr reg */
+ subi r2,r2,4
+clear_bss: stwu r0,4(r2)
+ bdnz clear_bss /* decrement counter and loop */
+
+dosbss: lwz r2,sbss_addr-base_addr(r1) /* start of sbss set by loader */
+ lwz r3,sbss_length-base_addr(r1) /* sbss length */
+ slwi. r3,r3,2 /* div 4 to get # of words */
+ subi r2,r2,4
+ beqlr /* no sbss */
+ mtctr r3 /* set ctr reg */
+clear_sbss: stwu r0,4(r2)
+ bdnz clear_sbss /* decrement counter and loop */
+
+ blr /* return */
+
+
+/*---------------------------------------------------------------------------
+ * Generic 405 register setup
+ *--------------------------------------------------------------------------*/
+init405:
+ li r0, 0
+ mtmsr r0
+ mticcr r0
+ mtdccr r0
+
+ li r3,0x7FFC # 405EX-specific
+ mtsgr r3 # Clear guarded mode on all storage except PCIe region
+
+ mtsler r0 # Storage is all big-endian
+ mtsu0r r0 # and uncompressed
+
+ iccci r3,0 # Invalidate the instruction cache
+ li r3,1 # Enable F800 0000 to FFFF FFFF
+ oris r3,r3,0xC000 # Enable 0000 0000 to 0FFF FFFF
+ mticcr r3
+ isync
+
+ li r3,0
+ li r4,256 # 405 has 128 or 256 32-byte lines: do 256
+ mtctr r4 # set loop ctr
+dcloop: dccci 0,r3 # invalidate line
+ addi r3,r3,0x20 # bump to next line
+ bdnz dcloop
+ mtdcwr r0 # Select write-back caching
+ lis r3,0xC000 # Enable 0000 0000 to 0FFF FFFF
+ # mtdccr r3 # Enable data cache
+
+ mtevpr r0
+ mtesr r0
+ mtxer r0
+
+ lwarx r3,r0,r0 # get some data/set resv bit
+ stwcx. r3,r0,r0 # store out and clear resv bit
+
+ lis r3,0xDEAD
+ ori r3,r3,0xBEEF # Make distintive uninitialised value
+ mr r4, r3
+ mr r5, r3
+ mr r6, r3
+ mr r7, r3
+ mr r8, r3
+ mr r9, r3
+ mr r10, r3
+ mr r11, r3
+ mr r12, r3
+ mr r13, r3
+ mr r14, r3
+ mr r15, r3
+ mr r16, r3
+ mr r17, r3
+ mr r18, r3
+ mr r19, r3
+ mr r20, r3
+ mr r21, r3
+ mr r22, r3
+ mr r23, r3
+ mr r24, r3
+ mr r25, r3
+ mr r26, r3
+ mr r27, r3
+ mr r28, r3
+ mr r29, r3
+ mr r30, r3
+ mr r31, r3
+
+ blr
+
+.L_text_e:
+
+ .comm environ,4,4
diff --git a/c/src/lib/libbsp/powerpc/haleakala/include/bsp.h b/c/src/lib/libbsp/powerpc/haleakala/include/bsp.h
new file mode 100644
index 0000000000..784e21c696
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/include/bsp.h
@@ -0,0 +1,103 @@
+/* bsp.h
+ *
+ * Generic 405EX bsp.h
+ * derived from virtex/include/bsp.h
+ * by Michael Hamel ADInstruments Ltd 2008
+ *
+ * derived from helas403/include/bsp.h:
+ * Id: bsp.h,v 1.4 2001/06/18 17:01:48 joel Exp
+ * Author: Thomas Doerfler <td@imd.m.isar.de>
+ * IMD Ingenieurbuero fuer Microcomputertechnik
+ *
+ * COPYRIGHT (c) 1998 by IMD
+ *
+ * Changes from IMD are covered by the original distributions terms.
+ * This file has been derived from the papyrus BSP.
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Derived from c/src/lib/libbsp/no_cpu/no_bsp/include/bsp.h
+ *
+ * COPYRIGHT (c) 1989-1999.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ *
+ *
+ * $Id$
+ *
+ */
+
+#ifndef _BSP_H
+#define _BSP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <bspopts.h>
+
+#ifdef ASM
+
+ /* Definition of where to store registers in alignment handler */
+ #define ALIGN_REGS 0x0140
+
+#else
+
+ #include <rtems.h>
+ #include <rtems/console.h>
+ #include <rtems/clockdrv.h>
+ #include <libcpu/io.h>
+ #include <rtems/console.h>
+ #include <rtems/iosupp.h>
+ #include <bsp/irq.h>
+ #include <bsp/vectors.h>
+
+ /* Network Defines */
+ #define RTEMS_BSP_NETWORK_DRIVER_NAME "eth0"
+
+ struct rtems_bsdnet_ifconfig;
+ int rtems_emac_driver_attach(struct rtems_bsdnet_ifconfig* config, int attaching);
+ #define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_emac_driver_attach
+
+ /* Definitions for the shared console/UART driver */
+ #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2
+
+ #define BSP_UART_IOBASE_COM1 0xEF600200 /* PPC405EX */
+ #define BSP_UART_IOBASE_COM2 0xEF600300
+
+ #define BSP_CONSOLE_PORT BSP_UART_COM1 /* console */
+
+ #define BSP_UART_BAUD_BASE (11059200 / 16) /* Kilauea ext clock, max speed */
+
+ /* functions */
+
+ rtems_isr_entry set_vector( /* returns old vector */
+ rtems_isr_entry handler, /* isr routine */
+ rtems_vector_number vector, /* vector number */
+ int type /* RTEMS or RAW intr */
+ );
+
+#endif /* ASM */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BSP_H */
diff --git a/c/src/lib/libbsp/powerpc/haleakala/include/coverhd.h b/c/src/lib/libbsp/powerpc/haleakala/include/coverhd.h
new file mode 100644
index 0000000000..f39d324eaa
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/include/coverhd.h
@@ -0,0 +1,133 @@
+/* coverhd.h
+ *
+ * This include file has defines to represent the overhead associated
+ * with calling a particular directive from C. These are used in the
+ * Timing Test Suite to ignore the overhead required to pass arguments
+ * to directives. On some CPUs and/or target boards, this overhead
+ * is significant and makes it difficult to distinguish internal
+ * RTEMS execution time from that used to call the directive.
+ * This file should be updated after running the C overhead timing
+ * test. Once this update has been performed, the RTEMS Time Test
+ * Suite should be rebuilt to account for these overhead times in the
+ * timing results.
+ *
+ * NOTE: If these are all zero, then the times reported include
+ * all calling overhead including passing of arguments.
+ *
+ * COPYRIGHT (c) 1989-1999.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+/*
+ * Updated for a 25MHz Papyrus by Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * Units are 100ns.
+ *
+ * These numbers are of questionable use, as they are developed by calling
+ * the routine many times, thus getting its entry veneer into the (small)
+ * cache on the 403GA. This in general is not true of the RTEMS timing
+ * tests, which usually call a routine only once, thus having no cache loaded
+ * advantage.
+ *
+ * Whether the directive times are useful after deducting the function call
+ * overhead is also questionable. The user is more interested generally
+ * in the total cost of a directive, not the cost if the procedure call
+ * is inlined! (In general this is not true).
+ *
+ * Andrew Bray 18/08/1995
+ *
+ */
+
+#ifndef __COVERHD_h
+#define __COVERHD_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 1
+#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 1
+#define CALLING_OVERHEAD_TASK_CREATE 3
+#define CALLING_OVERHEAD_TASK_IDENT 1
+#define CALLING_OVERHEAD_TASK_START 1
+#define CALLING_OVERHEAD_TASK_RESTART 1
+#define CALLING_OVERHEAD_TASK_DELETE 1
+#define CALLING_OVERHEAD_TASK_SUSPEND 1
+#define CALLING_OVERHEAD_TASK_RESUME 1
+#define CALLING_OVERHEAD_TASK_SET_PRIORITY 1
+#define CALLING_OVERHEAD_TASK_MODE 1
+#define CALLING_OVERHEAD_TASK_GET_NOTE 1
+#define CALLING_OVERHEAD_TASK_SET_NOTE 1
+#define CALLING_OVERHEAD_TASK_WAKE_WHEN 4
+#define CALLING_OVERHEAD_TASK_WAKE_AFTER 1
+#define CALLING_OVERHEAD_INTERRUPT_CATCH 1
+#define CALLING_OVERHEAD_CLOCK_GET 4
+#define CALLING_OVERHEAD_CLOCK_SET 3
+#define CALLING_OVERHEAD_CLOCK_TICK 1
+
+#define CALLING_OVERHEAD_TIMER_CREATE 1
+#define CALLING_OVERHEAD_TIMER_IDENT 1
+#define CALLING_OVERHEAD_TIMER_DELETE 1
+#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 2
+#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 5
+#define CALLING_OVERHEAD_TIMER_RESET 1
+#define CALLING_OVERHEAD_TIMER_CANCEL 1
+#define CALLING_OVERHEAD_SEMAPHORE_CREATE 2
+#define CALLING_OVERHEAD_SEMAPHORE_IDENT 1
+#define CALLING_OVERHEAD_SEMAPHORE_DELETE 1
+#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 1
+#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 1
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 2
+#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 1
+
+#define CALLING_OVERHEAD_EVENT_SEND 1
+#define CALLING_OVERHEAD_EVENT_RECEIVE 2
+#define CALLING_OVERHEAD_SIGNAL_CATCH 1
+#define CALLING_OVERHEAD_SIGNAL_SEND 1
+#define CALLING_OVERHEAD_PARTITION_CREATE 3
+#define CALLING_OVERHEAD_PARTITION_IDENT 1
+#define CALLING_OVERHEAD_PARTITION_DELETE 1
+#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 1
+#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 1
+#define CALLING_OVERHEAD_REGION_CREATE 3
+#define CALLING_OVERHEAD_REGION_IDENT 1
+#define CALLING_OVERHEAD_REGION_DELETE 1
+#define CALLING_OVERHEAD_REGION_GET_SEGMENT 2
+#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 1
+#define CALLING_OVERHEAD_PORT_CREATE 2
+#define CALLING_OVERHEAD_PORT_IDENT 1
+#define CALLING_OVERHEAD_PORT_DELETE 1
+#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 1
+#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 2
+
+#define CALLING_OVERHEAD_IO_INITIALIZE 2
+#define CALLING_OVERHEAD_IO_OPEN 2
+#define CALLING_OVERHEAD_IO_CLOSE 2
+#define CALLING_OVERHEAD_IO_READ 2
+#define CALLING_OVERHEAD_IO_WRITE 2
+#define CALLING_OVERHEAD_IO_CONTROL 2
+#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 1
+#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 1
+#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 1
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/c/src/lib/libbsp/powerpc/haleakala/include/tm27.h b/c/src/lib/libbsp/powerpc/haleakala/include/tm27.h
new file mode 100644
index 0000000000..18f3b6b32b
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/include/tm27.h
@@ -0,0 +1,32 @@
+/*
+ * tm27.h
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifndef _RTEMS_TMTEST27
+#error "This is an RTEMS internal file you must not include directly."
+#endif
+
+#ifndef __tm27_h
+#define __tm27_h
+
+/*
+ * Stuff for Time Test 27
+ */
+
+#define MUST_WAIT_FOR_INTERRUPT 0
+
+#define Install_tm27_vector( handler ) set_vector( (handler), PPC_IRQ_SCALL, 1 )
+
+#define Cause_tm27_intr() asm volatile ("sc")
+
+#define Clear_tm27_intr() /* empty */
+
+#define Lower_tm27_intr() /* empty */
+
+#endif
diff --git a/c/src/lib/libbsp/powerpc/haleakala/irq/irq.c b/c/src/lib/libbsp/powerpc/haleakala/irq/irq.c
new file mode 100644
index 0000000000..dd20e93b90
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/irq/irq.c
@@ -0,0 +1,212 @@
+/*
+ *
+ *
+ * The license and distribution terms for this file may be
+ * found in found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * Middleware support for PPC405 by M.Hamel ADInstruments Ltd 2008
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <bsp/irq.h>
+#include <bsp/irq_supp.h>
+#include <libcpu/raw_exception.h>
+#include <libcpu/powerpc-utility.h>
+
+
+/* PPC405EX UIC numbers */
+#define UIC_DCR_BASE 0xc0
+#define UIC0_SR (UIC_DCR_BASE+0x0) /* UIC status */
+#define UIC0_SRS (UIC_DCR_BASE+0x1) /* UIC status set */
+#define UIC0_ER (UIC_DCR_BASE+0x2) /* UIC enable */
+#define UIC0_CR (UIC_DCR_BASE+0x3) /* UIC critical */
+#define UIC0_PR (UIC_DCR_BASE+0x4) /* UIC polarity */
+#define UIC0_TR (UIC_DCR_BASE+0x5) /* UIC triggering */
+#define UIC0_MSR (UIC_DCR_BASE+0x6) /* UIC masked status */
+#define UIC0_VR (UIC_DCR_BASE+0x7) /* UIC vector */
+#define UIC0_VCR (UIC_DCR_BASE+0x8) /* UIC vector configuration */
+
+#define UIC1_SR (UIC_DCR_BASE+0x10) /* UIC status */
+#define UIC1_SRS (UIC_DCR_BASE+0x11) /* UIC status set */
+#define UIC1_ER (UIC_DCR_BASE+0x12) /* UIC enable */
+#define UIC1_CR (UIC_DCR_BASE+0x13) /* UIC critical */
+#define UIC1_PR (UIC_DCR_BASE+0x14) /* UIC polarity */
+#define UIC1_TR (UIC_DCR_BASE+0x15) /* UIC triggering */
+#define UIC1_MSR (UIC_DCR_BASE+0x16) /* UIC masked status */
+#define UIC1_VR (UIC_DCR_BASE+0x17) /* UIC vector */
+#define UIC1_VCR (UIC_DCR_BASE+0x18) /* UIC vector configuration */
+
+#define UIC2_SR (UIC_DCR_BASE+0x20) /* UIC status */
+#define UIC2_SRS (UIC_DCR_BASE+0x21) /* UIC status set */
+#define UIC2_ER (UIC_DCR_BASE+0x22) /* UIC enable */
+#define UIC2_CR (UIC_DCR_BASE+0x23) /* UIC critical */
+#define UIC2_PR (UIC_DCR_BASE+0x24) /* UIC polarity */
+#define UIC2_TR (UIC_DCR_BASE+0x25) /* UIC triggering */
+#define UIC2_MSR (UIC_DCR_BASE+0x26) /* UIC masked status */
+#define UIC2_VR (UIC_DCR_BASE+0x27) /* UIC vector */
+#define UIC2_VCR (UIC_DCR_BASE+0x28) /* UIC vector configuration */
+
+enum { kUICWords = 3 };
+
+static rtems_irq_connect_data* rtems_hdl_tblP;
+static rtems_irq_connect_data dflt_entry;
+
+static uint32_t gEnabledInts[kUICWords]; /* 1-bits mean enabled */
+static uint32_t gIntInhibited[kUICWords]; /* 1-bits disable, overriding gEnabledInts because the interrupt
+ is being processed in C_dispatch_irq_handler */
+
+static inline int IsUICIRQ(const rtems_irq_number irqLine)
+{
+ return (((int) irqLine <= BSP_UIC_IRQ_MAX_OFFSET) &&
+ ((int) irqLine >= BSP_UIC_IRQ_LOWEST_OFFSET)
+ );
+}
+
+static void WriteIState()
+/* Write the gEnabledInts state masked by gIntInhibited to the hardware */
+{
+ mtdcr(UIC0_ER, gEnabledInts[0] & ~gIntInhibited[0]);
+ mtdcr(UIC1_ER, gEnabledInts[1] & ~gIntInhibited[1]);
+ mtdcr(UIC2_ER, gEnabledInts[2] & ~gIntInhibited[2]);
+}
+
+void
+BSP_enable_irq_at_pic(const rtems_irq_number irq)
+/* Enable an interrupt; this can be called from inside C_dispatch_irq_handler */
+{
+ if (IsUICIRQ(irq)) {
+ /* Set relevant bit in the state, write state to the UIC */
+ gEnabledInts[irq>>5] |= (0x80000000 >> (irq & 0x1F));
+ WriteIState();
+ }
+}
+
+int
+BSP_disable_irq_at_pic(const rtems_irq_number irq)
+/* Enable an interrupt; this can be called from inside C_dispatch_irq_handler */
+{
+ if (IsUICIRQ(irq)) {
+ uint32_t oldState;
+ int iword = irq>>5;
+ uint32_t mask = (0x80000000 >> (irq & 0x1F));
+
+ oldState = gEnabledInts[iword] & mask;
+ gEnabledInts[iword] &= ~mask;
+ WriteIState();
+ return oldState ? 1 : 0;
+ } else
+ return -1;
+}
+
+int
+BSP_setup_the_pic(rtems_irq_global_settings* config)
+{
+ int i;
+
+ dflt_entry = config->defaultEntry;
+ rtems_hdl_tblP = config->irqHdlTbl;
+ for (i=0; i<kUICWords; i++)
+ gIntInhibited[i] = 0;
+
+ mtdcr (UIC2_ER, 0x00000000); /* disable all interrupts */
+ mtdcr (UIC2_CR, 0x00000000); /* Set Critical / Non Critical interrupts */
+ mtdcr (UIC2_PR, 0xf7ffffff); /* Set Interrupt Polarities */
+ mtdcr (UIC2_TR, 0x01e1fff8); /* Set Interrupt Trigger Levels */
+ mtdcr (UIC2_VR, 0x00000001); /* Set Vect base=0,INT31 Highest priority */
+ mtdcr (UIC2_SR, 0xffffffff); /* clear all interrupts */
+
+ mtdcr (UIC1_ER, 0x00000000); /* disable all interrupts */
+ mtdcr (UIC1_CR, 0x00000000); /* Set Critical / Non Critical interrupts */
+ mtdcr (UIC1_PR, 0xfffac785); /* Set Interrupt Polarities */
+ mtdcr (UIC1_TR, 0x001d0040); /* Set Interrupt Trigger Levels */
+ mtdcr (UIC1_VR, 0x00000001); /* Set Vect base=0,INT31 Highest priority */
+ mtdcr (UIC1_SR, 0xffffffff); /* clear all interrupts */
+
+ mtdcr (UIC0_ER, 0x0000000a); /* Disable all interrupts except cascade UIC0 and UIC1 */
+ mtdcr (UIC0_CR, 0x00000000); /* Set Critical / Non Critical interrupts */
+ mtdcr (UIC0_PR, 0xffbfefef); /* Set Interrupt Polarities */
+ mtdcr (UIC0_TR, 0x00007000); /* Set Interrupt Trigger Levels */
+ mtdcr (UIC0_VR, 0x00000001); /* Set Vect base=0,INT31 Highest priority */
+ mtdcr (UIC0_SR, 0xffffffff); /* clear all interrupts */
+
+ return 1;
+}
+
+
+/*
+ * High level IRQ handler called from shared_raw_irq_code_entry; decode and
+ * dispatch. Note that this routine needs to be re-entrant
+ *
+ * No support for critical interrupts here yet
+ */
+
+int
+C_dispatch_irq_handler( struct _BSP_Exception_frame* frame, unsigned int excNum )
+{
+ if (excNum == ASM_EXT_VECTOR) {
+ uint32_t active[kUICWords];
+
+ /* Fetch the masked flags that tell us what external ints are active.
+ Likely to be only one, but we need to handle more than one,
+ OR the flags into gIntInhibited */
+ active[0] = mfdcr(UIC0_MSR);
+ active[1] = mfdcr(UIC1_MSR);
+ active[2] = mfdcr(UIC2_MSR);
+ gIntInhibited[0] |= active[0];
+ gIntInhibited[1] |= active[1];
+ gIntInhibited[2] |= active[2];
+
+ /* ...and update the hardware so the active interrupts are disabled */
+ WriteIState();
+
+ /* Loop, calling bsp_irq_dispatch_list for each active interrupt */
+ while ((active[0] | active[1] | active[2]) != 0) {
+ uint32_t index = -1;
+ uint32_t bit, bmask;
+
+ /* Find an active interrupt, searching 0..2, bit 0..bit 31 (IBM order) */
+ do {
+ index++;
+ asm volatile (" cntlzw %0, %1":"=r" (bit):"r" (active[index]));
+ } while (bit==32);
+
+ /* Call the matching handler */
+ bsp_irq_dispatch_list(rtems_hdl_tblP, (index*32)+bit, dflt_entry.hdl);
+
+ /* Write a 1-bit to the appropriate status register to clear it */
+ bmask = 0x80000000 >> bit;
+ switch (index) {
+ case 0: mtdcr(UIC0_SR, bmask); break;
+ case 1: mtdcr(UIC1_SR, bmask); break;
+ case 2: mtdcr(UIC2_SR, bmask); break;
+ }
+
+ /* Clear in the active record and gIntInhibited */
+ active[index] &= ~bmask;
+ gIntInhibited[index] &= ~bmask;
+ };
+
+ /* Update the hardware again so the interrupts we have handled are unmasked */
+ WriteIState();
+ return 0;
+
+ } else if (excNum == ASM_DEC_VECTOR) { /* 0x1000 remapped by C_dispatch_dec_handler_bookE */
+ bsp_irq_dispatch_list(rtems_hdl_tblP, BSP_PIT, dflt_entry.hdl);
+ return 0;
+
+ } else if (excNum == ASM_BOOKE_FIT_VECTOR) { /* 0x1010 mapped to 0x13 by ppc_get_vector_addr */
+ bsp_irq_dispatch_list(rtems_hdl_tblP, BSP_FIT, dflt_entry.hdl);
+ return 0;
+
+ } else if (excNum == ASM_BOOKE_WDOG_VECTOR) { /* 0x1020 mapped to 0x14 by ppc_get_vector_addr */
+ bsp_irq_dispatch_list(rtems_hdl_tblP, BSP_WDOG, dflt_entry.hdl);
+ return 0;
+
+ } else
+ return -1; /* unhandled interrupt, panic time */
+}
+
diff --git a/c/src/lib/libbsp/powerpc/haleakala/irq/irq.h b/c/src/lib/libbsp/powerpc/haleakala/irq/irq.h
new file mode 100644
index 0000000000..fcb33e0b3e
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/irq/irq.h
@@ -0,0 +1,166 @@
+/*===============================================================*\
+| Project: RTEMS Haleakala BSP |
+| by Michael Hamel ADInstruments Ltd 2008 |
++-----------------------------------------------------------------+
+| The license and distribution terms for this file may be |
+| found in the file LICENSE in this distribution or at |
+| |
+| http://www.rtems.com/license/LICENSE. |
+| |
+\*===============================================================*/
+
+
+#ifndef Haleakala_IRQ_IRQ_H
+#define Haleakala_IRQ_IRQ_H
+
+/* Implemented for us in bsp_irq_dispatch_list */
+#define BSP_SHARED_HANDLER_SUPPORT 1
+
+#include <rtems/irq.h>
+
+#ifndef ASM
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /* Define UIC interrupt numbers; IRQs that cause an external interrupt that needs further decode.
+ These are arbitrary but it makes things easier if they match the CPU interrupt numbers */
+
+ /*
+
+ #define BSP_UIC_UART0_GP (BSP_UIC_IRQ_LOWEST_OFFSET + 0)
+ #define BSP_UIC_UART1 (BSP_UIC_IRQ_LOWEST_OFFSET + 1)
+ #define BSP_UIC_IIC0 (BSP_UIC_IRQ_LOWEST_OFFSET + 2)
+ #define BSP_UIC_ExtMaster (BSP_UIC_IRQ_LOWEST_OFFSET + 3)
+ #define BSP_UIC_PCI (BSP_UIC_IRQ_LOWEST_OFFSET + 4)
+ #define BSP_UIC_DMA0 (BSP_UIC_IRQ_LOWEST_OFFSET + 5)
+ #define BSP_UIC_DMA1 (BSP_UIC_IRQ_LOWEST_OFFSET + 6)
+ #define BSP_UIC_DMA2 (BSP_UIC_IRQ_LOWEST_OFFSET + 7)
+ #define BSP_UIC_DMA3 (BSP_UIC_IRQ_LOWEST_OFFSET + 8)
+ #define BSP_UIC_ENetWU (BSP_UIC_IRQ_LOWEST_OFFSET + 9)
+ #define BSP_UIC_MALSERR (BSP_UIC_IRQ_LOWEST_OFFSET + 10)
+ #define BSP_UIC_MALTXEOB (BSP_UIC_IRQ_LOWEST_OFFSET + 11)
+ #define BSP_UIC_MALRXEOB (BSP_UIC_IRQ_LOWEST_OFFSET + 12)
+ #define BSP_UIC_MALTXDE (BSP_UIC_IRQ_LOWEST_OFFSET + 13)
+ #define BSP_UIC_MALRXDE (BSP_UIC_IRQ_LOWEST_OFFSET + 14)
+ #define BSP_UIC_ENet (BSP_UIC_IRQ_LOWEST_OFFSET + 15)
+ #define BSP_UIC_PCISERR (BSP_UIC_IRQ_LOWEST_OFFSET + 16)
+ #define BSP_UIC_ECCERR (BSP_UIC_IRQ_LOWEST_OFFSET + 17)
+ #define BSP_UIC_PCIPower (BSP_UIC_IRQ_LOWEST_OFFSET + 18)
+ #define BSP_UIC_IRQ0 (BSP_UIC_IRQ_LOWEST_OFFSET + 25)
+ #define BSP_UIC_IRQ1 (BSP_UIC_IRQ_LOWEST_OFFSET + 26)
+ #define BSP_UIC_IRQ2 (BSP_UIC_IRQ_LOWEST_OFFSET + 27)
+ #define BSP_UIC_IRQ3 (BSP_UIC_IRQ_LOWEST_OFFSET + 28)
+ #define BSP_UIC_IRQ4 (BSP_UIC_IRQ_LOWEST_OFFSET + 29)
+ #define BSP_UIC_IRQ5 (BSP_UIC_IRQ_LOWEST_OFFSET + 30)
+ #define BSP_UIC_IRQ6 (BSP_UIC_IRQ_LOWEST_OFFSET + 31)
+
+ #define BSP_UIC_IRQ_NUMBER (32)
+
+ */
+ /* PPC405EX interrupt vectors */
+ #define BSP_UIC_UART1 (BSP_UIC_IRQ_LOWEST_OFFSET + 1)
+ #define BSP_UIC_IIC0 (BSP_UIC_IRQ_LOWEST_OFFSET + 2)
+ #define BSP_UIC_EIPPKP_READY (BSP_UIC_IRQ_LOWEST_OFFSET + 3)
+ #define BSP_UIC_EIPPKP_TRNG (BSP_UIC_IRQ_LOWEST_OFFSET + 4)
+ #define BSP_UIC_EBM (BSP_UIC_IRQ_LOWEST_OFFSET + 5)
+ #define BSP_UIC_OPBtoPLB (BSP_UIC_IRQ_LOWEST_OFFSET + 6)
+ #define BSP_UIC_IIC1 (BSP_UIC_IRQ_LOWEST_OFFSET + 7)
+ #define BSP_UIC_SPI (BSP_UIC_IRQ_LOWEST_OFFSET + 8)
+ #define BSP_UIC_IRQ0 (BSP_UIC_IRQ_LOWEST_OFFSET + 9)
+ #define BSP_UIC_MALTXEOB (BSP_UIC_IRQ_LOWEST_OFFSET + 10)
+ #define BSP_UIC_MALRXEOB (BSP_UIC_IRQ_LOWEST_OFFSET + 11)
+ #define BSP_UIC_DMA0 (BSP_UIC_IRQ_LOWEST_OFFSET + 12)
+ #define BSP_UIC_DMA1 (BSP_UIC_IRQ_LOWEST_OFFSET + 13)
+ #define BSP_UIC_DMA2 (BSP_UIC_IRQ_LOWEST_OFFSET + 14)
+ #define BSP_UIC_DMA3 (BSP_UIC_IRQ_LOWEST_OFFSET + 15)
+ #define BSP_UIC_PCIe0AL (BSP_UIC_IRQ_LOWEST_OFFSET + 16)
+ #define BSP_UIC_PCIe0VPD (BSP_UIC_IRQ_LOWEST_OFFSET + 17)
+ #define BSP_UIC_PCIe0HRst (BSP_UIC_IRQ_LOWEST_OFFSET + 18)
+ #define BSP_UIC_EIPPKP_PKA (BSP_UIC_IRQ_LOWEST_OFFSET + 19)
+ #define BSP_UIC_PCIe0TCR (BSP_UIC_IRQ_LOWEST_OFFSET + 20)
+ #define BSP_UIC_PCIe0VCO (BSP_UIC_IRQ_LOWEST_OFFSET + 21)
+ #define BSP_UIC_EIPPKP_TRNG_AL (BSP_UIC_IRQ_LOWEST_OFFSET + 22)
+ #define BSP_UIC_EIP94 (BSP_UIC_IRQ_LOWEST_OFFSET + 23)
+ #define BSP_UIC_EMAC0 (BSP_UIC_IRQ_LOWEST_OFFSET + 24)
+ #define BSP_UIC_EMAC1 (BSP_UIC_IRQ_LOWEST_OFFSET + 25)
+ #define BSP_UIC_UART0 (BSP_UIC_IRQ_LOWEST_OFFSET + 26)
+ #define BSP_UIC_IRQ4 (BSP_UIC_IRQ_LOWEST_OFFSET + 27)
+ #define BSP_UIC_UIC2_STD (BSP_UIC_IRQ_LOWEST_OFFSET + 28)
+ #define BSP_UIC_UIC2_CRIT (BSP_UIC_IRQ_LOWEST_OFFSET + 29)
+ #define BSP_UIC_UIC1_STD (BSP_UIC_IRQ_LOWEST_OFFSET + 30)
+ #define BSP_UIC_UIC1_CRIT (BSP_UIC_IRQ_LOWEST_OFFSET + 31)
+
+ #define BSP_UIC1_IRQ_LOWEST_OFFSET (BSP_UIC_IRQ_LOWEST_OFFSET + 32)
+ #define BSP_UIC_MALSERR (BSP_UIC1_IRQ_LOWEST_OFFSET + 0)
+ #define BSP_UIC_MALTXDE (BSP_UIC1_IRQ_LOWEST_OFFSET + 1)
+ #define BSP_UIC_MALRXDE (BSP_UIC1_IRQ_LOWEST_OFFSET + 2)
+ #define BSP_UIC_PCIe0DCRErr (BSP_UIC1_IRQ_LOWEST_OFFSET + 3)
+ #define BSP_UIC_PCIe1DCRErr (BSP_UIC1_IRQ_LOWEST_OFFSET + 4)
+ #define BSP_UIC_ExtBus (BSP_UIC1_IRQ_LOWEST_OFFSET + 5)
+ #define BSP_UIC_NDFC (BSP_UIC1_IRQ_LOWEST_OFFSET + 6)
+ #define BSP_UIC_EIPKP_SLAVE (BSP_UIC1_IRQ_LOWEST_OFFSET + 7)
+ #define BSP_UIC_GPT_TIMER5 (BSP_UIC1_IRQ_LOWEST_OFFSET + 8)
+ #define BSP_UIC_GPT_TIMER6 (BSP_UIC1_IRQ_LOWEST_OFFSET + 9)
+
+ #define BSP_UIC_GPT_TIMER0 (BSP_UIC1_IRQ_LOWEST_OFFSET + 16)
+ #define BSP_UIC_GPT_TIMER1 (BSP_UIC1_IRQ_LOWEST_OFFSET + 17)
+ #define BSP_UIC_IRQ7 (BSP_UIC1_IRQ_LOWEST_OFFSET + 18)
+ #define BSP_UIC_IRQ8 (BSP_UIC1_IRQ_LOWEST_OFFSET + 19)
+ #define BSP_UIC_IRQ9 (BSP_UIC1_IRQ_LOWEST_OFFSET + 20)
+ #define BSP_UIC_GPT_TIMER2 (BSP_UIC1_IRQ_LOWEST_OFFSET + 21)
+ #define BSP_UIC_GPT_TIMER3 (BSP_UIC1_IRQ_LOWEST_OFFSET + 22)
+ #define BSP_UIC_GPT_TIMER4 (BSP_UIC1_IRQ_LOWEST_OFFSET + 23)
+ #define BSP_UIC_SERIAL_ROM (BSP_UIC1_IRQ_LOWEST_OFFSET + 24)
+ #define BSP_UIC_GPT_DEC (BSP_UIC1_IRQ_LOWEST_OFFSET + 25)
+ #define BSP_UIC_IRQ2 (BSP_UIC1_IRQ_LOWEST_OFFSET + 26)
+ #define BSP_UIC_IRQ5 (BSP_UIC1_IRQ_LOWEST_OFFSET + 27)
+ #define BSP_UIC_IRQ6 (BSP_UIC1_IRQ_LOWEST_OFFSET + 28)
+ #define BSP_UIC_EMAC0WU (BSP_UIC1_IRQ_LOWEST_OFFSET + 29)
+ #define BSP_UIC_IRQ1 (BSP_UIC1_IRQ_LOWEST_OFFSET + 30)
+ #define BSP_UIC_EMAC1WU (BSP_UIC1_IRQ_LOWEST_OFFSET + 31)
+
+ #define BSP_UIC2_IRQ_LOWEST_OFFSET (BSP_UIC_IRQ_LOWEST_OFFSET + 64)
+ #define BSP_UIC_PCIe0INTA (BSP_UIC2_IRQ_LOWEST_OFFSET + 0)
+ #define BSP_UIC_PCIe0INTB (BSP_UIC2_IRQ_LOWEST_OFFSET + 1)
+ #define BSP_UIC_PCIe0INTC (BSP_UIC2_IRQ_LOWEST_OFFSET + 2)
+ #define BSP_UIC_PCIe0INTD (BSP_UIC2_IRQ_LOWEST_OFFSET + 3)
+ #define BSP_UIC_IRQ3 (BSP_UIC2_IRQ_LOWEST_OFFSET + 4)
+
+ #define BSP_UIC_USBOTG (BSP_UIC2_IRQ_LOWEST_OFFSET + 30)
+
+ #define BSP_UIC_IRQ_NUMBER (95)
+
+
+ #define BSP_UIC_IRQ_LOWEST_OFFSET 0
+ #define BSP_UIC_IRQ_MAX_OFFSET (BSP_UIC_IRQ_LOWEST_OFFSET + BSP_UIC_IRQ_NUMBER - 1)
+
+ #define BSP_UART_COM1_IRQ BSP_UIC_UART0 /* Required by shared/console/uart.c */
+ #define BSP_UART_COM2_IRQ BSP_UIC_UART1
+
+ /* Define processor IRQ numbers; IRQs that are handled by the raw_exception vectors */
+
+ #define BSP_PIT BSP_PROCESSOR_IRQ_LOWEST_OFFSET /* Required by ppc403/clock.c */
+ #define BSP_FIT BSP_PROCESSOR_IRQ_LOWEST_OFFSET + 1
+ #define BSP_WDOG BSP_PROCESSOR_IRQ_LOWEST_OFFSET + 2
+
+ #define BSP_PROCESSOR_IRQ_NUMBER (3)
+ #define BSP_PROCESSOR_IRQ_LOWEST_OFFSET (BSP_UIC_IRQ_MAX_OFFSET + 1)
+ #define BSP_PROCESSOR_IRQ_MAX_OFFSET (BSP_PROCESSOR_IRQ_LOWEST_OFFSET + BSP_PROCESSOR_IRQ_NUMBER - 1)
+
+ /* Summary and totals */
+
+ #define BSP_IRQ_NUMBER (BSP_PROCESSOR_IRQ_MAX_OFFSET + 1)
+ #define BSP_LOWEST_OFFSET (BSP_UIC_IRQ_LOWEST_OFFSET)
+ #define BSP_MAX_OFFSET (BSP_IRQ_NUMBER - 1)
+
+ extern void BSP_rtems_irq_mng_init(unsigned cpuId); // Implemented in irq_init.c
+ #include <bsp/irq_supp.h>
+
+ #ifdef __cplusplus
+ }
+ #endif
+#endif /* ASM */
+
+#endif /* Haleakala_IRQ_IRQ_H */
diff --git a/c/src/lib/libbsp/powerpc/haleakala/irq/irq_init.c b/c/src/lib/libbsp/powerpc/haleakala/irq/irq_init.c
new file mode 100644
index 0000000000..088b15ecaa
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/irq/irq_init.c
@@ -0,0 +1,89 @@
+/*===============================================================*\
+| Project: RTEMS Haleakala BSP |
+| * by Michael Hamel ADInstruments Ltd 2008 |
++-----------------------------------------------------------------+
+| The license and distribution terms for this file may be |
+| found in the file LICENSE in this distribution or at |
+| |
+| http://www.rtems.com/license/LICENSE. |
+| |
++-----------------------------------------------------------------+
+| this file contains the irq controller handler |
+\*===============================================================*/
+#include <libcpu/spr.h>
+#include <bsp/irq.h>
+#include <bsp.h>
+#include <libcpu/raw_exception.h>
+#include <rtems/bspIo.h>
+#include <rtems/powerpc/powerpc.h>
+
+
+/*
+ * default on/off function
+ */
+static void nop_func()
+{
+}
+
+/*
+ * default isOn function
+ */
+static int not_connected()
+{
+ return 0;
+}
+
+static rtems_irq_connect_data rtemsIrq[BSP_IRQ_NUMBER];
+static rtems_irq_global_settings initial_config;
+static rtems_irq_connect_data defaultIrq = {
+ /* name, hdl , handle , on , off , isOn */
+ 0, nop_func , NULL , nop_func , nop_func , not_connected
+};
+
+static rtems_irq_prio irqPrioTable[BSP_IRQ_NUMBER]={
+ /*
+ * Processor exceptions handled as interrupts
+ */
+ 0
+};
+
+ /*
+ * This code assumes the exceptions management setup has already
+ * been done. We just need to replace the exceptions that will
+ * be handled like interrupt. On mcp750/mpc750 and many PPC processors
+ * this means the decrementer exception and the external exception.
+ */
+
+void BSP_rtems_irq_mng_init(unsigned cpuId)
+{
+ int i;
+
+ /*
+ * re-init the rtemsIrq table
+ */
+ for (i = 0; i < BSP_IRQ_NUMBER; i++) {
+ rtemsIrq[i] = defaultIrq;
+ rtemsIrq[i].name = i;
+ }
+ /*
+ * Init initial Interrupt management config
+ */
+ initial_config.irqNb = BSP_IRQ_NUMBER;
+ initial_config.defaultEntry = defaultIrq;
+ initial_config.irqHdlTbl = rtemsIrq;
+ initial_config.irqBase = BSP_LOWEST_OFFSET;
+ initial_config.irqPrioTbl = irqPrioTable;
+
+ if (!BSP_rtems_irq_mngt_set(&initial_config)) {
+ /*
+ * put something here that will show the failure...
+ */
+ BSP_panic(
+ "Unable to initialize RTEMS interrupt management!!! System locked\n"
+ );
+ }
+
+ #ifdef TRACE_IRQ_INIT
+ printk("RTEMS IRQ management is now operational\n");
+ #endif
+}
diff --git a/c/src/lib/libbsp/powerpc/haleakala/preinstall.am b/c/src/lib/libbsp/powerpc/haleakala/preinstall.am
new file mode 100644
index 0000000000..85a77e1029
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/preinstall.am
@@ -0,0 +1,87 @@
+## Automatically generated by ampolish3 - Do not edit
+
+if AMPOLISH3
+$(srcdir)/preinstall.am: Makefile.am
+ $(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am
+endif
+
+PREINSTALL_DIRS =
+DISTCLEANFILES += $(PREINSTALL_DIRS)
+
+all-local: $(TMPINSTALL_FILES)
+
+TMPINSTALL_FILES =
+CLEANFILES = $(TMPINSTALL_FILES)
+
+all-am: $(PREINSTALL_FILES)
+
+PREINSTALL_FILES =
+CLEANFILES += $(PREINSTALL_FILES)
+
+$(PROJECT_LIB)/$(dirstamp):
+ @$(MKDIR_P) $(PROJECT_LIB)
+ @: > $(PROJECT_LIB)/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_LIB)/$(dirstamp)
+
+$(PROJECT_INCLUDE)/$(dirstamp):
+ @$(MKDIR_P) $(PROJECT_INCLUDE)
+ @: > $(PROJECT_INCLUDE)/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
+
+$(PROJECT_LIB)/bsp_specs: bsp_specs $(PROJECT_LIB)/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_LIB)/bsp_specs
+PREINSTALL_FILES += $(PROJECT_LIB)/bsp_specs
+
+$(PROJECT_INCLUDE)/bsp.h: include/bsp.h $(PROJECT_INCLUDE)/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h
+
+$(PROJECT_INCLUDE)/tm27.h: include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.h
+
+$(PROJECT_INCLUDE)/bspopts.h: include/bspopts.h $(PROJECT_INCLUDE)/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bspopts.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bspopts.h
+
+$(PROJECT_INCLUDE)/bsp/$(dirstamp):
+ @$(MKDIR_P) $(PROJECT_INCLUDE)/bsp
+ @: > $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+
+$(PROJECT_INCLUDE)/coverhd.h: include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/coverhd.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h
+
+$(PROJECT_LIB)/rtems_crti.$(OBJEXT): rtems_crti.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_LIB)/rtems_crti.$(OBJEXT)
+TMPINSTALL_FILES += $(PROJECT_LIB)/rtems_crti.$(OBJEXT)
+
+$(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
+PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
+
+$(PROJECT_INCLUDE)/bsp/uart.h: ../../powerpc/shared/console/uart.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/uart.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/uart.h
+
+$(PROJECT_INCLUDE)/bsp/consoleIo.h: ../../powerpc/shared/console/consoleIo.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/consoleIo.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/consoleIo.h
+
+$(PROJECT_INCLUDE)/bsp/irq.h: irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
+
+$(PROJECT_INCLUDE)/bsp/vectors.h: ../../../libcpu/@RTEMS_CPU@/@exceptions@/bspsupport/vectors.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/vectors.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/vectors.h
+
+$(PROJECT_INCLUDE)/bsp/irq_supp.h: ../../../libcpu/@RTEMS_CPU@/@exceptions@/bspsupport/irq_supp.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq_supp.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq_supp.h
+
+$(PROJECT_INCLUDE)/bsp/ppc_exc_bspsupp.h: ../../../libcpu/@RTEMS_CPU@/@exceptions@/bspsupport/ppc_exc_bspsupp.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/ppc_exc_bspsupp.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/ppc_exc_bspsupp.h
+
diff --git a/c/src/lib/libbsp/powerpc/haleakala/startup/bspclean.c b/c/src/lib/libbsp/powerpc/haleakala/startup/bspclean.c
new file mode 100644
index 0000000000..56699da354
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/startup/bspclean.c
@@ -0,0 +1,43 @@
+/* bsp_cleanup()
+ *
+ * This routine normally is part of start.s and usually returns
+ * control to a monitor.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Derived from c/src/lib/libbsp/no_cpu/no_bsp/startup/bspclean.c:
+ *
+ * COPYRIGHT (c) 1989-1999.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+void bsp_cleanup( void )
+{
+ rtems_fatal_error_occurred(0);
+}
diff --git a/c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c b/c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c
new file mode 100644
index 0000000000..2bf2f18c1b
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c
@@ -0,0 +1,315 @@
+/* bsp_start()
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * Author: Thomas Doerfler <td@imd.m.isar.de>
+ * IMD Ingenieurbuero fuer Microcomputertechnik
+ *
+ * COPYRIGHT (c) 1998 by IMD
+ *
+ * Changes from IMD are covered by the original distributions terms.
+ * This file has been derived from the papyrus BSP:
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Modifications for spooling console driver and control of memory layout
+ * with linker command file by
+ * Thomas Doerfler <td@imd.m.isar.de>
+ * for these modifications:
+ * COPYRIGHT (c) 1997 by IMD, Puchheim, Germany.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies. IMD makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Derived from c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * Modifications for PPC405GP by Dennis Ehlin
+ *
+ * Further modified for the PPC405EX Haleakala board by
+ * Michael Hamel ADInstruments Ltd May 2008
+ *
+ * $Id$
+ */
+#include <string.h>
+#include <fcntl.h>
+
+#include <bsp.h>
+#include <bsp/uart.h>
+#include <rtems/libio.h>
+#include <rtems/libcsupport.h>
+#include <bsp/irq.h>
+#include <rtems/bspIo.h>
+#include <libcpu/cpuIdent.h>
+#include <libcpu/spr.h>
+#include <rtems/powerpc/powerpc.h>
+#include <ppc4xx/ppc405gp.h>
+#include <ppc4xx/ppc405ex.h>
+
+SPR_RW(SPRG0)
+SPR_RW(SPRG1)
+
+#include <stdio.h>
+
+/*
+ * Driver configuration parameters
+ */
+
+/* Expected by clock.c */
+uint32_t bsp_clicks_per_usec;
+boolean bsp_timer_internal_clock; /* TRUE, when timer runs with CPU clk */
+uint32_t bsp_timer_least_valid;
+uint32_t bsp_timer_average_overhead;
+
+
+/* Initialize whatever libc we are using
+ * called from postdriver hook
+ */
+
+void bsp_postdriver_hook(void);
+void bsp_libc_init( void *, uint32_t, int );
+
+/*
+ *
+ * bsp_predriver_hook
+ *
+ * Before drivers are setup.
+ */
+
+void bsp_predriver_hook(void)
+{
+
+}
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * NOTES:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ */
+
+
+extern uint8_t _RAMEnd; /* Defined in linkcmds */
+
+void bsp_pretasking_hook(void)
+/* Initialise libc with the address and size of the heap, which runs
+ from the end of the RTEMS workspace to the top of RAM */
+{
+ uint32_t heap_start;
+
+ heap_start = ( (uint32_t)Configuration.work_space_start +
+ rtems_configuration_get_work_space_size() );
+
+ bsp_libc_init((void *)heap_start, (uint32_t)(&_RAMEnd) - heap_start, 0);
+
+ #ifdef RTEMS_DEBUG
+ rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+ #endif
+}
+
+/*-------------------- Haleakala-specific UART setup -------------------------*/
+
+static void
+EarlyUARTInit(int baudRate)
+{
+ uint8_t* up = (uint8_t*)(BSP_UART_IOBASE_COM1);
+ int divider = BSP_UART_BAUD_BASE / baudRate;
+ up[LCR] = DLAB; /* Access DLM/DLL */
+ up[DLL] = divider & 0x0FF;
+ up[DLM] = divider >> 8;
+ up[LCR] = CHR_8_BITS;
+ up[MCR] = DTR | RTS;
+ up[FCR] = FIFO_EN | XMIT_RESET | RCV_RESET;
+ up[THR] = '+';
+}
+
+
+static void
+InitUARTClock()
+{
+ uint32_t reg;
+ mfsdr(SDR0_UART0,reg);
+ reg &= ~0x008000FF;
+ reg |= 0x00800001; /* Ext clock, div 1 */
+ mtsdr(SDR0_UART0,reg);
+}
+
+void GPIO_AlternateSelect(int bitnum, int source)
+/* PPC405EX: select a GPIO function for the specified pin */
+{
+ int shift;
+ unsigned long value, mask;
+ GPIORegisters* gpioPtr = (GPIORegisters*)(GPIOAddress);
+
+ shift = (31 - bitnum) & 0xF;
+ value = (source & 3) << (shift*2);
+ mask = 3 << (shift*2);
+ if (bitnum <= 15) {
+ gpioPtr->OSRL = (gpioPtr->OSRL & ~mask) | value;
+ gpioPtr->TSRL = (gpioPtr->TSRL & ~mask) | value;
+ } else {
+ gpioPtr->OSRH = (gpioPtr->OSRH & ~mask) | value;
+ gpioPtr->TSRH = (gpioPtr->TSRH & ~mask) | value;
+ }
+}
+
+void Init_FPGA()
+{
+ /* Have to write to the FPGA to enable the UART drivers */
+ /* Have to enable CS2 as an output in GPIO to get the FPGA working */
+ mtebc(EBC0_B2CR,0xF0018000); /* Set up CS2 at 0xF0000000 */
+ mtebc(EBC0_B2AP,0x9400C800);
+ GPIO_AlternateSelect(9,1); /* GPIO9 = PerCS2 */
+ {
+ unsigned long *fpgaPtr = (unsigned long*)(0xF0000000);
+ unsigned long n;
+ n = *(fpgaPtr);
+ n &= ~0x00100; /* User LEDs on */
+ n |= 0x30000; /* UART 0 and 1 transcievers on! */
+ *fpgaPtr = n;
+ }
+}
+
+/*===================================================================*/
+
+static void
+DirectUARTWrite(const char c)
+{
+ uint8_t* up = (uint8_t*)(BSP_UART_IOBASE_COM1);
+ while ((up[LSR] & THRE) == 0) { ; }
+ up[THR] = c;
+ if (c=='\n')
+ DirectUARTWrite('\r');
+}
+
+/* We will provide our own printk output function as it may get used early */
+BSP_output_char_function_type BSP_output_char = DirectUARTWrite;
+
+
+/*===================================================================*/
+
+
+/*
+ * bsp_start
+ *
+ * This routine does the bulk of the system initialization.
+ */
+
+
+void bsp_start( void )
+{
+ extern unsigned long *intrStackPtr;
+ register unsigned char* intrStack;
+ ppc_cpu_id_t myCpu;
+ ppc_cpu_revision_t myCpuRevision;
+
+ /* Get the UART clock initialized first in case we call printk */
+
+ InitUARTClock();
+ Init_FPGA();
+ EarlyUARTInit(115200);
+
+ /*
+ * Get CPU identification dynamically. Note that the get_ppc_cpu_type()
+ * function store the result in global variables
+ * so that it can be used later...
+ */
+ myCpu = get_ppc_cpu_type();
+ myCpuRevision = get_ppc_cpu_revision();
+
+ /*
+ * initialize the device driver parameters
+ */
+
+ /* Set globals visible to clock.c */
+ bsp_clicks_per_usec = 400; /* timebase register ticks/microsecond = CPU Clk in MHz */
+ bsp_timer_internal_clock = TRUE;
+ bsp_timer_average_overhead = 2;
+ bsp_timer_least_valid = 3;
+
+ /*
+ * Initialize some SPRG registers related to irq handling
+ */
+
+ intrStack = (((unsigned char*)&intrStackPtr) - PPC_MINIMUM_STACK_FRAME_SIZE);
+ _write_SPRG1((unsigned int)intrStack);
+ /* signal them that we have fixed PR288 - eventually, this should go away */
+ /*
+ * Initialize default raw exception handlers.
+ */
+ initialize_exceptions();
+
+ /*
+ * Install our own set of exception vectors
+ */
+ BSP_rtems_irq_mng_init(0);
+
+ /*
+ * Allocate the memory for the RTEMS Work Space. This can come from
+ * a variety of places: hard coded address, malloc'ed from outside
+ * RTEMS world (e.g. simulator or primitive memory manager), or (as
+ * typically done by stock BSPs) by subtracting the required amount
+ * of work space from the last physical address on the CPU board.
+ */
+ /* In this case we allocate space at an address defined in linkcmds
+ which points to a block above the stack and below the heap */
+ {
+ extern uint8_t _WorkspaceStart;
+ Configuration.work_space_start = &_WorkspaceStart;
+ }
+
+}
+
+void BSP_ask_for_reset(void)
+{
+ printk("system stopped, press RESET");
+ while(1) {};
+}
+
+void BSP_panic(char *s)
+{
+ printk("%s PANIC %s\n",_RTEMS_version, s);
+ BSP_ask_for_reset();
+}
+
+void _BSP_Fatal_error(unsigned int v)
+{
+ printk("%s PANIC ERROR %x\n",_RTEMS_version, v);
+ BSP_ask_for_reset();
+}
+
+
diff --git a/c/src/lib/libbsp/powerpc/haleakala/startup/linkcmds b/c/src/lib/libbsp/powerpc/haleakala/startup/linkcmds
new file mode 100644
index 0000000000..abd15dab60
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/haleakala/startup/linkcmds
@@ -0,0 +1,255 @@
+/*
+ * This file contains directives for the GNU linker which are specific
+ * to the 405GP/EX
+ * This file is intended to be used together with dlentry.s
+ * it will generate downloadable code
+ *
+ * Modifications for gen405 by Dennis Ehlin
+ * Modifications for virtex by Keith, Greg, and Bob
+ * Modifications for 405GP/EX by Michael Hamel
+ *
+ * $Id$
+ */
+
+OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
+OUTPUT_ARCH(powerpc)
+ENTRY(download_entry)
+
+kIntrStackSize = 16K;
+kMainStackSize = 64K;
+
+MEMORY {
+ RAM : ORIGIN = 0, LENGTH = 256M
+ /*FLASH : ORIGIN = 0xFFE00000, LENGTH = 16M*/
+}
+
+
+SECTIONS
+{
+ /* First 16K is occupied by exception vectors and anything else we want to put there */
+ .text 0x4000:
+ {
+ text.start = . ;
+ *(.entry)
+ *(.entry2)
+ *(.text*)
+ *(.rodata*)
+ *(.rodata1)
+
+ /*
+ * Special FreeBSD sysctl sections.
+ */
+ . = ALIGN (16);
+ __start_set_sysctl_set = .;
+ *(set_sysctl_*);
+ __stop_set_sysctl_set = ABSOLUTE(.);
+ *(set_domain_*);
+ *(set_pseudo_*);
+
+ /* C++ constructors/destructors */
+ *(.gnu.linkonce.t*)
+
+ /* Initialization and finalization code.
+ *
+ * Various files can provide initialization and finalization functions.
+ * The bodies of these functions are in .init and .fini sections. We
+ * accumulate the bodies here, and prepend function prologues from
+ * ecrti.o and function epilogues from ecrtn.o. ecrti.o must be linked
+ * first; ecrtn.o must be linked last. Because these are wildcards, it
+ * doesn't matter if the user does not actually link against ecrti.o and
+ * ecrtn.o; the linker won't look for a file to match a wildcard. The
+ * wildcard also means that it doesn't matter which directory ecrti.o
+ * and ecrtn.o are in.
+ */
+ PROVIDE (_init = .);
+ *ecrti.o(.init)
+ *(.init)
+ *ecrtn.o(.init)
+
+ PROVIDE (_fini = .);
+ *ecrti.o(.fini)
+ *(.fini)
+ *ecrtn.o(.init)
+
+ /*
+ * C++ constructors and destructors for static objects.
+ * PowerPC EABI does not use crtstuff yet, so we build "old-style"
+ * constructor and destructor lists that begin with the list lenght
+ * end terminate with a NULL entry.
+ */
+
+ PROVIDE (__CTOR_LIST__ = .);
+ *crtbegin.o(.ctors)
+ *(.ctors)
+ *crtend.o(.ctors)
+ LONG(0)
+ PROVIDE (__CTOR_END__ = .);
+
+ PROVIDE (__DTOR_LIST__ = .);
+ *crtbegin.o(.dtors)
+ *(.dtors)
+ *crtend.o(.dtors)
+ LONG(0)
+ PROVIDE (__DTOR_END__ = .);
+
+ /* Exception frame info */
+ *(.eh_frame)
+ /* Miscellaneous read-only data */
+ _rodata_start = . ;
+ *(.gnu.linkonce.r*)
+ *(.lit)
+ *(.shdata)
+ *(.rodata)
+ *(.rodata1)
+ *(.descriptors)
+ *(rom_ver)
+ _erodata = .;
+
+ PROVIDE (__EXCEPT_START__ = .);
+ *(.gcc_except_table*)
+ PROVIDE (__EXCEPT_END__ = .);
+ __GOT_START__ = .;
+ s.got = .;
+ *(.got.plt)
+ *(.got)
+ *(.got1)
+ PROVIDE (__GOT2_START__ = .);
+ PROVIDE (_GOT2_START_ = .);
+ *(.got2)
+ PROVIDE (__GOT2_END__ = .);
+ PROVIDE (_GOT2_END_ = .);
+
+ PROVIDE (__FIXUP_START__ = .);
+ PROVIDE (_FIXUP_START_ = .);
+ *(.fixup)
+ PROVIDE (_FIXUP_END_ = .);
+ PROVIDE (__FIXUP_END__ = .);
+
+
+ /* Various possible names for the end of the .text section */
+ etext = ALIGN(0x10);
+ _etext = .;
+
+ *(.lit)
+ *(.shdata)
+ _endtext = ALIGN(0x10);
+ text.end = .;
+ text.size = text.end - text.start;
+ } >RAM
+
+ text.size = text.end - text.start;
+
+ .jcr : { KEEP (*(.jcr)) } >RAM
+
+ .rel.dyn : {
+ *(.rel.init)
+ *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
+ *(.rel.fini)
+ *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
+ *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
+ *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
+ *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
+ *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
+ *(.rel.ctors)
+ *(.rel.dtors)
+ *(.rel.got)
+ *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
+ *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
+ *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
+ *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
+ *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
+ } >RAM
+ .rela.dyn : {
+ *(.rela.init)
+ *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
+ *(.rela.fini)
+ *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
+ *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
+ *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
+ *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
+ *(.rela.ctors)
+ *(.rela.dtors)
+ *(.rela.got)
+ *(.rela.got1)
+ *(.rela.got2)
+ *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
+ *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
+ *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
+ *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
+ *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
+ } >RAM
+
+
+ /* Initialised large data */
+ .data ( . ) :
+ {
+ . = ALIGN (4);
+ data.start = .;
+ *(.data)
+ *(.data1)
+ *(.data.* .gnu.linkonce.d.*)
+ data.end = .;
+ } > RAM
+
+ /* Initialised small data addressed as offsets from r13 */
+ .sdata : {
+ . = ALIGN (4);
+ PROVIDE (__SDATA_START__ = .);
+ sdata.start = .;
+ *(.sdata*)
+ *(.gnu.linkonce.s.*)
+ sdata.end = .;
+ } > RAM
+
+ /* Zeroed small data addressed as offsets from r13 */
+ .sbss : {
+ . = ALIGN (4);
+ PROVIDE(__SBSS_START__ = .);
+ sbss.start = .;
+ *(.sbss*)
+ *(.gnu.linkonce.sb.*);
+ sbss.end = .;
+ } > RAM
+ PROVIDE(__SBSS_END__ = .);
+
+ /* Zeroed large data */
+ .bss : {
+ . = ALIGN (4);
+ bss.start = .;
+ *(.bss .bss* .gnu.linkonce.b*)
+ . = ALIGN(4);
+ bss.end = .;
+ } > RAM
+
+ bss.size = bss.end - bss.start;
+ sbss.size = sbss.end - sbss.start;
+
+ /* Interrupt stack: align to a cache-line boundary */
+ IntrStack_start = ALIGN(0x20);
+ . += kIntrStackSize;
+ intrStack = .;
+ PROVIDE(intrStackPtr = intrStack);
+
+ /* Main stack: align to a cache-line boundary */
+ stack.start = ALIGN(0x20);
+ . += kMainStackSize;
+ stack.end = .;
+
+ /* RTEMS workspace: size specified by application */
+ _WorkspaceStart = ALIGN(0x20);
+
+ /* Heap: from end of the workspace to _RAMEnd */
+ _RAMEnd = ORIGIN(RAM) + LENGTH(RAM);
+
+ /* Debugging information */
+ .line 0 : { *(.line) }
+ .debug 0 : { *(.debug) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_aregion 0 : { *(.debug_aregion) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+}
diff --git a/c/src/lib/libbsp/powerpc/shared/console/uart.c b/c/src/lib/libbsp/powerpc/shared/console/uart.c
index ea47aa8313..dd63c6781b 100644
--- a/c/src/lib/libbsp/powerpc/shared/console/uart.c
+++ b/c/src/lib/libbsp/powerpc/shared/console/uart.c
@@ -74,15 +74,13 @@ static struct uart_data uart_data[2] = {
static inline unsigned char
uread(int uart, unsigned int reg)
{
-
- return in_8((unsigned char*)(uart_data[uart].ioBase + reg));
-
+ return in_8((unsigned char*)(uart_data[uart].ioBase + reg));
}
static inline void
uwrite(int uart, int reg, unsigned int val)
{
- out_8((unsigned char*)(uart_data[uart].ioBase + reg), val);
+ out_8((unsigned char*)(uart_data[uart].ioBase + reg), val);
}