UCOS_TI_LM3S_Keil
 全部 结构体 文件 函数 变量 类型定义 宏定义 
lib_def.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 * CORE CUSTOM LIBRARY MODULE
28 *
29 * Filename : lib_def.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_DEF_MODULE_PRESENT
58 #define LIB_DEF_MODULE_PRESENT
59 
60 
61 /*$PAGE*/
62 /*
63 *********************************************************************************************************
64 * CUSTOM LIBRARY MODULE VERSION NUMBER
65 *
66 * Note(s) : (1) (a) The custom library module software version is denoted as follows :
67 *
68 * Vx.yy
69 *
70 * where
71 * V denotes 'Version' label
72 * x denotes major software version revision number
73 * yy denotes minor software version revision number
74 *
75 * (b) The software version label #define is formatted as follows :
76 *
77 * ver = x.yy * 100
78 *
79 * where
80 * ver denotes software version number scaled as an integer value
81 * x.yy denotes software version number
82 *********************************************************************************************************
83 */
84 
85 #define LIB_VERSION 130u /* See Note #1. */
86 
87 
88 /*
89 *********************************************************************************************************
90 * INCLUDE FILES
91 *
92 * Note(s) : (1) The following common software files are located in the following directories :
93 *
94 * (a) <Custom Library Directory>\lib*.*
95 *
96 * (b) (1) <CPU-Compiler Directory>\cpu_def.h
97 *
98 * (2) <CPU-Compiler Directory><cpu><compiler>\cpu*.*
99 *
100 * where
101 * <Custom Library Directory> directory path for custom library software
102 * <CPU-Compiler Directory> directory path for common CPU-compiler software
103 * <cpu> directory name for specific processor (CPU)
104 * <compiler> directory name for specific compiler
105 *
106 * (2) Compiler MUST be configured to include the '<Custom Library Directory>\uC-LIB\',
107 * '<CPU-Compiler Directory>\' directory, & the specific CPU-compiler directory as
108 * additional include path directories.
109 *********************************************************************************************************
110 */
111 
112 #include <cpu.h>
113 
114 
115 /*$PAGE*/
116 /*
117 *********************************************************************************************************
118 * STANDARD DEFINES
119 *********************************************************************************************************
120 */
121 
122  /* ----------------- BOOLEAN DEFINES ------------------ */
123 #define DEF_FALSE 0u
124 #define DEF_TRUE 1u
125 
126 #define DEF_NO 0u
127 #define DEF_YES 1u
128 
129 #define DEF_DISABLED 0u
130 #define DEF_ENABLED 1u
131 
132 #define DEF_INACTIVE 0u
133 #define DEF_ACTIVE 1u
134 
135 #define DEF_OFF 0u
136 #define DEF_ON 1u
137 
138 #define DEF_CLR 0u
139 #define DEF_SET 1u
140 
141 #define DEF_FAIL 0u
142 #define DEF_OK 1u
143 
144 
145  /* ------------------- BIT DEFINES -------------------- */
146 #define DEF_BIT_NONE 0x00u
147 
148 #define DEF_BIT_00 0x01u
149 #define DEF_BIT_01 0x02u
150 #define DEF_BIT_02 0x04u
151 #define DEF_BIT_03 0x08u
152 #define DEF_BIT_04 0x10u
153 #define DEF_BIT_05 0x20u
154 #define DEF_BIT_06 0x40u
155 #define DEF_BIT_07 0x80u
156 
157 #define DEF_BIT_08 0x0100u
158 #define DEF_BIT_09 0x0200u
159 #define DEF_BIT_10 0x0400u
160 #define DEF_BIT_11 0x0800u
161 #define DEF_BIT_12 0x1000u
162 #define DEF_BIT_13 0x2000u
163 #define DEF_BIT_14 0x4000u
164 #define DEF_BIT_15 0x8000u
165 
166 #define DEF_BIT_16 0x00010000u
167 #define DEF_BIT_17 0x00020000u
168 #define DEF_BIT_18 0x00040000u
169 #define DEF_BIT_19 0x00080000u
170 #define DEF_BIT_20 0x00100000u
171 #define DEF_BIT_21 0x00200000u
172 #define DEF_BIT_22 0x00400000u
173 #define DEF_BIT_23 0x00800000u
174 
175 #define DEF_BIT_24 0x01000000u
176 #define DEF_BIT_25 0x02000000u
177 #define DEF_BIT_26 0x04000000u
178 #define DEF_BIT_27 0x08000000u
179 #define DEF_BIT_28 0x10000000u
180 #define DEF_BIT_29 0x20000000u
181 #define DEF_BIT_30 0x40000000u
182 #define DEF_BIT_31 0x80000000u
183 
184  /* ------------------ OCTET DEFINES ------------------- */
185 #define DEF_OCTET_NBR_BITS 8u
186 #define DEF_OCTET_MASK 0xFFu
187 
188 #define DEF_NIBBLE_NBR_BITS 4u
189 #define DEF_NIBBLE_MASK 0x0Fu
190 
191 
192  /* --------------- NUMBER BASE DEFINES ---------------- */
193 #define DEF_NBR_BASE_BIN 2u
194 #define DEF_NBR_BASE_OCT 8u
195 #define DEF_NBR_BASE_DEC 10u
196 #define DEF_NBR_BASE_HEX 16u
197 
198 
199 /*$PAGE*/
200  /* ----------------- INTEGER DEFINES ------------------ */
201 #define DEF_INT_08_NBR_BITS 8u
202 #define DEF_INT_08_MASK 0xFFu
203 
204 #define DEF_INT_08U_MIN_VAL 0u
205 #define DEF_INT_08U_MAX_VAL 255u
206 
207 #define DEF_INT_08S_MIN_VAL_ONES_CPL (-127)
208 #define DEF_INT_08S_MAX_VAL_ONES_CPL 127
209 
210 #define DEF_INT_08S_MIN_VAL (DEF_INT_08S_MIN_VAL_ONES_CPL - 1)
211 #define DEF_INT_08S_MAX_VAL DEF_INT_08S_MAX_VAL_ONES_CPL
212 
213 #define DEF_INT_08U_NBR_DIG_MIN 1u
214 #define DEF_INT_08U_NBR_DIG_MAX 3u
215 
216 #define DEF_INT_08S_NBR_DIG_MIN 3u
217 #define DEF_INT_08S_NBR_DIG_MAX 3u
218 
219 
220 
221 #define DEF_INT_16_NBR_BITS 16u
222 #define DEF_INT_16_MASK 0xFFFFu
223 
224 #define DEF_INT_16U_MIN_VAL 0u
225 #define DEF_INT_16U_MAX_VAL 65535u
226 
227 #define DEF_INT_16S_MIN_VAL_ONES_CPL (-32767)
228 #define DEF_INT_16S_MAX_VAL_ONES_CPL 32767
229 
230 #define DEF_INT_16S_MIN_VAL (DEF_INT_16S_MIN_VAL_ONES_CPL - 1)
231 #define DEF_INT_16S_MAX_VAL DEF_INT_16S_MAX_VAL_ONES_CPL
232 
233 #define DEF_INT_16U_NBR_DIG_MIN 1u
234 #define DEF_INT_16U_NBR_DIG_MAX 5u
235 
236 #define DEF_INT_16S_NBR_DIG_MIN 5u
237 #define DEF_INT_16S_NBR_DIG_MAX 5u
238 
239 
240 
241 #define DEF_INT_32_NBR_BITS 32u
242 #define DEF_INT_32_MASK 0xFFFFFFFFu
243 
244 #define DEF_INT_32U_MIN_VAL 0u
245 #define DEF_INT_32U_MAX_VAL 4294967295u
246 
247 #define DEF_INT_32S_MIN_VAL_ONES_CPL (-2147483647)
248 #define DEF_INT_32S_MAX_VAL_ONES_CPL 2147483647
249 
250 #define DEF_INT_32S_MIN_VAL (DEF_INT_32S_MIN_VAL_ONES_CPL - 1)
251 #define DEF_INT_32S_MAX_VAL DEF_INT_32S_MAX_VAL_ONES_CPL
252 
253 #define DEF_INT_32U_NBR_DIG_MIN 1u
254 #define DEF_INT_32U_NBR_DIG_MAX 10u
255 
256 #define DEF_INT_32S_NBR_DIG_MIN 10u
257 #define DEF_INT_32S_NBR_DIG_MAX 10u
258 
259 
260 
261 #define DEF_INT_64_NBR_BITS 64u
262 #define DEF_INT_64_MASK 0xFFFFFFFFFFFFFFFFu
263 
264 #define DEF_INT_64U_MIN_VAL 0u
265 #define DEF_INT_64U_MAX_VAL 18446744073709551615u
266 
267 #define DEF_INT_64S_MIN_VAL_ONES_CPL (-9223372036854775807)
268 #define DEF_INT_64S_MAX_VAL_ONES_CPL 9223372036854775807
269 
270 #define DEF_INT_64S_MIN_VAL (DEF_INT_64S_MIN_VAL_ONES_CPL - 1)
271 #define DEF_INT_64S_MAX_VAL DEF_INT_64S_MAX_VAL_ONES_CPL
272 
273 #define DEF_INT_64U_NBR_DIG_MIN 1u
274 #define DEF_INT_64U_NBR_DIG_MAX 20u
275 
276 #define DEF_INT_64S_NBR_DIG_MIN 19u
277 #define DEF_INT_64S_NBR_DIG_MAX 19u
278 
279 
280 
281 /*$PAGE*/
282  /* --------------- CPU INTEGER DEFINES ---------------- */
283 #define DEF_INT_CPU_NBR_BITS (CPU_CFG_DATA_SIZE * DEF_OCTET_NBR_BITS)
284 
285 
286 #if (DEF_INT_CPU_NBR_BITS == DEF_INT_08_NBR_BITS)
287 
288 
289 #define DEF_INT_CPU_MASK DEF_INT_08_MASK
290 
291 #define DEF_INT_CPU_U_MIN_VAL DEF_INT_08U_MIN_VAL
292 #define DEF_INT_CPU_U_MAX_VAL DEF_INT_08U_MAX_VAL
293 
294 #define DEF_INT_CPU_S_MIN_VAL DEF_INT_08S_MIN_VAL
295 #define DEF_INT_CPU_S_MAX_VAL DEF_INT_08S_MAX_VAL
296 
297 #define DEF_INT_CPU_S_MIN_VAL_ONES_CPL DEF_INT_08S_MIN_VAL_ONES_CPL
298 #define DEF_INT_CPU_S_MAX_VAL_ONES_CPL DEF_INT_08S_MAX_VAL_ONES_CPL
299 
300 
301 
302 #elif (DEF_INT_CPU_NBR_BITS == DEF_INT_16_NBR_BITS)
303 
304 
305 #define DEF_INT_CPU_MASK DEF_INT_16_MASK
306 
307 #define DEF_INT_CPU_U_MIN_VAL DEF_INT_16U_MIN_VAL
308 #define DEF_INT_CPU_U_MAX_VAL DEF_INT_16U_MAX_VAL
309 
310 #define DEF_INT_CPU_S_MIN_VAL DEF_INT_16S_MIN_VAL
311 #define DEF_INT_CPU_S_MAX_VAL DEF_INT_16S_MAX_VAL
312 
313 #define DEF_INT_CPU_S_MIN_VAL_ONES_CPL DEF_INT_16S_MIN_VAL_ONES_CPL
314 #define DEF_INT_CPU_S_MAX_VAL_ONES_CPL DEF_INT_16S_MAX_VAL_ONES_CPL
315 
316 
317 
318 #elif (DEF_INT_CPU_NBR_BITS == DEF_INT_32_NBR_BITS)
319 
320 
321 #define DEF_INT_CPU_MASK DEF_INT_32_MASK
322 
323 #define DEF_INT_CPU_U_MIN_VAL DEF_INT_32U_MIN_VAL
324 #define DEF_INT_CPU_U_MAX_VAL DEF_INT_32U_MAX_VAL
325 
326 #define DEF_INT_CPU_S_MIN_VAL DEF_INT_32S_MIN_VAL
327 #define DEF_INT_CPU_S_MAX_VAL DEF_INT_32S_MAX_VAL
328 
329 #define DEF_INT_CPU_S_MIN_VAL_ONES_CPL DEF_INT_32S_MIN_VAL_ONES_CPL
330 #define DEF_INT_CPU_S_MAX_VAL_ONES_CPL DEF_INT_32S_MAX_VAL_ONES_CPL
331 
332 
333 
334 #elif (DEF_INT_CPU_NBR_BITS == DEF_INT_64_NBR_BITS)
335 
336 
337 #define DEF_INT_CPU_MASK DEF_INT_64_MASK
338 
339 #define DEF_INT_CPU_U_MIN_VAL DEF_INT_64U_MIN_VAL
340 #define DEF_INT_CPU_U_MAX_VAL DEF_INT_64U_MAX_VAL
341 
342 #define DEF_INT_CPU_S_MIN_VAL DEF_INT_64S_MIN_VAL
343 #define DEF_INT_CPU_S_MAX_VAL DEF_INT_64S_MAX_VAL
344 
345 #define DEF_INT_CPU_S_MIN_VAL_ONES_CPL DEF_INT_64S_MIN_VAL_ONES_CPL
346 #define DEF_INT_CPU_S_MAX_VAL_ONES_CPL DEF_INT_64S_MAX_VAL_ONES_CPL
347 
348 
349 
350 #else
351 
352 #error "CPU_CFG_DATA_SIZE illegally #defined in 'cpu.h' "
353 #error " [See 'cpu.h CONFIGURATION ERRORS']"
354 
355 #endif
356 
357 
358 
359 /*$PAGE*/
360  /* ------------------- TIME DEFINES ------------------- */
361 #define DEF_TIME_NBR_DAY_PER_WK 7uL
362 #define DEF_TIME_NBR_DAY_PER_YR 365uL
363 #define DEF_TIME_NBR_DAY_PER_YR_LEAP 366uL
364 
365 #define DEF_TIME_NBR_HR_PER_DAY 24uL
366 #define DEF_TIME_NBR_HR_PER_WK (DEF_TIME_NBR_HR_PER_DAY * DEF_TIME_NBR_DAY_PER_WK )
367 #define DEF_TIME_NBR_HR_PER_YR (DEF_TIME_NBR_HR_PER_DAY * DEF_TIME_NBR_DAY_PER_YR )
368 #define DEF_TIME_NBR_HR_PER_YR_LEAP (DEF_TIME_NBR_HR_PER_DAY * DEF_TIME_NBR_DAY_PER_YR_LEAP)
369 
370 #define DEF_TIME_NBR_MIN_PER_HR 60uL
371 #define DEF_TIME_NBR_MIN_PER_DAY (DEF_TIME_NBR_MIN_PER_HR * DEF_TIME_NBR_HR_PER_DAY )
372 #define DEF_TIME_NBR_MIN_PER_WK (DEF_TIME_NBR_MIN_PER_DAY * DEF_TIME_NBR_DAY_PER_WK )
373 #define DEF_TIME_NBR_MIN_PER_YR (DEF_TIME_NBR_MIN_PER_DAY * DEF_TIME_NBR_DAY_PER_YR )
374 #define DEF_TIME_NBR_MIN_PER_YR_LEAP (DEF_TIME_NBR_MIN_PER_DAY * DEF_TIME_NBR_DAY_PER_YR_LEAP)
375 
376 #define DEF_TIME_NBR_SEC_PER_MIN 60uL
377 #define DEF_TIME_NBR_SEC_PER_HR (DEF_TIME_NBR_SEC_PER_MIN * DEF_TIME_NBR_MIN_PER_HR )
378 #define DEF_TIME_NBR_SEC_PER_DAY (DEF_TIME_NBR_SEC_PER_HR * DEF_TIME_NBR_HR_PER_DAY )
379 #define DEF_TIME_NBR_SEC_PER_WK (DEF_TIME_NBR_SEC_PER_DAY * DEF_TIME_NBR_DAY_PER_WK )
380 #define DEF_TIME_NBR_SEC_PER_YR (DEF_TIME_NBR_SEC_PER_DAY * DEF_TIME_NBR_DAY_PER_YR )
381 #define DEF_TIME_NBR_SEC_PER_YR_LEAP (DEF_TIME_NBR_SEC_PER_DAY * DEF_TIME_NBR_DAY_PER_YR_LEAP)
382 
383 #define DEF_TIME_NBR_mS_PER_SEC 1000uL
384 #define DEF_TIME_NBR_uS_PER_SEC 1000000uL
385 #define DEF_TIME_NBR_nS_PER_SEC 1000000000uL
386 
387 
388 /*$PAGE*/
389 /*
390 *********************************************************************************************************
391 * ERROR CODES
392 *
393 * Note(s) : (1) All generic library error codes are #define'd in 'lib_def.h';
394 * Any module-specific error codes are #define'd in library module header files.
395 *********************************************************************************************************
396 */
397 
398 #define LIB_ERR_NONE 0
399 
400 
401 /*$PAGE*/
402 /*
403 *********************************************************************************************************
404 * DATA TYPES
405 *********************************************************************************************************
406 */
407 
408 /*
409 *********************************************************************************************************
410 * LIBRARY ERROR CODES DATA TYPE
411 *********************************************************************************************************
412 */
413 
415 
416 
417 /*
418 *********************************************************************************************************
419 * GLOBAL VARIABLES
420 *********************************************************************************************************
421 */
422 
423 
424 /*$PAGE*/
425 /*
426 *********************************************************************************************************
427 * BIT MACRO'S
428 *********************************************************************************************************
429 */
430 
431 /*
432 *********************************************************************************************************
433 * DEF_BIT()
434 *
435 * Description : Create bit mask with single, specified bit set.
436 *
437 * Argument(s) : bit Bit number of bit to set.
438 *
439 * Return(s) : Bit mask with single, specified bit set.
440 *
441 * Caller(s) : Application.
442 *
443 * Note(s) : (1) 'bit' values that overflow the target CPU &/or compiler environment (e.g. negative
444 * or greater-than-CPU-data-size values) MAY generate compiler warnings &/or errors.
445 *********************************************************************************************************
446 */
447 
448 #define DEF_BIT(bit) (1u << (bit))
449 
450 
451 /*$PAGE*/
452 /*
453 *********************************************************************************************************
454 * DEF_BIT_MASK()
455 *
456 * Description : Shift a bit mask.
457 *
458 * Argument(s) : bit_mask Bit mask to shift.
459 *
460 * bit_shift Number of bit positions to left-shift bit mask.
461 *
462 * Return(s) : Shifted bit mask.
463 *
464 * Caller(s) : Application.
465 *
466 * Note(s) : (1) 'bit_shift' values that overflow the target CPU &/or compiler environment (e.g. negative
467 * or greater-than-CPU-data-size values) MAY generate compiler warnings &/or errors.
468 *********************************************************************************************************
469 */
470 
471 #define DEF_BIT_MASK(bit_mask, bit_shift) ((bit_mask) << (bit_shift))
472 
473 
474 /*
475 *********************************************************************************************************
476 * DEF_BIT_FIELD()
477 *
478 * Description : Create & shift a contiguous bit field.
479 *
480 * Argument(s) : bit_field Number of contiguous bits to set in the bit field.
481 *
482 * bit_shift Number of bit positions to left-shift bit field.
483 *
484 * Return(s) : Shifted bit field.
485 *
486 * Caller(s) : Application.
487 *
488 * Note(s) : (1) 'bit_field'/'bit_shift' values that overflow the target CPU &/or compiler environment
489 * (e.g. negative or greater-than-CPU-data-size values) MAY generate compiler warnings
490 * &/or errors.
491 *********************************************************************************************************
492 */
493 
494 #define DEF_BIT_FIELD(bit_field, bit_shift) ((((bit_field) >= DEF_INT_CPU_NBR_BITS) ? (DEF_INT_CPU_U_MAX_VAL) \
495  : (DEF_BIT(bit_field) - 1)) \
496  << (bit_shift))
497 
498 
499 /*$PAGE*/
500 /*
501 *********************************************************************************************************
502 * DEF_BIT_SET()
503 *
504 * Description : Set specified bit(s) in a value.
505 *
506 * Argument(s) : val Value to modify by setting specified bit(s).
507 *
508 * mask Mask of bits to set.
509 *
510 * Return(s) : Modified value with specified bit(s) set.
511 *
512 * Caller(s) : Application.
513 *
514 * Note(s) : none.
515 *********************************************************************************************************
516 */
517 
518 #define DEF_BIT_SET(val, mask) ((val) |= (mask))
519 
520 
521 /*
522 *********************************************************************************************************
523 * DEF_BIT_CLR()
524 *
525 * Description : Clear specified bit(s) in a value.
526 *
527 * Argument(s) : val Value to modify by clearing specified bit(s).
528 *
529 * mask Mask of bits to clear.
530 *
531 * Return(s) : Modified value with specified bit(s) clear.
532 *
533 * Caller(s) : Application.
534 *
535 * Note(s) : none.
536 *********************************************************************************************************
537 */
538 
539 #define DEF_BIT_CLR(val, mask) ((val) &= ~(mask))
540 
541 
542 /*$PAGE*/
543 /*
544 *********************************************************************************************************
545 * DEF_BIT_IS_SET()
546 *
547 * Description : Determine if specified bit(s) in a value are set.
548 *
549 * Argument(s) : val Value to check for specified bit(s) set.
550 *
551 * mask Mask of bits to check if set.
552 *
553 * Return(s) : DEF_YES, if ALL specified bit(s) are set in value.
554 *
555 * DEF_NO, if ALL specified bit(s) are NOT set in value.
556 *
557 * Caller(s) : Application.
558 *
559 * Note(s) : none.
560 *********************************************************************************************************
561 */
562 
563 #define DEF_BIT_IS_SET(val, mask) ((((val) & (mask)) == (mask)) ? (DEF_YES) : (DEF_NO ))
564 
565 
566 /*
567 *********************************************************************************************************
568 * DEF_BIT_IS_CLR()
569 *
570 * Description : Determine if specified bit(s) in a value are clear.
571 *
572 * Argument(s) : val Value to check for specified bit(s) clear.
573 *
574 * mask Mask of bits to check if clear.
575 *
576 * Return(s) : DEF_YES, if ALL specified bit(s) are clear in value.
577 *
578 * DEF_NO, if ALL specified bit(s) are NOT clear in value.
579 *
580 * Caller(s) : Application.
581 *
582 * Note(s) : none.
583 *********************************************************************************************************
584 */
585 
586 #define DEF_BIT_IS_CLR(val, mask) (((val) & (mask)) ? (DEF_NO ) : (DEF_YES))
587 
588 
589 /*$PAGE*/
590 /*
591 *********************************************************************************************************
592 * DEF_BIT_IS_SET_ANY()
593 *
594 * Description : Determine if any specified bit(s) in a value are set.
595 *
596 * Argument(s) : val Value to check for specified bit(s) set.
597 *
598 * mask Mask of bits to check if set.
599 *
600 * Return(s) : DEF_YES, if ANY specified bit(s) are set in value.
601 *
602 * DEF_NO, if ALL specified bit(s) are NOT set in value.
603 *
604 * Caller(s) : Application.
605 *
606 * Note(s) : none.
607 *********************************************************************************************************
608 */
609 
610 #define DEF_BIT_IS_SET_ANY(val, mask) (((val) & (mask)) ? (DEF_YES) : (DEF_NO ))
611 
612 
613 /*
614 *********************************************************************************************************
615 * DEF_BIT_IS_CLR_ANY()
616 *
617 * Description : Determine if any specified bit(s) in a value are clear.
618 *
619 * Argument(s) : val Value to check for specified bit(s) clear.
620 *
621 * mask Mask of bits to check if clear.
622 *
623 * Return(s) : DEF_YES, if ANY specified bit(s) are clear in value.
624 *
625 * DEF_NO, if ALL specified bit(s) are NOT clear in value.
626 *
627 * Note(s) : none.
628 *********************************************************************************************************
629 */
630 
631 #define DEF_BIT_IS_CLR_ANY(val, mask) ((((val) & (mask)) != (mask)) ? (DEF_YES) : (DEF_NO ))
632 
633 
634 /*$PAGE*/
635 /*
636 *********************************************************************************************************
637 * MATH MACRO'S
638 *
639 * Note(s) : Ideally, ALL mathematical macro's & functions SHOULD be defined in the custom mathematic
640 * library ('lib_math.*'). #### However, to maintain backwards compatibility with previously-
641 * released modules, mathematical macro & function definitions should only be moved to the
642 * custom mathematic library once all previously-released modules are updated to include the
643 * custom mathematic library.
644 *********************************************************************************************************
645 */
646 
647 /*
648 *********************************************************************************************************
649 * DEF_MIN()
650 *
651 * Description : Determine the minimum of two values.
652 *
653 * Argument(s) : a First value.
654 *
655 * b Second value.
656 *
657 * Return(s) : Minimum of the two values.
658 *
659 * Caller(s) : Application.
660 *
661 * Note(s) : none.
662 *********************************************************************************************************
663 */
664 
665 #define DEF_MIN(a, b) (((a) < (b)) ? (a) : (b))
666 
667 
668 /*
669 *********************************************************************************************************
670 * DEF_MAX()
671 *
672 * Description : Determine the maximum of two values.
673 *
674 * Argument(s) : a First value.
675 *
676 * b Second value.
677 *
678 * Return(s) : Maximum of the two values.
679 *
680 * Note(s) : none.
681 *********************************************************************************************************
682 */
683 
684 #define DEF_MAX(a, b) (((a) > (b)) ? (a) : (b))
685 
686 
687 /*$PAGE*/
688 /*
689 *********************************************************************************************************
690 * DEF_ABS()
691 *
692 * Description : Determine the absolute value of a value.
693 *
694 * Argument(s) : a Value to calculate absolute value.
695 *
696 * Return(s) : Absolute value of the value.
697 *
698 * Caller(s) : Application.
699 *
700 * Note(s) : none.
701 *********************************************************************************************************
702 */
703 
704 #define DEF_ABS(a) (((a) < 0) ? (-(a)) : (a))
705 
706 
707 /*$PAGE*/
708 /*
709 *********************************************************************************************************
710 * FUNCTION PROTOTYPES
711 *********************************************************************************************************
712 */
713 
714 
715 /*
716 *********************************************************************************************************
717 * CONFIGURATION ERRORS
718 *********************************************************************************************************
719 */
720 
721 
722 /*$PAGE*/
723 /*
724 *********************************************************************************************************
725 * MODULE END
726 *********************************************************************************************************
727 */
728 
729 #endif /* End of lib def module include. */
730