DSPLIB User Guide
DSPLIB_add_cn.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2 **+--------------------------------------------------------------------------+**
3 **| **** |**
4 **| **** |**
5 **| ******o*** |**
6 **| ********_///_**** |**
7 **| ***** /_//_/ **** |**
8 **| ** ** (__/ **** |**
9 **| ********* |**
10 **| **** |**
11 **| *** |**
12 **| |**
13 **| Copyright (c) 2016 Texas Instruments Incorporated |**
14 **| ALL RIGHTS RESERVED |**
15 **| |**
16 **| Permission to use, copy, modify, or distribute this software, |**
17 **| whether in part or in whole, for any purpose is forbidden without |**
18 **| a signed licensing agreement and NDA from Texas Instruments |**
19 **| Incorporated (TI). |**
20 **| |**
21 **| TI makes no representation or warranties with respect to the |**
22 **| performance of this computer program, and specifically disclaims |**
23 **| any responsibility for any damages, special or consequential, |**
24 **| connected with the use of this program. |**
25 **| |**
26 **+--------------------------------------------------------------------------+**
27 *******************************************************************************/
28 
29 #include "DSPLIB_add_priv.h"
30 
31 template <typename dataType>
33 DSPLIB_add_exec_cn(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut)
34 {
36 
37  DSPLIB_add_PrivArgs *pKerPrivArgs = (DSPLIB_add_PrivArgs *) handle;
38  uint32_t blockSize = pKerPrivArgs->blockSize;
39 
40 #if DSPLIB_DEBUGPRINT
41  printf("Enter DSPLIB_add_exec_cn\n");
42 #endif
43 
44  dataType *pInLocal1 = (dataType *) pIn1;
45  dataType *pInLocal2 = (dataType *) pIn2;
46  dataType *pOutLocal = (dataType *) pOut;
47 
48 #if DSPLIB_DEBUGPRINT
49  printf("Enter pInLocal1 %p pInLocal2 %p pOut %p\n", pInLocal1, pInLocal2, pOut);
50 #endif
51 
52  dataType a, b, out;
53 
54  for (int32_t counter = 0; counter < blockSize; counter++) {
55  a = *pInLocal1++;
56  b = *pInLocal2++;
57 #if DSPLIB_DEBUGPRINT
58  if (counter <= 8)
59  printf("counter %d a %d b %d\n", counter, a, b);
60 #endif
61 
62  out = a + b;
63 #if DSPLIB_DEBUGPRINT
64  if (counter <= 8)
65  printf("counter %d y %d\n", counter, out);
66 #endif
67 
68  *pOutLocal++ = out;
69  }
70  return (status);
71 }
72 
73 // explicit insaddtiation for the different data type versions
74 template DSPLIB_STATUS
75 DSPLIB_add_exec_cn<float>(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut);
76 
77 template DSPLIB_STATUS
78 DSPLIB_add_exec_cn<double>(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut);
79 template DSPLIB_STATUS
80 DSPLIB_add_exec_cn<int8_t>(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut);
81 template DSPLIB_STATUS
82 DSPLIB_add_exec_cn<uint8_t>(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut);
83 template DSPLIB_STATUS
84 DSPLIB_add_exec_cn<int16_t>(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut);
85 template DSPLIB_STATUS
86 DSPLIB_add_exec_cn<uint16_t>(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut);
87 template DSPLIB_STATUS
88 DSPLIB_add_exec_cn<int32_t>(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut);
89 template DSPLIB_STATUS
90 DSPLIB_add_exec_cn<uint32_t>(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut);
template DSPLIB_STATUS DSPLIB_add_exec_cn< double >(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_add_exec_cn< float >(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_add_exec_cn< int8_t >(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_add_exec_cn< uint32_t >(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_add_exec_cn< int32_t >(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_add_exec_cn< uint8_t >(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_add_exec_cn< int16_t >(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_add_exec_cn< uint16_t >(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut)
DSPLIB_STATUS DSPLIB_add_exec_cn(DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pOut)
This function is the main execution function for the natural C implementation of the kernel....
Header file for kernel's internal use. For the kernel's interface, please see DSPLIB_add.
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_SUCCESS
Definition: DSPLIB_types.h:152
Structure that is reserved for internal use by the kernel.
int32_t blockSize
Size of input buffer for different batches DSPLIB_add_init that will be retrieved and used by DSPLIB_...