source: rtems/c/src/lib/libbsp/shared/include/bootcard.h @ 0e27119

4.11
Last change on this file since 0e27119 was 0e27119, checked in by Joel Sherrill <joel.sherrill@…>, on Oct 11, 2012 at 8:52:18 PM

Use proper 3 line form of license text

  • Property mode set to 100644
File size: 3.9 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup bsp_bootcard
5 *
6 * @brief Standard system startup.
7 */
8
9/*
10 * Copyright (c) 2008
11 * Embedded Brains GmbH
12 * Obere Lagerstr. 30
13 * D-82178 Puchheim
14 * Germany
15 * rtems@embedded-brains.de
16 *
17 * The license and distribution terms for this file may be
18 * found in the file LICENSE in this distribution or at
19 * http://www.rtems.com/license/LICENSE.
20 */
21
22/**
23 * @defgroup bsp_kit Board Support Package
24 *
25 * @brief Board support package dependent code.
26 */
27
28/**
29 * @defgroup bsp_bootcard Bootcard
30 *
31 * @ingroup bsp_kit
32 *
33 * @brief Standard system startup.
34 *
35 * @{
36 */
37
38#ifndef LIBBSP_SHARED_BOOTCARD_H
39#define LIBBSP_SHARED_BOOTCARD_H
40
41#include <stddef.h>
42#include <stdint.h>
43#include <sys/types.h>
44
45#include <bspopts.h>
46
47#ifdef __cplusplus
48extern "C" {
49#endif /* __cplusplus */
50
51/**
52 * @brief Global pointer to the command line of boot_card().
53 */
54extern const char *bsp_boot_cmdline;
55
56void bsp_start(void);
57
58void bsp_pretasking_hook(void);
59
60void bsp_predriver_hook(void);
61
62void bsp_postdriver_hook(void);
63
64void bsp_cleanup(uint32_t status);
65
66void bsp_reset(void);
67
68/**
69 * @brief Should be used as the heap begin address in bsp_get_work_area() if
70 * the heap area is contained in the work area.
71 */
72#define BSP_BOOTCARD_HEAP_USES_WORK_AREA NULL
73
74/**
75 * @brief Should be used to request the default heap size in bsp_get_work_area().
76 *
77 * In case that the heap area is contained in the work area this heap size
78 * value indicates that the area outside the work space should be used as heap
79 * space.
80 */
81#define BSP_BOOTCARD_HEAP_SIZE_DEFAULT 0
82
83void bsp_get_work_area(
84  void      **work_area_begin,
85  uintptr_t  *work_area_size,
86  void      **heap_begin,
87  uintptr_t  *heap_size
88);
89
90/**
91 * @brief Gives the BSP a chance to reduce the work area size with sbrk() adding more later.
92 *
93 * bsp_sbrk_init() may reduce the work area size passed in. The routine
94 * returns the 'sbrk_amount' to be used when extending the heap.
95 * Note that the return value may be zero.
96 *
97 */
98
99#ifdef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
100uintptr_t bsp_sbrk_init(
101  void              *work_area_begin,
102  uintptr_t         *work_area_size_p
103);
104#endif
105
106
107/**
108 * @brief Standard system initialization procedure.
109 *
110 * You may pass a command line in @a cmdline.  It is later available via the
111 * global @ref bsp_boot_cmdline variable.
112 *
113 * This is the C entry point for ALL RTEMS BSPs.  It is invoked from the
114 * assembly language initialization file usually called @c start.S which does
115 * the basic CPU setup (stack, C runtime environment, zero BSS, load other
116 * sections) and calls afterwards boot_card().  The boot card function provides
117 * the framework for the BSP initialization sequence.  The basic flow of
118 * initialization is:
119 *
120 * - disable interrupts, interrupts will be enabled during the first context
121 *   switch
122 * - bsp_start() - more advanced initialization
123 * - obtain information on BSP memory via bsp_get_work_area() and allocate
124 *   RTEMS Workspace
125 * - rtems_initialize_data_structures()
126 * - allocate memory for C Program Heap
127 * - initialize C Library and C Program Heap
128 * - bsp_pretasking_hook()
129 * - if defined( RTEMS_DEBUG )
130 *   - rtems_debug_enable( RTEMS_DEBUG_ALL_MASK )
131 * - rtems_initialize_before_drivers()
132 * - bsp_predriver_hook()
133 * - rtems_initialize_device_drivers()
134 *   - initialization of all device drivers
135 * - bsp_postdriver_hook()
136 * - rtems_initialize_start_multitasking()
137 *   - 1st task executes C++ global constructors
138 *   - .... application runs ...
139 *   - exit
140 * - back to here eventually
141 * - bsp_cleanup()
142 *
143 * If something goes wrong bsp_cleanup() will be called out of order.
144 *
145 * This style of initialization ensures that the C++ global constructors are
146 * executed after RTEMS is initialized.
147 */
148uint32_t boot_card(const char *cmdline);
149
150/** @} */
151
152void bsp_libc_init(void *heap_begin, uintptr_t heap_size, size_t sbrk_amount);
153
154#ifdef __cplusplus
155}
156#endif /* __cplusplus */
157
158#endif /* LIBBSP_SHARED_BOOTCARD_H */
Note: See TracBrowser for help on using the repository browser.