Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:59

0001 /*  bsp_start()
0002  *
0003  *  This routine starts the application.  It includes application,
0004  *  board, and monitor specific initialization and configuration.
0005  *  The generic CPU dependent initialization has been performed
0006  *  before this routine is invoked.
0007  *
0008  *  INPUT:  NONE
0009  *
0010  *  OUTPUT: NONE
0011  *
0012  *  Author: Thomas Doerfler <td@imd.m.isar.de>
0013  *              IMD Ingenieurbuero fuer Microcomputertechnik
0014  *
0015  *  Copyright (c) 1998 IMD Ingenieurbuero fuer Microcomputertechnik
0016  *
0017  *  Changes from IMD are covered by the original distributions terms.
0018  *  This file has been derived from the papyrus BSP:
0019  *
0020  *  Author: Andrew Bray <andy@i-cubed.co.uk>
0021  *
0022  *  COPYRIGHT (c) 1995 by i-cubed ltd.
0023  *
0024  *  To anyone who acknowledges that this file is provided "AS IS"
0025  *  without any express or implied warranty:
0026  *      permission to use, copy, modify, and distribute this file
0027  *      for any purpose is hereby granted without fee, provided that
0028  *      the above copyright notice and this notice appears in all
0029  *      copies, and that the name of i-cubed limited not be used in
0030  *      advertising or publicity pertaining to distribution of the
0031  *      software without specific, written prior permission.
0032  *      i-cubed limited makes no representations about the suitability
0033  *      of this software for any purpose.
0034  *
0035  *  Modifications for spooling console driver and control of memory layout
0036  *  with linker command file by
0037  *              Thomas Doerfler <td@imd.m.isar.de>
0038  *  for these modifications:
0039  *  Copyright (c) 1997 IMD Ingenieurbuero fuer Microcomputertechnik
0040  *
0041  *  To anyone who acknowledges that this file is provided "AS IS"
0042  *  without any express or implied warranty:
0043  *      permission to use, copy, modify, and distribute this file
0044  *      for any purpose is hereby granted without fee, provided that
0045  *      the above copyright notice and this notice appears in all
0046  *      copies. IMD makes no representations about the suitability
0047  *      of this software for any purpose.
0048  *
0049  *  Derived from c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c:
0050  *
0051  *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
0052  *  On-Line Applications Research Corporation (OAR).
0053  *
0054  *  Modifications for PPC405GP by Dennis Ehlin
0055  */
0056 
0057 #include <rtems/counter.h>
0058 
0059 #include <bsp.h>
0060 #include <bsp/irq.h>
0061 #include <bsp/irq-generic.h>
0062 #include <bsp/bootcard.h>
0063 #include <bsp/linker-symbols.h>
0064 
0065 #include <libcpu/powerpc-utility.h>
0066 
0067 #include RTEMS_XPARAMETERS_H
0068 
0069 /* Symbols defined in linker command file */
0070 LINKER_SYMBOL(virtex_exc_vector_base);
0071 
0072 /*
0073  *  Driver configuration parameters
0074  */
0075 uint32_t bsp_time_base_frequency = XPAR_CPU_PPC405_CORE_CLOCK_FREQ_HZ;
0076 
0077 uint32_t _CPU_Counter_frequency(void)
0078 {
0079   return bsp_time_base_frequency;
0080 }
0081 
0082 /*
0083  *  bsp_start
0084  *
0085  *  This routine does the bulk of the system initialization.
0086  */
0087 void bsp_start( void )
0088 {
0089   /*
0090    * Get CPU identification dynamically. Note that the get_ppc_cpu_type()
0091    * function store the result in global variables
0092    * so that it can be used latter...
0093    */
0094   get_ppc_cpu_type();
0095   get_ppc_cpu_revision();
0096 
0097   ppc_exc_initialize_with_vector_base(
0098     (uintptr_t) _ISR_Stack_area_begin,
0099     virtex_exc_vector_base
0100   );
0101   __asm__ volatile (
0102     ".machine \"push\"\n"
0103     ".machine \"any\"\n"
0104     "mtevpr %0\n"
0105     ".machine \"pop\"" : :
0106     "r" (virtex_exc_vector_base)
0107   );
0108 
0109   bsp_interrupt_initialize();
0110 }