diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-09-22 10:33:23 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-09-22 10:33:23 -0600 |
commit | 2f5f0694b85c610b4f93cdaccb37623d9f5607a6 (patch) | |
tree | 6c0dc7d971a01ca55a5b91f8f61acf0ae4b8bf4a /nuttx/mm | |
parent | 2346e07b16084d1b0c3238b223c07134b043d2e0 (diff) | |
download | px4-nuttx-2f5f0694b85c610b4f93cdaccb37623d9f5607a6.tar.gz px4-nuttx-2f5f0694b85c610b4f93cdaccb37623d9f5607a6.tar.bz2 px4-nuttx-2f5f0694b85c610b4f93cdaccb37623d9f5607a6.zip |
Move granuale allocator and page allocator from mm/. to mm/mm_gran/.
Diffstat (limited to 'nuttx/mm')
-rw-r--r-- | nuttx/mm/Makefile | 28 | ||||
-rw-r--r-- | nuttx/mm/mm_gran/Make.defs | 52 | ||||
-rw-r--r-- | nuttx/mm/mm_gran/mm_gran.h (renamed from nuttx/mm/mm_gran.h) | 8 | ||||
-rw-r--r-- | nuttx/mm/mm_gran/mm_granalloc.c (renamed from nuttx/mm/mm_granalloc.c) | 4 | ||||
-rw-r--r-- | nuttx/mm/mm_gran/mm_grancritical.c (renamed from nuttx/mm/mm_grancritical.c) | 4 | ||||
-rw-r--r-- | nuttx/mm/mm_gran/mm_granfree.c (renamed from nuttx/mm/mm_granfree.c) | 4 | ||||
-rw-r--r-- | nuttx/mm/mm_gran/mm_graninit.c (renamed from nuttx/mm/mm_graninit.c) | 4 | ||||
-rw-r--r-- | nuttx/mm/mm_gran/mm_granmark.c (renamed from nuttx/mm/mm_granmark.c) | 4 | ||||
-rw-r--r-- | nuttx/mm/mm_gran/mm_granreserve.c (renamed from nuttx/mm/mm_granreserve.c) | 4 | ||||
-rw-r--r-- | nuttx/mm/mm_gran/mm_pgalloc.c (renamed from nuttx/mm/mm_pgalloc.c) | 4 |
10 files changed, 83 insertions, 33 deletions
diff --git a/nuttx/mm/Makefile b/nuttx/mm/Makefile index 03331ebd9..2aa90e5e4 100644 --- a/nuttx/mm/Makefile +++ b/nuttx/mm/Makefile @@ -48,10 +48,17 @@ else endif endif -# Core allocator logic +# Sources and paths ASRCS = -CSRCS = mm_initialize.c mm_sem.c mm_addfreechunk.c mm_size2ndx.c +CSRCS = + +DEPPATH = --dep-path . +VPATH = . + +# Core allocator logic + +CSRCS += mm_initialize.c mm_sem.c mm_addfreechunk.c mm_size2ndx.c CSRCS += mm_shrinkchunk.c CSRCS += mm_brkaddr.c mm_calloc.c mm_extend.c mm_free.c mm_mallinfo.c CSRCS += mm_malloc.c mm_memalign.c mm_realloc.c mm_zalloc.c @@ -88,16 +95,7 @@ endif # An optional granule allocator -ifeq ($(CONFIG_GRAN),y) -CSRCS += mm_graninit.c mm_granreserve.c mm_granalloc.c mm_granmark.c -CSRCS += mm_granfree.c mm_grancritical.c - -# A page allocator based on the granule allocator - -ifeq ($(CONFIG_MM_PGALLOC),y) -CSRCS += mm_pgalloc.c -endif -endif +include mm_gran/Make.defs BINDIR ?= bin @@ -145,10 +143,10 @@ endif .depend: Makefile $(SRCS) ifeq ($(CONFIG_BUILD_PROTECTED),y) - $(Q) $(MKDEP) --obj-path ubin --obj-suffix $(OBJEXT) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_ubin.dep - $(Q) $(MKDEP) --obj-path kbin --obj-suffix $(OBJEXT) "$(CC)" -- $(CFLAGS) $(KDEFINE) -- $(SRCS) >Make_kbin.dep + $(Q) $(MKDEP) --obj-path ubin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_ubin.dep + $(Q) $(MKDEP) --obj-path kbin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) $(KDEFINE) -- $(SRCS) >Make_kbin.dep else - $(Q) $(MKDEP) --obj-path bin --obj-suffix $(OBJEXT) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_bin.dep + $(Q) $(MKDEP) --obj-path bin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_bin.dep endif $(Q) touch $@ diff --git a/nuttx/mm/mm_gran/Make.defs b/nuttx/mm/mm_gran/Make.defs new file mode 100644 index 000000000..b561ac8da --- /dev/null +++ b/nuttx/mm/mm_gran/Make.defs @@ -0,0 +1,52 @@ +############################################################################ +# mm/mm_gran/Make.defs +# +# Copyright (C) 2014 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt <gnutt@nuttx.org> +# +# 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. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# 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. +# +############################################################################ + +# An optional granule allocator + +ifeq ($(CONFIG_GRAN),y) +CSRCS += mm_graninit.c mm_granreserve.c mm_granalloc.c mm_granmark.c +CSRCS += mm_granfree.c mm_grancritical.c + +# A page allocator based on the granule allocator + +ifeq ($(CONFIG_MM_PGALLOC),y) +CSRCS += mm_pgalloc.c +endif + +# Add the granule directory to the build + +DEPPATH += --dep-path mm_gran +VPATH += :mm_gran +endif diff --git a/nuttx/mm/mm_gran.h b/nuttx/mm/mm_gran/mm_gran.h index 8836a5b42..2156f96ef 100644 --- a/nuttx/mm/mm_gran.h +++ b/nuttx/mm/mm_gran/mm_gran.h @@ -1,5 +1,5 @@ /**************************************************************************** - * mm/mm_gran.h + * mm/mm_gran/mm_gran.h * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __MM_MM_GRAN_H -#define __MM_MM_GRAN_H +#ifndef __MM_MM_GRAN_MM_GRAHN_H +#define __MM_MM_GRAN_MM_GRAHN_H /**************************************************************************** * Included Files @@ -148,4 +148,4 @@ void gran_leave_critical(FAR struct gran_s *priv); void gran_mark_allocated(FAR struct gran_s *priv, uintptr_t alloc, unsigned int ngranules); -#endif /* __MM_MM_GRAN_H */ +#endif /* __MM_MM_GRAN_MM_GRAHN_H */ diff --git a/nuttx/mm/mm_granalloc.c b/nuttx/mm/mm_gran/mm_granalloc.c index 6e6d375d1..cc4a9cb6d 100644 --- a/nuttx/mm/mm_granalloc.c +++ b/nuttx/mm/mm_gran/mm_granalloc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * mm/mm_granalloc.c + * mm/mm_gran/mm_granalloc.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> @@ -43,7 +43,7 @@ #include <nuttx/gran.h> -#include "mm_gran.h" +#include "mm_gran/mm_gran.h" #ifdef CONFIG_GRAN diff --git a/nuttx/mm/mm_grancritical.c b/nuttx/mm/mm_gran/mm_grancritical.c index 190aa3e7d..04d2de35c 100644 --- a/nuttx/mm/mm_grancritical.c +++ b/nuttx/mm/mm_gran/mm_grancritical.c @@ -1,5 +1,5 @@ /**************************************************************************** - * mm/mm_grancritical.c + * mm/mm_gran/mm_grancritical.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> @@ -46,7 +46,7 @@ #include <arch/irq.h> #include <nuttx/gran.h> -#include "mm_gran.h" +#include "mm_gran/mm_gran.h" #ifdef CONFIG_GRAN diff --git a/nuttx/mm/mm_granfree.c b/nuttx/mm/mm_gran/mm_granfree.c index fcab11af9..707dbaa2d 100644 --- a/nuttx/mm/mm_granfree.c +++ b/nuttx/mm/mm_gran/mm_granfree.c @@ -1,5 +1,5 @@ /**************************************************************************** - * mm/mm_granfree.c + * mm/mm_gran/mm_granfree.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> @@ -43,7 +43,7 @@ #include <nuttx/gran.h> -#include "mm_gran.h" +#include "mm_gran/mm_gran.h" #ifdef CONFIG_GRAN diff --git a/nuttx/mm/mm_graninit.c b/nuttx/mm/mm_gran/mm_graninit.c index 53c572328..1dc319114 100644 --- a/nuttx/mm/mm_graninit.c +++ b/nuttx/mm/mm_gran/mm_graninit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * mm/mm_graninit.c + * mm/mm_gran/mm_graninit.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> @@ -45,7 +45,7 @@ #include <nuttx/gran.h> #include <nuttx/kmalloc.h> -#include "mm_gran.h" +#include "mm_gran/mm_gran.h" #ifdef CONFIG_GRAN diff --git a/nuttx/mm/mm_granmark.c b/nuttx/mm/mm_gran/mm_granmark.c index a2c9e9054..805dbc1da 100644 --- a/nuttx/mm/mm_granmark.c +++ b/nuttx/mm/mm_gran/mm_granmark.c @@ -1,5 +1,5 @@ /**************************************************************************** - * mm/mm_granmark.c + * mm/mm_gran/mm_granmark.c * * Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> @@ -43,7 +43,7 @@ #include <nuttx/gran.h> -#include "mm_gran.h" +#include "mm_gran/mm_gran.h" #ifdef CONFIG_GRAN diff --git a/nuttx/mm/mm_granreserve.c b/nuttx/mm/mm_gran/mm_granreserve.c index da2a4a38e..bf73671c3 100644 --- a/nuttx/mm/mm_granreserve.c +++ b/nuttx/mm/mm_gran/mm_granreserve.c @@ -1,5 +1,5 @@ /**************************************************************************** - * mm/mm_granreserve.c + * mm/mm_gran/mm_granreserve.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> @@ -43,7 +43,7 @@ #include <nuttx/gran.h> -#include "mm_gran.h" +#include "mm_gran/mm_gran.h" #ifdef CONFIG_GRAN diff --git a/nuttx/mm/mm_pgalloc.c b/nuttx/mm/mm_gran/mm_pgalloc.c index 403e1fd2f..67e8653f4 100644 --- a/nuttx/mm/mm_pgalloc.c +++ b/nuttx/mm/mm_gran/mm_pgalloc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * mm/mm_pgalloc.c + * mm/mm_gran/mm_pgalloc.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> @@ -44,7 +44,7 @@ #include <nuttx/gran.h> #include <nuttx/pgalloc.h> -#include "mm_gran.h" +#include "mm_gran/mm_gran.h" #ifdef CONFIG_MM_PGALLOC |