source: rtems/cpukit/libcsupport/include/rtems/libcsupport.h @ 5055281

Last change on this file since 5055281 was 5055281, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 26, 2015 at 6:29:33 AM

Delete unused declarations and define

  • Property mode set to 100644
File size: 4.5 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 );
60
61/**
62 * @brief Get free malloc information.
63 *
64 * Find amount of free heap remaining
65 */
66extern size_t malloc_free_space(void);
67
68/**
69 * @brief Get malloc status information.
70 *
71 * Find amount of free heap remaining.
72 */
73extern int malloc_info(Heap_Information_block *the_info);
74
75/*
76 *  Prototypes required to install newlib reentrancy user extension
77 */
78bool newlib_create_hook(
79  rtems_tcb *current_task,
80  rtems_tcb *creating_task
81);
82
83void newlib_terminate_hook(
84  rtems_tcb *current_task
85);
86
87#define RTEMS_NEWLIB_EXTENSION \
88{ \
89  newlib_create_hook,     /* rtems_task_create  */ \
90  0,                      /* rtems_task_start   */ \
91  0,                      /* rtems_task_restart */ \
92  0,                      /* rtems_task_delete  */ \
93  0,                      /* task_switch  */ \
94  0,                      /* task_begin   */ \
95  0,                      /* task_exitted */ \
96  0,                      /* fatal        */ \
97  newlib_terminate_hook   /* thread terminate */ \
98}
99
100typedef struct {
101  uint32_t active_barriers;
102  uint32_t active_extensions;
103  uint32_t active_message_queues;
104  uint32_t active_partitions;
105  uint32_t active_periods;
106  uint32_t active_ports;
107  uint32_t active_regions;
108  uint32_t active_semaphores;
109  uint32_t active_tasks;
110  uint32_t active_timers;
111} rtems_resource_rtems_api;
112
113typedef struct {
114  uint32_t active_barriers;
115  uint32_t active_condition_variables;
116  uint32_t active_message_queues;
117  uint32_t active_message_queue_descriptors;
118  uint32_t active_mutexes;
119  uint32_t active_rwlocks;
120  uint32_t active_semaphores;
121  uint32_t active_spinlocks;
122  uint32_t active_threads;
123  uint32_t active_timers;
124} rtems_resource_posix_api;
125
126typedef struct {
127  Heap_Information_block workspace_info;
128  Heap_Information_block heap_info;
129  uint32_t active_posix_key_value_pairs;
130  uint32_t active_posix_keys;
131  rtems_resource_rtems_api rtems_api;
132  rtems_resource_posix_api posix_api;
133  int open_files;
134} rtems_resource_snapshot;
135
136/**
137 * @brief Tasks a snapshot of the resource usage of the system.
138 *
139 * @param[out] snapshot The snapshot of used resources.
140 *
141 * @see rtems_resource_snapshot_equal() and rtems_resource_snapshot_check().
142 *
143 * @code
144 * #include <assert.h>
145 *
146 * #include <rtems/libcsupport.h>
147 *
148 * void example(void)
149 * {
150 *   rtems_resource_snapshot before;
151 *
152 *   test_setup();
153 *   rtems_resource_snapshot_take(&before);
154 *   test();
155 *   assert(rtems_resource_snapshot_check(&before));
156 *   test_cleanup();
157 * }
158 * @endcode
159 */
160void rtems_resource_snapshot_take(rtems_resource_snapshot *snapshot);
161
162/**
163 * @brief Compares two resource snapshots for equality.
164 *
165 * @param[in] a One resource snapshot.
166 * @param[in] b Another resource snapshot.
167 *
168 * @retval true The resource snapshots are equal.
169 * @retval false Otherwise.
170 *
171 * @see rtems_resource_snapshot_take().
172 */
173bool rtems_resource_snapshot_equal(
174  const rtems_resource_snapshot *a,
175  const rtems_resource_snapshot *b
176);
177
178/**
179 * @brief Takes a new resource snapshot and checks that it is equal to the
180 * given resource snapshot.
181 *
182 * @param[in] snapshot The resource snapshot used for comparison with the new
183 * resource snapshot.
184 *
185 * @retval true The resource snapshots are equal.
186 * @retval false Otherwise.
187 *
188 * @see rtems_resource_snapshot_take().
189 */
190bool rtems_resource_snapshot_check(const rtems_resource_snapshot *snapshot);
191
192/** @} */
193
194#ifdef __cplusplus
195}
196#endif
197
198#endif
199/* end of include file */
Note: See TracBrowser for help on using the repository browser.