source: rtems/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c @ 45a34d82

4.104.114.95
Last change on this file since 45a34d82 was 7db0adc5, checked in by Ralf Corsepius <ralf.corsepius@…>, on 08/18/08 at 12:00:57

Remove bogus local declarations.

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2 *  This set of routines starts the application.  It includes application,
3 *  board, and monitor specific initialization and configuration.
4 *  The generic CPU dependent initialization has been performed
5 *  before any of these are invoked.
6 *
7 *  COPYRIGHT (c) 1989-2007.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  Modified for LEON3 BSP.
11 *  COPYRIGHT (c) 2004.
12 *  Gaisler Research.
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 *
18 *  $Id$
19 */
20
21
22#include <string.h>
23
24#include <bsp.h>
25#include <bsp/bootcard.h>
26#include <rtems/bspIo.h>
27
28/* must be identical to STACK_SIZE in start.S */
29#define STACK_SIZE 16 * 1024
30
31/*
32 *  Tells us where to put the workspace in case remote debugger is present.
33 */
34extern uint32_t rdb_start;
35
36/*
37 * Tells us if data cache snooping is available
38 */
39int CPU_SPARC_HAS_SNOOPING;
40
41/*
42 * set_snooping
43 *
44 * Read the data cache configuration register to determine if
45 * bus snooping is available. This is needed for some drivers so
46 * that they can select the most efficient copy routines. 
47 *
48 */
49
50static inline int set_snooping(void)
51{
52  int tmp;       
53  asm(" lda [%1] 2, %0 "
54      : "=r"(tmp)
55      : "r"(0xC)
56  );
57  return (tmp >> 27) & 1;
58}
59
60/*
61 *  bsp_pretasking_hook
62 *
63 *  BSP pretasking hook.  Called just before drivers are initialized.
64 *  Used to setup libc and install any BSP extensions     .
65 */
66
67void bsp_pretasking_hook(void)
68{
69  bsp_spurious_initialize();
70}
71
72/*
73 *  This method returns the base address and size of the area which
74 *  is to be allocated between the RTEMS Workspace and the C Program
75 *  Heap.
76 */
77void bsp_get_work_area(
78  void   **work_area_start,
79  size_t  *work_area_size,
80  void   **heap_start,
81  size_t  *heap_size
82)
83{
84  /* Tells us where to put the workspace in case remote debugger is present.  */
85  extern uint32_t rdb_start;
86
87  *work_area_start       = &end;
88  *work_area_size       = (void *)rdb_start - (void *)&end - STACK_SIZE;
89  *heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
90  *heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
91}
92
93/*
94 *  bsp_start
95 *
96 *  This routine does the bulk of the system initialization.
97 */
98void bsp_start( void )
99{
100  CPU_SPARC_HAS_SNOOPING = set_snooping();
101}
Note: See TracBrowser for help on using the repository browser.