source: rtems/c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c @ deada8d

4.104.115
Last change on this file since deada8d was deada8d, checked in by Joel Sherrill <joel.sherrill@…>, on 04/28/10 at 13:23:16

2010-04-28 Joel Sherrill <joel.sherrilL@…>

  • network/xiltemac.c, startup/bspstart.c: Remove warnings.
  • Property mode set to 100644
File size: 4.8 KB
Line 
1/*  bsp_start()
2 *
3 *  This routine starts the application.  It includes application,
4 *  board, and monitor specific initialization and configuration.
5 *  The generic CPU dependent initialization has been performed
6 *  before this routine is invoked.
7 *
8 *  INPUT:  NONE
9 *
10 *  OUTPUT: NONE
11 *
12 *  Author:     Thomas Doerfler <td@imd.m.isar.de>
13 *              IMD Ingenieurbuero fuer Microcomputertechnik
14 *
15 *  COPYRIGHT (c) 1998 by IMD
16 *
17 *  Changes from IMD are covered by the original distributions terms.
18 *  This file has been derived from the papyrus BSP:
19 *
20 *  Author:     Andrew Bray <andy@i-cubed.co.uk>
21 *
22 *  COPYRIGHT (c) 1995 by i-cubed ltd.
23 *
24 *  To anyone who acknowledges that this file is provided "AS IS"
25 *  without any express or implied warranty:
26 *      permission to use, copy, modify, and distribute this file
27 *      for any purpose is hereby granted without fee, provided that
28 *      the above copyright notice and this notice appears in all
29 *      copies, and that the name of i-cubed limited not be used in
30 *      advertising or publicity pertaining to distribution of the
31 *      software without specific, written prior permission.
32 *      i-cubed limited makes no representations about the suitability
33 *      of this software for any purpose.
34 *
35 *  Modifications for spooling console driver and control of memory layout
36 *  with linker command file by
37 *              Thomas Doerfler <td@imd.m.isar.de>
38 *  for these modifications:
39 *  COPYRIGHT (c) 1997 by IMD, Puchheim, Germany.
40 *
41 *  To anyone who acknowledges that this file is provided "AS IS"
42 *  without any express or implied warranty:
43 *      permission to use, copy, modify, and distribute this file
44 *      for any purpose is hereby granted without fee, provided that
45 *      the above copyright notice and this notice appears in all
46 *      copies. IMD makes no representations about the suitability
47 *      of this software for any purpose.
48 *
49 *  Derived from c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c:
50 *
51 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
52 *  On-Line Applications Research Corporation (OAR).
53 *
54 *  Modifications for PPC405GP by Dennis Ehlin
55 *
56 *  $Id$
57 */
58
59#include <string.h>
60#include <fcntl.h>
61
62#include <bsp.h>
63#include <bsp/irq.h>
64#include <rtems/bspIo.h>
65#include <libcpu/cpuIdent.h>
66#include <libcpu/spr.h>
67#include <rtems/powerpc/powerpc.h>
68
69#include RTEMS_XPARAMETERS_H
70#include <stdio.h>
71
72uint32_t _heap_start;
73uint32_t _heap_end;
74uint32_t _top_of_ram;
75
76/*
77 *  Driver configuration parameters
78 */
79uint32_t   bsp_clicks_per_usec;
80uint32_t   bsp_serial_per_sec;         /* Serial clocks per second */
81bool       bsp_serial_external_clock;
82bool       bsp_serial_xon_xoff;
83bool       bsp_serial_cts_rts;
84uint32_t   bsp_serial_rate;
85uint32_t   bsp_timer_average_overhead; /* Average overhead of timer in ticks */
86uint32_t   bsp_timer_least_valid;      /* Least valid number from timer      */
87bool       bsp_timer_internal_clock;   /* TRUE, when timer runs with CPU clk */
88
89extern unsigned char IntrStack_start[];
90extern unsigned char IntrStack_end[];
91
92/*      Initialize whatever libc we are using
93 *      called from postdriver hook
94 */
95
96void bsp_XAssertHandler(const char* file, int line);
97
98void bsp_XAssertHandler(const char* file, int line) {
99  printf("\n***\n*** XAssert Failed!  File: %s, Line: %d\n***\n", file, line);
100}
101
102/*
103 *  bsp_start
104 *
105 *  This routine does the bulk of the system initialization.
106 */
107void bsp_start( void )
108{
109  rtems_status_code sc = RTEMS_SUCCESSFUL;
110  ppc_cpu_id_t myCpu;
111  ppc_cpu_revision_t myCpuRevision;
112
113  /*
114   * Get CPU identification dynamically. Note that the get_ppc_cpu_type()
115   * function store the result in global variables
116   * so that it can be used latter...
117   */
118  myCpu             = get_ppc_cpu_type();
119  myCpuRevision = get_ppc_cpu_revision();
120
121  /*
122   *  initialize the device driver parameters
123   */
124
125  /* timebase register ticks/microsecond */
126  bsp_clicks_per_usec = (250000000 / 1000000);
127  bsp_serial_per_sec = 14625000;
128  bsp_serial_external_clock = false;
129  bsp_timer_internal_clock  = true;
130  bsp_serial_xon_xoff = false;
131  bsp_serial_cts_rts = false;
132  bsp_serial_rate = 115200;
133  bsp_timer_average_overhead = 2;
134  bsp_timer_least_valid = 3;
135
136  /*
137   * Initialize default raw exception handlers.
138   */
139  sc = ppc_exc_initialize(
140    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
141    (uint32_t)IntrStack_start,
142    IntrStack_end - IntrStack_start
143  );
144  if (sc != RTEMS_SUCCESSFUL) {
145    BSP_panic("cannot initialize exceptions");
146  }
147
148  /*
149   * Install our own set of exception vectors
150   */
151  BSP_rtems_irq_mng_init(0);
152}
153
154void BSP_ask_for_reset(void)
155{
156  printk("system stopped, press RESET");
157  while(1) {};
158}
159
160void BSP_panic(char *s)
161{
162  printk("%s PANIC %s\n",_RTEMS_version, s);
163  BSP_ask_for_reset();
164}
165
166void _BSP_Fatal_error(unsigned int v)
167{
168  printk("%s PANIC ERROR %x\n",_RTEMS_version, v);
169  BSP_ask_for_reset();
170}
Note: See TracBrowser for help on using the repository browser.