1 | /* |
---|
2 | * This set of routines are the BSP specific initialization |
---|
3 | * support routines. |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989-2008. |
---|
6 | * On-Line Applications Research Corporation (OAR). |
---|
7 | * |
---|
8 | * The license and distribution terms for this file may be |
---|
9 | * found in the file LICENSE in this distribution or at |
---|
10 | * http://www.rtems.com/license/LICENSE. |
---|
11 | * |
---|
12 | * Ported to ERC32 implementation of the SPARC by On-Line Applications |
---|
13 | * Research Corporation (OAR) under contract to the European Space |
---|
14 | * Agency (ESA). |
---|
15 | * |
---|
16 | * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995. |
---|
17 | * European Space Agency. |
---|
18 | * |
---|
19 | * $Id$ |
---|
20 | */ |
---|
21 | |
---|
22 | #include <string.h> |
---|
23 | |
---|
24 | #include <bsp.h> |
---|
25 | #include <bsp/bootcard.h> |
---|
26 | #include <rtems/libio.h> |
---|
27 | #include <rtems/libcsupport.h> |
---|
28 | #include <rtems/bspIo.h> |
---|
29 | |
---|
30 | /* |
---|
31 | * LEON2 Cache Snooping Support |
---|
32 | */ |
---|
33 | #ifdef LEON2 |
---|
34 | /* |
---|
35 | * Tells us if data cache snooping is available |
---|
36 | */ |
---|
37 | int CPU_SPARC_HAS_SNOOPING; |
---|
38 | |
---|
39 | /* |
---|
40 | * set_snooping |
---|
41 | * |
---|
42 | * Read the data cache configuration register to determine if |
---|
43 | * bus snooping is available. This is needed for some drivers so |
---|
44 | * that they can select the most efficient copy routines. |
---|
45 | */ |
---|
46 | static inline int set_snooping(void) |
---|
47 | { |
---|
48 | unsigned int tmp = *(unsigned int *)0x80000014; /* Cache control register */ |
---|
49 | return ((tmp>>23) & 1); /* Data cache snooping enabled */ |
---|
50 | } |
---|
51 | #endif |
---|
52 | |
---|
53 | /* |
---|
54 | * BSP pretasking hook. Called just before drivers are initialized. |
---|
55 | * Used to setup libc and install any BSP extensions. |
---|
56 | */ |
---|
57 | void bsp_pretasking_hook(void) |
---|
58 | { |
---|
59 | extern void bsp_spurious_initialize(); |
---|
60 | |
---|
61 | bsp_spurious_initialize(); |
---|
62 | } |
---|
63 | |
---|
64 | /* |
---|
65 | * This method returns the base address and size of the area which |
---|
66 | * is to be allocated between the RTEMS Workspace and the C Program |
---|
67 | * Heap. |
---|
68 | */ |
---|
69 | void bsp_get_work_area( |
---|
70 | void **work_area_start, |
---|
71 | size_t *work_area_size, |
---|
72 | void **heap_start, |
---|
73 | size_t *heap_size |
---|
74 | ) |
---|
75 | { |
---|
76 | /* Tells us where to put the workspace in case remote debugger is present. */ |
---|
77 | extern uint32_t rdb_start; |
---|
78 | /* must be identical to STACK_SIZE in start.S */ |
---|
79 | #define STACK_SIZE (16 * 1024) |
---|
80 | |
---|
81 | *work_area_start = &end; |
---|
82 | *work_area_size = (void *)rdb_start - (void *)&end - STACK_SIZE; |
---|
83 | *heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA; |
---|
84 | *heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT; |
---|
85 | } |
---|
86 | |
---|
87 | /* |
---|
88 | * bsp_start |
---|
89 | * |
---|
90 | * This routine does the bulk of the system initialization. |
---|
91 | */ |
---|
92 | void bsp_start( void ) |
---|
93 | { |
---|
94 | #ifdef LEON2 |
---|
95 | CPU_SPARC_HAS_SNOOPING = set_snooping(); |
---|
96 | #endif |
---|
97 | } |
---|