Move all memory manager globals to a structure. Pass structure pointer as a handler because MM APIs

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5719 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2013-03-08 18:29:56 +00:00
parent 8a774a1712
commit 45ce321f51
18 changed files with 576 additions and 314 deletions
+7 -3
View File
@@ -60,7 +60,8 @@
#undef KMALLOC_EXTERN
#if defined(__cplusplus)
# define KMALLOC_EXTERN extern "C"
extern "C" {
extern "C"
{
#else
# define KMALLOC_EXTERN extern
#endif
@@ -76,10 +77,13 @@ extern "C" {
#ifndef CONFIG_NUTTX_KERNEL
struct mm_heap_s;
extern struct mm_heap_s g_mmheap;
# define kmm_initialize(h,s) mm_initialize(h,s)
# define kmm_addregion(h,s) mm_addregion(h,s)
# define kmm_trysemaphore() mm_trysemaphore()
# define kmm_givesemaphore() mm_givesemaphore()
# define kmm_trysemaphore() mm_trysemaphore(&g_mmheap)
# define kmm_givesemaphore() mm_givesemaphore(&g_mmheap)
# define kmalloc(s) malloc(s)
# define kzalloc(s) zalloc(s)
+8 -6
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/mm.h
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -61,20 +61,22 @@
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
extern "C"
{
#else
#define EXTERN extern
#endif
/* Functions contained in mm_initialize.c ***********************************/
EXTERN void mm_initialize(FAR void *heap_start, size_t heap_size);
EXTERN void mm_addregion(FAR void *heapstart, size_t heapsize);
void mm_initialize(FAR void *heap_start, size_t heap_size);
void mm_addregion(FAR void *heapstart, size_t heapsize);
/* Functions contained in mm_sem.c ******************************************/
EXTERN int mm_trysemaphore(void);
EXTERN void mm_givesemaphore(void);
struct mm_heap_s;
int mm_trysemaphore(FAR struct mm_heap_s *heap);
void mm_givesemaphore(FAR struct mm_heap_s *heap);
#undef EXTERN
#ifdef __cplusplus