VXLIB User Guide
VXLIB_debug.h
Go to the documentation of this file.
1 /******************************************************************************/
5 /* Copyright (C) 2015 Texas Instruments Incorporated - https://www.ti.com/
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the
17  * distribution.
18  *
19  * Neither the name of Texas Instruments Incorporated nor the names of
20  * its contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  *
35  ******************************************************************************/
36 
37 #ifndef C71_VXLIB_DEBUG_H_
38 #define C71_VXLIB_DEBUG_H_ 1
39 
40 /*******************************************************************************
41  *
42  * INCLUDES
43  *
44  ******************************************************************************/
45 
46 #include <float.h> // for max float, double values
47 #include <limits.h> // for min, max integer values
48 
49 #include "../VXLIB_bufParams.h"
50 #include "../VXLIB_types.h"
51 
52 #include "VXLIB_debugPrintVector.h"
53 
54 /*******************************************************************************
55  *
56  * Function prototypes
57  *
58  ******************************************************************************/
59 
60 #ifdef __cplusplus
61 
62 extern "C" {
63 #endif /* __cplusplus */
64 
65 void VXLIB_debugPrintMatrix1D(void *matrix, const VXLIB_bufParams1D_t *params);
66 void VXLIB_debugPrintMatrix(void *matrix, const VXLIB_bufParams2D_t *params);
67 void VXLIB_debugPrintMatrix3D(void *matrix, const VXLIB_bufParams3D_t *params);
68 
69 void VXLIB_debugPrint3DVReg(void *matrix, const VXLIB_bufParams3D_t *params);
73 
74 /******************************************************************************/
75 
76 //#if defined(_HOST_BUILD)
77 // // x86 GCC assembly code for printing the stack pointer
78 // // this version defines the function in asm, which avoid all compiler
79 // warnings
80 // // if this stops working, a simpler version is commented below
81 // unsigned long *get_stack_ptr(void);
82 // __asm__(
83 // "get_stack_ptr:\n"
84 // "mov %rsp, %rax\n"
85 // "ret\n"
86 // );
87 //
88 // static inline unsigned long *get_stack_ptr(void) {
89 // __asm__(
90 // "mov %rsp, %rax"
91 // );
92 // }
93 //#define VXLIB_DEBUGPRINT_STACK_PTR VXLIB_DEBUGPRINTFN(1, "Stack Pointer:
94 //%p\n", get_stack_ptr()) #else #define VXLIB_DEBUGPRINT_STACK_PTR #endif //
95 //#if defined(_HOST_BUILD)
96 
97 // static inline void VXLIB_debugPrintStackPtr(void){
98 //#if defined(_HOST_BUILD)
99 // unsigned long *stack_ptr = get_stack_ptr();
100 // VXLIB_DEBUGPRINTFN(0, "Stack Pointer: %p\n", stack_ptr);
101 //#endif
102 // }
103 
104 #ifdef __cplusplus
105 }
106 #endif /* __cplusplus */
107 
108 // C++ linkage only
109 #ifdef __cplusplus
110 
111 static inline uint8_t VXLIB_firstElement(c7x::uchar_vec vector) { return *((uint8_t *) (&vector)); }
112 
113 static inline int8_t VXLIB_firstElement(c7x::char_vec vector) { return *((int8_t *) (&vector)); }
114 
115 static inline uint16_t VXLIB_firstElement(c7x::ushort_vec vector) { return *((uint16_t *) (&vector)); }
116 
117 static inline int16_t VXLIB_firstElement(c7x::short_vec vector) { return *((int16_t *) (&vector)); }
118 
119 #endif // #ifdef __cplusplus
120 
121 #endif /* C71_VXLIB_DEBUG_H_ */
void VXLIB_debugPrintBufParams3D(const VXLIB_bufParams3D_t *params)
void VXLIB_debugPrintMatrix1D(void *matrix, const VXLIB_bufParams1D_t *params)
void VXLIB_debugPrint3DVReg(void *matrix, const VXLIB_bufParams3D_t *params)
void VXLIB_debugPrintBufParams(const VXLIB_bufParams2D_t *params)
void VXLIB_debugPrintMatrix3D(void *matrix, const VXLIB_bufParams3D_t *params)
void VXLIB_debugPrintBufParams1D(const VXLIB_bufParams1D_t *params)
void VXLIB_debugPrintMatrix(void *matrix, const VXLIB_bufParams2D_t *params)
A structure for a 1 dimensional buffer descriptor.
A structure for a 2 dimensional buffer descriptor.
A structure for a 3 dimensional buffer descriptor.