summaryrefslogtreecommitdiff
path: root/nuttx/mm
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-01-09 14:20:31 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-01-09 14:20:31 +0000
commita2c6c96d13de37908120dcae297530665836f8e8 (patch)
treed77644599c129cf8d3699215096e70c656916e32 /nuttx/mm
parent5205351a1af35821a02ef91090375593e05415bc (diff)
downloadpx4-nuttx-a2c6c96d13de37908120dcae297530665836f8e8.tar.gz
px4-nuttx-a2c6c96d13de37908120dcae297530665836f8e8.tar.bz2
px4-nuttx-a2c6c96d13de37908120dcae297530665836f8e8.zip
Changes for ZNeo compile
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@539 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/mm')
-rw-r--r--nuttx/mm/mm_environment.h25
-rw-r--r--nuttx/mm/mm_sem.c50
2 files changed, 40 insertions, 35 deletions
diff --git a/nuttx/mm/mm_environment.h b/nuttx/mm/mm_environment.h
index 973fe533c..b844c2133 100644
--- a/nuttx/mm/mm_environment.h
+++ b/nuttx/mm/mm_environment.h
@@ -1,7 +1,7 @@
-/************************************************************
+/****************************************************************************
* mm_environment.h
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,14 +31,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
#ifndef __MM_ENVIRONMENT_H
#define __MM_ENVIRONMENT_H
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
/* The platform configuratioin file will not be included
* when the memory manager is built for the host-based
@@ -61,9 +61,9 @@
# include <assert.h>
#endif
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
/* Special definitions used when the memory mnager is built
* for the host-based test harness.
@@ -74,6 +74,7 @@
/* Fake NuttX dependencies */
# define FAR /* Normally in compiler.h */
+# define CONFIG_CPP_HAVE_VARARGS 1 /* Normally in compiler.h */
# define CONFIG_MM_REGIONS 2 /* Normally in config.h */
# define CONFIG_CAN_PASS_STRUCTS 1 /* Normally in config.h */
# undef CONFIG_SMALL_MEMORY /* Normally in config.h */
@@ -116,12 +117,12 @@ extern void mm_addregion(FAR void *heapstart, size_t heapsize);
# define mm_errno (*get_errno_ptr())
#endif
-/************************************************************
+/****************************************************************************
* Public Types
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Pulblic Function Prototypes
- ************************************************************/
+ ****************************************************************************/
#endif /* __MM_ENVIRONMENT_H */
diff --git a/nuttx/mm/mm_sem.c b/nuttx/mm/mm_sem.c
index 66c667061..74b24af56 100644
--- a/nuttx/mm/mm_sem.c
+++ b/nuttx/mm/mm_sem.c
@@ -1,7 +1,7 @@
-/************************************************************
+/****************************************************************************
* mm_sem.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include "mm_environment.h"
#include <unistd.h>
@@ -44,9 +44,9 @@
#include <assert.h>
#include "mm_internal.h"
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
/* Define the following to enable semaphore state monitoring */
//#define MONITOR_MM_SEMAPHORE 1
@@ -59,12 +59,16 @@
# define msemdbg printf
# endif
#else
-# define msemdbg(x...)
+# ifdef CONFIG_CPP_HAVE_VARARGS
+# define msemdbg(x...)
+# else
+# define msemdbg (void)
+# endif
#endif
-/************************************************************
+/****************************************************************************
* Private Data
- ************************************************************/
+ ****************************************************************************/
/* Mutually exclusive access to this data set is enforced with
* the following (un-named) semaphore. */
@@ -73,17 +77,17 @@ static sem_t g_mm_semaphore;
static pid_t g_holder;
static int g_counts_held;
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Name: mm_seminitialize
*
* Description:
* Initialize the MM mutex
*
- ************************************************************/
+ ****************************************************************************/
void mm_seminitialize(void)
{
@@ -97,7 +101,7 @@ void mm_seminitialize(void)
g_counts_held = 0;
}
-/************************************************************
+/****************************************************************************
* Name: mm_trysemaphore
*
* Description:
@@ -107,7 +111,7 @@ void mm_seminitialize(void)
* impossible to wait on a semaphore (e.g., the idle process
* when it performs its background memory cleanup).
*
- ************************************************************/
+ ****************************************************************************/
#ifndef MM_TEST
int mm_trysemaphore(void)
@@ -141,14 +145,14 @@ int mm_trysemaphore(void)
}
#endif
-/************************************************************
+/****************************************************************************
* Name: mm_takesemaphore
*
* Description:
* Take the MM mutex. This is the normal action before all
* memory management actions.
*
- ************************************************************/
+ ****************************************************************************/
void mm_takesemaphore(void)
{
@@ -186,13 +190,13 @@ void mm_takesemaphore(void)
g_holder, g_counts_held);
}
-/************************************************************
+/****************************************************************************
* Name: mm_givesemaphore
*
* Description:
* Release the MM mutex when it is not longer needed.
*
- ************************************************************/
+ ****************************************************************************/
void mm_givesemaphore(void)
{
@@ -223,14 +227,14 @@ void mm_givesemaphore(void)
}
}
-/************************************************************
+/****************************************************************************
* Name: mm_getsemaphore
*
* Description:
* Return the current value of the MM semaphore (for test
* purposes only)
*
- ************************************************************/
+ ****************************************************************************/
#ifdef MM_TEST
int mm_getsemaphore(void)