Fixed bug 3303841.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2973 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
gdisirio 2011-05-19 09:13:24 +00:00
parent 807c5f1882
commit 5e1249af26
5 changed files with 17 additions and 9 deletions

View File

@ -76,7 +76,9 @@ struct memory_heap {
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 chHeapFree(void *p);
size_t chHeapStatus(MemoryHeap *heapp, size_t *sizep);

View File

@ -80,6 +80,8 @@ void _heap_init(void) {
* @brief Initializes a memory heap from a static memory area.
* @pre Both the heap buffer base and the heap size must be aligned to
* the @p stkalign_t type size.
* @pre In order to use this function the option @p CH_USE_MALLOC_HEAP
* must be disabled.
*
* @param[out] heapp pointer to the memory heap descriptor to be initialized
* @param[in] buf heap buffer base
@ -271,7 +273,7 @@ static Mutex hmtx;
static Semaphore hsem;
#endif
void heap_init(void) {
void _heap_init(void) {
#if CH_USE_MUTEXES
chMtxInit(&hmtx);

View File

@ -72,6 +72,8 @@
*** 2.3.3 ***
- FIX: Race condition in output queues (bug 3303908)(backported to 2.2.4).
- FIX: Fixed CH_USE_HEAP and CH_USE_MALLOC_HEAP conflict (bug 3303841)
(backported to 2.2.4)
- FIX: Fixed timeout problem in the lwIP interface layer (bug 3302420)
(backported to 2.2.4).
- NEW: Reorganization of the Cortex-Mx ports in order to reduced code and

View File

@ -54,7 +54,7 @@
*/
#if CH_USE_DYNAMIC || defined(__DOXYGEN__)
#if CH_USE_HEAP || defined(__DOXYGEN__)
#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
static MemoryHeap heap1;
#endif
#if CH_USE_MEMPOOLS || defined(__DOXYGEN__)
@ -78,7 +78,7 @@ static msg_t thread(void *p) {
return 0;
}
#if CH_USE_HEAP || defined(__DOXYGEN__)
#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
static void dyn1_setup(void) {
chHeapInit(&heap1, test.buffer, sizeof(union test_buffers));
@ -124,7 +124,7 @@ ROMCONST struct testcase testdyn1 = {
NULL,
dyn1_execute
};
#endif /* CH_USE_HEAP */
#endif /* (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) */
#if CH_USE_MEMPOOLS || defined(__DOXYGEN__)
/**
@ -182,7 +182,8 @@ ROMCONST struct testcase testdyn2 = {
};
#endif /* CH_USE_MEMPOOLS */
#if (CH_USE_HEAP && CH_USE_REGISTRY) || defined(__DOXYGEN__)
#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP && CH_USE_REGISTRY) || \
defined(__DOXYGEN__)
/**
* @page test_dynamic_003 Registry and References test
*
@ -252,13 +253,14 @@ ROMCONST struct testcase testdyn3 = {
*/
ROMCONST struct testcase * ROMCONST patterndyn[] = {
#if CH_USE_DYNAMIC || defined(__DOXYGEN__)
#if CH_USE_HEAP || defined(__DOXYGEN__)
#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
&testdyn1,
#endif
#if CH_USE_MEMPOOLS || defined(__DOXYGEN__)
&testdyn2,
#endif
#if (CH_USE_HEAP && CH_USE_REGISTRY) || defined(__DOXYGEN__)
#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP && CH_USE_REGISTRY) || \
defined(__DOXYGEN__)
&testdyn3,
#endif
#endif

View File

@ -48,7 +48,7 @@
* @brief Heap header file
*/
#if CH_USE_HEAP || defined(__DOXYGEN__)
#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
#define SIZE 16
@ -156,7 +156,7 @@ ROMCONST struct testcase testheap1 = {
* @brief Test sequence for heap.
*/
ROMCONST struct testcase * ROMCONST patternheap[] = {
#if CH_USE_HEAP || defined(__DOXYGEN__)
#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
&testheap1,
#endif
NULL