UCOS_TI_LM3S_Keil
 全部 结构体 文件 函数 变量 类型定义 宏定义 
lib_mem.h
浏览该文件的文档.
1 /*
2 *********************************************************************************************************
3 * uC/LIB
4 * CUSTOM LIBRARY MODULES
5 *
6 * (c) Copyright 2004-2009; Micrium, Inc.; Weston, FL
7 *
8 * All rights reserved. Protected by international copyright laws.
9 *
10 * uC/LIB is provided in source form for FREE evaluation, for educational
11 * use or peaceful research. If you plan on using uC/LIB in a commercial
12 * product you need to contact Micrium to properly license its use in your
13 * product. We provide ALL the source code for your convenience and to
14 * help you experience uC/LIB. The fact that the source code is provided
15 * does NOT mean that you can use it without paying a licensing fee.
16 *
17 * Knowledge of the source code may NOT be used to develop a similar product.
18 *
19 * Please help us continue to provide the Embedded community with the finest
20 * software available. Your honesty is greatly appreciated.
21 *********************************************************************************************************
22 */
23 
24 /*
25 *********************************************************************************************************
26 *
27 * STANDARD MEMORY OPERATIONS
28 *
29 * Filename : lib_mem.h
30 * Version : V1.30
31 * Programmer(s) : ITJ
32 *********************************************************************************************************
33 * Note(s) : (1) NO compiler-supplied standard library functions are used in library or product software.
34 *
35 * (a) ALL standard library functions are implemented in the custom library modules :
36 *
37 * (1) <Custom Library Directory>\lib*.*
38 *
39 * (2) <Custom Library Directory>\Ports<cpu><compiler>\lib*_a.*
40 *
41 * where
42 * <Custom Library Directory> directory path for custom library software
43 * <cpu> directory name for specific processor (CPU)
44 * <compiler> directory name for specific compiler
45 *
46 * (b) Product-specific library functions are implemented in individual products.
47 *********************************************************************************************************
48 */
49 
50 
51 /*
52 *********************************************************************************************************
53 * MODULE
54 *********************************************************************************************************
55 */
56 
57 #ifndef LIB_MEM_MODULE_PRESENT
58 #define LIB_MEM_MODULE_PRESENT
59 
60 
61 /*$PAGE*/
62 /*
63 *********************************************************************************************************
64 * INCLUDE FILES
65 *
66 * Note(s) : (1) The following common software files are located in the following directories :
67 *
68 * (a) <Custom Library Directory>\lib*.*
69 *
70 * (b) (1) <CPU-Compiler Directory>\cpu_def.h
71 *
72 * (2) <CPU-Compiler Directory><cpu><compiler>\cpu*.*
73 *
74 * where
75 * <Custom Library Directory> directory path for custom library software
76 * <CPU-Compiler Directory> directory path for common CPU-compiler software
77 * <cpu> directory name for specific processor (CPU)
78 * <compiler> directory name for specific compiler
79 *
80 * (2) Compiler MUST be configured to include the '<Custom Library Directory>\uC-LIB\',
81 * '<CPU-Compiler Directory>\' directory, & the specific CPU-compiler directory as
82 * additional include path directories.
83 *
84 * (3) NO compiler-supplied standard library functions SHOULD be used.
85 *********************************************************************************************************
86 */
87 
88 #include <cpu.h>
89 #include <cpu_core.h>
90 
91 #include <lib_def.h>
92 #include <app_cfg.h>
93 
94 
95 /*
96 *********************************************************************************************************
97 * EXTERNS
98 *********************************************************************************************************
99 */
100 
101 #ifdef LIB_MEM_MODULE
102 #define LIB_MEM_EXT
103 #else
104 #define LIB_MEM_EXT extern
105 #endif
106 
107 
108 /*$PAGE*/
109 /*
110 *********************************************************************************************************
111 * DEFAULT CONFIGURATION
112 *********************************************************************************************************
113 */
114 
115 /*
116 *********************************************************************************************************
117 * MEMORY LIBRARY ARGUMENT CHECK CONFIGURATION
118 *
119 * Note(s) : (1) Configure LIB_MEM_CFG_ARG_CHK_EXT_EN to enable/disable the memory library suite external
120 * argument check feature :
121 *
122 * (a) When ENABLED, arguments received from any port interface provided by the developer
123 * or application are checked/validated.
124 *
125 * (b) When DISABLED, NO arguments received from any port interface provided by the developer
126 * or application are checked/validated.
127 *********************************************************************************************************
128 */
129  /* Configure external argument check feature (see Note #1) : */
130 #ifndef LIB_MEM_CFG_ARG_CHK_EXT_EN
131 #define LIB_MEM_CFG_ARG_CHK_EXT_EN DEF_DISABLED
132  /* DEF_DISABLED Argument check DISABLED */
133  /* DEF_ENABLED Argument check ENABLED */
134 #endif
135 
136 
137 /*
138 *********************************************************************************************************
139 * MEMORY LIBRARY ASSEMBLY OPTIMIZATION CONFIGURATION
140 *
141 * Note(s) : (1) Configure LIB_MEM_CFG_OPTIMIZE_ASM_EN to enable/disable assembly-optimized memory functions.
142 *********************************************************************************************************
143 */
144  /* Configure assembly-optimized function(s) [see Note #1] : */
145 #ifndef LIB_MEM_CFG_OPTIMIZE_ASM_EN
146 #define LIB_MEM_CFG_OPTIMIZE_ASM_EN DEF_DISABLED
147  /* DEF_DISABLED Assembly-optimized function(s) DISABLED */
148  /* DEF_ENABLED Assembly-optimized function(s) ENABLED */
149 #endif
150 
151 
152 /*
153 *********************************************************************************************************
154 * MEMORY ALLOCATION CONFIGURATION
155 *
156 * Note(s) : (1) Configure LIB_MEM_CFG_ALLOC_EN to enable/disable memory allocation functions.
157 *********************************************************************************************************
158 */
159  /* Configure memory allocation feature (see Note #1) : */
160 #ifndef LIB_MEM_CFG_ALLOC_EN
161 #define LIB_MEM_CFG_ALLOC_EN DEF_DISABLED
162  /* DEF_DISABLED Memory allocation DISABLED */
163  /* DEF_ENABLED Memory allocation ENABLED */
164 #endif
165 
166 
167 /*$PAGE*/
168 /*
169 *********************************************************************************************************
170 * DEFINES
171 *********************************************************************************************************
172 */
173 
174 /*
175 *********************************************************************************************************
176 * LIBRARY MEMORY ERROR CODES
177 *********************************************************************************************************
178 */
179 
180 #define LIB_MEM_ERR_NONE 10000
181 #define LIB_MEM_ERR_NULL_PTR 10001 /* Ptr arg(s) passed NULL ptr(s). */
182 
183 #define LIB_MEM_ERR_INVALID_MEM_SIZE 10100 /* Invalid mem size. */
184 #define LIB_MEM_ERR_INVALID_SEG_SIZE 10110 /* Invalid mem seg size. */
185 #define LIB_MEM_ERR_INVALID_SEG_OVERLAP 10111 /* Invalid mem seg overlaps other mem seg(s). */
186 #define LIB_MEM_ERR_INVALID_POOL 10120 /* Invalid mem pool. */
187 #define LIB_MEM_ERR_INVALID_BLK_NBR 10130 /* Invalid mem pool blk nbr. */
188 #define LIB_MEM_ERR_INVALID_BLK_SIZE 10131 /* Invalid mem pool blk size. */
189 #define LIB_MEM_ERR_INVALID_BLK_IX 10132 /* Invalid mem pool ix. */
190 #define LIB_MEM_ERR_INVALID_BLK_ADDR 10135 /* Invalid mem pool blk addr. */
191 #define LIB_MEM_ERR_INVALID_BLK_ADDR_IN_POOL 10136 /* Mem pool blk addr already in mem pool. */
192 
193 #define LIB_MEM_ERR_SEG_EMPTY 10200 /* Mem seg empty; i.e. NO avail mem for mem pools. */
194 #define LIB_MEM_ERR_POOL_FULL 10205 /* Mem pool full; i.e. All mem blks avail in mem pool. */
195 #define LIB_MEM_ERR_POOL_EMPTY 10206 /* Mem pool empty; i.e. NO mem blks avail in mem pool. */
196 
197 #define LIB_MEM_ERR_HEAP_NOT_FOUND 10210 /* Heap seg NOT found. */
198 #define LIB_MEM_ERR_HEAP_EMPTY 10211 /* Heap seg empty; i.e. NO avail mem in heap. */
199 
200 
201 /*$PAGE*/
202 /*
203 *********************************************************************************************************
204 * MEMORY LIBRARY TYPE DEFINES
205 *
206 * Note(s) : (1) LIB_MEM_TYPE_??? #define values specifically chosen as ASCII representations of the memory
207 * library types. Memory displays of memory library objects will display the library TYPEs
208 * with their chosen ASCII names.
209 **********************************************************************************************************/
210 
211  /* ------------------- LIB_MEM TYPES ------------------ */
212 #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
213 #define LIB_MEM_TYPE_NONE 0x4E4F4E45 /* "NONE" in ASCII. */
214 #define LIB_MEM_TYPE_HEAP 0x48454150 /* "HEAP" in ASCII. */
215 #define LIB_MEM_TYPE_POOL 0x504F4F4C /* "POOL" in ASCII. */
216 
217 #else
218 
219 #if (CPU_CFG_DATA_SIZE == CPU_WORD_SIZE_32)
220 #define LIB_MEM_TYPE_NONE 0x454E4F4E /* "NONE" in ASCII. */
221 #define LIB_MEM_TYPE_HEAP 0x50414548 /* "HEAP" in ASCII. */
222 #define LIB_MEM_TYPE_POOL 0x4C4F4F50 /* "POOL" in ASCII. */
223 
224 #elif (CPU_CFG_DATA_SIZE == CPU_WORD_SIZE_16)
225 #define LIB_MEM_TYPE_NONE 0x4F4E454E /* "NONE" in ASCII. */
226 #define LIB_MEM_TYPE_HEAP 0x45485041 /* "HEAP" in ASCII. */
227 #define LIB_MEM_TYPE_POOL 0x4F504C4F /* "POOL" in ASCII. */
228 
229 #else /* Dflt CPU_WORD_SIZE_08. */
230 #define LIB_MEM_TYPE_NONE 0x4E4F4E45 /* "NONE" in ASCII. */
231 #define LIB_MEM_TYPE_HEAP 0x48454150 /* "HEAP" in ASCII. */
232 #define LIB_MEM_TYPE_POOL 0x504F4F4C /* "POOL" in ASCII. */
233 
234 #endif
235 #endif
236 
237 
238 /*$PAGE*/
239 /*
240 *********************************************************************************************************
241 * DATA TYPES
242 *********************************************************************************************************
243 */
244 
245 /*
246 *********************************************************************************************************
247 * LIB MEM TYPE
248 *
249 * Note(s) : (1) 'LIB_MEM_TYPE' declared as 'CPU_INT32U' & all 'LIB_MEM_TYPE's #define'd with large, non-trivial
250 * values to trap & discard invalid/corrupted library memory objects based on 'LIB_MEM_TYPE'.
251 *********************************************************************************************************
252 */
253 
255 
256 
257 /*
258 *********************************************************************************************************
259 * MEMORY POOL TABLE IX TYPE
260 *
261 * Note(s) : (1) MEM_POOL_IX_NONE SHOULD be #define'd based on 'MEM_POOL_IX' data type declared.
262 *********************************************************************************************************
263 */
264 
266 
267 #define MEM_POOL_IX_NONE DEF_INT_16U_MAX_VAL /* Define as max unsigned val (see Note #1). */
268 #define MEM_POOL_IX_MIN 1
269 #define MEM_POOL_IX_MAX (MEM_POOL_IX_NONE - 1)
270 
271 
272 /*$PAGE*/
273 /*
274 *********************************************************************************************************
275 * MEMORY POOL DATA TYPES
276 *
277 * MEMORY SEGMENT
278 * ----------------
279 * MEMORY POOL'S | | <----
280 * POINTERS TO | MEMORY | |
281 * MEM_POOL MEMORY BLOCKS | BLOCKS | |
282 * |----------------| |---------| | -------- | |
283 * | O------------------> | O--------------------> | | | |
284 * |----------------| |---------| | | | | |
285 * | Pool Addr Ptrs | | O------------- | -------- | |
286 * | Pool Size | |---------| | | | |
287 * |----------------| | | | | -------- | |
288 * | Blk Size | | | --------> | | | |
289 * | Blk Nbr | | | | | | | |
290 * | Blk Ix | | . | | -------- | |
291 * |----------------| | . | | | |
292 * |----------------| | . | | . | |
293 * | O----------------- | | | . | |
294 * |----------------| | | | | . | |
295 * | O------------ | | | | | |
296 * |----------------| | | |---------| | -------- | |
297 * | Seg Size Tot | | | | O--------------------> | | | |
298 * | Seg Size Rem | | | |---------| | | | | |
299 * |----------------| | | | | | -------- | |
300 * | Seg List Ptrs | | | |---------| | | |
301 * |----------------| | | | ------------ | |
302 * | | | | <--------
303 * | | | | | |
304 * | | | | | |
305 * | | | | | |
306 * | | | | | |
307 * | | | | | |
308 * | | ---------------- | |
309 * | | | |
310 * | -------------------------------------------------- |
311 * | |
312 * -----------------------------------------------------------
313 *
314 *********************************************************************************************************
315 */
316 
317 typedef struct mem_pool MEM_POOL;
318 
319  /* --------------------- MEM POOL --------------------- */
320 struct mem_pool {
321  LIB_MEM_TYPE Type; /* Pool type : LIB_TYPE_POOL or LIB_TYPE_HEAP. */
322 
323  MEM_POOL *SegPrevPtr; /* Ptr to PREV mem seg. */
324  MEM_POOL *SegNextPtr; /* Ptr to NEXT mem seg. */
325  MEM_POOL *PoolPrevPtr; /* Ptr to PREV mem pool. */
326  MEM_POOL *PoolNextPtr; /* Ptr to NEXT mem pool. */
327 
328  void *PoolAddrStart; /* Ptr to start of mem seg for mem pool blks. */
329  void *PoolAddrEnd; /* Ptr to end of mem seg for mem pool blks. */
330  void **PoolPtrs; /* Ptr to mem pool's array of blk ptrs. */
331  MEM_POOL_IX BlkIx; /* Ix into mem pool's array of blk ptrs. */
332  CPU_SIZE_T PoolSize; /* Size of mem pool (in octets). */
333  CPU_SIZE_T BlkNbr; /* Nbr of mem pool blks. */
334  CPU_SIZE_T BlkSize; /* Size of mem pool blks (in octets). */
335  CPU_SIZE_T BlkAlign; /* Align of mem pool blks (in octets). */
336 
337  /* --------------------- MEM SEG ---------------------- */
338  void *SegAddr; /* Ptr to mem seg's base/start addr. */
339  void *SegAddrNextAvail; /* Ptr to mem seg's next avail addr. */
340  CPU_SIZE_T SegSizeTot; /* Tot size of mem seg (in octets). */
341  CPU_SIZE_T SegSizeRem; /* Rem size of mem seg (in octets). */
342 };
343 
344 
345 /*$PAGE*/
346 /*
347 *********************************************************************************************************
348 * GLOBAL VARIABLES
349 *********************************************************************************************************
350 */
351 
352 
353 /*$PAGE*/
354 /*
355 *********************************************************************************************************
356 * MACRO'S
357 *********************************************************************************************************
358 */
359 
360 /*
361 *********************************************************************************************************
362 * MEMORY DATA VALUE MACRO'S
363 *
364 * Note(s) : (1) (a) Some variables & variable buffers to pass & receive data values MUST start on appropriate
365 * CPU word-aligned addresses. This is required because most word-aligned processors are more
366 * efficient & may even REQUIRE that multi-octet words start on CPU word-aligned addresses.
367 *
368 * (1) For 16-bit word-aligned processors, this means that
369 *
370 * all 16- & 32-bit words MUST start on addresses that are multiples of 2 octets
371 *
372 * (2) For 32-bit word-aligned processors, this means that
373 *
374 * all 16-bit words MUST start on addresses that are multiples of 2 octets
375 * all 32-bit words MUST start on addresses that are multiples of 4 octets
376 *
377 * (b) However, some data values macro's appropriately access data values from any CPU addresses,
378 * word-aligned or not. Thus for processors that require data word alignment, data words can
379 * be accessed to/from any CPU address, word-aligned or not, without generating data-word-
380 * alignment exceptions/faults.
381 *********************************************************************************************************
382 */
383 
384 
385 /*$PAGE*/
386 /*
387 *********************************************************************************************************
388 * MEM_VAL_GET_xxx()
389 *
390 * Description : Decode data values from any CPU memory address.
391 *
392 * Argument(s) : addr Lowest CPU memory address of data value to decode (see Notes #2 & #3a).
393 *
394 * Return(s) : Decoded data value from CPU memory address (see Notes #1 & #3b).
395 *
396 * Caller(s) : Application.
397 *
398 * Note(s) : (1) Decode data values based on the values' data-word order in CPU memory :
399 *
400 * MEM_VAL_GET_xxx_BIG() Decode big- endian data values -- data words' most
401 * significant octet @ lowest memory address
402 * MEM_VAL_GET_xxx_LITTLE() Decode little-endian data values -- data words' least
403 * significant octet @ lowest memory address
404 * MEM_VAL_GET_xxx() Decode data values using CPU's native or configured
405 * data-word order
406 *
407 * See also 'cpu.h CPU WORD CONFIGURATION Note #2'.
408 *
409 * (2) CPU memory addresses/pointers NOT checked for NULL.
410 *
411 * (3) (a) MEM_VAL_GET_xxx() macro's decode data values without regard to CPU word-aligned addresses.
412 * Thus for processors that require data word alignment, data words can be decoded from any
413 * CPU address, word-aligned or not, without generating data-word-alignment exceptions/faults.
414 *
415 * (b) However, any variable to receive the returned data value MUST start on an appropriate CPU
416 * word-aligned address.
417 *
418 * See also 'MEMORY DATA VALUE MACRO'S Note #1'.
419 *
420 * (4) MEM_VAL_COPY_GET_xxx() macro's are more efficient than MEM_VAL_GET_xxx() macro's & are
421 * also independent of CPU data-word-alignment & SHOULD be used whenever possible.
422 *
423 * See also 'MEM_VAL_COPY_GET_xxx() Note #4'.
424 *
425 * (5) MEM_VAL_GET_xxx() macro's are NOT atomic operations & MUST NOT be used on any non-static
426 * (i.e. volatile) variables, registers, hardware, etc.
427 *
428 * (6) The 'CPU_CFG_ENDIAN_TYPE' pre-processor 'else'-conditional code SHOULD never be compiled/
429 * linked since each 'cpu.h' SHOULD ensure that the CPU data-word-memory order configuration
430 * constant (CPU_CFG_ENDIAN_TYPE) is configured with an appropriate data-word-memory order
431 * value (see 'cpu.h CPU WORD CONFIGURATION Note #2'). The 'else'-conditional code is
432 * included as an extra precaution in case 'cpu.h' is incorrectly configured.
433 *********************************************************************************************************
434 */
435 
436 #define MEM_VAL_GET_INT08U_BIG(addr) ((CPU_INT08U) (((CPU_INT08U)(*(((CPU_INT08U *)(addr)) + 0))) << (0 * DEF_OCTET_NBR_BITS)))
437 
438 #define MEM_VAL_GET_INT16U_BIG(addr) ((CPU_INT16U)((((CPU_INT16U)(*(((CPU_INT08U *)(addr)) + 0))) << (1 * DEF_OCTET_NBR_BITS)) + \
439  (((CPU_INT16U)(*(((CPU_INT08U *)(addr)) + 1))) << (0 * DEF_OCTET_NBR_BITS))))
440 
441 #define MEM_VAL_GET_INT32U_BIG(addr) ((CPU_INT32U)((((CPU_INT32U)(*(((CPU_INT08U *)(addr)) + 0))) << (3 * DEF_OCTET_NBR_BITS)) + \
442  (((CPU_INT32U)(*(((CPU_INT08U *)(addr)) + 1))) << (2 * DEF_OCTET_NBR_BITS)) + \
443  (((CPU_INT32U)(*(((CPU_INT08U *)(addr)) + 2))) << (1 * DEF_OCTET_NBR_BITS)) + \
444  (((CPU_INT32U)(*(((CPU_INT08U *)(addr)) + 3))) << (0 * DEF_OCTET_NBR_BITS))))
445 
446 
447 
448 #define MEM_VAL_GET_INT08U_LITTLE(addr) ((CPU_INT08U) (((CPU_INT08U)(*(((CPU_INT08U *)(addr)) + 0))) << (0 * DEF_OCTET_NBR_BITS)))
449 
450 #define MEM_VAL_GET_INT16U_LITTLE(addr) ((CPU_INT16U)((((CPU_INT16U)(*(((CPU_INT08U *)(addr)) + 0))) << (0 * DEF_OCTET_NBR_BITS)) + \
451  (((CPU_INT16U)(*(((CPU_INT08U *)(addr)) + 1))) << (1 * DEF_OCTET_NBR_BITS))))
452 
453 #define MEM_VAL_GET_INT32U_LITTLE(addr) ((CPU_INT32U)((((CPU_INT32U)(*(((CPU_INT08U *)(addr)) + 0))) << (0 * DEF_OCTET_NBR_BITS)) + \
454  (((CPU_INT32U)(*(((CPU_INT08U *)(addr)) + 1))) << (1 * DEF_OCTET_NBR_BITS)) + \
455  (((CPU_INT32U)(*(((CPU_INT08U *)(addr)) + 2))) << (2 * DEF_OCTET_NBR_BITS)) + \
456  (((CPU_INT32U)(*(((CPU_INT08U *)(addr)) + 3))) << (3 * DEF_OCTET_NBR_BITS))))
457 
458 
459 
460 #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
461 
462 #define MEM_VAL_GET_INT08U(addr) MEM_VAL_GET_INT08U_BIG(addr)
463 #define MEM_VAL_GET_INT16U(addr) MEM_VAL_GET_INT16U_BIG(addr)
464 #define MEM_VAL_GET_INT32U(addr) MEM_VAL_GET_INT32U_BIG(addr)
465 
466 #elif (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_LITTLE)
467 
468 #define MEM_VAL_GET_INT08U(addr) MEM_VAL_GET_INT08U_LITTLE(addr)
469 #define MEM_VAL_GET_INT16U(addr) MEM_VAL_GET_INT16U_LITTLE(addr)
470 #define MEM_VAL_GET_INT32U(addr) MEM_VAL_GET_INT32U_LITTLE(addr)
471 
472 #else /* See Note #6. */
473 
474 #error "CPU_CFG_ENDIAN_TYPE illegally #defined in 'cpu.h' "
475 #error " [See 'cpu.h CONFIGURATION ERRORS']"
476 
477 #endif
478 
479 
480 /*$PAGE*/
481 /*
482 *********************************************************************************************************
483 * MEM_VAL_SET_xxx()
484 *
485 * Description : Encode data values to any CPU memory address.
486 *
487 * Argument(s) : addr Lowest CPU memory address to encode data value (see Notes #2 & #3a).
488 *
489 * val Data value to encode (see Notes #1 & #3b).
490 *
491 * Return(s) : none.
492 *
493 * Caller(s) : Application.
494 *
495 * Note(s) : (1) Encode data values into CPU memory based on the values' data-word order :
496 *
497 * MEM_VAL_SET_xxx_BIG() Encode big- endian data values -- data words' most
498 * significant octet @ lowest memory address
499 * MEM_VAL_SET_xxx_LITTLE() Encode little-endian data values -- data words' least
500 * significant octet @ lowest memory address
501 * MEM_VAL_SET_xxx() Encode data values using CPU's native or configured
502 * data-word order
503 *
504 * See also 'cpu.h CPU WORD CONFIGURATION Note #2'.
505 *
506 * (2) CPU memory addresses/pointers NOT checked for NULL.
507 *
508 * (3) (a) MEM_VAL_SET_xxx() macro's encode data values without regard to CPU word-aligned addresses.
509 * Thus for processors that require data word alignment, data words can be encoded to any
510 * CPU address, word-aligned or not, without generating data-word-alignment exceptions/faults.
511 *
512 * (b) However, 'val' data value to encode MUST start on an appropriate CPU word-aligned address.
513 *
514 * See also 'MEMORY DATA VALUE MACRO'S Note #1'.
515 *
516 * (4) MEM_VAL_COPY_SET_xxx() macro's are more efficient than MEM_VAL_SET_xxx() macro's & are
517 * also independent of CPU data-word-alignment & SHOULD be used whenever possible.
518 *
519 * See also 'MEM_VAL_COPY_SET_xxx() Note #4'.
520 *
521 * (5) MEM_VAL_SET_xxx() macro's are NOT atomic operations & MUST NOT be used on any non-static
522 * (i.e. volatile) variables, registers, hardware, etc.
523 *
524 * (6) The 'CPU_CFG_ENDIAN_TYPE' pre-processor 'else'-conditional code SHOULD never be compiled/
525 * linked since each 'cpu.h' SHOULD ensure that the CPU data-word-memory order configuration
526 * constant (CPU_CFG_ENDIAN_TYPE) is configured with an appropriate data-word-memory order
527 * value (see 'cpu.h CPU WORD CONFIGURATION Note #2'). The 'else'-conditional code is
528 * included as an extra precaution in case 'cpu.h' is incorrectly configured.
529 *********************************************************************************************************
530 */
531 
532 #define MEM_VAL_SET_INT08U_BIG(addr, val) { (*(((CPU_INT08U *)(addr)) + 0)) = ((CPU_INT08U)((((CPU_INT08U)(val)) & 0xFF) >> (0 * DEF_OCTET_NBR_BITS))); }
533 
534 #define MEM_VAL_SET_INT16U_BIG(addr, val) { (*(((CPU_INT08U *)(addr)) + 0)) = ((CPU_INT08U)((((CPU_INT16U)(val)) & 0xFF00) >> (1 * DEF_OCTET_NBR_BITS))); \
535  (*(((CPU_INT08U *)(addr)) + 1)) = ((CPU_INT08U)((((CPU_INT16U)(val)) & 0x00FF) >> (0 * DEF_OCTET_NBR_BITS))); }
536 
537 #define MEM_VAL_SET_INT32U_BIG(addr, val) { (*(((CPU_INT08U *)(addr)) + 0)) = ((CPU_INT08U)((((CPU_INT32U)(val)) & 0xFF000000) >> (3 * DEF_OCTET_NBR_BITS))); \
538  (*(((CPU_INT08U *)(addr)) + 1)) = ((CPU_INT08U)((((CPU_INT32U)(val)) & 0x00FF0000) >> (2 * DEF_OCTET_NBR_BITS))); \
539  (*(((CPU_INT08U *)(addr)) + 2)) = ((CPU_INT08U)((((CPU_INT32U)(val)) & 0x0000FF00) >> (1 * DEF_OCTET_NBR_BITS))); \
540  (*(((CPU_INT08U *)(addr)) + 3)) = ((CPU_INT08U)((((CPU_INT32U)(val)) & 0x000000FF) >> (0 * DEF_OCTET_NBR_BITS))); }
541 
542 
543 
544 #define MEM_VAL_SET_INT08U_LITTLE(addr, val) { (*(((CPU_INT08U *)(addr)) + 0)) = ((CPU_INT08U)((((CPU_INT08U)(val)) & 0xFF) >> (0 * DEF_OCTET_NBR_BITS))); }
545 
546 #define MEM_VAL_SET_INT16U_LITTLE(addr, val) { (*(((CPU_INT08U *)(addr)) + 0)) = ((CPU_INT08U)((((CPU_INT16U)(val)) & 0x00FF) >> (0 * DEF_OCTET_NBR_BITS))); \
547  (*(((CPU_INT08U *)(addr)) + 1)) = ((CPU_INT08U)((((CPU_INT16U)(val)) & 0xFF00) >> (1 * DEF_OCTET_NBR_BITS))); }
548 
549 #define MEM_VAL_SET_INT32U_LITTLE(addr, val) { (*(((CPU_INT08U *)(addr)) + 0)) = ((CPU_INT08U)((((CPU_INT32U)(val)) & 0x000000FF) >> (0 * DEF_OCTET_NBR_BITS))); \
550  (*(((CPU_INT08U *)(addr)) + 1)) = ((CPU_INT08U)((((CPU_INT32U)(val)) & 0x0000FF00) >> (1 * DEF_OCTET_NBR_BITS))); \
551  (*(((CPU_INT08U *)(addr)) + 2)) = ((CPU_INT08U)((((CPU_INT32U)(val)) & 0x00FF0000) >> (2 * DEF_OCTET_NBR_BITS))); \
552  (*(((CPU_INT08U *)(addr)) + 3)) = ((CPU_INT08U)((((CPU_INT32U)(val)) & 0xFF000000) >> (3 * DEF_OCTET_NBR_BITS))); }
553 
554 
555 
556 #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
557 
558 #define MEM_VAL_SET_INT08U(addr, val) MEM_VAL_SET_INT08U_BIG(addr, val)
559 #define MEM_VAL_SET_INT16U(addr, val) MEM_VAL_SET_INT16U_BIG(addr, val)
560 #define MEM_VAL_SET_INT32U(addr, val) MEM_VAL_SET_INT32U_BIG(addr, val)
561 
562 #elif (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_LITTLE)
563 
564 #define MEM_VAL_SET_INT08U(addr, val) MEM_VAL_SET_INT08U_LITTLE(addr, val)
565 #define MEM_VAL_SET_INT16U(addr, val) MEM_VAL_SET_INT16U_LITTLE(addr, val)
566 #define MEM_VAL_SET_INT32U(addr, val) MEM_VAL_SET_INT32U_LITTLE(addr, val)
567 
568 #else /* See Note #6. */
569 
570 #error "CPU_CFG_ENDIAN_TYPE illegally #defined in 'cpu.h' "
571 #error " [See 'cpu.h CONFIGURATION ERRORS']"
572 
573 #endif
574 
575 
576 /*$PAGE*/
577 /*
578 *********************************************************************************************************
579 * MEM_VAL_COPY_GET_xxx()
580 *
581 * Description : Copy & decode data values from any CPU memory address to any CPU memory address.
582 *
583 * Argument(s) : addr_dest Lowest CPU memory address to copy/decode source address's data value
584 * (see Notes #2 & #3).
585 *
586 * addr_src Lowest CPU memory address of data value to copy/decode
587 * (see Notes #2 & #3).
588 *
589 * Return(s) : none.
590 *
591 * Caller(s) : Application.
592 *
593 * Note(s) : (1) Copy/decode data values based on the values' data-word order :
594 *
595 * MEM_VAL_COPY_GET_xxx_BIG() Decode big- endian data values -- data words' most
596 * significant octet @ lowest memory address
597 * MEM_VAL_COPY_GET_xxx_LITTLE() Decode little-endian data values -- data words' least
598 * significant octet @ lowest memory address
599 * MEM_VAL_COPY_GET_xxx() Decode data values using CPU's native or configured
600 * data-word order
601 *
602 * See also 'cpu.h CPU WORD CONFIGURATION Note #2'.
603 *
604 * (2) CPU memory addresses/pointers NOT checked for NULL.
605 *
606 * (3) MEM_VAL_COPY_GET_xxx() macro's copy/decode data values without regard to CPU word-aligned
607 * addresses. Thus for processors that require data word alignment, data words can be copied/
608 * decoded to/from any CPU address, word-aligned or not, without generating data-word-alignment
609 * exceptions/faults.
610 *
611 * (4) MEM_VAL_COPY_GET_xxx() macro's are more efficient than MEM_VAL_GET_xxx() macro's & are
612 * also independent of CPU data-word-alignment & SHOULD be used whenever possible.
613 *
614 * See also 'MEM_VAL_GET_xxx() Note #4'.
615 *
616 * (5) Since octet-order copy/conversion are inverse operations, memory data value gets/sets are
617 * inverse operations.
618 *
619 * See also 'MEM_VAL_COPY_SET_xxx() Note #5'.
620 *
621 * (6) MEM_VAL_COPY_GET_xxx() macro's are NOT atomic operations & MUST NOT be used on any non-
622 * static (i.e. volatile) variables, registers, hardware, etc.
623 *
624 * (7) The 'CPU_CFG_ENDIAN_TYPE' pre-processor 'else'-conditional code SHOULD never be compiled/
625 * linked since each 'cpu.h' SHOULD ensure that the CPU data-word-memory order configuration
626 * constant (CPU_CFG_ENDIAN_TYPE) is configured with an appropriate data-word-memory order
627 * value (see 'cpu.h CPU WORD CONFIGURATION Note #2'). The 'else'-conditional code is
628 * included as an extra precaution in case 'cpu.h' is incorrectly configured.
629 *********************************************************************************************************
630 */
631 /*$PAGE*/
632 
633 #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
634 
635 
636 #define MEM_VAL_COPY_GET_INT08U_BIG(addr_dest, addr_src) { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); }
637 
638 #define MEM_VAL_COPY_GET_INT16U_BIG(addr_dest, addr_src) { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); \
639  (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 1)); }
640 
641 #define MEM_VAL_COPY_GET_INT32U_BIG(addr_dest, addr_src) { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); \
642  (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \
643  (*(((CPU_INT08U *)(addr_dest)) + 2)) = (*(((CPU_INT08U *)(addr_src)) + 2)); \
644  (*(((CPU_INT08U *)(addr_dest)) + 3)) = (*(((CPU_INT08U *)(addr_src)) + 3)); }
645 
646 
647 
648 #define MEM_VAL_COPY_GET_INT08U_LITTLE(addr_dest, addr_src) { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); }
649 
650 #define MEM_VAL_COPY_GET_INT16U_LITTLE(addr_dest, addr_src) { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \
651  (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 0)); }
652 
653 #define MEM_VAL_COPY_GET_INT32U_LITTLE(addr_dest, addr_src) { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 3)); \
654  (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 2)); \
655  (*(((CPU_INT08U *)(addr_dest)) + 2)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \
656  (*(((CPU_INT08U *)(addr_dest)) + 3)) = (*(((CPU_INT08U *)(addr_src)) + 0)); }
657 
658 
659 
660 #define MEM_VAL_COPY_GET_INT08U(addr_dest, addr_src) MEM_VAL_COPY_GET_INT08U_BIG(addr_dest, addr_src)
661 #define MEM_VAL_COPY_GET_INT16U(addr_dest, addr_src) MEM_VAL_COPY_GET_INT16U_BIG(addr_dest, addr_src)
662 #define MEM_VAL_COPY_GET_INT32U(addr_dest, addr_src) MEM_VAL_COPY_GET_INT32U_BIG(addr_dest, addr_src)
663 
664 
665 
666 
667 #elif (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_LITTLE)
668 
669 
670 #define MEM_VAL_COPY_GET_INT08U_BIG(addr_dest, addr_src) { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); }
671 
672 #define MEM_VAL_COPY_GET_INT16U_BIG(addr_dest, addr_src) { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \
673  (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 0)); }
674 
675 #define MEM_VAL_COPY_GET_INT32U_BIG(addr_dest, addr_src) { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 3)); \
676  (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 2)); \
677  (*(((CPU_INT08U *)(addr_dest)) + 2)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \
678  (*(((CPU_INT08U *)(addr_dest)) + 3)) = (*(((CPU_INT08U *)(addr_src)) + 0)); }
679 
680 
681 
682 #define MEM_VAL_COPY_GET_INT08U_LITTLE(addr_dest, addr_src) { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); }
683 
684 #define MEM_VAL_COPY_GET_INT16U_LITTLE(addr_dest, addr_src) { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); \
685  (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 1)); }
686 
687 #define MEM_VAL_COPY_GET_INT32U_LITTLE(addr_dest, addr_src) { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); \
688  (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \
689  (*(((CPU_INT08U *)(addr_dest)) + 2)) = (*(((CPU_INT08U *)(addr_src)) + 2)); \
690  (*(((CPU_INT08U *)(addr_dest)) + 3)) = (*(((CPU_INT08U *)(addr_src)) + 3)); }
691 
692 
693 
694 #define MEM_VAL_COPY_GET_INT08U(addr_dest, addr_src) MEM_VAL_COPY_GET_INT08U_LITTLE(addr_dest, addr_src)
695 #define MEM_VAL_COPY_GET_INT16U(addr_dest, addr_src) MEM_VAL_COPY_GET_INT16U_LITTLE(addr_dest, addr_src)
696 #define MEM_VAL_COPY_GET_INT32U(addr_dest, addr_src) MEM_VAL_COPY_GET_INT32U_LITTLE(addr_dest, addr_src)
697 
698 
699 
700 
701 #else /* See Note #7. */
702 
703 #error "CPU_CFG_ENDIAN_TYPE illegally #defined in 'cpu.h' "
704 #error " [See 'cpu.h CONFIGURATION ERRORS']"
705 
706 #endif
707 
708 
709 /*$PAGE*/
710 /*
711 *********************************************************************************************************
712 * MEM_VAL_COPY_SET_xxx()
713 *
714 * Description : Copy & encode data values from any CPU memory address to any CPU memory address.
715 *
716 * Argument(s) : addr_dest Lowest CPU memory address to copy/encode source address's data value
717 * (see Notes #2 & #3).
718 *
719 * addr_src Lowest CPU memory address of data value to copy/encode
720 * (see Notes #2 & #3).
721 *
722 * Return(s) : none.
723 *
724 * Caller(s) : Application.
725 *
726 * Note(s) : (1) Copy/encode data values based on the values' data-word order :
727 *
728 * MEM_VAL_COPY_SET_xxx_BIG() Encode big- endian data values -- data words' most
729 * significant octet @ lowest memory address
730 * MEM_VAL_COPY_SET_xxx_LITTLE() Encode little-endian data values -- data words' least
731 * significant octet @ lowest memory address
732 * MEM_VAL_COPY_SET_xxx() Encode data values using CPU's native or configured
733 * data-word order
734 *
735 * See also 'cpu.h CPU WORD CONFIGURATION Note #2'.
736 *
737 * (2) CPU memory addresses/pointers NOT checked for NULL.
738 *
739 * (3) MEM_VAL_COPY_SET_xxx() macro's copy/encode data values without regard to CPU word-aligned
740 * addresses. Thus for processors that require data word alignment, data words can be copied/
741 * encoded to/from any CPU address, word-aligned or not, without generating data-word-alignment
742 * exceptions/faults.
743 *
744 * (4) MEM_VAL_COPY_SET_xxx() macro's are more efficient than MEM_VAL_SET_xxx() macro's & are
745 * also independent of CPU data-word-alignment & SHOULD be used whenever possible.
746 *
747 * See also 'MEM_VAL_SET_xxx() Note #4'.
748 *
749 * (5) Since octet-order copy/conversion are inverse operations, memory data value gets/sets
750 * are inverse operations.
751 *
752 * See also 'MEM_VAL_COPY_GET_xxx() Note #5'.
753 *
754 * (6) MEM_VAL_COPY_SET_xxx() macro's are NOT atomic operations & MUST NOT be used on any non-
755 * static (i.e. volatile) variables, registers, hardware, etc.
756 *********************************************************************************************************
757 */
758 
759  /* See Note #5. */
760 #define MEM_VAL_COPY_SET_INT08U_BIG(addr_dest, addr_src) MEM_VAL_COPY_GET_INT08U_BIG(addr_dest, addr_src)
761 #define MEM_VAL_COPY_SET_INT16U_BIG(addr_dest, addr_src) MEM_VAL_COPY_GET_INT16U_BIG(addr_dest, addr_src)
762 #define MEM_VAL_COPY_SET_INT32U_BIG(addr_dest, addr_src) MEM_VAL_COPY_GET_INT32U_BIG(addr_dest, addr_src)
763 
764 #define MEM_VAL_COPY_SET_INT08U_LITTLE(addr_dest, addr_src) MEM_VAL_COPY_GET_INT08U_LITTLE(addr_dest, addr_src)
765 #define MEM_VAL_COPY_SET_INT16U_LITTLE(addr_dest, addr_src) MEM_VAL_COPY_GET_INT16U_LITTLE(addr_dest, addr_src)
766 #define MEM_VAL_COPY_SET_INT32U_LITTLE(addr_dest, addr_src) MEM_VAL_COPY_GET_INT32U_LITTLE(addr_dest, addr_src)
767 
768 
769 #define MEM_VAL_COPY_SET_INT08U(addr_dest, addr_src) MEM_VAL_COPY_GET_INT08U(addr_dest, addr_src)
770 #define MEM_VAL_COPY_SET_INT16U(addr_dest, addr_src) MEM_VAL_COPY_GET_INT16U(addr_dest, addr_src)
771 #define MEM_VAL_COPY_SET_INT32U(addr_dest, addr_src) MEM_VAL_COPY_GET_INT32U(addr_dest, addr_src)
772 
773 
774 /*$PAGE*/
775 /*
776 *********************************************************************************************************
777 * MEM_VAL_COPY_xxx()
778 *
779 * Description : Copy data values from any CPU memory address to any CPU memory address.
780 *
781 * Argument(s) : addr_dest Lowest CPU memory address to copy source address's data value
782 * (see Notes #2 & #3).
783 *
784 * addr_src Lowest CPU memory address of data value to copy
785 * (see Notes #2 & #3).
786 *
787 * Return(s) : none.
788 *
789 * Caller(s) : Application.
790 *
791 * Note(s) : (1) MEM_VAL_COPY_xxx() macro's copy data values based on CPU's native data-word order.
792 *
793 * See also 'cpu.h CPU WORD CONFIGURATION Note #2'.
794 *
795 * (2) CPU memory addresses/pointers NOT checked for NULL.
796 *
797 * (3) MEM_VAL_COPY_xxx() macro's copy data values without regard to CPU word-aligned addresses.
798 * Thus for processors that require data word alignment, data words can be copied to/from any
799 * CPU address, word-aligned or not, without generating data-word-alignment exceptions/faults.
800 *
801 * (4) MEM_VAL_COPY_xxx() macro's are NOT atomic operations & MUST NOT be used on any non-static
802 * (i.e. volatile) variables, registers, hardware, etc.
803 *********************************************************************************************************
804 */
805 
806 #define MEM_VAL_COPY_08(addr_dest, addr_src) { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); }
807 
808 #define MEM_VAL_COPY_16(addr_dest, addr_src) { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); \
809  (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 1)); }
810 
811 #define MEM_VAL_COPY_32(addr_dest, addr_src) { (*(((CPU_INT08U *)(addr_dest)) + 0)) = (*(((CPU_INT08U *)(addr_src)) + 0)); \
812  (*(((CPU_INT08U *)(addr_dest)) + 1)) = (*(((CPU_INT08U *)(addr_src)) + 1)); \
813  (*(((CPU_INT08U *)(addr_dest)) + 2)) = (*(((CPU_INT08U *)(addr_src)) + 2)); \
814  (*(((CPU_INT08U *)(addr_dest)) + 3)) = (*(((CPU_INT08U *)(addr_src)) + 3)); }
815 
816 
817 /*$PAGE*/
818 /*
819 *********************************************************************************************************
820 * FUNCTION PROTOTYPES
821 *********************************************************************************************************
822 */
823 
824 void Mem_Init (void);
825 
826  /* -------------- MEM API FNCTS -------------- */
827 void Mem_Clr (void *pmem,
828  CPU_SIZE_T size);
829 
830 void Mem_Set (void *pmem,
831  CPU_INT08U data_val,
832  CPU_SIZE_T size);
833 
834 void Mem_Copy (void *pdest,
835  void *psrc,
836  CPU_SIZE_T size);
837 
838 CPU_BOOLEAN Mem_Cmp (void *p1_mem,
839  void *p2_mem,
840  CPU_SIZE_T size);
841 
842 
843 
844 #if (LIB_MEM_CFG_ALLOC_EN == DEF_ENABLED) /* -------------- MEM POOL FNCTS -------------- */
845 
846 void *Mem_HeapAlloc (CPU_SIZE_T size,
847  CPU_SIZE_T align,
848  CPU_SIZE_T *poctets_reqd,
849  LIB_ERR *perr);
850 
851 
852 void Mem_PoolClr (MEM_POOL *pmem_pool,
853  LIB_ERR *perr);
854 
855 void Mem_PoolCreate (MEM_POOL *pmem_pool,
856  void *pmem_base_addr,
857  CPU_SIZE_T mem_size,
858  CPU_SIZE_T blk_nbr,
859  CPU_SIZE_T blk_size,
860  CPU_SIZE_T blk_align,
861  CPU_SIZE_T *poctets_reqd,
862  LIB_ERR *perr);
863 
864 void *Mem_PoolBlkGet (MEM_POOL *pmem_pool,
865  CPU_SIZE_T size,
866  LIB_ERR *perr);
867 
868 void Mem_PoolBlkFree(MEM_POOL *pmem_pool,
869  void *pmem_blk,
870  LIB_ERR *perr);
871 
872 #endif
873 
874 
875 /*$PAGE*/
876 /*
877 *********************************************************************************************************
878 * CONFIGURATION ERRORS
879 *********************************************************************************************************
880 */
881 
882 #ifndef LIB_MEM_CFG_ARG_CHK_EXT_EN
883 #error "LIB_MEM_CFG_ARG_CHK_EXT_EN not #define'd in 'app_cfg.h'"
884 #error " [MUST be DEF_DISABLED] "
885 #error " [ || DEF_ENABLED ] "
886 
887 #elif ((LIB_MEM_CFG_ARG_CHK_EXT_EN != DEF_DISABLED) && \
888  (LIB_MEM_CFG_ARG_CHK_EXT_EN != DEF_ENABLED ))
889 #error "LIB_MEM_CFG_ARG_CHK_EXT_EN illegally #define'd in 'app_cfg.h'"
890 #error " [MUST be DEF_DISABLED] "
891 #error " [ || DEF_ENABLED ] "
892 #endif
893 
894 
895 
896 #ifndef LIB_MEM_CFG_OPTIMIZE_ASM_EN
897 #error "LIB_MEM_CFG_OPTIMIZE_ASM_EN not #define'd in 'app_cfg.h'"
898 #error " [MUST be DEF_DISABLED] "
899 #error " [ || DEF_ENABLED ] "
900 
901 #elif ((LIB_MEM_CFG_OPTIMIZE_ASM_EN != DEF_DISABLED) && \
902  (LIB_MEM_CFG_OPTIMIZE_ASM_EN != DEF_ENABLED ))
903 #error "LIB_MEM_CFG_OPTIMIZE_ASM_EN illegally #define'd in 'app_cfg.h'"
904 #error " [MUST be DEF_DISABLED] "
905 #error " [ || DEF_ENABLED ] "
906 #endif
907 
908 
909 
910 #ifndef LIB_MEM_CFG_ALLOC_EN
911 #error "LIB_MEM_CFG_ALLOC_EN not #define'd in 'app_cfg.h'"
912 #error " [MUST be DEF_DISABLED] "
913 #error " [ || DEF_ENABLED ] "
914 
915 #elif ((LIB_MEM_CFG_ALLOC_EN != DEF_DISABLED) && \
916  (LIB_MEM_CFG_ALLOC_EN != DEF_ENABLED ))
917 #error "LIB_MEM_CFG_ALLOC_EN illegally #define'd in 'app_cfg.h'"
918 #error " [MUST be DEF_DISABLED] "
919 #error " [ || DEF_ENABLED ] "
920 
921 
922 #elif (LIB_MEM_CFG_ALLOC_EN == DEF_ENABLED)
923 
924 #ifndef LIB_MEM_CFG_HEAP_SIZE
925 #error "LIB_MEM_CFG_HEAP_SIZE not #define'd in 'app_cfg.h'"
926 #error " [MUST be > 0] "
927 
928 #elif (LIB_MEM_CFG_HEAP_SIZE < 1)
929 
930 #error "LIB_MEM_CFG_HEAP_SIZE illegally #define'd in 'app_cfg.h'"
931 #error " [MUST be > 0] "
932 #endif
933 
934 #endif
935 
936 
937 /*$PAGE*/
938 /*
939 *********************************************************************************************************
940 * MODULE END
941 *********************************************************************************************************
942 */
943 
944 #endif /* End of lib mem module include. */
945