source: rtems/cpukit/libcsupport/include/rtems/libcsupport.h @ 443c61ec

Last change on this file since 443c61ec was 443c61ec, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 25, 2015 at 8:01:57 AM

Delete empty libc_init()

  • Property mode set to 100644
File size: 4.6 KB
Line 
1/**
2 * @file
3 *
4 * @brief Standard C Library Support
5 *
6 * This include file contains the information regarding the
7 * RTEMS specific support for the standard C library.
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-2011.
12 *  On-Line Applications Research Corporation (OAR).
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.org/license/LICENSE.
17 */
18
19#ifndef _RTEMS_RTEMS_LIBCSUPPORT_H
20#define _RTEMS_RTEMS_LIBCSUPPORT_H
21
22#include <sys/types.h>
23#include <stdint.h>
24
25#include <rtems/score/heap.h>
26#include <rtems/rtems/tasks.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32/**
33 * @defgroup libcsupport Standard C Library Support
34 *
35 * @brief RTEMS Specific Support for the Standard C Library
36 *
37 */
38/**@{**/
39
40extern void malloc_dump(void);
41
42/**
43 * @brief Malloc walk.
44 */
45extern bool malloc_walk(int source, bool printf_enabled);
46
47/**
48 * @brief Set malloc heap pointer.
49 *
50 * This routine is primarily used for debugging.
51 */
52void malloc_set_heap_pointer(Heap_Control *new_heap);
53
54/**
55 * @brief Get malloc heap pointer.
56 *
57 * This routine is primarily used for debugging.
58 */
59Heap_Control *malloc_get_heap_pointer( void );
60extern int  host_errno(void);
61extern void fix_syscall_errno(void);
62
63/**
64 * @brief Get free malloc information.
65 *
66 * Find amount of free heap remaining
67 */
68extern size_t malloc_free_space(void);
69
70/**
71 * @brief Get malloc status information.
72 *
73 * Find amount of free heap remaining.
74 */
75extern int malloc_info(Heap_Information_block *the_info);
76
77/*
78 *  Prototypes required to install newlib reentrancy user extension
79 */
80bool newlib_create_hook(
81  rtems_tcb *current_task,
82  rtems_tcb *creating_task
83);
84
85#define __RTEMS_NEWLIB_BEGIN 0
86
87void newlib_terminate_hook(
88  rtems_tcb *current_task
89);
90
91#define RTEMS_NEWLIB_EXTENSION \
92{ \
93  newlib_create_hook,     /* rtems_task_create  */ \
94  0,                      /* rtems_task_start   */ \
95  0,                      /* rtems_task_restart */ \
96  0,                      /* rtems_task_delete  */ \
97  0,                      /* task_switch  */ \
98  __RTEMS_NEWLIB_BEGIN,   /* task_begin   */ \
99  0,                      /* task_exitted */ \
100  0,                      /* fatal        */ \
101  newlib_terminate_hook   /* thread terminate */ \
102}
103
104typedef struct {
105  uint32_t active_barriers;
106  uint32_t active_extensions;
107  uint32_t active_message_queues;
108  uint32_t active_partitions;
109  uint32_t active_periods;
110  uint32_t active_ports;
111  uint32_t active_regions;
112  uint32_t active_semaphores;
113  uint32_t active_tasks;
114  uint32_t active_timers;
115} rtems_resource_rtems_api;
116
117typedef struct {
118  uint32_t active_barriers;
119  uint32_t active_condition_variables;
120  uint32_t active_message_queues;
121  uint32_t active_message_queue_descriptors;
122  uint32_t active_mutexes;
123  uint32_t active_rwlocks;
124  uint32_t active_semaphores;
125  uint32_t active_spinlocks;
126  uint32_t active_threads;
127  uint32_t active_timers;
128} rtems_resource_posix_api;
129
130typedef struct {
131  Heap_Information_block workspace_info;
132  Heap_Information_block heap_info;
133  uint32_t active_posix_key_value_pairs;
134  uint32_t active_posix_keys;
135  rtems_resource_rtems_api rtems_api;
136  rtems_resource_posix_api posix_api;
137  int open_files;
138} rtems_resource_snapshot;
139
140/**
141 * @brief Tasks a snapshot of the resource usage of the system.
142 *
143 * @param[out] snapshot The snapshot of used resources.
144 *
145 * @see rtems_resource_snapshot_equal() and rtems_resource_snapshot_check().
146 *
147 * @code
148 * #include <assert.h>
149 *
150 * #include <rtems/libcsupport.h>
151 *
152 * void example(void)
153 * {
154 *   rtems_resource_snapshot before;
155 *
156 *   test_setup();
157 *   rtems_resource_snapshot_take(&before);
158 *   test();
159 *   assert(rtems_resource_snapshot_check(&before));
160 *   test_cleanup();
161 * }
162 * @endcode
163 */
164void rtems_resource_snapshot_take(rtems_resource_snapshot *snapshot);
165
166/**
167 * @brief Compares two resource snapshots for equality.
168 *
169 * @param[in] a One resource snapshot.
170 * @param[in] b Another resource snapshot.
171 *
172 * @retval true The resource snapshots are equal.
173 * @retval false Otherwise.
174 *
175 * @see rtems_resource_snapshot_take().
176 */
177bool rtems_resource_snapshot_equal(
178  const rtems_resource_snapshot *a,
179  const rtems_resource_snapshot *b
180);
181
182/**
183 * @brief Takes a new resource snapshot and checks that it is equal to the
184 * given resource snapshot.
185 *
186 * @param[in] snapshot The resource snapshot used for comparison with the new
187 * resource snapshot.
188 *
189 * @retval true The resource snapshots are equal.
190 * @retval false Otherwise.
191 *
192 * @see rtems_resource_snapshot_take().
193 */
194bool rtems_resource_snapshot_check(const rtems_resource_snapshot *snapshot);
195
196/** @} */
197
198#ifdef __cplusplus
199}
200#endif
201
202#endif
203/* end of include file */
Note: See TracBrowser for help on using the repository browser.