ConOpSys V2970  P004.07
ANVILEX control operating system
Anvilex_Library.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file Anvilex_Library.h
3 //! @brief Anvilex library header file.
4 //! @copyright (C) 2004-2020 ANVILEX LLC
5 //! @attention No special attention requered.
6 //! $HeadURL: https://192.168.3.4:8443/svn/P004_07/ConOpSys/Common/Anvilex_Library.h $
7 //! $Revision: 2765 $
8 //! $Date: 2021-07-04 04:32:25 +0500 (So, 04 Jul 2021) $
9 //! $Author: minch $
10 //------------------------------------------------------------------------------
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are met:
14 //
15 // 1. Redistributions of source code must retain the above copyright notice,
16 // this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright notice,
19 // this list of conditions and the following disclaimer in the documentation
20 // and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of ANVILEX nor the names of its contributors may be
23 // used to endorse or promote products derived from this software without
24 // specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
30 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 // POSSIBILITY OF SUCH DAMAGE.
37 //
38 //------------------------------------------------------------------------------
39 
40 //------------------------------------------------------------------------------
41 // Protecting header files from mutual, recursive inclusion.
42 //------------------------------------------------------------------------------
43 
44 #pragma once
45 
46 //------------------------------------------------------------------------------
47 // system includes
48 //------------------------------------------------------------------------------
49 
50 //------------------------------------------------------------------------------
51 // project includes
52 //------------------------------------------------------------------------------
53 
54 #include "Defines.h"
55 
56 //------------------------------------------------------------------------------
57 // Export function prototypes
58 //------------------------------------------------------------------------------
59 
60 //------------------------------------------------------------------------------
61 //! @brief Decode hex string to 8 bit unsigned integer representation
62 //! @note None
63 //! @param [in] *c8_Input_Buffer Pointer to input hex string
64 //! @param [out] *u8_Output_Buffer Pointer to the output buffer
65 //! @param [in] u16_Input_Size Length of input hex string
66 //! @param [in] u16_Output_Size Size of the output buffer
67 //! @return Convertion status
68 //! @retval false - Convertion failed
69 //! @retval true - Convertion successed
70 //! @attention None
71 //------------------------------------------------------------------------------
72 
73 extern BOOL Decode_Hex_Buffer( C8 *c8_Input_Buffer, U8* u8_Output_Buffer, U16 u16_Input_Size, U16 u16_Output_Size );
74 
75 //------------------------------------------------------------------------------
76 //! @brief Check input string for integer representation
77 //! @note None
78 //! @param [in] *c8_Input_String Input string
79 //! @return Checking status
80 //! @retval false - String don't have an integer value representation
81 //! @retval true - String have an integer value representation
82 //! @attention None
83 //------------------------------------------------------------------------------
84 
85 extern BOOL Is_Integer( C8 *c8_Input_String );
86 
87 //------------------------------------------------------------------------------
88 //! @brief Check input string for floating point representation
89 //! @note None
90 //! @param [in] *c8_Input_String Input string
91 //! @return Checking status
92 //! @retval false - String don't have a floating point value representation
93 //! @retval true - String have a floating point value representation
94 //! @attention None
95 //------------------------------------------------------------------------------
96 
97 extern BOOL Is_Float( C8 *c8_Input_String );
98 
99 //------------------------------------------------------------------------------
100 //! @brief Check input string for hexadecimal representation
101 //! @note None
102 //! @param [in] *c8_Input_String Input string
103 //! @return Checking status
104 //! @retval false - String don't have a hexadecimal value representation
105 //! @retval true - String have a hexadecimal value representation
106 //! @attention None
107 //------------------------------------------------------------------------------
108 
109 extern BOOL Is_Hex( C8 *c8_Input_String );
110 
111 //------------------------------------------------------------------------------
112 //! @brief Check for input 32-bit unsigned value is odd
113 //! @note None
114 //! @param [in] *u32_Value Input 32-bit unsigned value
115 //! @return Checking status
116 //! @retval false - 32 bit unsigned value is not odd
117 //! @retval true - 32 bit unsigned value is odd
118 //! @attention None
119 //------------------------------------------------------------------------------
120 
121 extern BOOL Is_Odd( U32 u32_Value );
122 
123 //------------------------------------------------------------------------------
124 //! @brief Check for input 32-bit unsigned value is even
125 //! @note None
126 //! @param [in] *u32_Value Input 32-bit unsigned value
127 //! @return Checking status
128 //! @retval false - 32 bit unsigned value is not even
129 //! @retval true - 32 bit unsigned value is even
130 //! @attention None
131 //------------------------------------------------------------------------------
132 
133 extern BOOL Is_Even( U32 u32_Value );
134 
135 //extern unsigned char Swap_Bit_Direction( unsigned char value );
136 //extern unsigned short Swap_Bit_Direction( unsigned short value );
137 
138 //------------------------------------------------------------------------------
139 //! @brief Convert 8 bit unsigned integer (U8) to 7-segment indicator code (S7)
140 //! @note None
141 //! @param [in] u8_Input_Value Input 8-bit unsigned integer value
142 //! @param [out] *s7_Output_Value Pointer to 7-segment indicator code
143 //! @return Conversion status
144 //! @retval false - Conversion failed
145 //! @retval true - Conversion successed
146 //! @attention None
147 //------------------------------------------------------------------------------
148 
149 extern BOOL Convert_U8_To_S7( U8 u8_Input_Value, S7 *s7_Output_Value );
150 
151 //------------------------------------------------------------------------------
152 //! @brief Convert 8 bit chaaracter (C8) to 7-segment indicator code (S7)
153 //! @note None
154 //! @param [in] c8_Input_Value Input 8-bit character code
155 //! @param [out] *s7_Output_Value Pointer to 7-segment indicator code
156 //! @return Conversion status
157 //! @retval false - Conversion failed
158 //! @retval true - Conversion successed
159 //! @attention None
160 //------------------------------------------------------------------------------
161 
162 extern BOOL Convert_C8_To_S7( C8 c8_Input_Value, S7 *s7_Output_Value );
163 
164 //------------------------------------------------------------------------------
165 //! @brief Convert 8 bit character (C8) to 7-segment indicator code (S7) and insert decomal point information
166 //! @note None
167 //! @param [in] c8_Input_Value Input 8-bit character code
168 //! @param [in] bool_Decimal_Point Decomal point status
169 //! @param [out] *s7_Output_Value Pointer to 7-segment indicator code
170 //! @return Conversion status
171 //! @retval false - Conversion failed
172 //! @retval true - Conversion successed
173 //! @attention None
174 //------------------------------------------------------------------------------
175 
176 extern BOOL Convert_C8_To_S7( C8 c8_Input_Value, BOOL bool_Decimal_Point, S7 *s7_Output_Value );
177 
178 //------------------------------------------------------------------------------
179 //! @brief Convert 16 bit unsigned integer (U16) to 7-segment indicator code (S7) string
180 //! @note None
181 //! @param [in] u16_Input_Value Input 16-bit unsigned integer value
182 //! @param [out] *s7_Output_String Pointer to string of 7-segment indicator codes
183 //! @return None
184 //! @attention None
185 //------------------------------------------------------------------------------
186 
187 extern VOID Convert_U16_To_S7_String( U16 u16_Input_Value, S7 *s7_Output_String );
188 
189 //------------------------------------------------------------------------------
190 //! @brief Convert 8 bit-unsigned integer value (U8) to two digit BCD2 code (U8)
191 //! @note None
192 //! @param [in] u8_Value Input 8-bit unsigned integer value
193 //! @return Two digit BCD code
194 //! @attention Input value not checked for valid range
195 //------------------------------------------------------------------------------
196 
197 extern U8 Byte_To_BCD2( U8 u8_Value );
198 
199 //------------------------------------------------------------------------------
200 //! @brief Convert two digit BCD2 code (U8) to 8-bit unsigned integer value (U8)
201 //! @note None
202 //! @param [in] u8_Value Input two digit BCD2 code value
203 //! @return Two digit BCD code
204 //! @attention Input value not checked for valid range
205 //------------------------------------------------------------------------------
206 
207 extern U8 BCD2_To_Byte( U8 u8_Value );
208 
209 //------------------------------------------------------------------------------
210 
211 extern U8 Hex_To_U8( C8 c8_Value );
212 
213 //------------------------------------------------------------------------------
214 
215 extern C8 Low_Nibble_To_Hex( U8 u8_Value );
216 
217 //------------------------------------------------------------------------------
218 
219 extern C8 High_Nibble_To_Hex( U8 u8_Value );
220 
221 //------------------------------------------------------------------------------
222 // Bit swaping functions
223 //------------------------------------------------------------------------------
224 
225 extern U8 Bit_Swap( U8 u8_Value ); //!< Bit swaping
226 
227 //------------------------------------------------------------------------------
228 
229 extern U16 Swap_Bytes_U16( U16 u16_Value );
230 
231 //------------------------------------------------------------------------------
232 
233 extern U32 Swap_Bytes_U32( U32 u16_Value );
234 
235 //------------------------------------------------------------------------------
236 
237 extern U64 Swap_Bytes_U64( U64 u64_Value );
238 
239 //------------------------------------------------------------------------------
240 
241 extern BOOL Is_Bit_Set( U16 u16_Value, U8 u8_Index );
242 
243 //------------------------------------------------------------------------------
244 // Cross data type conversion with saturation
245 //------------------------------------------------------------------------------
246 
247 //------------------------------------------------------------------------------
248 //! @brief Convert 32-bit unsigned integer number (U32) to 16-bit unsigned indeger number (U16) with saturation at the bounds of datatype.
249 //! @note None
250 //! @param [in] u32_Input_Value Input 32-bit unsigned integer value
251 //! @return Result of convertion as unsigned integer number (U16)
252 //! @attention None
253 //------------------------------------------------------------------------------
254 
255 extern U16 Convert_U32_To_U16_Satureted( U32 u32_Input_Value );
256 
257 //------------------------------------------------------------------------------
258 //! @brief Convert 64-bit unsigned integer number (U64) to 16-bit unsigned indeger number (U16) with saturation at the bounds of datatype.
259 //! @note None
260 //! @param [in] u64_Input_Value Input 64-bit unsigned integer value
261 //! @return Result of convertion as unsigned integer number (U16)
262 //! @attention None
263 //------------------------------------------------------------------------------
264 
265 extern U16 Convert_U64_To_U16_Satureted( U64 u64_Input_Value );
266 
267 //------------------------------------------------------------------------------
268 //! @brief Convert 32-bit floating point number (F32) to 16-bit signed indeger number (I16) with saturation at the bounds of datatype.
269 //! @note None
270 //! @param [in] f32_Input_Value Input 32-bit floating point value
271 //! @return Result of convertion as signed integer number (I16)
272 //! @attention None
273 //------------------------------------------------------------------------------
274 
275 extern I16 Convert_F32_To_Saturated_I16( F32 f32_Input_Value );
276 
277 //------------------------------------------------------------------------------
278 //! @brief Convert 32 bit floating point number (F32) to 16 bit unsigned indeger number (U16) with saturation at the bounds of datatype.
279 //! @note None
280 //! @param [in] f32_Input_Value Input 32-bit floating point value
281 //! @return Result of convertion as unsigned integer number (U16)
282 //! @attention None
283 //------------------------------------------------------------------------------
284 
285 extern U16 Convert_F32_To_Saturated_U16( F32 f32_Input_Value );
286 
287 //------------------------------------------------------------------------------
288 // Composition functions
289 //------------------------------------------------------------------------------
290 
291 extern VOID Split_U32( U32 u32_Input_Value, U16 *u16_Output_1, U16 *u16_Output_0 );
292 
293 //------------------------------------------------------------------------------
294 //! @brief Compose U16 value from U8 values.
295 //! @note None
296 //! @param [in] u8_Input_Byte_1 Input byte 1, bits 8 to 15.
297 //! @param [in] u8_Input_Byte_0 Input byte 0, bits 0 to 7.
298 //! @return Output U16 value.
299 //! @attention None
300 //------------------------------------------------------------------------------
301 
302 extern U16 Compose_U16( U8 u8_Input_Byte_1, U8 u8_Input_Byte_0 );
303 
304 //------------------------------------------------------------------------------
305 //! @brief Compose U32 value from U8 values.
306 //! @note None
307 //! @param [in] u8_Input_Byte_3 Input byte 3, bits 24 to 31.
308 //! @param [in] u8_Input_Byte_2 Input byte 2, bits 16 to 23.
309 //! @param [in] u8_Input_Byte_1 Input byte 1, bits 8 to 15.
310 //! @param [in] u8_Input_Byte_0 Input byte 0, bits 0 to 7.
311 //! @return Output U32 value.
312 //! @attention None
313 //------------------------------------------------------------------------------
314 
315 extern U32 Compose_U32( U8 u8_Input_Byte_3, U8 u8_Input_Byte_2, U8 u8_Input_Byte_1, U8 u8_Input_Byte_0 );
316 
317 //------------------------------------------------------------------------------
318 //! @brief Compose U32 value from U16 values.
319 //! @note None
320 //! @param [in] u16_Input_1 Input word 1, bits 16 to 31.
321 //! @param [in] u16_Input_0 Input word 0, bits 0 to 15.
322 //! @return Output U32 value.
323 //! @attention None
324 //------------------------------------------------------------------------------
325 
326 extern U32 Compose_U32( U16 u16_Input_1, U16 u16_Input_0 );
327 
328 //------------------------------------------------------------------------------
329 //! @brief Compose U64 value from U16 values.
330 //! @note None
331 //! @param [in] u16_Input_3 Input word 3, bits 48 to 63.
332 //! @param [in] u16_Input_2 Input word 2, bits 32 to 47.
333 //! @param [in] u16_Input_1 Input word 1, bits 16 to 31.
334 //! @param [in] u16_Input_0 Input word 0, bits 0 to 15.
335 //! @return Output U64 value.
336 //! @attention None
337 //------------------------------------------------------------------------------
338 
339 extern U64 Compose_U64( U16 u16_Input_3, U16 u16_Input_2, U16 u16_Input_1, U16 u16_Input_0 );
340 
341 //------------------------------------------------------------------------------
342 //! @brief Compose U64 value from U32 values.
343 //! @note None
344 //! @param [in] u32_Input_1 Input word 1, bits 32 to 63.
345 //! @param [in] u32_Input_0 Input word 0, bits 0 to 31.
346 //! @return Output U64 value.
347 //! @attention None
348 //------------------------------------------------------------------------------
349 
350 extern U64 Compose_U64( U32 u32_Input_1, U32 u32_Input_0 );
351 
352 //------------------------------------------------------------------------------
353 //! @brief Compose F32 value from U8 values.
354 //! @note None
355 //! @param [in] u8_Input_Byte_3 Input byte 3, bits 24 to 31.
356 //! @param [in] u8_Input_Byte_2 Input byte 2, bits 16 to 23.
357 //! @param [in] u8_Input_Byte_1 Input byte 1, bits 8 to 15.
358 //! @param [in] u8_Input_Byte_0 Input byte 0, bits 0 to 7.
359 //! @return Output F32 value.
360 //! @attention None
361 //------------------------------------------------------------------------------
362 
363 extern F32 Compose_F32( U8 u8_Input_Byte_3, U8 u8_Input_Byte_2, U8 u8_Input_Byte_1, U8 u8_Input_Byte_0 );
364 
365 //------------------------------------------------------------------------------
366 // Extraction functions
367 //------------------------------------------------------------------------------
368 
369 //------------------------------------------------------------------------------
370 //! @brief Extract U8 value from U16 value.
371 //! @note None
372 //! @param [in] u16_Value Input U16 value.
373 //! @param [in] u8_Index Byte index. Can be 0 for extracting bits 0 to 7, 1 for extracting bits 8 to 15.
374 //! @return Output U8 value.
375 //! @attention None
376 //------------------------------------------------------------------------------
377 
378 extern U8 Extract_U8_From_U16( U16 u16_Value, U8 u8_Index );
379 
380 //------------------------------------------------------------------------------
381 //! @brief Extract U8 value from U32 value.
382 //! @note None
383 //! @param [in] u32_Value Input U32 value.
384 //! @param [in] u8_Index Byte index. Can be 0 for extracting bits 0 to 7, 1 for extracting bits 8 to 15, 2 for extracting bits 16 to 23, 3 for extracting bits 24 to 31.
385 //! @return Output U8 value.
386 //! @attention None
387 //------------------------------------------------------------------------------
388 
389 extern U8 Extract_U8_From_U32( U32 u32_Value, U8 u8_Index );
390 
391 //------------------------------------------------------------------------------
392 //! @brief Extract U16 value from U32 value.
393 //! @note None
394 //! @param [in] u32_Value Input U32 value.
395 //! @param [in] u8_Index Word index. Can be 0 for extrecting bits 0 to 15 or 1 for extracting bits 16 to 31.
396 //! @return Output U16 value.
397 //! @attention None
398 //------------------------------------------------------------------------------
399 
400 extern U16 Extract_U16_From_U32( U32 u32_Value, U8 u8_Index );
401 
402 //------------------------------------------------------------------------------
403 //! @brief Extract U8 value from F32 value.
404 //! @note None
405 //! @param [in] f32_Value Input F32 value.
406 //! @param [in] u8_Index Byte index. Can be 0 for extracting bits 0 to 7, 1 for extracting bits 8 to 15, 2 for extracting bits 16 to 23, 3 for extracting bits 24 to 31.
407 //! @return Output U8 value.
408 //! @attention None
409 //------------------------------------------------------------------------------
410 
411 extern U8 Extract_U8_From_F32( F32 f32_Value, U8 u8_Index );
412 
413 //------------------------------------------------------------------------------
414 //! @brief Extract U8 value from I8 value.
415 //! @note None
416 //! @param [in] i8_Value Input I8 value.
417 //! @return Output U8 value.
418 //! @attention None
419 //------------------------------------------------------------------------------
420 
421 extern U8 Extract_U8_From_I8( I8 i8_Value );
422 
423 //------------------------------------------------------------------------------
424 //! @brief Extract U8 value from I16 value.
425 //! @note None
426 //! @param [in] i16_Value Input I16 value.
427 //! @param [in] u8_Index Byte index. Can be 0 for extracting bits 0 to 7, 1 for extracting bits 8 to 15.
428 //! @return Output U8 value.
429 //! @attention None
430 //------------------------------------------------------------------------------
431 
432 extern U8 Extract_U8_From_I16( I16 i16_Value, U8 u8_Index );
433 
434 //------------------------------------------------------------------------------
435 //! @brief Extract U8 value from I32 value.
436 //! @note None
437 //! @param [in] i32_Value Input I32 value.
438 //! @param [in] u8_Index Byte index. Can be 0 for extracting bits 0 to 7, 1 for extracting bits 8 to 15, 2 for extracting bits 16 to 23, 3 for extracting bits 24 to 31.
439 //! @return Output U8 value.
440 //! @attention None
441 //------------------------------------------------------------------------------
442 
443 extern U8 Extract_U8_From_I32( I32 i32_Value, U8 u8_Index );
444 
445 //------------------------------------------------------------------------------
446 // Increment variable with saturation related functions
447 //------------------------------------------------------------------------------
448 
449 extern BOOL Increment_Saturated( U8 *u8_Value );
450 extern BOOL Increment_Saturated( U8 *u8_Value, U8 u8_Saturation );
451 
452 extern BOOL Increment_Saturated( U16 *u16_Value );
453 extern BOOL Increment_Saturated( U16 *u16_Value, U16 u16_Saturation );
454 
455 extern BOOL Increment_Saturated( U32 *u32_Value );
456 extern BOOL Increment_Saturated( U32 *u32_Value, U32 u32_Saturation );
457 
458 extern BOOL Increment_Saturated( U64 *u64_Value );
459 extern BOOL Increment_Saturated( U64 *u64_Value, U64 u64_Saturation );
460 
461 extern BOOL Increment_Saturated( F32 *f32_Value, F32 f32_Step, F32 f32_Saturation );
462 
463 //------------------------------------------------------------------------------
464 // Decrement variable with saturation related functions
465 //------------------------------------------------------------------------------
466 
467 extern BOOL Decrement_Saturated( U8 *u8_Value );
468 extern BOOL Decrement_Saturated( U8 *u8_Value, U8 u8_Saturation );
469 
470 extern BOOL Decrement_Saturated( U16 *u16_Value );
471 extern BOOL Decrement_Saturated( U16 *u16_Value, U16 u16_Saturation );
472 
473 extern BOOL Decrement_Saturated( U32 *u32_Value );
474 extern BOOL Decrement_Saturated( U32 *u32_Value, U32 u32_Saturation );
475 
476 //extern BOOL Decrement_Saturated( U64 *u64_Value );
477 //extern BOOL Decrement_Saturated( U64 *u64_Value, U64 u64_Saturation );
478 
479 extern BOOL Decrement_Saturated( F32 *f32_Value, F32 f32_Step, F32 f32_Saturation );
480 
481 //------------------------------------------------------------------------------
482 // Increment variable with overflow related functions
483 //------------------------------------------------------------------------------
484 
485 extern BOOL Increment_Overflowed( U8 *u8_Value, U8 u8_Maximal_Value );
486 
487 //------------------------------------------------------------------------------
488 
489 extern BOOL Increment_Overflowed( U16 *u16_Value, U16 u16_Maximal_Value );
490 
491 //------------------------------------------------------------------------------
492 
493 extern BOOL Increment_Overflowed( U32 *u32_Value, U32 u32_Maximal_Value );
494 
495 //------------------------------------------------------------------------------
496 
497 extern BOOL Increment_Overflowed( F32 *f32_Value, F32 f32_Step, F32 f32_Initial, F32 f32_Saturation );
498 
499 //------------------------------------------------------------------------------
500 //! @brief Return maximum value from two U8 values.
501 //! @note None
502 //! @param [in] u8_Value_1 First U8 value.
503 //! @param [in] u8_Value_2 Second U8 value.
504 //! @return Output U8 value.
505 //! @attention None
506 //------------------------------------------------------------------------------
507 
508 extern U8 Maximum_U8( U8 u8_Value_1, U8 u8_Value_2 );
509 
510 //------------------------------------------------------------------------------
511 //! @brief Return maximum value from two U16 values.
512 //! @note None
513 //! @param [in] u16_Value_1 First U16 value.
514 //! @param [in] u16_Value_2 Second U16 value.
515 //! @return Output U32 value.
516 //! @attention None
517 //------------------------------------------------------------------------------
518 
519 extern U16 Maximum_U16( U16 u16_Value_1, U16 u16_Value_2 );
520 
521 //------------------------------------------------------------------------------
522 //! @brief Return maximum value from two U32 values.
523 //! @note None
524 //! @param [in] u32_Value_1 First U32 value.
525 //! @param [in] u32_Value_2 Second U32 value.
526 //! @return Output U32 value.
527 //! @attention None
528 //------------------------------------------------------------------------------
529 
530 extern U32 Maximum_U32( U32 u32_Value_1, U32 u32_Value_2 );
531 
532 //------------------------------------------------------------------------------
533 //! @brief Return maximum value from two U64 values.
534 //! @note None
535 //! @param [in] u64_Value_1 First U64 value.
536 //! @param [in] u64_Value_2 Second U64 value.
537 //! @return Output U64 value.
538 //! @attention None
539 //------------------------------------------------------------------------------
540 
541 extern U64 Maximum_U64( U64 u64_Value_1, U64 u64_Value_2 );
542 
543 //------------------------------------------------------------------------------
544 
545 extern BOOL Is_In_Range_Less_Greater( U16 u16_Value, U16 u16_Low_Bounds, U16 u16_High_Bounds );
546 
547 //------------------------------------------------------------------------------
548 
549 extern BOOL Is_In_Range_Less_Greater( U64 u64_Value, U64 u64_Low_Bounds, U64 u64_High_Bounds );
550 
551 //------------------------------------------------------------------------------
552 
553 extern BOOL Is_In_Range_Less_Greater( F32 f32_Value, F32 f32_Low_Bounds, F32 f32_High_Bounds );
554 
555 //------------------------------------------------------------------------------
556 
557 extern VOID Seconds_To_HMS( U32 u32_Time, U32 *u32_Hours, U32 *u32_Minutes, U32 *u32_Seconds );
558 
559 //------------------------------------------------------------------------------
560 // Variable limitation
561 //------------------------------------------------------------------------------
562 
563 //------------------------------------------------------------------------------
564 //! @brief Limit F32 value to lower or upper limit.
565 //! @note None
566 //! @param [in,out] f32_Value F32 value to limit.
567 //! @param [in] f32_Lower_Limit Lower limit F32 value.
568 //! @param [in] f32_Upper_Limit Upper limit F32 value.
569 //! @return None
570 //! @attention None
571 //------------------------------------------------------------------------------
572 
573 extern VOID Limit_Low_High_F32( F32 &f32_Value, F32 f32_Lower_Limit, F32 f32_Upper_Limit );
574 
575 //------------------------------------------------------------------------------
576 //! @brief Limit I32 value to lower or upper limit.
577 //! @note None
578 //! @param [in,out] i32_Value I32 value to limit.
579 //! @param [in] i32_Lower_Limit Lower limit I32 value.
580 //! @param [in] i32_Upper_Limit Upper limit I32 value.
581 //! @return None
582 //! @attention None
583 //------------------------------------------------------------------------------
584 
585 extern VOID Limit_Low_High_I32( I32 &i32_Value, I32 i32_Lower_Limit, I32 i32_Upper_Limit );
586 
587 //------------------------------------------------------------------------------
588 //! @brief Convert hexal string to U8 value.
589 //! @note None
590 //! @param [in] *c8_Value Pointer to null terminated hexal string.
591 //! @return Output U8 value.
592 //! @attention None
593 //------------------------------------------------------------------------------
594 
595 extern U8 String_To_U8( C8 *c8_Value );
596 
597 //------------------------------------------------------------------------------
598 //! @brief Convert hexal string to U16 value.
599 //! @note None
600 //! @param [in] *c8_Value Pointer to null terminated hexal string.
601 //! @return Output U16 value.
602 //! @attention None
603 //------------------------------------------------------------------------------
604 
605 extern U16 String_To_U16( C8 *c8_Value );
606 
607 //------------------------------------------------------------------------------
608 //! @brief Convert hexal string to U32 value.
609 //! @note None
610 //! @param [in] *c8_Value Pointer to null terminated hexal string.
611 //! @return Output U32 value.
612 //! @attention None
613 //------------------------------------------------------------------------------
614 
615 extern U32 String_To_U32( C8 *c8_Value );
616 
617 //------------------------------------------------------------------------------
618 //! @brief Convert hexal string to U64 value.
619 //! @note None
620 //! @param [in] *c8_Value Pointer to null terminated hexal string.
621 //! @return Output U64 value.
622 //! @attention None
623 //------------------------------------------------------------------------------
624 
625 extern U64 String_To_U64( C8 *c8_Value );
626 
627 //------------------------------------------------------------------------------
628 //! @brief Calculate lengthnof the null terminated string.
629 //! @note None
630 //! @param [in] *c8_Value Pointer to null terminated string.
631 //! @return String length as U32 value.
632 //! @attention None
633 //------------------------------------------------------------------------------
634 
635 extern U32 String_Length( C8 *c8_Value );
636 
637 extern BOOL Is_Hex_Digit( C8 c8_Value );
638 
639 extern VOID U8_To_Hex_String( C8 *c8_String, U8 u8_Value );
640 
641 extern VOID U16_To_Hex_String( C8 *c8_String, U16 u16_Value );
642 
643 extern VOID U32_To_Hex_String( C8 *c8_String, U32 u32_Value );
644 
645 extern VOID U64_To_Hex_String( C8 *c8_String, U64 u64_Value );
646 
647 extern U32 Get_String_Chunk_Count( C8 *c8_Input_String, C8 c8_Delimiter );
648 
649 extern VOID Get_String_Chunk( C8 *c8_Chunk_String, C8 *c8_Input_String, C8 c8_Delimiter, U32 u32_Chunk_Index );
650 
651 //------------------------------------------------------------------------------
652 // End of file
653 //------------------------------------------------------------------------------
U16 Maximum_U16(U16 u16_Value_1, U16 u16_Value_2)
Return maximum value from two U16 values.
Definition: Anvilex_Library.cpp:2836
U8 Extract_U8_From_I16(I16 i16_Value, U8 u8_Index)
Extract U8 value from I16 value.
Definition: Anvilex_Library.cpp:2141
BOOL Convert_C8_To_S7(C8 c8_Input_Value, S7 *s7_Output_Value)
Convert 8 bit chaaracter (C8) to 7-segment indicator code (S7)
Definition: Anvilex_Library.cpp:698
U16 Convert_U32_To_U16_Satureted(U32 u32_Input_Value)
Convert 32-bit unsigned integer number (U32) to 16-bit unsigned indeger number (U16) with saturation ...
Definition: Anvilex_Library.cpp:1682
U8 Extract_U8_From_I8(I8 i8_Value)
Extract U8 value from I8 value.
Definition: Anvilex_Library.cpp:2110
U8 Bit_Swap(U8 u8_Value)
Bit swaping.
Definition: Anvilex_Library.cpp:1579
BOOL Is_Float(C8 *c8_Input_String)
Check input string for floating point representation.
Definition: Anvilex_Library.cpp:257
U32 Get_String_Chunk_Count(C8 *c8_Input_String, C8 c8_Delimiter)
Definition: Anvilex_Library.cpp:3414
U8 Extract_U8_From_U32(U32 u32_Value, U8 u8_Index)
Extract U8 value from U32 value.
Definition: Anvilex_Library.cpp:1987
U8 Byte_To_BCD2(U8 u8_Value)
Convert 8 bit-unsigned integer value (U8) to two digit BCD2 code (U8)
Definition: Anvilex_Library.cpp:1367
U64 Maximum_U64(U64 u64_Value_1, U64 u64_Value_2)
Return maximum value from two U64 values.
Definition: Anvilex_Library.cpp:2860
U32 Maximum_U32(U32 u32_Value_1, U32 u32_Value_2)
Return maximum value from two U32 values.
Definition: Anvilex_Library.cpp:2848
VOID U64_To_Hex_String(C8 *c8_String, U64 u64_Value)
Definition: Anvilex_Library.cpp:3370
U64 String_To_U64(C8 *c8_Value)
Convert hexal string to U64 value.
Definition: Anvilex_Library.cpp:3239
VOID Get_String_Chunk(C8 *c8_Chunk_String, C8 *c8_Input_String, C8 c8_Delimiter, U32 u32_Chunk_Index)
Definition: Anvilex_Library.cpp:3450
U64 Swap_Bytes_U64(U64 u64_Value)
U32 Compose_U32(U8 u8_Input_Byte_3, U8 u8_Input_Byte_2, U8 u8_Input_Byte_1, U8 u8_Input_Byte_0)
Compose U32 value from U8 values.
Definition: Anvilex_Library.cpp:1857
BOOL Increment_Overflowed(U8 *u8_Value, U8 u8_Maximal_Value)
Definition: Anvilex_Library.cpp:2652
U16 Convert_F32_To_Saturated_U16(F32 f32_Input_Value)
Convert 32 bit floating point number (F32) to 16 bit unsigned indeger number (U16) with saturation at...
Definition: Anvilex_Library.cpp:1772
U32 String_To_U32(C8 *c8_Value)
Convert hexal string to U32 value.
Definition: Anvilex_Library.cpp:3209
I16 Convert_F32_To_Saturated_I16(F32 f32_Input_Value)
Convert 32-bit floating point number (F32) to 16-bit signed indeger number (I16) with saturation at t...
Definition: Anvilex_Library.cpp:1716
VOID Limit_Low_High_F32(F32 &f32_Value, F32 f32_Lower_Limit, F32 f32_Upper_Limit)
Limit F32 value to lower or upper limit.
Definition: Anvilex_Library.cpp:3062
U16 Compose_U16(U8 u8_Input_Byte_1, U8 u8_Input_Byte_0)
Compose U16 value from U8 values.
Definition: Anvilex_Library.cpp:1841
BOOL Is_Bit_Set(U16 u16_Value, U8 u8_Index)
Definition: Anvilex_Library.cpp:1645
BOOL Decrement_Saturated(U8 *u8_Value)
Definition: Anvilex_Library.cpp:2468
U64 Compose_U64(U16 u16_Input_3, U16 u16_Input_2, U16 u16_Input_1, U16 u16_Input_0)
Compose U64 value from U16 values.
Definition: Anvilex_Library.cpp:1890
BOOL Is_Hex(C8 *c8_Input_String)
Check input string for hexadecimal representation.
Definition: Anvilex_Library.cpp:355
BOOL Is_Integer(C8 *c8_Input_String)
Check input string for integer representation.
Definition: Anvilex_Library.cpp:204
BOOL Is_In_Range_Less_Greater(U16 u16_Value, U16 u16_Low_Bounds, U16 u16_High_Bounds)
Definition: Anvilex_Library.cpp:2872
U16 Swap_Bytes_U16(U16 u16_Value)
Definition: Anvilex_Library.cpp:1605
U32 Swap_Bytes_U32(U32 u16_Value)
Definition: Anvilex_Library.cpp:1624
VOID Seconds_To_HMS(U32 u32_Time, U32 *u32_Hours, U32 *u32_Minutes, U32 *u32_Seconds)
Definition: Anvilex_Library.cpp:3040
VOID Convert_U16_To_S7_String(U16 u16_Input_Value, S7 *s7_Output_String)
Convert 16 bit unsigned integer (U16) to 7-segment indicator code (S7) string.
Definition: Anvilex_Library.cpp:979
U8 Extract_U8_From_F32(F32 f32_Value, U8 u8_Index)
Extract U8 value from F32 value.
Definition: Anvilex_Library.cpp:2061
U16 Convert_U64_To_U16_Satureted(U64 u64_Input_Value)
Convert 64-bit unsigned integer number (U64) to 16-bit unsigned indeger number (U16) with saturation ...
Definition: Anvilex_Library.cpp:1698
U8 Extract_U8_From_U16(U16 u16_Value, U8 u8_Index)
Extract U8 value from U16 value.
Definition: Anvilex_Library.cpp:1950
U8 String_To_U8(C8 *c8_Value)
Convert hexal string to U8 value.
Definition: Anvilex_Library.cpp:3149
VOID U16_To_Hex_String(C8 *c8_String, U16 u16_Value)
Definition: Anvilex_Library.cpp:3322
VOID U8_To_Hex_String(C8 *c8_String, U8 u8_Value)
Definition: Anvilex_Library.cpp:3306
F32 Compose_F32(U8 u8_Input_Byte_3, U8 u8_Input_Byte_2, U8 u8_Input_Byte_1, U8 u8_Input_Byte_0)
Compose F32 value from U8 values.
Definition: Anvilex_Library.cpp:1924
BOOL Decode_Hex_Buffer(C8 *c8_Input_Buffer, U8 *u8_Output_Buffer, U16 u16_Input_Size, U16 u16_Output_Size)
Decode hex string to 8 bit unsigned integer representation.
Definition: Anvilex_Library.cpp:94
BOOL Increment_Saturated(U8 *u8_Value)
Definition: Anvilex_Library.cpp:2245
U8 BCD2_To_Byte(U8 u8_Value)
Convert two digit BCD2 code (U8) to 8-bit unsigned integer value (U8)
Definition: Anvilex_Library.cpp:1391
VOID Limit_Low_High_I32(I32 &i32_Value, I32 i32_Lower_Limit, I32 i32_Upper_Limit)
Limit I32 value to lower or upper limit.
Definition: Anvilex_Library.cpp:3106
C8 High_Nibble_To_Hex(U8 u8_Value)
Definition: Anvilex_Library.cpp:1567
BOOL Is_Hex_Digit(C8 c8_Value)
Definition: Anvilex_Library.cpp:3291
U32 String_Length(C8 *c8_Value)
Calculate lengthnof the null terminated string.
Definition: Anvilex_Library.cpp:3269
BOOL Convert_U8_To_S7(U8 u8_Input_Value, S7 *s7_Output_Value)
Convert 8 bit unsigned integer (U8) to 7-segment indicator code (S7)
Definition: Anvilex_Library.cpp:465
C8 Low_Nibble_To_Hex(U8 u8_Value)
Definition: Anvilex_Library.cpp:1555
BOOL Is_Odd(U32 u32_Value)
Check for input 32-bit unsigned value is odd.
Definition: Anvilex_Library.cpp:386
U16 String_To_U16(C8 *c8_Value)
Convert hexal string to U16 value.
Definition: Anvilex_Library.cpp:3179
U16 Extract_U16_From_U32(U32 u32_Value, U8 u8_Index)
Extract U16 value from U32 value.
Definition: Anvilex_Library.cpp:2024
U8 Extract_U8_From_I32(I32 i32_Value, U8 u8_Index)
Extract U8 value from I32 value.
Definition: Anvilex_Library.cpp:2193
U8 Maximum_U8(U8 u8_Value_1, U8 u8_Value_2)
Return maximum value from two U8 values.
Definition: Anvilex_Library.cpp:2824
BOOL Is_Even(U32 u32_Value)
Check for input 32-bit unsigned value is even.
Definition: Anvilex_Library.cpp:398
VOID U32_To_Hex_String(C8 *c8_String, U32 u32_Value)
Definition: Anvilex_Library.cpp:3342
VOID Split_U32(U32 u32_Input_Value, U16 *u16_Output_1, U16 *u16_Output_0)
Definition: Anvilex_Library.cpp:1828
U8 Hex_To_U8(C8 c8_Value)
Definition: Anvilex_Library.cpp:1409
ConOpSys data type definitions header file.
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
unsigned char S7
7-Segment code datatype definition
Definition: Defines.h:379
unsigned long long U64
Binary 64-Bit unsigned integer datatype defenition.
Definition: Defines.h:213
long I32
2s Compliment 32-Bit signed integer datatype defenition
Definition: Defines.h:206
unsigned char U8
Binary 8-Bit unsigned integer datatype defenition.
Definition: Defines.h:183
signed char I8
2s Compliment 8-Bit signed integer datatype defenition
Definition: Defines.h:186
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
unsigned long U32
Binary 32-Bit unsigned integer datatype defenition.
Definition: Defines.h:203
float F32
IEEE-754 32-Bit single presession floating point numbers datatype defenition.
Definition: Defines.h:324
short I16
2s Compliment 16-Bit signed integer datatype defenition
Definition: Defines.h:196
unsigned short U16
Binary 16-Bit unsigned integer datatype defenition.
Definition: Defines.h:193
char C8
ASCII 8-Bit char datatype defenition.
Definition: Defines.h:156