From 64a3d8bb573b09bd06557202af7851f5877d19d9 Mon Sep 17 00:00:00 2001 From: Thomas Doerfler Date: Sat, 3 Oct 2009 09:43:14 +0000 Subject: add missing file --- c/src/lib/libbsp/powerpc/qemuppc/ChangeLog | 4 + .../lib/libbsp/powerpc/qemuppc/startup/bspstart.c | 134 +++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 c/src/lib/libbsp/powerpc/qemuppc/startup/bspstart.c (limited to 'c') diff --git a/c/src/lib/libbsp/powerpc/qemuppc/ChangeLog b/c/src/lib/libbsp/powerpc/qemuppc/ChangeLog index 027411455c..1b56602355 100644 --- a/c/src/lib/libbsp/powerpc/qemuppc/ChangeLog +++ b/c/src/lib/libbsp/powerpc/qemuppc/ChangeLog @@ -1,3 +1,7 @@ +2009-10-03 Thomas Doerfler + * startup/bspstart.c: + add missing file + 2009-10-02 Thomas Doerfler * Makefile.am, irq/irq_config.h, irq/irq_init.c, irq/irq.h: add basic IRQ support (for decrementer) diff --git a/c/src/lib/libbsp/powerpc/qemuppc/startup/bspstart.c b/c/src/lib/libbsp/powerpc/qemuppc/startup/bspstart.c new file mode 100644 index 0000000000..6668290256 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/qemuppc/startup/bspstart.c @@ -0,0 +1,134 @@ +/* + * This set of routines starts the application. It includes application, + * board, and monitor specific initialization and configuration. + * The generic CPU dependent initialization has been performed + * before any of these are invoked. + * + * COPYRIGHT (c) 1989-2008. + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +/* + * CPU Bus Frequency + */ +unsigned int BSP_bus_frequency; + +/* + * Driver configuration parameters + */ +uint32_t bsp_clicks_per_usec; + +/* + * Memory on this board. + */ +extern char RamSize[]; +extern char bsp_interrupt_stack_start[]; +extern char bsp_interrupt_stack_end[]; +extern char bsp_interrupt_stack_size[]; +uint32_t BSP_mem_size = (uint32_t)RamSize; + +/* + * Time base divisior (how many tick for 1 second). + */ +unsigned int BSP_time_base_divisor; + +/* Default decrementer exception handler */ +static int default_decrementer_exception_handler( BSP_Exception_frame *frame, unsigned number) +{ + ppc_set_decrementer_register(UINT32_MAX); + + return 0; +} + +/* + * bsp_start + * + * This routine does the bulk of the system initialization. + */ + +void bsp_start( void ) +{ + uint32_t intrStackStart; + uint32_t intrStackSize; + int rv = 0; + rtems_status_code sc; + + /* + * Note we can not get CPU identification dynamically, so + * force current_ppc_cpu. + */ + current_ppc_cpu = PPC_PSIM; + + /* + * initialize the device driver parameters + */ + /* BSP_bus_frequency = (unsigned int)&PSIM_INSTRUCTIONS_PER_MICROSECOND; */ + /* bsp_clicks_per_usec = BSP_bus_frequency; */ + /* BSP_time_base_divisor = 1; */ + + /* + * Initialize the interrupt related settings. + */ + intrStackStart = (uint32_t) bsp_interrupt_stack_start; + intrStackSize = (uint32_t) bsp_interrupt_stack_size; + + BSP_mem_size = (uint32_t )RamSize; + + /* + * Initialize default raw exception handlers. + */ + ppc_exc_initialize( + PPC_INTERRUPT_DISABLE_MASK_DEFAULT, + intrStackStart, + intrStackSize + ); + + /* Install default handler for the decrementer exception */ + rv = ppc_exc_set_handler( ASM_DEC_VECTOR, default_decrementer_exception_handler); + if (rv < 0) { + BSP_panic( "Cannot install decrementer exception handler!\n"); + } + + /* Initalize interrupt support */ + sc = bsp_interrupt_initialize(); + if (sc != RTEMS_SUCCESSFUL) { + BSP_panic( "Cannot intitialize interrupt support\n"); + } + +#if 0 + /* + * Setup BATs and enable MMU + */ + /* Memory */ + setdbat(0, 0x0<<24, 0x0<<24, 2<<24, _PAGE_RW); + setibat(0, 0x0<<24, 0x0<<24, 2<<24, 0); + /* PCI */ + setdbat(1, 0x8<<24, 0x8<<24, 1<<24, IO_PAGE); + setdbat(2, 0xc<<24, 0xc<<24, 1<<24, IO_PAGE); + + _write_MSR(_read_MSR() | MSR_DR | MSR_IR); + asm volatile("sync; isync"); +#endif +} -- cgit v1.2.3