git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@414 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2008-08-29 08:31:33 +00:00
parent 7ffd1d5e5b
commit ff6163a049
4 changed files with 40 additions and 3 deletions

View File

@ -255,6 +255,8 @@ PREDEFINED = __JUST_STUBS__ \
CH_USE_QUEUES_HALFDUPLEX \ CH_USE_QUEUES_HALFDUPLEX \
CH_USE_SERIAL_FULLDUPLEX \ CH_USE_SERIAL_FULLDUPLEX \
CH_USE_SERIAL_HALFDUPLEX \ CH_USE_SERIAL_HALFDUPLEX \
CH_USE_HEAP \
CH_USE_MEMPOOLS \
CH_USE_MESSAGES \ CH_USE_MESSAGES \
CH_USE_MESSAGES_EVENT \ CH_USE_MESSAGES_EVENT \
CH_USE_MESSAGES_PRIORITY \ CH_USE_MESSAGES_PRIORITY \

View File

@ -344,6 +344,38 @@
*/ */
/** @} */ /** @} */
/**
* @defgroup Heap Heap
* @{
* Heap Allocator related APIs.
* <b>Operation mode</b><br><br>
* The heap allocator implements a first-fit strategy and its APIs are
* functionally equivalent to the usual \p malloc() and \p free(). The main
* difference is that the heap APIs are thread safe.<br>
* By enabling the \p CH_USE_MALLOC_HEAP option the heap manager will use the
* runtime-provided \p malloc() and \p free() as backend for the heap APIs
* instead of the system provided allocator.<br>
* In order to use the heap APIs the \p CH_USE_HEAP option must be specified
* in \p chconf.h.
* @file include/heap.h Heap macros and structures.
* @file chheap.c Heap functions.
*/
/** @} */
/**
* @defgroup MemoryPools Memory Pools
* @{
* Memory Pools related APIs.
* <b>Operation mode</b><br><br>
* The Memory Pools APIs allow to allocate/free fixed size objects in
* <b>constant time</b> and reliably without memory fragmentation problems.<br>
* In order to use the Time APIs the \p CH_USE_MEMPOOLS option must be
* specified in \p chconf.h.
* @file include/mempools.h Memory Pools macros and structures.
* @file chmempools.c Memory Pools functions.
*/
/** @} */
/** /**
* @defgroup Semaphores Semaphores * @defgroup Semaphores Semaphores
* @{ * @{

View File

@ -18,7 +18,7 @@
*/ */
/** /**
* @addtogroup Memory * @addtogroup Heap
* @{ * @{
*/ */
@ -251,3 +251,5 @@ bool_t chHeapNotFragmented(void) {
#endif /* CH_USE_MALLOC_HEAP */ #endif /* CH_USE_MALLOC_HEAP */
#endif /* CH_USE_HEAP */ #endif /* CH_USE_HEAP */
/** @} */

View File

@ -102,9 +102,10 @@ void chPoolFree(MemoryPool *mp, void *objp) {
* of objects. * of objects.
*/ */
void chPoolRelease(MemoryPool *mp) { void chPoolRelease(MemoryPool *mp) {
void *p;
while (mp->mp_next) while ((p = chPoolAlloc(mp, FALSE)) != NULL)
chHeapFree(mp->mp_next); chHeapFree(p);
} }
#endif #endif