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
This commit is contained in:
parent
36a65f3e0e
commit
e47c64204c
@ -70,10 +70,8 @@
|
||||
* 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.
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
|
@ -68,10 +68,14 @@
|
||||
* 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().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -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().
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -72,9 +72,14 @@
|
||||
* 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().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -182,10 +182,14 @@
|
||||
* 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().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -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>
|
||||
@ -2658,7 +2659,7 @@ static FAR struct usbdev_req_s *lpc17_epallocreq(FAR struct usbdev_ep_s *ep)
|
||||
#endif
|
||||
usbtrace(TRACE_EPALLOCREQ, ((FAR struct lpc17_ep_s *)ep)->epphy);
|
||||
|
||||
privreq = (FAR struct lpc17_req_s *)malloc(sizeof(struct lpc17_req_s));
|
||||
privreq = (FAR struct lpc17_req_s *)kmalloc(sizeof(struct lpc17_req_s));
|
||||
if (!privreq)
|
||||
{
|
||||
usbtrace(TRACE_DEVERROR(LPC17_TRACEERR_ALLOCFAIL), 0);
|
||||
@ -2690,7 +2691,7 @@ static void lpc17_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
|
||||
#endif
|
||||
usbtrace(TRACE_EPFREEREQ, ((FAR struct lpc17_ep_s *)ep)->epphy);
|
||||
|
||||
free(privreq);
|
||||
kfree(privreq);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -2728,7 +2729,7 @@ static FAR void *lpc17_epallocbuffer(FAR struct usbdev_ep_s *ep, uint16_t nbytes
|
||||
#else
|
||||
|
||||
usbtrace(TRACE_EPALLOCBUFFER, privep->epphy);
|
||||
return malloc(bytes);
|
||||
return kmalloc(bytes);
|
||||
|
||||
#endif
|
||||
}
|
||||
@ -2767,7 +2768,7 @@ static void lpc17_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
|
||||
#else
|
||||
|
||||
usbtrace(TRACE_EPFREEBUFFER, privep->epphy);
|
||||
free(buf);
|
||||
kfree(buf);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -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>
|
||||
@ -2622,7 +2623,7 @@ static FAR struct usbdev_req_s *lpc214x_epallocreq(FAR struct usbdev_ep_s *ep)
|
||||
#endif
|
||||
usbtrace(TRACE_EPALLOCREQ, ((FAR struct lpc214x_ep_s *)ep)->epphy);
|
||||
|
||||
privreq = (FAR struct lpc214x_req_s *)malloc(sizeof(struct lpc214x_req_s));
|
||||
privreq = (FAR struct lpc214x_req_s *)kmalloc(sizeof(struct lpc214x_req_s));
|
||||
if (!privreq)
|
||||
{
|
||||
usbtrace(TRACE_DEVERROR(LPC214X_TRACEERR_ALLOCFAIL), 0);
|
||||
@ -2654,7 +2655,7 @@ static void lpc214x_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_
|
||||
#endif
|
||||
usbtrace(TRACE_EPFREEREQ, ((FAR struct lpc214x_ep_s *)ep)->epphy);
|
||||
|
||||
free(privreq);
|
||||
kfree(privreq);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -2692,7 +2693,7 @@ static FAR void *lpc214x_epallocbuffer(FAR struct usbdev_ep_s *ep, uint16_t nbyt
|
||||
#else
|
||||
|
||||
usbtrace(TRACE_EPALLOCBUFFER, privep->epphy);
|
||||
return malloc(bytes);
|
||||
return kmalloc(bytes);
|
||||
|
||||
#endif
|
||||
}
|
||||
@ -2731,7 +2732,7 @@ static void lpc214x_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
|
||||
#else
|
||||
|
||||
usbtrace(TRACE_EPFREEBUFFER, privep->epphy);
|
||||
free(buf);
|
||||
kfree(buf);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -157,10 +157,14 @@
|
||||
* 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 to the end
|
||||
* of SRAM.
|
||||
* 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().
|
||||
*
|
||||
* SRAM layout:
|
||||
* Start of SRAM: .data
|
||||
|
@ -53,6 +53,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>
|
||||
@ -1949,7 +1950,7 @@ static FAR struct usbdev_req_s *lpc31_epallocreq(FAR struct usbdev_ep_s *ep)
|
||||
#endif
|
||||
usbtrace(TRACE_EPALLOCREQ, ((FAR struct lpc31_ep_s *)ep)->epphy);
|
||||
|
||||
privreq = (FAR struct lpc31_req_s *)malloc(sizeof(struct lpc31_req_s));
|
||||
privreq = (FAR struct lpc31_req_s *)kmalloc(sizeof(struct lpc31_req_s));
|
||||
if (!privreq)
|
||||
{
|
||||
usbtrace(TRACE_DEVERROR(LPC31_TRACEERR_ALLOCFAIL), 0);
|
||||
@ -1981,7 +1982,7 @@ static void lpc31_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
|
||||
#endif
|
||||
|
||||
usbtrace(TRACE_EPFREEREQ, ((FAR struct lpc31_ep_s *)ep)->epphy);
|
||||
free(privreq);
|
||||
kfree(privreq);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -2000,7 +2001,7 @@ static void *lpc31_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
|
||||
@ -2021,7 +2022,7 @@ static void lpc31_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
|
||||
|
@ -228,10 +228,14 @@ const uint32_t g_heapbase = (uint32_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE;
|
||||
* 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().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -58,6 +58,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>
|
||||
@ -1949,7 +1950,7 @@ static FAR struct usbdev_req_s *lpc43_epallocreq(FAR struct usbdev_ep_s *ep)
|
||||
#endif
|
||||
usbtrace(TRACE_EPALLOCREQ, ((FAR struct lpc43_ep_s *)ep)->epphy);
|
||||
|
||||
privreq = (FAR struct lpc43_req_s *)malloc(sizeof(struct lpc43_req_s));
|
||||
privreq = (FAR struct lpc43_req_s *)kmalloc(sizeof(struct lpc43_req_s));
|
||||
if (!privreq)
|
||||
{
|
||||
usbtrace(TRACE_DEVERROR(LPC43_TRACEERR_ALLOCFAIL), 0);
|
||||
@ -1981,7 +1982,7 @@ static void lpc43_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
|
||||
#endif
|
||||
|
||||
usbtrace(TRACE_EPFREEREQ, ((FAR struct lpc43_ep_s *)ep)->epphy);
|
||||
free(privreq);
|
||||
kfree(privreq);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -2000,7 +2001,7 @@ static void *lpc43_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
|
||||
@ -2021,7 +2022,7 @@ static void lpc43_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
|
||||
|
@ -94,10 +94,14 @@
|
||||
* 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().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -356,10 +356,14 @@
|
||||
* 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().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -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>
|
||||
@ -4230,7 +4231,7 @@ static FAR struct usbdev_req_s *stm32_ep_allocreq(FAR struct usbdev_ep_s *ep)
|
||||
#endif
|
||||
usbtrace(TRACE_EPALLOCREQ, ((FAR struct stm32_ep_s *)ep)->epphy);
|
||||
|
||||
privreq = (FAR struct stm32_req_s *)malloc(sizeof(struct stm32_req_s));
|
||||
privreq = (FAR struct stm32_req_s *)kmalloc(sizeof(struct stm32_req_s));
|
||||
if (!privreq)
|
||||
{
|
||||
usbtrace(TRACE_DEVERROR(STM32_TRACEERR_ALLOCFAIL), 0);
|
||||
@ -4262,7 +4263,7 @@ static void stm32_ep_freereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
|
||||
#endif
|
||||
|
||||
usbtrace(TRACE_EPFREEREQ, ((FAR struct stm32_ep_s *)ep)->epphy);
|
||||
free(privreq);
|
||||
kfree(privreq);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -4281,7 +4282,7 @@ static void *stm32_ep_allocbuffer(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
|
||||
@ -4302,7 +4303,7 @@ static void stm32_ep_freebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
|
||||
#ifdef CONFIG_USBDEV_DMAMEMORY
|
||||
usbdev_dma_free(buf);
|
||||
#else
|
||||
free(buf);
|
||||
kfree(buf);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -52,6 +52,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>
|
||||
@ -2762,7 +2763,7 @@ static struct usbdev_req_s *stm32_epallocreq(struct usbdev_ep_s *ep)
|
||||
#endif
|
||||
usbtrace(TRACE_EPALLOCREQ, USB_EPNO(ep->eplog));
|
||||
|
||||
privreq = (struct stm32_req_s *)malloc(sizeof(struct stm32_req_s));
|
||||
privreq = (struct stm32_req_s *)kmalloc(sizeof(struct stm32_req_s));
|
||||
if (!privreq)
|
||||
{
|
||||
usbtrace(TRACE_DEVERROR(STM32_TRACEERR_ALLOCFAIL), 0);
|
||||
@ -2790,7 +2791,7 @@ static void stm32_epfreereq(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
|
||||
#endif
|
||||
usbtrace(TRACE_EPFREEREQ, USB_EPNO(ep->eplog));
|
||||
|
||||
free(privreq);
|
||||
kfree(privreq);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* arch/arm/src/at90usb/at90usb_usbdev.c
|
||||
*
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-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>
|
||||
@ -2286,7 +2287,7 @@ static FAR struct usbdev_req_s *avr_epallocreq(FAR struct usbdev_ep_s *ep)
|
||||
#endif
|
||||
usbtrace(TRACE_EPALLOCREQ, ((FAR struct avr_ep_s *)ep)->ep.eplog);
|
||||
|
||||
privreq = (FAR struct avr_req_s *)malloc(sizeof(struct avr_req_s));
|
||||
privreq = (FAR struct avr_req_s *)kmalloc(sizeof(struct avr_req_s));
|
||||
if (!privreq)
|
||||
{
|
||||
usbtrace(TRACE_DEVERROR(AVR_TRACEERR_ALLOCFAIL), 0);
|
||||
@ -2319,7 +2320,7 @@ static void avr_epfreereq(FAR struct usbdev_ep_s *ep,
|
||||
#endif
|
||||
|
||||
usbtrace(TRACE_EPFREEREQ, ((FAR struct avr_ep_s *)ep)->ep.eplog);
|
||||
free(privreq);
|
||||
kfree(privreq);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -2338,7 +2339,7 @@ static void *avr_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
|
||||
@ -2359,7 +2360,7 @@ static void avr_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
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/src/common/up_allocateheap.c
|
||||
*
|
||||
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -68,9 +68,14 @@
|
||||
* 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().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/hc/src/common/up_allocateheap.c
|
||||
*
|
||||
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -67,10 +67,14 @@
|
||||
* 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().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/mips/src/common/up_allocateheap.c
|
||||
*
|
||||
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2010, 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,14 @@
|
||||
* 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().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/mips/src/pic32mx/pic32mx_usbdev.c
|
||||
*
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* References:
|
||||
@ -57,6 +57,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>
|
||||
@ -3313,7 +3314,7 @@ static struct usbdev_req_s *pic32mx_epallocreq(struct usbdev_ep_s *ep)
|
||||
#endif
|
||||
usbtrace(TRACE_EPALLOCREQ, USB_EPNO(ep->eplog));
|
||||
|
||||
privreq = (struct pic32mx_req_s *)malloc(sizeof(struct pic32mx_req_s));
|
||||
privreq = (struct pic32mx_req_s *)kmalloc(sizeof(struct pic32mx_req_s));
|
||||
if (!privreq)
|
||||
{
|
||||
usbtrace(TRACE_DEVERROR(PIC32MX_TRACEERR_ALLOCFAIL), 0);
|
||||
@ -3341,7 +3342,7 @@ static void pic32mx_epfreereq(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
|
||||
#endif
|
||||
usbtrace(TRACE_EPFREEREQ, USB_EPNO(ep->eplog));
|
||||
|
||||
free(privreq);
|
||||
kfree(privreq);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -161,7 +161,7 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
|
||||
void up_release_stack(struct tcb_s *dtcb)
|
||||
{
|
||||
if (dtcb->stack_alloc_ptr) {
|
||||
free(dtcb->stack_alloc_ptr);
|
||||
kfree(dtcb->stack_alloc_ptr);
|
||||
}
|
||||
|
||||
dtcb->stack_alloc_ptr = NULL;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/sh/src/common/up_allocateheap.c
|
||||
*
|
||||
* Copyright (C) 2008 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
|
||||
@ -67,10 +67,14 @@
|
||||
* 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().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* up_allocateheap.c
|
||||
*
|
||||
* 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
|
||||
@ -71,10 +71,14 @@ static uint8_t sim_heap[SIM_HEAP_SIZE];
|
||||
* 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().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -43,9 +43,13 @@
|
||||
# include <zlib.h>
|
||||
#else
|
||||
# include <nuttx/config.h>
|
||||
|
||||
# include <stdlib.h>
|
||||
# include <debug.h>
|
||||
# include <zlib.h>
|
||||
|
||||
# include <nuttx/kmalloc.h>
|
||||
|
||||
# include "up_internal.h"
|
||||
#endif
|
||||
|
||||
@ -55,6 +59,8 @@
|
||||
|
||||
#ifdef VFAT_STANDALONE
|
||||
# define sdbg(format, arg...) printf(format, ##arg)
|
||||
# define kmalloc(size) malloc(size)
|
||||
# define kfree(mem) free(mem)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -224,7 +230,8 @@ char *up_deviceimage(void)
|
||||
/* Allocate a buffer to hold the decompressed buffer. We may have
|
||||
* to reallocate this a few times to get the size right.
|
||||
*/
|
||||
pbuffer = (char*)malloc(bufsize);
|
||||
|
||||
pbuffer = (char*)kmalloc(bufsize);
|
||||
|
||||
/* Set up the input buffer */
|
||||
|
||||
@ -253,7 +260,7 @@ char *up_deviceimage(void)
|
||||
case Z_STREAM_ERROR:
|
||||
sdbg("inflate FAILED: ret=%d msg=\"%s\"\n", ret, strm.msg ? strm.msg : "No message" );
|
||||
(void)inflateEnd(&strm);
|
||||
free(pbuffer);
|
||||
kfree(pbuffer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -265,10 +272,10 @@ char *up_deviceimage(void)
|
||||
if (strm.avail_out == 0)
|
||||
{
|
||||
int newbufsize = bufsize + 128*1024;
|
||||
char *newbuffer = realloc(pbuffer, newbufsize);
|
||||
char *newbuffer = krealloc(pbuffer, newbufsize);
|
||||
if (!newbuffer)
|
||||
{
|
||||
free(pbuffer);
|
||||
kfree(pbuffer);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
@ -285,10 +292,10 @@ char *up_deviceimage(void)
|
||||
*/
|
||||
|
||||
int newbufsize = bufsize - strm.avail_out;
|
||||
char *newbuffer = realloc(pbuffer, newbufsize);
|
||||
char *newbuffer = krealloc(pbuffer, newbufsize);
|
||||
if (!newbuffer)
|
||||
{
|
||||
free(pbuffer);
|
||||
kfree(pbuffer);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
@ -344,7 +351,7 @@ int main(int argc, char **argv, char **envp)
|
||||
if (deviceimage)
|
||||
{
|
||||
printf("Inflate SUCCEEDED\n");
|
||||
free(deviceimage);
|
||||
kfree(deviceimage);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/x86/src/common/up_allocateheap.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -68,9 +68,14 @@
|
||||
* 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().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -83,9 +83,14 @@
|
||||
* 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().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -85,9 +85,14 @@
|
||||
* 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().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/z80/src/ez80/ez80_i2c.c
|
||||
*
|
||||
* Copyright(C) 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright(C) 2009, 2011, 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/i2c.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <arch/io.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
@ -920,7 +921,7 @@ FAR struct i2c_dev_s *up_i2cinitialize(int port)
|
||||
|
||||
/* Now, allocate an I2C instance for this caller */
|
||||
|
||||
i2c = (FAR struct ez80_i2cdev_s *)malloc(sizeof(FAR struct ez80_i2cdev_s));
|
||||
i2c = (FAR struct ez80_i2cdev_s *)kmalloc(sizeof(FAR struct ez80_i2cdev_s));
|
||||
if (i2c)
|
||||
{
|
||||
/* Initialize the allocated instance */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/z80/src/z8/z8_i2c.c
|
||||
*
|
||||
* Copyright(C) 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright(C) 2009, 2011, 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/i2c.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include <eZ8.h> /* eZ8 Register definitions */
|
||||
@ -592,7 +593,7 @@ FAR struct i2c_dev_s *up_i2cinitialize(int port)
|
||||
|
||||
/* Now, allocate an I2C instance for this caller */
|
||||
|
||||
i2c = (FAR struct z8_i2cdev_s *)malloc(sizeof(FAR struct z8_i2cdev_s));
|
||||
i2c = (FAR struct z8_i2cdev_s *)kmalloc(sizeof(FAR struct z8_i2cdev_s));
|
||||
if (i2c)
|
||||
{
|
||||
/* Initialize the allocated instance */
|
||||
@ -600,5 +601,6 @@ FAR struct i2c_dev_s *up_i2cinitialize(int port)
|
||||
i2c->ops = &g_ops;
|
||||
i2c->brg = g_currbrg;
|
||||
}
|
||||
|
||||
return (FAR struct i2c_dev_s *)i2c;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user