VXLIB User Guide
VXLIB_debugPrintMatrix1D.cpp
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 /*******************************************************************************
38  *
39  * INCLUDES
40  *
41  ******************************************************************************/
42 
43 #include "../VXLIB_bufParams.h"
44 #include "../VXLIB_types.h"
45 #include "../VXLIB_utility.h"
46 
47 //----------------------------------------------------------------------------------
48 
49 template <typename dataType> void VXLIB_debugPrintMatrix_helper(dataType *matrix, const VXLIB_bufParams1D_t *params)
50 {
51  uint32_t x;
52  dataType *xPtr = matrix;
53 
54  VXLIB_PRINTF("%p |", xPtr);
55  for (x = 0; x < params->dim_x; x++) {
56  VXLIB_PRINTF("%3d ", *(xPtr));
57  xPtr++;
58  }
59  VXLIB_PRINTF("%s", "|\n");
60 
61  return;
62 }
63 
64 template void VXLIB_debugPrintMatrix_helper<int8_t>(int8_t *matrix, const VXLIB_bufParams1D_t *params);
65 template void VXLIB_debugPrintMatrix_helper<uint8_t>(uint8_t *matrix, const VXLIB_bufParams1D_t *params);
66 template void VXLIB_debugPrintMatrix_helper<int16_t>(int16_t *matrix, const VXLIB_bufParams1D_t *params);
67 template void VXLIB_debugPrintMatrix_helper<uint16_t>(uint16_t *matrix, const VXLIB_bufParams1D_t *params);
68 template void VXLIB_debugPrintMatrix_helper<int32_t>(int32_t *matrix, const VXLIB_bufParams1D_t *params);
69 
70 /******************************************************************************/
71 
72 // want this function to have C-linkage in library...
73 #ifdef __cplusplus
74 extern "C" {
75 #endif /* __cplusplus */
76 
77 void VXLIB_debugPrintMatrix1D(void *matrix, const VXLIB_bufParams1D_t *params)
78 {
79  switch (params->data_type) {
80  case VXLIB_INT32:
81  VXLIB_debugPrintMatrix_helper<int32_t>((int32_t *) matrix, params);
82  break;
83  case VXLIB_INT16:
84  VXLIB_debugPrintMatrix_helper<int16_t>((int16_t *) matrix, params);
85  break;
86  case VXLIB_UINT16:
87  VXLIB_debugPrintMatrix_helper<uint16_t>((uint16_t *) matrix, params);
88  break;
89  case VXLIB_INT8:
90  VXLIB_debugPrintMatrix_helper<int8_t>((int8_t *) matrix, params);
91  break;
92  case VXLIB_UINT8:
93  VXLIB_debugPrintMatrix_helper<uint8_t>((uint8_t *) matrix, params);
94  break;
95  default:
96  VXLIB_PRINTF("\nERROR: Unrecognized data type in %s.\n", __FUNCTION__);
97  }
98 
99  return;
100 }
101 #ifdef __cplusplus
102 }
103 #endif /* __cplusplus */
template void VXLIB_debugPrintMatrix_helper< uint8_t >(uint8_t *matrix, const VXLIB_bufParams1D_t *params)
void VXLIB_debugPrintMatrix1D(void *matrix, const VXLIB_bufParams1D_t *params)
template void VXLIB_debugPrintMatrix_helper< int16_t >(int16_t *matrix, const VXLIB_bufParams1D_t *params)
template void VXLIB_debugPrintMatrix_helper< int32_t >(int32_t *matrix, const VXLIB_bufParams1D_t *params)
void VXLIB_debugPrintMatrix_helper(dataType *matrix, const VXLIB_bufParams1D_t *params)
template void VXLIB_debugPrintMatrix_helper< uint16_t >(uint16_t *matrix, const VXLIB_bufParams1D_t *params)
template void VXLIB_debugPrintMatrix_helper< int8_t >(int8_t *matrix, const VXLIB_bufParams1D_t *params)
#define VXLIB_PRINTF(fmt,...)
Definition: VXLIB_types.h:95
@ VXLIB_UINT16
@ VXLIB_INT32
@ VXLIB_INT16
@ VXLIB_INT8
@ VXLIB_UINT8
A structure for a 1 dimensional buffer descriptor.
uint32_t dim_x
Width of buffer in X dimension in elements.
uint32_t data_type
Values are of type VXLIB_data_type_e.