diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-09 21:12:20 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-09 21:12:20 +0000 |
commit | dda5be5c1fc672b5d9cb3a910b5e0cb0a41046c5 (patch) | |
tree | 0af32db840a032a50312791977b7d129def1d5b3 /nuttx/arch/arm/src/dm320 | |
parent | 2ac33dcffabd9422659c3b013ed8624c09ae90e4 (diff) | |
download | nuttx-dda5be5c1fc672b5d9cb3a910b5e0cb0a41046c5.tar.gz nuttx-dda5be5c1fc672b5d9cb3a910b5e0cb0a41046c5.tar.bz2 nuttx-dda5be5c1fc672b5d9cb3a910b5e0cb0a41046c5.zip |
More changes for a kernel-mode allocator (more to be done)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5724 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/dm320')
-rw-r--r-- | nuttx/arch/arm/src/dm320/dm320_allocateheap.c | 17 | ||||
-rw-r--r-- | nuttx/arch/arm/src/dm320/dm320_framebuffer.c | 21 | ||||
-rw-r--r-- | nuttx/arch/arm/src/dm320/dm320_usbdev.c | 11 |
3 files changed, 29 insertions, 20 deletions
diff --git a/nuttx/arch/arm/src/dm320/dm320_allocateheap.c b/nuttx/arch/arm/src/dm320/dm320_allocateheap.c index 5d4b90093..1383b93da 100644 --- a/nuttx/arch/arm/src/dm320/dm320_allocateheap.c +++ b/nuttx/arch/arm/src/dm320/dm320_allocateheap.c @@ -1,7 +1,7 @@ /************************************************************ * dm320/dm320_allocateheap.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -68,10 +68,17 @@ * Name: up_allocate_heap * * Description: - * The heap may be statically allocated by - * defining CONFIG_HEAP_BASE and CONFIG_HEAP_SIZE. If these - * are not defined, then this function will be called to - * dynamically set aside the heap region. + * This function will be called to dynamically set aside + * the heap region. + * + * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both + * kernel- and user-space heaps (CONFIG_MM_KERNEL_HEAP=y), + * this function provides the size of the unprotected, + * user-space heap. + * + * If a protected kernel-space heap is provided, the kernel + * heap must be allocated (and protected) by an analogous + * up_allocate_kheap(). * ************************************************************/ diff --git a/nuttx/arch/arm/src/dm320/dm320_framebuffer.c b/nuttx/arch/arm/src/dm320/dm320_framebuffer.c index 1b1197d53..8b5aec444 100644 --- a/nuttx/arch/arm/src/dm320/dm320_framebuffer.c +++ b/nuttx/arch/arm/src/dm320/dm320_framebuffer.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/dm320/dm320_framebuffer.c * - * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -46,6 +46,7 @@ #include <debug.h> #include <nuttx/fb.h> +#include <nuttx/kmalloc.h> #include <nuttx/nx/nxglib.h> #include "up_arch.h" @@ -674,10 +675,10 @@ static int dm320_allocvideomemory(void) { #ifndef CONFIG_DM320_VID0_DISABLE #ifndef CONFIG_DM320_DISABLE_PINGPONG - g_vid0base = (FAR void *)malloc(2 * DM320_VID0_FBLEN); + g_vid0base = (FAR void *)kmalloc(2 * DM320_VID0_FBLEN); g_vid0ppbase = (FAR char*)g_vid0base + DM320_VID0_FBLEN; #else - g_vid0base = (FAR void *)malloc(DM320_VID0_FBLEN); + g_vid0base = (FAR void *)kmalloc(DM320_VID0_FBLEN); #endif if (!g_vid0base) { @@ -686,7 +687,7 @@ static int dm320_allocvideomemory(void) #endif #ifndef CONFIG_DM320_VID1_DISABLE - g_vid1base = (FAR void *)malloc(DM320_VID1_FBLEN); + g_vid1base = (FAR void *)kmalloc(DM320_VID1_FBLEN); if (!g_vid1base) { goto errout; @@ -694,7 +695,7 @@ static int dm320_allocvideomemory(void) #endif #ifndef CONFIG_DM320_OSD0_DISABLE - g_osd0base = (FAR void *)malloc(DM320_OSD0_FBLEN); + g_osd0base = (FAR void *)kmalloc(DM320_OSD0_FBLEN); if (!g_osd0base) { goto errout; @@ -702,7 +703,7 @@ static int dm320_allocvideomemory(void) #endif #ifndef CONFIG_DM320_OSD1_DISABLE - g_osd1base = (FAR void *)malloc(DM320_OSD1_FBLEN); + g_osd1base = (FAR void *)kmalloc(DM320_OSD1_FBLEN); if (!g_osd1base) { goto errout; @@ -725,7 +726,7 @@ static void dm320_freevideomemory(void) #ifndef CONFIG_DM320_VID0_DISABLE if (g_vid0base) { - free(g_vid0base); + kfree(g_vid0base); g_vid0base = NULL; #ifndef CONFIG_DM320_DISABLE_PINGPONG g_vid0ppbase = NULL; @@ -736,7 +737,7 @@ static void dm320_freevideomemory(void) #ifndef CONFIG_DM320_VID1_DISABLE if (g_vid1base != 0) { - free(g_vid1base); + kfree(g_vid1base); g_vid1base = NULL; } #endif @@ -744,7 +745,7 @@ static void dm320_freevideomemory(void) #ifndef CONFIG_DM320_OSD0_DISABLE if (g_osd0base != 0) { - free(g_osd0base); + kfree(g_osd0base); g_osd0base = NULL; } #endif @@ -752,7 +753,7 @@ static void dm320_freevideomemory(void) #ifndef CONFIG_DM320_OSD1_DISABLE if (g_osd1base != 0) { - free(g_osd1base); + kfree(g_osd1base); g_osd1base = NULL; } #endif diff --git a/nuttx/arch/arm/src/dm320/dm320_usbdev.c b/nuttx/arch/arm/src/dm320/dm320_usbdev.c index c924db197..b30aba72c 100644 --- a/nuttx/arch/arm/src/dm320/dm320_usbdev.c +++ b/nuttx/arch/arm/src/dm320/dm320_usbdev.c @@ -1,7 +1,7 @@ /******************************************************************************* * arch/arm/src/dm320/dm320_usbdev.c * - * Copyright (C) 2008-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -48,6 +48,7 @@ #include <debug.h> #include <nuttx/arch.h> +#include <nuttx/kmalloc.h> #include <nuttx/usb/usb.h> #include <nuttx/usb/usbdev.h> #include <nuttx/usb/usbdev_trace.h> @@ -1936,7 +1937,7 @@ static FAR struct usbdev_req_s *dm320_epallocreq(FAR struct usbdev_ep_s *ep) #endif usbtrace(TRACE_EPALLOCREQ, ((FAR struct dm320_ep_s *)ep)->epphy); - privreq = (FAR struct dm320_req_s *)malloc(sizeof(struct dm320_req_s)); + privreq = (FAR struct dm320_req_s *)kmalloc(sizeof(struct dm320_req_s)); if (!privreq) { usbtrace(TRACE_DEVERROR(DM320_TRACEERR_ALLOCFAIL), 0); @@ -1968,7 +1969,7 @@ static void dm320_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s #endif usbtrace(TRACE_EPFREEREQ, ((FAR struct dm320_ep_s *)ep)->epphy); - free(privreq); + kfree(privreq); } /******************************************************************************* @@ -1987,7 +1988,7 @@ static void *dm320_epallocbuffer(FAR struct usbdev_ep_s *ep, unsigned bytes) #ifdef CONFIG_USBDEV_DMAMEMORY return usbdev_dma_alloc(bytes); #else - return malloc(bytes); + return kmalloc(bytes); #endif } #endif @@ -2008,7 +2009,7 @@ static void dm320_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf) #ifdef CONFIG_USBDEV_DMAMEMORY usbdev_dma_free(buf); #else - free(buf); + kfree(buf); #endif } #endif |