diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-09-03 11:43:23 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-09-03 11:43:23 -0600 |
commit | 021cf46544be7eeb7900630cea0ee6ad768ba233 (patch) | |
tree | ed79ec918407fb50623e3423f14823fbdb55af14 /nuttx/mm | |
parent | 04a080ef2aaa4353e21ba5e767b5b304fdbf5365 (diff) | |
download | px4-nuttx-021cf46544be7eeb7900630cea0ee6ad768ba233.tar.gz px4-nuttx-021cf46544be7eeb7900630cea0ee6ad768ba233.tar.bz2 px4-nuttx-021cf46544be7eeb7900630cea0ee6ad768ba233.zip |
I love/hate conditional compilation
Diffstat (limited to 'nuttx/mm')
-rw-r--r-- | nuttx/mm/kmm_heapmember.c | 4 | ||||
-rw-r--r-- | nuttx/mm/mm_brkaddr.c | 4 | ||||
-rw-r--r-- | nuttx/mm/mm_extend.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_addregion.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_brkaddr.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_calloc.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_extend.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_free.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_initialize.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_mallinfo.c | 3 | ||||
-rw-r--r-- | nuttx/mm/umm_malloc.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_memalign.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_realloc.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_sbrk.c | 5 | ||||
-rw-r--r-- | nuttx/mm/umm_sem.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_zalloc.c | 4 |
16 files changed, 58 insertions, 6 deletions
diff --git a/nuttx/mm/kmm_heapmember.c b/nuttx/mm/kmm_heapmember.c index 01fa8b53c..a91a6a667 100644 --- a/nuttx/mm/kmm_heapmember.c +++ b/nuttx/mm/kmm_heapmember.c @@ -39,6 +39,10 @@ #include <nuttx/config.h> +#include <stdbool.h> + +#include <nuttx/mm.h> + #if defined(CONFIG_MM_KERNEL_HEAP) && defined(CONFIG_DEBUG) /************************************************************************ diff --git a/nuttx/mm/mm_brkaddr.c b/nuttx/mm/mm_brkaddr.c index 693b81086..8476050c4 100644 --- a/nuttx/mm/mm_brkaddr.c +++ b/nuttx/mm/mm_brkaddr.c @@ -63,7 +63,11 @@ FAR void *mm_brkaddr(FAR struct mm_heap_s *heap, int region) { uintptr_t brkaddr; +#if CONFIG_MM_REGIONS > 1 DEBUGASSERT(heap && region < heap->mm_nregions); +#else + DEBUGASSERT(heap && region == 0); +#endif brkaddr = (uintptr_t)heap->mm_heapend[region]; return brkaddr ? (FAR void *)(brkaddr + SIZEOF_MM_ALLOCNODE) : 0; diff --git a/nuttx/mm/mm_extend.c b/nuttx/mm/mm_extend.c index 3aa3f37d7..834360760 100644 --- a/nuttx/mm/mm_extend.c +++ b/nuttx/mm/mm_extend.c @@ -73,7 +73,11 @@ void mm_extend(FAR struct mm_heap_s *heap, FAR void *mem, size_t size, /* Make sure that we were passed valid parameters */ DEBUGASSERT(heap && mem); +#if CONFIG_MM_REGIONS > 1 DEBUGASSERT(size >= MIN_EXTEND && (unsigned)region < heap->mm_nregions); +#else + DEBUGASSERT(size >= MIN_EXTEND && (unsigned)region == 0); +#endif /* Make sure that the memory region are properly aligned */ diff --git a/nuttx/mm/umm_addregion.c b/nuttx/mm/umm_addregion.c index 22a03cb8a..5cef04b01 100644 --- a/nuttx/mm/umm_addregion.c +++ b/nuttx/mm/umm_addregion.c @@ -41,7 +41,7 @@ #include <nuttx/mm.h> -#ifdef MM_KERNEL_USRHEAP_INIT +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) /************************************************************************ * Pre-processor definition @@ -102,4 +102,4 @@ void umm_addregion(FAR void *heap_start, size_t heap_size) mm_addregion(USR_HEAP, heap_start, heap_size); } -#endif /* MM_KERNEL_USRHEAP_INIT */ +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_brkaddr.c b/nuttx/mm/umm_brkaddr.c index 6381d368b..25e399542 100644 --- a/nuttx/mm/umm_brkaddr.c +++ b/nuttx/mm/umm_brkaddr.c @@ -43,6 +43,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -80,3 +82,5 @@ FAR void *umm_brkaddr(int region) { return mm_brkaddr(USR_HEAP, region); } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_calloc.c b/nuttx/mm/umm_calloc.c index 0009b5a1f..ed1a2d606 100644 --- a/nuttx/mm/umm_calloc.c +++ b/nuttx/mm/umm_calloc.c @@ -43,6 +43,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -80,3 +82,5 @@ FAR void *calloc(size_t n, size_t elem_size) { return mm_calloc(USR_HEAP, n, elem_size); } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_extend.c b/nuttx/mm/umm_extend.c index f8edc9ef6..af1bb18d3 100644 --- a/nuttx/mm/umm_extend.c +++ b/nuttx/mm/umm_extend.c @@ -41,6 +41,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -79,3 +81,5 @@ void umm_extend(FAR void *mem, size_t size, int region) { mm_extend(USR_HEAP, mem, size, region); } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_free.c b/nuttx/mm/umm_free.c index d26d7ba11..6c6d59be7 100644 --- a/nuttx/mm/umm_free.c +++ b/nuttx/mm/umm_free.c @@ -43,6 +43,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -85,3 +87,5 @@ void free(FAR void *mem) { mm_free(USR_HEAP, mem); } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_initialize.c b/nuttx/mm/umm_initialize.c index 5b926504d..d7288e474 100644 --- a/nuttx/mm/umm_initialize.c +++ b/nuttx/mm/umm_initialize.c @@ -43,7 +43,7 @@ #include <nuttx/mm.h> -#ifdef MM_KERNEL_USRHEAP_INIT +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) /************************************************************************ * Pre-processor definition @@ -109,4 +109,4 @@ void umm_initialize(FAR void *heap_start, size_t heap_size) mm_initialize(USR_HEAP, heap_start, heap_size); } -#endif /* MM_KERNEL_USRHEAP_INIT */ +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_mallinfo.c b/nuttx/mm/umm_mallinfo.c index 447269f00..c7ea241c0 100644 --- a/nuttx/mm/umm_mallinfo.c +++ b/nuttx/mm/umm_mallinfo.c @@ -43,6 +43,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -102,3 +104,4 @@ int mallinfo(struct mallinfo *info) } #endif /* CONFIG_CAN_PASS_STRUCTS */ +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_malloc.c b/nuttx/mm/umm_malloc.c index fd4fe9608..31511b82f 100644 --- a/nuttx/mm/umm_malloc.c +++ b/nuttx/mm/umm_malloc.c @@ -44,6 +44,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -135,3 +137,5 @@ FAR void *malloc(size_t size) return mm_malloc(USR_HEAP, size); #endif } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_memalign.c b/nuttx/mm/umm_memalign.c index 51b0f923c..3659606f3 100644 --- a/nuttx/mm/umm_memalign.c +++ b/nuttx/mm/umm_memalign.c @@ -43,6 +43,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -89,3 +91,5 @@ FAR void *memalign(size_t alignment, size_t size) { return mm_memalign(USR_HEAP, alignment, size); } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_realloc.c b/nuttx/mm/umm_realloc.c index 344d24d68..45da6e7ec 100644 --- a/nuttx/mm/umm_realloc.c +++ b/nuttx/mm/umm_realloc.c @@ -43,6 +43,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -91,3 +93,5 @@ FAR void *realloc(FAR void *oldmem, size_t size) { return mm_realloc(USR_HEAP, oldmem, size); } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_sbrk.c b/nuttx/mm/umm_sbrk.c index 349c61b86..19b945d3c 100644 --- a/nuttx/mm/umm_sbrk.c +++ b/nuttx/mm/umm_sbrk.c @@ -45,7 +45,8 @@ #include <nuttx/pgalloc.h> #if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_MM_PGALLOC) && \ - defined(CONFIG_ARCH_USE_MMU) + defined(CONFIG_ARCH_USE_MMU) && (!defined(CONFIG_BUILD_PROTECTED) || \ + !defined(__KERNEL__)) /**************************************************************************** * Pre-processor Definitions @@ -109,4 +110,4 @@ FAR void *sbrk(intptr_t incr) return mm_sbrk(USR_HEAP, incr, CONFIG_ARCH_STACK_NPAGES << MM_PGSHIFT); } -#endif /* CONFIG_ARCH_ADDRENV && CONFIG_MM_PGALLOC && CONFIG_ARCH_USE_MMU */ +#endif /* CONFIG_ARCH_ADDRENV && CONFIG_MM_PGALLOC && ... */ diff --git a/nuttx/mm/umm_sem.c b/nuttx/mm/umm_sem.c index 8e899994b..baa992ebb 100644 --- a/nuttx/mm/umm_sem.c +++ b/nuttx/mm/umm_sem.c @@ -41,6 +41,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /************************************************************************ * Pre-processor definition ************************************************************************/ @@ -119,3 +121,5 @@ void umm_givesemaphore(void) { mm_givesemaphore(USR_HEAP); } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_zalloc.c b/nuttx/mm/umm_zalloc.c index 20a37c2e2..06d9d1047 100644 --- a/nuttx/mm/umm_zalloc.c +++ b/nuttx/mm/umm_zalloc.c @@ -44,6 +44,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -102,3 +104,5 @@ FAR void *zalloc(size_t size) return mm_zalloc(USR_HEAP, size); #endif } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ |