From 25ddb1c801f06a3be7171e20dcfd46d11a75f112 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 19 Jul 2013 14:51:35 +0000 Subject: First cleanup pass finished, queues and streams not yet removed. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@5999 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/include/chheap.h | 54 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 14 deletions(-) (limited to 'os/kernel/include/chheap.h') diff --git a/os/kernel/include/chheap.h b/os/kernel/include/chheap.h index 8a54d7290..03c1643ab 100644 --- a/os/kernel/include/chheap.h +++ b/os/kernel/include/chheap.h @@ -31,18 +31,34 @@ #if CH_USE_HEAP || defined(__DOXYGEN__) -/* - * Module dependencies check. - */ -#if !CH_USE_MEMCORE && !CH_USE_MALLOC_HEAP -#error "CH_USE_HEAP requires CH_USE_MEMCORE or CH_USE_MALLOC_HEAP" +/*===========================================================================*/ +/* Module constants. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module pre-compile time settings. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Derived constants and error checks. */ +/*===========================================================================*/ + +#if !CH_USE_MEMCORE +#error "CH_USE_HEAP requires CH_USE_MEMCORE" #endif #if !CH_USE_MUTEXES && !CH_USE_SEMAPHORES #error "CH_USE_HEAP requires CH_USE_MUTEXES and/or CH_USE_SEMAPHORES" #endif -typedef struct memory_heap MemoryHeap; +/*===========================================================================*/ +/* Module data structures and types. */ +/*===========================================================================*/ + +/** + * @brief Type of a memory heap. + */ +typedef struct memory_heap memory_heap_t; /** * @brief Memory heap block header. @@ -52,7 +68,7 @@ union heap_header { struct { union { union heap_header *next; /**< @brief Next block in free list. */ - MemoryHeap *heap; /**< @brief Block owner heap. */ + memory_heap_t *heap; /**< @brief Block owner heap. */ } u; /**< @brief Overlapped fields. */ size_t size; /**< @brief Size of the memory block. */ } h; @@ -66,26 +82,36 @@ struct memory_heap { this heap. */ union heap_header h_free; /**< @brief Free blocks list header. */ #if CH_USE_MUTEXES - Mutex h_mtx; /**< @brief Heap access mutex. */ + mutex_t h_mtx; /**< @brief Heap access mutex. */ #else - Semaphore h_sem; /**< @brief Heap access semaphore. */ + semaphore_t h_sem; /**< @brief Heap access semaphore. */ #endif }; +/*===========================================================================*/ +/* Module macros. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* External declarations. */ +/*===========================================================================*/ + #ifdef __cplusplus extern "C" { #endif void _heap_init(void); -#if !CH_USE_MALLOC_HEAP - void chHeapInit(MemoryHeap *heapp, void *buf, size_t size); -#endif - void *chHeapAlloc(MemoryHeap *heapp, size_t size); + void chHeapInit(memory_heap_t *heapp, void *buf, size_t size); + void *chHeapAlloc(memory_heap_t *heapp, size_t size); void chHeapFree(void *p); - size_t chHeapStatus(MemoryHeap *heapp, size_t *sizep); + size_t chHeapStatus(memory_heap_t *heapp, size_t *sizep); #ifdef __cplusplus } #endif +/*===========================================================================*/ +/* Module inline functions. */ +/*===========================================================================*/ + #endif /* CH_USE_HEAP */ #endif /* _CHHEAP_H_ */ -- cgit v1.2.3 From 390ed322cb8f40cb9250021cde5f48acb928d291 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 20 Jul 2013 07:24:12 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6001 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/include/chheap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/kernel/include/chheap.h') diff --git a/os/kernel/include/chheap.h b/os/kernel/include/chheap.h index 03c1643ab..bc5a9afb4 100644 --- a/os/kernel/include/chheap.h +++ b/os/kernel/include/chheap.h @@ -100,7 +100,7 @@ struct memory_heap { extern "C" { #endif void _heap_init(void); - void chHeapInit(memory_heap_t *heapp, void *buf, size_t size); + void chHeapObjectInit(memory_heap_t *heapp, void *buf, size_t size); void *chHeapAlloc(memory_heap_t *heapp, size_t size); void chHeapFree(void *p); size_t chHeapStatus(memory_heap_t *heapp, size_t *sizep); -- cgit v1.2.3 From 49d71a01abeefa000a4cd7a556052d826b096d49 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 20 Jul 2013 10:12:44 +0000 Subject: Renamed or added prefix to all hernel configuration options. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6010 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/include/chheap.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'os/kernel/include/chheap.h') diff --git a/os/kernel/include/chheap.h b/os/kernel/include/chheap.h index bc5a9afb4..73e0d4148 100644 --- a/os/kernel/include/chheap.h +++ b/os/kernel/include/chheap.h @@ -29,7 +29,7 @@ #ifndef _CHHEAP_H_ #define _CHHEAP_H_ -#if CH_USE_HEAP || defined(__DOXYGEN__) +#if CH_CFG_USE_HEAP || defined(__DOXYGEN__) /*===========================================================================*/ /* Module constants. */ @@ -43,12 +43,12 @@ /* Derived constants and error checks. */ /*===========================================================================*/ -#if !CH_USE_MEMCORE -#error "CH_USE_HEAP requires CH_USE_MEMCORE" +#if !CH_CFG_USE_MEMCORE +#error "CH_CFG_USE_HEAP requires CH_CFG_USE_MEMCORE" #endif -#if !CH_USE_MUTEXES && !CH_USE_SEMAPHORES -#error "CH_USE_HEAP requires CH_USE_MUTEXES and/or CH_USE_SEMAPHORES" +#if !CH_CFG_USE_MUTEXES && !CH_CFG_USE_SEMAPHORES +#error "CH_CFG_USE_HEAP requires CH_CFG_USE_MUTEXES and/or CH_CFG_USE_SEMAPHORES" #endif /*===========================================================================*/ @@ -81,7 +81,7 @@ struct memory_heap { memgetfunc_t h_provider; /**< @brief Memory blocks provider for this heap. */ union heap_header h_free; /**< @brief Free blocks list header. */ -#if CH_USE_MUTEXES +#if CH_CFG_USE_MUTEXES mutex_t h_mtx; /**< @brief Heap access mutex. */ #else semaphore_t h_sem; /**< @brief Heap access semaphore. */ @@ -112,7 +112,7 @@ extern "C" { /* Module inline functions. */ /*===========================================================================*/ -#endif /* CH_USE_HEAP */ +#endif /* CH_CFG_USE_HEAP */ #endif /* _CHHEAP_H_ */ -- cgit v1.2.3 From a1435e018bfc9919cb76b1356509ecc883767fb4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 10 Aug 2013 14:51:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6123 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/include/chheap.h | 119 --------------------------------------------- 1 file changed, 119 deletions(-) delete mode 100644 os/kernel/include/chheap.h (limited to 'os/kernel/include/chheap.h') diff --git a/os/kernel/include/chheap.h b/os/kernel/include/chheap.h deleted file mode 100644 index 73e0d4148..000000000 --- a/os/kernel/include/chheap.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file chheap.h - * @brief Heaps macros and structures. - * - * @addtogroup heaps - * @{ - */ - -#ifndef _CHHEAP_H_ -#define _CHHEAP_H_ - -#if CH_CFG_USE_HEAP || defined(__DOXYGEN__) - -/*===========================================================================*/ -/* Module constants. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Module pre-compile time settings. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Derived constants and error checks. */ -/*===========================================================================*/ - -#if !CH_CFG_USE_MEMCORE -#error "CH_CFG_USE_HEAP requires CH_CFG_USE_MEMCORE" -#endif - -#if !CH_CFG_USE_MUTEXES && !CH_CFG_USE_SEMAPHORES -#error "CH_CFG_USE_HEAP requires CH_CFG_USE_MUTEXES and/or CH_CFG_USE_SEMAPHORES" -#endif - -/*===========================================================================*/ -/* Module data structures and types. */ -/*===========================================================================*/ - -/** - * @brief Type of a memory heap. - */ -typedef struct memory_heap memory_heap_t; - -/** - * @brief Memory heap block header. - */ -union heap_header { - stkalign_t align; - struct { - union { - union heap_header *next; /**< @brief Next block in free list. */ - memory_heap_t *heap; /**< @brief Block owner heap. */ - } u; /**< @brief Overlapped fields. */ - size_t size; /**< @brief Size of the memory block. */ - } h; -}; - -/** - * @brief Structure describing a memory heap. - */ -struct memory_heap { - memgetfunc_t h_provider; /**< @brief Memory blocks provider for - this heap. */ - union heap_header h_free; /**< @brief Free blocks list header. */ -#if CH_CFG_USE_MUTEXES - mutex_t h_mtx; /**< @brief Heap access mutex. */ -#else - semaphore_t h_sem; /**< @brief Heap access semaphore. */ -#endif -}; - -/*===========================================================================*/ -/* Module macros. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* External declarations. */ -/*===========================================================================*/ - -#ifdef __cplusplus -extern "C" { -#endif - void _heap_init(void); - void chHeapObjectInit(memory_heap_t *heapp, void *buf, size_t size); - void *chHeapAlloc(memory_heap_t *heapp, size_t size); - void chHeapFree(void *p); - size_t chHeapStatus(memory_heap_t *heapp, size_t *sizep); -#ifdef __cplusplus -} -#endif - -/*===========================================================================*/ -/* Module inline functions. */ -/*===========================================================================*/ - -#endif /* CH_CFG_USE_HEAP */ - -#endif /* _CHHEAP_H_ */ - -/** @} */ -- cgit v1.2.3