1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /********************************************************************20**
21 Name: common memory allocation library
25 Desc: Structures, variables and typedefs required by the
26 memory library routines
30 *********************************************************************21*/
39 /************************************************
40 Memory Management Control Block
41 ************************************************/
43 typedef struct cmMemCb
45 Size maxSize; /* Size of memory chunk */
46 Mem sMem; /* Static memory region and pool */
47 U32 memAllocated; /* amount of memory already allocated */
48 PTR initPtr; /* Initial pointer */
49 PTR runPtr; /* Start of avaliable memory chunk */
52 /************************************************
53 Memory Link List Node Structure
54 ************************************************/
55 typedef struct cmMemList CmMemList;
59 CmMemList *next; /* next */
60 CmMemList *prev; /* previous */
61 /* cm_mblk_x_001.101: added new element "size" */
62 Size size; /* block size */
65 /************************************************
66 Memory Link List Control Point
67 ************************************************/
69 typedef struct cmMemListCp
71 CmMemList *first; /* first entry in list */
72 CmMemList *last; /* last entry in list */
73 U32 count; /* number of entries */
74 CmMemCb memCb; /* Memory Control Block */
77 /***********************************************
78 Memory Status structure
79 ***********************************************/
80 typedef struct cmMemStatus
82 Mem sMem; /* Static Memory region,pool */
83 U32 memBlkCnt; /* Memory Blocks Count */
84 Size maxBlkSize; /* Size of memory Block */
85 Size memAllocated; /* Memory allocated off chunk */
89 /***********************************************
91 ***********************************************/
93 #ifdef TFU_ALLOC_EVENT_NO_INIT
94 EXTERN S16 cmAllocEvntNoInit ARGS((
100 #ifdef TFU_ALLOC_EVENT_NO_INIT
101 EXTERN S16 cmGetMemNoInit ARGS((
106 EXTERN S16 cmAllocEvnt ARGS((
112 EXTERN Void cmInitMemCp ARGS((
117 #ifdef TFU_ALLOC_EVENT_NO_INIT
118 EXTERN S16 cmGetMemNoInit ARGS((
123 EXTERN S16 cmGetMem ARGS((
128 EXTERN Void cmFreeMem ARGS((
131 EXTERN Void cmGetMemStatus ARGS((
133 CmMemStatus *status));
139 #endif /* __CMMBLKX__ */
142 /********************************************************************30**
145 **********************************************************************/