DSPLIB User Guide
DSPLIB_min_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_min_priv.h"
30 
31 template <typename dataType, int32_t dataIn>
32 DSPLIB_STATUS DSPLIB_min_exec_cn(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
33 {
35 
36  DSPLIB_min_PrivArgs *pKerPrivArgs = (DSPLIB_min_PrivArgs *) handle;
37  uint32_t blockSize = pKerPrivArgs->blockSize;
38 
39 #if DSPLIB_DEBUGPRINT
40  printf("Enter DSPLIB_min_exec_cn\n");
41 #endif
42 
43  dataType *pInLocal = (dataType *) pIn;
44  dataType *pOutLocal = (dataType *) pOut;
45 
46 #if DSPLIB_DEBUGPRINT
47  printf("Enter pInLocal %p pOut %p\n", pInLocal, pOut);
48 #endif
49 
50  dataType a, out;
51 
52  out = pInLocal[0];
53 
54  for (int32_t counter = 0; counter < (int32_t)blockSize; counter++) {
55  a = *pInLocal++;
56 #if DSPLIB_DEBUGPRINT
57  if (counter <= 8)
58  printf("counter %d a %d b %d\n", counter, a);
59 #endif
60 
61  out = (a < out) ? a : out;
62 
63 #if DSPLIB_DEBUGPRINT
64  if (counter <= 8)
65  printf("counter %d y %d\n", counter, out);
66 #endif
67  }
68 
69  *pOutLocal = out;
70  return (status);
71 }
72 
73 // explicit instantiation for the different data type versions
74 template DSPLIB_STATUS
75 DSPLIB_min_exec_cn<float, DSPLIB_FLOAT32>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
76 
77 template DSPLIB_STATUS
78 DSPLIB_min_exec_cn<double, DSPLIB_FLOAT64>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
79 template DSPLIB_STATUS
80 DSPLIB_min_exec_cn<int8_t, DSPLIB_INT8>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
81 template DSPLIB_STATUS
82 DSPLIB_min_exec_cn<uint8_t, DSPLIB_UINT8>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
83 template DSPLIB_STATUS
84 DSPLIB_min_exec_cn<int16_t, DSPLIB_INT16>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
85 template DSPLIB_STATUS
86 DSPLIB_min_exec_cn<uint16_t, DSPLIB_UINT16>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
87 template DSPLIB_STATUS
88 DSPLIB_min_exec_cn<int32_t, DSPLIB_INT32>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
89 template DSPLIB_STATUS
90 DSPLIB_min_exec_cn<uint32_t, DSPLIB_UINT32>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
DSPLIB_STATUS DSPLIB_min_exec_cn(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
This function is the main execution function for the natural C implementation of the kernel....
template DSPLIB_STATUS DSPLIB_min_exec_cn< float, DSPLIB_FLOAT32 >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_min_exec_cn< int32_t, DSPLIB_INT32 >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_min_exec_cn< double, DSPLIB_FLOAT64 >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_min_exec_cn< uint16_t, DSPLIB_UINT16 >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_min_exec_cn< int8_t, DSPLIB_INT8 >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_min_exec_cn< int16_t, DSPLIB_INT16 >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_min_exec_cn< uint8_t, DSPLIB_UINT8 >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_min_exec_cn< uint32_t, DSPLIB_UINT32 >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
Header file for kernel's internal use. For the kernel's interface, please see DSPLIB_min.
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_min_init that will be retrieved and used by DSPLIB_...