GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / cfe / cfe / include / lib_malloc.h
blobda1e27b4981fcbf5b00494091bffc60233bdd1db
1 /* *********************************************************************
2 * Broadcom Common Firmware Environment (CFE)
3 *
4 * Local memory manager File: mempool.h
5 *
6 * This routine is used to manage memory allocated within the
7 * firmware. You give it a chunk of memory to manage, and then
8 * these routines manage suballocations from there.
9 *
10 * Author: Mitch Lichtenberg (mpl@broadcom.com)
12 *********************************************************************
14 * Copyright 2000,2001,2002,2003
15 * Broadcom Corporation. All rights reserved.
17 * This software is furnished under license and may be used and
18 * copied only in accordance with the following terms and
19 * conditions. Subject to these conditions, you may download,
20 * copy, install, use, modify and distribute modified or unmodified
21 * copies of this software in source and/or binary form. No title
22 * or ownership is transferred hereby.
24 * 1) Any source code used, modified or distributed must reproduce
25 * and retain this copyright notice and list of conditions
26 * as they appear in the source file.
28 * 2) No right is granted to use any trade name, trademark, or
29 * logo of Broadcom Corporation. The "Broadcom Corporation"
30 * name may not be used to endorse or promote products derived
31 * from this software without the prior written permission of
32 * Broadcom Corporation.
34 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR
35 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED
36 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
37 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT
38 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN
39 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT,
40 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
41 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
42 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
43 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
44 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
45 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF
46 * THE POSSIBILITY OF SUCH DAMAGE.
47 ********************************************************************* */
49 #ifndef _LIB_MALLOC_H
50 #define _LIB_MALLOC_H
52 typedef struct memstats_s {
53 int mem_totalbytes;
54 int mem_allocbytes;
55 int mem_freebytes;
56 int mem_allocnodes;
57 int mem_freenodes;
58 int mem_largest;
59 } memstats_t;
61 typedef struct mempool_s mempool_t;
62 void kmeminit(mempool_t *pool,unsigned char *buffer,int length);
63 void kfree(mempool_t *pool,void *ptr);
64 void *kmalloc(mempool_t *pool,unsigned int size,unsigned int align);
65 int kmemchk(mempool_t *pool,int verbose);
66 extern mempool_t kmempool;
67 void *kmempoolbase(mempool_t *pool);
68 int kmempoolsize(mempool_t *pool);
69 int kmemstats(mempool_t *pool,memstats_t *stats);
71 #define KMEMINIT(buffer,length) kmeminit(&kmempool,(buffer),(length))
72 #define KMEMPOOLBASE() kmempoolbase(&kmempool)
73 #define KMEMPOOLSIZE() kmempoolsize(&kmempool)
74 #define KMALLOC(size,align) kmalloc(&kmempool,(size),(align))
75 #define KFREE(ptr) kfree(&kmempool,(ptr))
76 #define KMEMSTATS(s) kmemstats(&kmempool,(s))
78 #endif