DSPLIB User Guide
DSPLIB_fir.h
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 **| |**
15 **| All rights reserved not granted herein. |**
16 **| |**
17 **| Limited License. |**
18 **| |**
19 **| Texas Instruments Incorporated grants a world-wide, royalty-free, |**
20 **| non-exclusive license under copyrights and patents it now or |**
21 **| hereafter owns or controls to make, have made, use, import, offer to |**
22 **| sell and sell ("Utilize") this software subject to the terms herein. |**
23 **| With respect to the foregoing patent license, such license is granted |**
24 **| solely to the extent that any such patent is necessary to Utilize the |**
25 **| software alone. The patent license shall not apply to any |**
26 **| combinations which include this software, other than combinations |**
27 **| with devices manufactured by or for TI ("TI Devices"). No hardware |**
28 **| patent is licensed hereunder. |**
29 **| |**
30 **| Redistributions must preserve existing copyright notices and |**
31 **| reproduce this license (including the above copyright notice and the |**
32 **| disclaimer and (if applicable) source code license limitations below) |**
33 **| in the documentation and/or other materials provided with the |**
34 **| distribution |**
35 **| |**
36 **| Redistribution and use in binary form, without modification, are |**
37 **| permitted provided that the following conditions are met: |**
38 **| |**
39 **| * No reverse engineering, decompilation, or disassembly of this |**
40 **| software is permitted with respect to any software provided in binary |**
41 **| form. |**
42 **| |**
43 **| * any redistribution and use are licensed by TI for use only with |**
44 **| TI Devices. |**
45 **| |**
46 **| * Nothing shall obligate TI to provide you with source code for |**
47 **| the software licensed and provided to you in object code. |**
48 **| |**
49 **| If software source code is provided to you, modification and |**
50 **| redistribution of the source code are permitted provided that the |**
51 **| following conditions are met: |**
52 **| |**
53 **| * any redistribution and use of the source code, including any |**
54 **| resulting derivative works, are licensed by TI for use only with TI |**
55 **| Devices. |**
56 **| |**
57 **| * any redistribution and use of any object code compiled from the |**
58 **| source code and any resulting derivative works, are licensed by TI |**
59 **| for use only with TI Devices. |**
60 **| |**
61 **| Neither the name of Texas Instruments Incorporated nor the names of |**
62 **| its suppliers may be used to endorse or promote products derived from |**
63 **| this software without specific prior written permission. |**
64 **| |**
65 **| DISCLAIMER. |**
66 **| |**
67 **| THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY |**
68 **| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |**
69 **| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |**
70 **| PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL TI AND TI'S LICENSORS BE |**
71 **| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |**
72 **| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |**
73 **| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |**
74 **| BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |**
75 **| WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |**
76 **| OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |**
77 **| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |**
78 **+--------------------------------------------------------------------------+**
79 *******************************************************************************/
80 
81 #ifndef DSPLIB_FIR_H_
82 #define DSPLIB_FIR_H_
83 
84 #include "../common/DSPLIB_types.h"
85 
86 #ifdef __cplusplus
87 extern "C" {
88 #endif
89 
105 typedef struct {
107  int8_t funcStyle;
109  int32_t dataSize;
111  int32_t batchSize;
113  int32_t filterSize;
121  uint32_t shift;
125  uint32_t enableNchCoefs;
126 
128 
137 int32_t DSPLIB_fir_getHandleSize(DSPLIB_fir_InitArgs *pKerInitArgs);
138 
160  DSPLIB_bufParams2D_t *bufParamsIn,
161  DSPLIB_bufParams2D_t *bufParamsFilter,
162  DSPLIB_bufParams2D_t *bufParamsOut);
163 
188  DSPLIB_bufParams2D_t *bufParamsIn,
189  DSPLIB_bufParams2D_t *bufParamsFilter,
190  DSPLIB_bufParams2D_t *bufParamsOut,
191  DSPLIB_fir_InitArgs *pKerInitArgs);
192 
218  const DSPLIB_bufParams2D_t *bufParamsIn,
219  const DSPLIB_bufParams2D_t *bufParamsFilter,
220  const DSPLIB_bufParams2D_t *bufParamsOut,
221  const DSPLIB_fir_InitArgs *pKerInitArgs);
222 
252 DSPLIB_fir_exec(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pFilter, void *restrict pOut);
253 
273  const void *restrict pIn,
274  const void *restrict pFilter,
275  const void *restrict pOut);
276 
295  const DSPLIB_bufParams2D_t *bufParamsIn,
296  const DSPLIB_bufParams2D_t *bufParamsFilter,
297  const DSPLIB_bufParams2D_t *bufParamsOut,
298  uint64_t *archCycles,
299  uint64_t *estCycles);
300 
303 #ifdef __cplusplus
304 }
305 #endif
306 
307 #endif /* DSPLIB_H_ */
308 
309 /* ======================================================================== */
310 /* End of file: DSPLIB_fir.h */
311 /* ======================================================================== */
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_STATUS DSPLIB_fir_exec(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pFilter, void *restrict pOut)
This function is the main kernel compute function.
Definition: DSPLIB_fir.cpp:225
DSPLIB_STATUS DSPLIB_fir_getSizes(const DSPLIB_fir_InitArgs *pKerInitArgs, DSPLIB_bufParams2D_t *bufParamsIn, DSPLIB_bufParams2D_t *bufParamsFilter, DSPLIB_bufParams2D_t *bufParamsOut)
This is a query function to calculate the sizes of input, filter and the output buffers.
Definition: DSPLIB_fir.cpp:90
DSPLIB_STATUS DSPLIB_fir_init_checkParams(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsIn, const DSPLIB_bufParams2D_t *bufParamsFilter, const DSPLIB_bufParams2D_t *bufParamsOut, const DSPLIB_fir_InitArgs *pKerInitArgs)
This function checks the validity of the parameters passed to DSPLIB_fir_init function....
Definition: DSPLIB_fir.cpp:32
int32_t DSPLIB_fir_getHandleSize(DSPLIB_fir_InitArgs *pKerInitArgs)
This is a query function to calculate the size of internal handle.
Definition: DSPLIB_fir.cpp:25
DSPLIB_STATUS DSPLIB_fir_exec_checkParams(DSPLIB_kernelHandle handle, const void *restrict pIn, const void *restrict pFilter, const void *restrict pOut)
This function checks the validity of the parameters passed to DSPLIB_fir_exec function....
Definition: DSPLIB_fir.cpp:119
void DSPLIB_fir_perfEst(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsIn, const DSPLIB_bufParams2D_t *bufParamsFilter, const DSPLIB_bufParams2D_t *bufParamsOut, uint64_t *archCycles, uint64_t *estCycles)
This is a utility function that gives an estimate of the cycles consumed for the kernel execution.
DSPLIB_STATUS DSPLIB_fir_init(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsIn, DSPLIB_bufParams2D_t *bufParamsFilter, DSPLIB_bufParams2D_t *bufParamsOut, DSPLIB_fir_InitArgs *pKerInitArgs)
This function should be called before the DSPLIB_fir_exec function is called. This function takes car...
Definition: DSPLIB_fir.cpp:139
A structure for a 2 dimensional buffer descriptor.
Structure containing the parameters to initialize the kernel.
Definition: DSPLIB_fir.h:105
int32_t dataSize
Size of input data
Definition: DSPLIB_fir.h:109
int8_t funcStyle
Variant of the function refer to DSPLIB_FUNCTION_STYLE
Definition: DSPLIB_fir.h:107
uint32_t enableNchCoefs
Flag to enable per channel filter coefficients: 0 => same coefficients for all channels in batch 1 =>...
Definition: DSPLIB_fir.h:125
int32_t batchSize
Size of batch in terms of number of channels of input data
Definition: DSPLIB_fir.h:111
uint32_t shift
Bit-shift values to be used for internal computation.
Definition: DSPLIB_fir.h:121
int32_t filterSize
Size of filter
Definition: DSPLIB_fir.h:113