diff options
Diffstat (limited to 'cpukit/include/rtems/malloc.h')
-rw-r--r-- | cpukit/include/rtems/malloc.h | 95 |
1 files changed, 66 insertions, 29 deletions
diff --git a/cpukit/include/rtems/malloc.h b/cpukit/include/rtems/malloc.h index eba538e223..c26b262881 100644 --- a/cpukit/include/rtems/malloc.h +++ b/cpukit/include/rtems/malloc.h @@ -1,16 +1,40 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * - * This file defines the interface to RTEMS extensions to the Malloc Family. + * @ingroup MallocSupport + * + * @ingroup RTEMSAPIMalloc + * + * @brief This header file defines interfaces to support and use dynamic memory + * allocation. */ /* - * COPYRIGHT (c) 1989-2011. - * On-Line Applications Research Corporation (OAR). + * COPYRIGHT (c) 1989-2011. + * On-Line Applications Research Corporation (OAR). * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RTEMS_MALLOC_H @@ -19,7 +43,6 @@ #include <rtems.h> #include <rtems/bspIo.h> #include <rtems/libcsupport.h> /* for malloc_walk() */ -#include <rtems/score/memory.h> #include <stdint.h> @@ -28,11 +51,13 @@ extern "C" { #endif /** - * @defgroup MallocSupport Malloc Support + * @defgroup MallocSupport Malloc Support + * + * @ingroup libcsupport * - * @ingroup libcsupport + * @brief This group contains interfaces to support dynamic memory allocation. * - * @brief RTEMS extensions to the Malloc Family + * @{ */ /** @@ -43,12 +68,7 @@ extern "C" { */ extern Heap_Control *RTEMS_Malloc_Heap; -Heap_Control *RTEMS_Malloc_Initialize( - const Memory_Information *mem, - Heap_Initialization_or_extend_handler extend -); - -void rtems_heap_set_sbrk_amount( ptrdiff_t sbrk_amount ); +void _Malloc_Initialize( void ); typedef void *(*rtems_heap_extend_handler)( Heap_Control *heap, @@ -63,19 +83,6 @@ void *rtems_heap_extend_via_sbrk( size_t alloc_size ); -/** - * @brief Greedy allocate that empties the sbrk memory - * - * Afterwards all the sbrk avialable memory will have been allocated - * to the provided heap. - * - * @see rtems_heap_extend_via_sbrk(). - */ -void rtems_heap_sbrk_greedy_allocate( - Heap_Control *heap, - size_t alloc_size -); - void *rtems_heap_null_extend( Heap_Control *heap, size_t alloc_size @@ -89,6 +96,34 @@ extern const rtems_heap_extend_handler rtems_malloc_extend_handler; typedef void (*rtems_malloc_dirtier_t)(void *, size_t); extern rtems_malloc_dirtier_t rtems_malloc_dirty_helper; +/** @} */ + +/** + * @defgroup RTEMSAPIMalloc Dynamic Memory Allocation + * + * @ingroup RTEMSAPI + * + * @brief This group contains non-standard interfaces to use dynamic memory + * allocation. + * + * @{ + */ + +void rtems_heap_set_sbrk_amount( ptrdiff_t sbrk_amount ); + +/** + * @brief Greedy allocate that empties the sbrk memory + * + * Afterwards all the sbrk avialable memory will have been allocated + * to the provided heap. + * + * @see rtems_heap_extend_via_sbrk(). + */ +void rtems_heap_sbrk_greedy_allocate( + Heap_Control *heap, + size_t alloc_size +); + /** * @brief Dirty Memory Function * @@ -236,6 +271,8 @@ void *rtems_heap_greedy_allocate_all_except_largest( */ void rtems_heap_greedy_free( void *opaque ); +/** @} */ + #ifdef __cplusplus } #endif |