DSPLIB User Guide
DSPLIB_blk_move.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  * *
3  * module name :DSPLIB *
4  * *
5  * module descripton :Digital Signal Processing Library module for C7x+MMA *
6  * *
7  * Copyright (C) 2017-2018 Texas Instruments Incorporated - https://www.ti.com/ *
8  * ALL RIGHTS RESERVED *
9  * *
10  ******************************************************************************/
11 
23 #include "DSPLIB_blk_move_priv.h"
24 
26 {
27  int32_t privBufSize = sizeof(DSPLIB_blk_move_PrivArgs);
28 
29  DSPLIB_DEBUGPRINTFN(0, "privBufSize: %d\n", privBufSize);
30 
31  return privBufSize;
32 }
33 
35  const DSPLIB_bufParams1D_t *bufParamsIn,
36  const DSPLIB_bufParams1D_t *bufParamsOut,
37  const DSPLIB_blk_move_InitArgs *pKerInitArgs)
38 {
39  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering Function");
40 
42 
43  if (handle == NULL) {
44  status = DSPLIB_ERR_NULL_POINTER;
45  }
46 
47  if (status == DSPLIB_SUCCESS) {
48  if ((bufParamsIn->data_type != DSPLIB_INT8) && (bufParamsIn->data_type != DSPLIB_INT16) &&
49  (bufParamsIn->data_type != DSPLIB_INT32) && (bufParamsIn->data_type != DSPLIB_INT64) &&
50  (bufParamsIn->data_type != DSPLIB_UINT8) && (bufParamsIn->data_type != DSPLIB_UINT16) &&
51  (bufParamsIn->data_type != DSPLIB_UINT32) && (bufParamsIn->data_type != DSPLIB_UINT64) &&
52  (bufParamsIn->data_type != DSPLIB_FLOAT32) && (bufParamsIn->data_type != DSPLIB_FLOAT64)) {
53  status = DSPLIB_ERR_INVALID_TYPE;
54  }
55  else if (bufParamsIn->data_type != bufParamsOut->data_type) {
56  status = DSPLIB_ERR_INVALID_TYPE;
57  }
58  else {
59  /* Nothing to do here */
60  }
61  }
62 
63  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
64 
65  return status;
66 }
67 
69 DSPLIB_blk_move_exec_checkParams(DSPLIB_kernelHandle handle, const void *restrict pIn, const void *restrict pOut)
70 {
71  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
72 
73  DSPLIB_STATUS status;
74 
75  if ((pIn == NULL) || (pOut == NULL)) {
76  status = DSPLIB_ERR_NULL_POINTER;
77  }
78  else {
79  status = DSPLIB_SUCCESS;
80  }
81  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
82 
83  return status;
84 }
85 
87  DSPLIB_bufParams1D_t *bufParamsIn,
88  DSPLIB_bufParams1D_t *bufParamsOut,
89  const DSPLIB_blk_move_InitArgs *pKerInitArgs)
90 {
91  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
92 
94  DSPLIB_blk_move_PrivArgs *pKerPrivArgs = (DSPLIB_blk_move_PrivArgs *) handle;
95 
96  pKerPrivArgs->blockSize = pKerInitArgs->dataSize;
97 
98  DSPLIB_DEBUGPRINTFN(0, "pKerInitArgs->funcStyle: %d bufParamsOut->data_type: %d\n", pKerInitArgs->funcStyle,
99  bufParamsOut->data_type);
100 
101  if (pKerInitArgs->funcStyle == DSPLIB_FUNCTION_NATC) {
102  if (bufParamsIn->data_type == DSPLIB_FLOAT32) {
103  pKerPrivArgs->execute = DSPLIB_blk_move_exec_cn<float>;
104  status = DSPLIB_blk_move_init_cn(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
105  }
106  else if (bufParamsIn->data_type == DSPLIB_FLOAT64) {
108  status = DSPLIB_blk_move_init_cn(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
109  }
110  else if (bufParamsIn->data_type == DSPLIB_INT8) {
112  status = DSPLIB_blk_move_init_cn(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
113  }
114  else if (bufParamsIn->data_type == DSPLIB_INT16) {
116  status = DSPLIB_blk_move_init_cn(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
117  }
118  else if (bufParamsIn->data_type == DSPLIB_INT32) {
120  status = DSPLIB_blk_move_init_cn(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
121  }
122  else if (bufParamsIn->data_type == DSPLIB_INT64) {
124  status = DSPLIB_blk_move_init_cn(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
125  }
126  else if (bufParamsIn->data_type == DSPLIB_UINT8) {
128  status = DSPLIB_blk_move_init_cn(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
129  }
130  else if (bufParamsIn->data_type == DSPLIB_UINT16) {
132  status = DSPLIB_blk_move_init_cn(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
133  }
134  else if (bufParamsIn->data_type == DSPLIB_UINT32) {
136  status = DSPLIB_blk_move_init_cn(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
137  }
138  else if (bufParamsIn->data_type == DSPLIB_UINT64) {
140  status = DSPLIB_blk_move_init_cn(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
141  }
142  else {
143  status = DSPLIB_ERR_INVALID_TYPE;
144  }
145  }
146  else {
147  if (bufParamsIn->data_type == DSPLIB_FLOAT32) {
148  pKerPrivArgs->execute = DSPLIB_blk_move_exec_ci<float>;
149  status = DSPLIB_blk_move_init_ci<float>(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
150  }
151  else if (bufParamsIn->data_type == DSPLIB_FLOAT64) {
153  status = DSPLIB_blk_move_init_ci<double>(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
154  }
155  else if (bufParamsIn->data_type == DSPLIB_INT8) {
157  status = DSPLIB_blk_move_init_ci<int8_t>(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
158  }
159  else if (bufParamsIn->data_type == DSPLIB_INT16) {
161  status = DSPLIB_blk_move_init_ci<int16_t>(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
162  }
163  else if (bufParamsIn->data_type == DSPLIB_INT32) {
165  status = DSPLIB_blk_move_init_ci<int32_t>(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
166  }
167  else if (bufParamsIn->data_type == DSPLIB_INT64) {
169  status = DSPLIB_blk_move_init_ci<int64_t>(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
170  }
171  else if (bufParamsIn->data_type == DSPLIB_UINT8) {
173  status = DSPLIB_blk_move_init_ci<uint8_t>(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
174  }
175  else if (bufParamsIn->data_type == DSPLIB_UINT16) {
177  status = DSPLIB_blk_move_init_ci<uint16_t>(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
178  }
179  else if (bufParamsIn->data_type == DSPLIB_UINT32) {
181  status = DSPLIB_blk_move_init_ci<uint32_t>(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
182  }
183  else if (bufParamsIn->data_type == DSPLIB_UINT64) {
185  status = DSPLIB_blk_move_init_ci<uint64_t>(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
186  }
187  else {
188  status = DSPLIB_ERR_INVALID_TYPE;
189  }
190  }
191 
192  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
193 
194  return status;
195 }
196 
197 DSPLIB_STATUS DSPLIB_blk_move_exec(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
198 {
199  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
200 
201  DSPLIB_STATUS status;
202 
203  DSPLIB_blk_move_PrivArgs *pKerPrivArgs = (DSPLIB_blk_move_PrivArgs *) handle;
204 
205  DSPLIB_DEBUGPRINTFN(0, "pKerPrivArgs->blockSize %d\n", pKerPrivArgs->blockSize);
206 
207  status = pKerPrivArgs->execute(handle, pIn, pOut);
208 
209  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
210 
211  return status;
212 }
template DSPLIB_STATUS DSPLIB_blk_move_exec_ci< double >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_init_ci< uint8_t >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams1D_t *bufParamsIn, const DSPLIB_bufParams1D_t *bufParamsOut, const DSPLIB_blk_move_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_blk_move_exec_ci< uint64_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_exec_ci< uint8_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_exec_ci< float >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_exec_ci< int16_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_init_ci< double >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams1D_t *bufParamsIn, const DSPLIB_bufParams1D_t *bufParamsOut, const DSPLIB_blk_move_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_blk_move_exec_ci< uint32_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_exec_ci< uint16_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_init_ci< uint32_t >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams1D_t *bufParamsIn, const DSPLIB_bufParams1D_t *bufParamsOut, const DSPLIB_blk_move_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_blk_move_init_ci< float >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams1D_t *bufParamsIn, const DSPLIB_bufParams1D_t *bufParamsOut, const DSPLIB_blk_move_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_blk_move_init_ci< int8_t >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams1D_t *bufParamsIn, const DSPLIB_bufParams1D_t *bufParamsOut, const DSPLIB_blk_move_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_blk_move_init_ci< int16_t >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams1D_t *bufParamsIn, const DSPLIB_bufParams1D_t *bufParamsOut, const DSPLIB_blk_move_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_blk_move_exec_ci< int8_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_init_ci< int64_t >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams1D_t *bufParamsIn, const DSPLIB_bufParams1D_t *bufParamsOut, const DSPLIB_blk_move_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_blk_move_init_ci< uint16_t >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams1D_t *bufParamsIn, const DSPLIB_bufParams1D_t *bufParamsOut, const DSPLIB_blk_move_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_blk_move_init_ci< int32_t >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams1D_t *bufParamsIn, const DSPLIB_bufParams1D_t *bufParamsOut, const DSPLIB_blk_move_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_blk_move_exec_ci< int64_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_exec_ci< int32_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_init_ci< uint64_t >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams1D_t *bufParamsIn, const DSPLIB_bufParams1D_t *bufParamsOut, const DSPLIB_blk_move_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_blk_move_exec_cn< uint8_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_exec_cn< float >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_exec_cn< int64_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_exec_cn< uint16_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_exec_cn< int16_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_exec_cn< int32_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_exec_cn< double >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_exec_cn< int8_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_blk_move_exec_cn< uint64_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
DSPLIB_STATUS DSPLIB_blk_move_init_cn(DSPLIB_kernelHandle handle, DSPLIB_bufParams1D_t *bufParamsIn, DSPLIB_bufParams1D_t *bufParamsOut, const DSPLIB_blk_move_InitArgs *pKerInitArgs)
This function is the initialization function for the natural C implementation of the kernel....
template DSPLIB_STATUS DSPLIB_blk_move_exec_cn< uint32_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
Header file for kernel's internal use. For the kernel's interface, please see DSPLIB_blk_move.
#define DSPLIB_DEBUGPRINTFN(N, fmt,...)
Definition: DSPLIB_types.h:83
DSPLIB_STATUS_NAME
The enumeration of all status codes.
Definition: DSPLIB_types.h:151
void * DSPLIB_kernelHandle
Handle type for DSPLIB operations.
Definition: DSPLIB_types.h:172
@ DSPLIB_FUNCTION_NATC
Definition: DSPLIB_types.h:176
@ DSPLIB_UINT64
@ DSPLIB_UINT8
@ DSPLIB_UINT16
@ DSPLIB_INT32
@ DSPLIB_INT16
@ DSPLIB_FLOAT32
@ DSPLIB_INT64
@ DSPLIB_FLOAT64
@ DSPLIB_UINT32
@ DSPLIB_INT8
@ DSPLIB_SUCCESS
Definition: DSPLIB_types.h:152
@ DSPLIB_ERR_NULL_POINTER
Definition: DSPLIB_types.h:157
@ DSPLIB_ERR_INVALID_TYPE
Definition: DSPLIB_types.h:155
DSPLIB_STATUS DSPLIB_blk_move_exec_checkParams(DSPLIB_kernelHandle handle, const void *restrict pIn, const void *restrict pOut)
This function checks the validity of the parameters passed to DSPLIB_blk_move_exec function....
DSPLIB_STATUS DSPLIB_blk_move_init(DSPLIB_kernelHandle handle, DSPLIB_bufParams1D_t *bufParamsIn, DSPLIB_bufParams1D_t *bufParamsOut, const DSPLIB_blk_move_InitArgs *pKerInitArgs)
This function should be called before the DSPLIB_blk_move_exec function is called....
DSPLIB_STATUS DSPLIB_blk_move_exec(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
This function is the main kernel compute function.
DSPLIB_STATUS DSPLIB_blk_move_init_checkParams(DSPLIB_kernelHandle handle, const DSPLIB_bufParams1D_t *bufParamsIn, const DSPLIB_bufParams1D_t *bufParamsOut, const DSPLIB_blk_move_InitArgs *pKerInitArgs)
This function checks the validity of the parameters passed to DSPLIB_blk_move_init function....
int32_t DSPLIB_blk_move_getHandleSize(DSPLIB_blk_move_InitArgs *pKerInitArgs)
This is a query function to calculate the size of internal handle.
Structure containing the parameters to initialize the kernel.
uint32_t dataSize
Size of input data
int8_t funcStyle
Variant of the function refer to DSPLIB_FUNCTION_STYLE
Structure that is reserved for internal use by the kernel.
int32_t blockSize
Size of input buffer for different batches DSPLIB_blk_move_init that will be retrieved and used by DS...
pFxnDSPLIB_blk_move_exec execute
Function pointer to point to the right execution variant between DSPLIB_blk_move_exec_cn and DSPLIB_b...
A structure for a 1 dimensional buffer descriptor.
uint32_t data_type
Values are of type DSPLIB_data_type_e.