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

4.104.114.9
Last change on this file since d4886a06 was d4886a06, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on Jul 24, 2008 at 2:52:55 PM

Changed bsp_get_workarea() to bsp_get_work_area() and
added support for an optional separate heap area.

  • Property mode set to 100644
File size: 2.4 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/* must be identical to STACK_SIZE in start.S */
22#define STACK_SIZE 16 * 1024
23
24#include <string.h>
25
26#include <bsp.h>
27#include <bsp/bootcard.h>
28#include <rtems/bspIo.h>
29
30/*
31 *  Tells us where to put the workspace in case remote debugger is present.
32 */
33extern uint32_t rdb_start;
34
35/*
36 * Tells us if data cache snooping is available
37 */ 
38int CPU_SPARC_HAS_SNOOPING;
39
40/*
41 * set_snooping
42 *
43 * Read the data cache configuration register to determine if
44 * bus snooping is available. This is needed for some drivers so
45 * that they can select the most efficient copy routines. 
46 *
47 */
48
49static inline int set_snooping(void) 
50{
51  int tmp;       
52  asm(" lda [%1] 2, %0 "
53      : "=r"(tmp)
54      : "r"(0xC)
55  );
56  return (tmp >> 27) & 1;
57}
58
59/*
60 *  bsp_pretasking_hook
61 *
62 *  BSP pretasking hook.  Called just before drivers are initialized.
63 *  Used to setup libc and install any BSP extensions     .
64 */
65
66void bsp_pretasking_hook(void)
67{
68  extern void bsp_spurious_initialize();
69
70  bsp_spurious_initialize();
71}
72
73/*
74 *  This method returns the base address and size of the area which
75 *  is to be allocated between the RTEMS Workspace and the C Program
76 *  Heap.
77 */
78void bsp_get_work_area(
79  void   **work_area_start,
80  size_t  *work_area_size,
81  void   **heap_start,
82  size_t  *heap_size
83)
84{
85  /* Tells us where to put the workspace in case remote debugger is present.  */
86  extern uint32_t rdb_start;
87  /* must be identical to STACK_SIZE in start.S */
88  #define STACK_SIZE (16 * 1024)
89
90  *work_area_start       = &end;
91  *work_area_size       = (void *)rdb_start - (void *)&end - STACK_SIZE;
92  *heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
93  *heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
94}
95
96/*
97 *  bsp_start
98 *
99 *  This routine does the bulk of the system initialization.
100 */
101void bsp_start( void )
102{
103  CPU_SPARC_HAS_SNOOPING = set_snooping();
104}
Note: See TracBrowser for help on using the repository browser.