CC27xxDriverLibrary
apu.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Filename: apu.h
3  *
4  * Description: Defines and prototypes for the APU peripheral.
5  *
6  * Copyright (c) 2024-2025 Texas Instruments Incorporated
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1) Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the following disclaimer.
13  *
14  * 2) Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * 3) Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from this
20  * software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER I25N
30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  ******************************************************************************/
35 
36 #ifndef __APU_H__
37 #define __APU_H__
38 
39 //*****************************************************************************
40 //
45 //
46 //*****************************************************************************
47 
48 #include <stdint.h>
49 #include <stdbool.h>
50 
51 //*****************************************************************************
52 //
53 // If building with a C++ compiler, make all of the definitions in this header
54 // have a C binding.
55 //
56 //*****************************************************************************
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 //*****************************************************************************
62 //
63 // Enum defines for the APU_API register, to control APU operation.
64 //
65 //*****************************************************************************
66 enum APUApi
67 {
68  APU_API_NOP = 0x0000,
69  APU_API_CONFIG = 0x0001,
70  APU_API_DOTPROD = 0x0002,
71  APU_API_VECTMULT = 0x0003,
72  APU_API_VECTSUM = 0x0004,
74  APU_API_UNITCIRC = 0x0006,
82  APU_API_POLAR = 0x000E,
85  APU_API_EIGEN = 0x0011,
86  APU_API_R2C = 0x0012,
88  APU_API_FFT = 0x0014,
89  APU_API_DCT = 0x0015,
90  APU_API_SORT = 0x0016,
91  APU_API_GAUSS = 0x0017,
92  APU_API_HERMLO = 0x0018,
93  APU_API_MAXMIN = 0x0019,
94 };
95 
96 //****************************************************************************
97 // Generic Definition
98 //****************************************************************************
99 #define APU_FBA_ENABLE 1
100 #define APU_FBA_DISABLE 0
101 #define APU_MEMORY_INTERLEAVED 1
102 #define APU_MEMORY_MIRRORED 0
103 
104 #define APU_HEAP_ADDR 0x03CE
105 
106 //****************************************************************************
107 // Operator definitions
108 //****************************************************************************
109 #define APU_OP_R2C 0
110 #define APU_OP_R2CC 1
111 #define APU_OP_R2CA 2
112 #define APU_OP_R2CCA 3
113 #define APU_OP_RA 4
114 #define APU_OP_IMA 5
115 #define APU_OP_ABS 6
116 
117 #define APU_OP_ADD 0
118 #define APU_OP_SUB 1
119 
120 #define APU_OP_MIN 0
121 #define APU_OP_MAX 1
122 
123 // Macro to convert absolute-address to offset-address used by APU
124 #define APU_GET_DATA_MEM_OFFSET(x) ((uint32_t)x - (uint32_t)APURAM_DATA0_BASE) >> 3
125 // Macro to convert offset-address used by APU to absolute-address
126 #define APU_GET_DATA_MEM_ABS(x) ((uint32_t)APURAM_DATA0_BASE + (((uint32_t)x) << 3))
127 
128 //*****************************************************************************
129 //
130 // API Functions and prototypes
131 //
132 //*****************************************************************************
133 
134 //****************************************************************************
135 // Generic Utils
136 //****************************************************************************
137 
138 //*****************************************************************************
139 //
145 //
146 //*****************************************************************************
147 void APUWaitOnIrq(void);
148 
149 //*****************************************************************************
150 //
156 //
157 //*****************************************************************************
158 bool APUOperationDone(void);
159 
160 //*****************************************************************************
161 //
167 //
168 //*****************************************************************************
169 void APUWaitOp(void);
170 
171 //*****************************************************************************
172 //
183 //
184 //*****************************************************************************
185 void APUSetConfig(uint32_t memConfig);
186 
187 //*****************************************************************************
188 //
194 //
195 //*****************************************************************************
196 void APUNop(void);
197 
198 //****************************************************************************
199 // Generic Linear Algebra
200 //****************************************************************************
201 
202 //*****************************************************************************
203 //
206 //
207 //*****************************************************************************
208 
209 //*****************************************************************************
210 //
230 //
231 //*****************************************************************************
232 void APUVectorDot(uint16_t N, void *pInputA, void *pInputB, void *pResult);
233 
234 //*****************************************************************************
235 //
256 //
257 //*****************************************************************************
258 void APUVectorDotConj(uint16_t N, void *pInputA, void *pInputB, void *pResult);
259 
260 //*****************************************************************************
261 //
282 //
283 //*****************************************************************************
284 void APUVectorMult(uint16_t N, void *pInputA, void *pInputB, void *pResult);
285 
286 //*****************************************************************************
287 //
305 //
306 //*****************************************************************************
307 void APUVectorScalarMult(uint16_t N, void *pInputA, void *pInputB, void *pResult);
308 
309 //*****************************************************************************
310 //
330 //
331 //*****************************************************************************
332 void APUVectorMultConj(uint16_t N, void *pInputA, void *pInputB, void *pResult);
333 
334 //*****************************************************************************
335 //
358 //
359 //*****************************************************************************
360 void APUVectorSum(uint16_t N, void *pInputA, void *pInputB, uint16_t op, void *pResult);
361 
362 //*****************************************************************************
363 //
386 //
387 //*****************************************************************************
388 void APUVectorScalarSum(uint16_t N, void *pInputA, void *pInputB, uint16_t op, void *pResult);
389 
390 //*****************************************************************************
391 //
412 //
413 //*****************************************************************************
414 void APUVectorCart2Pol(uint16_t N, void *pInput, void *pResult);
415 
416 //*****************************************************************************
417 //
443 //
444 //*****************************************************************************
445 void APUVectorPol2Cart(uint16_t N, void *pInput, void *pResult, void *pTemp);
446 
447 //*****************************************************************************
448 //
467 //
468 //*****************************************************************************
469 void APUVectorSort(uint16_t N, void *pInput);
470 
471 //*****************************************************************************
472 //
475 //
476 //*****************************************************************************
477 
478 //*****************************************************************************
479 //
482 //
483 //*****************************************************************************
484 
485 //*****************************************************************************
486 //
508 //
509 //*****************************************************************************
510 void APUMatrixMult(uint16_t M, uint16_t N, uint16_t P, void *pInputA, void *pInputB, void *pResult);
511 
512 //*****************************************************************************
513 //
536 //
537 //*****************************************************************************
538 void APUMatrixMultHerm(uint16_t M, void *pInputA, void *pInputB, void *pResult);
539 
540 //*****************************************************************************
541 //
564 //
565 //*****************************************************************************
566 void APUMatrixMultSym(uint16_t M, void *pInputA, void *pInputB, void *pResult);
567 
568 //*****************************************************************************
569 //
589 //
590 //*****************************************************************************
591 void APUMatrixSum(uint16_t M, uint16_t N, void *pInputA, void *pInputB, void *pResult);
592 
593 //*****************************************************************************
594 //
614 //
615 //*****************************************************************************
616 void APUMatrixScalarMult(uint16_t M, uint16_t N, void *pInputA, void *pInputB, void *pResult);
617 
618 //*****************************************************************************
619 //
639 //
640 //*****************************************************************************
641 void APUMatrixScalarSum(uint16_t M, uint16_t N, void *pInputA, void *pInputB, void *pResult);
642 
643 //*****************************************************************************
644 //
660 //
661 //*****************************************************************************
662 void APUMatrixNorm(uint16_t M, uint16_t N, void *pInput, void *pResult);
663 
664 //*****************************************************************************
665 //
668 //
669 //*****************************************************************************
670 
671 //*****************************************************************************
672 //
675 //
676 //*****************************************************************************
677 
678 //*****************************************************************************
679 //
697 //
698 //*****************************************************************************
699 void APUSpSmoothCovMatrix(uint16_t N, void *pInput, uint16_t L, void *pResult, uint16_t fb);
700 
701 //*****************************************************************************
702 //
732 //
733 //*****************************************************************************
734 void APUJacobiEVD(uint16_t N, void *pInput, void *pResultV, uint16_t maxIter, float minSum, float epsTol);
735 
736 //*****************************************************************************
737 //
767 //
768 //*****************************************************************************
769 void APUGaussJordanElim(uint16_t M, uint16_t N, void *pInput, float epsTol);
770 
771 //*****************************************************************************
772 //
795 //
796 //*****************************************************************************
797 void APUConfigFft(uint16_t N, void *pX);
798 
799 //*****************************************************************************
800 //
822 //
823 //*****************************************************************************
824 void APUComputeFft(uint16_t N, void *pX);
825 
826 //*****************************************************************************
827 //
853 //
854 //*****************************************************************************
855 void APUComputeIfft(uint16_t N, void *pX);
856 
857 //*****************************************************************************
858 //
880 //
881 //*****************************************************************************
882 void APUUnitCircle(uint16_t N, uint16_t M, uint16_t phase, uint16_t conj, void *pResult);
883 
884 //*****************************************************************************
885 //
917 //
918 //*****************************************************************************
919 void APUVectorMaxMin(uint16_t N, void *pInput, float thresh, uint16_t op, void *pResult);
920 
921 //*****************************************************************************
922 //
952 //
953 //*****************************************************************************
954 void APUVectorR2C(uint16_t N, void *pInputA, void *pInputB, uint16_t op, void *pResult);
955 
956 //*****************************************************************************
957 //
973 //
974 //*****************************************************************************
975 void APUHermLo(uint16_t N, void *pInput, void *pResult);
976 
977 //*****************************************************************************
978 //
981 //
982 //*****************************************************************************
983 
984 //*****************************************************************************
985 //
986 // Mark the end of the C bindings section for C++ compilers.
987 //
988 //*****************************************************************************
989 #ifdef __cplusplus
990 }
991 #endif
992 
993 //*****************************************************************************
994 //
998 //
999 //*****************************************************************************
1000 
1001 #endif // __APU_H__
void APUMatrixMult(uint16_t M, uint16_t N, uint16_t P, void *pInputA, void *pInputB, void *pResult)
APU accelerator for matrix multiplication of two matrices C = A*B.
Definition: apu.c:312
void APUVectorR2C(uint16_t N, void *pInputA, void *pInputB, uint16_t op, void *pResult)
APU accelerator for converting back and forth between real and complex numbers.
Definition: apu.c:702
void APUGaussJordanElim(uint16_t M, uint16_t N, void *pInput, float epsTol)
APU accelerator for Gauss-Jordan Elimination of a rectable complex matrix.
Definition: apu.c:545
Definition: apu.h:80
void APUVectorMaxMin(uint16_t N, void *pInput, float thresh, uint16_t op, void *pResult)
APU accelerator for computing max/min of the real part of a vector and a real value scalar...
Definition: apu.c:672
Definition: apu.h:81
void APUMatrixScalarSum(uint16_t M, uint16_t N, void *pInputA, void *pInputB, void *pResult)
APU accelerator for addition of a matrix A and a scalar b.
Definition: apu.c:417
void APUSpSmoothCovMatrix(uint16_t N, void *pInput, uint16_t L, void *pResult, uint16_t fb)
APU accelerator for covariance matrix computation using spatial smoothing and forward-backward averag...
Definition: apu.c:484
void APUWaitOnIrq(void)
Wait for the APU interrupt.
Definition: apu.c:50
void APUVectorScalarSum(uint16_t N, void *pInputA, void *pInputB, uint16_t op, void *pResult)
APU accelerator for addition/subtraction of a vector and a scalar.
Definition: apu.c:288
Definition: apu.h:86
void APUVectorSum(uint16_t N, void *pInputA, void *pInputB, uint16_t op, void *pResult)
APU accelerator for addition/subtraction of two vectors.
Definition: apu.c:264
Definition: apu.h:82
Definition: apu.h:70
void APUMatrixSum(uint16_t M, uint16_t N, void *pInputA, void *pInputB, void *pResult)
APU accelerator for matrix addition of two matrices C = A+B.
Definition: apu.c:384
Definition: apu.h:89
Definition: apu.h:74
void APUVectorScalarMult(uint16_t N, void *pInputA, void *pInputB, void *pResult)
APU accelerator for product of a vector and a scalar.
Definition: apu.c:210
void APUSetConfig(uint32_t memConfig)
Configure the APU.
Definition: apu.c:87
Definition: apu.h:79
void APUVectorMultConj(uint16_t N, void *pInputA, void *pInputB, void *pResult)
APU accelerator for element-wise product of vector A with the conjugate of vector B...
Definition: apu.c:238
void APUWaitOp(void)
Wait for the APU to start and finish.
Definition: apu.c:74
void APUMatrixMultSym(uint16_t M, void *pInputA, void *pInputB, void *pResult)
APU accelerator for matrix multiplication of two symmetric matrices C = A*B.
Definition: apu.c:360
void APUVectorSort(uint16_t N, void *pInput)
APU accelerator for in-place sorting of a vector.
Definition: apu.c:466
Definition: apu.h:78
void APUVectorDot(uint16_t N, void *pInputA, void *pInputB, void *pResult)
APU accelerator for vector dot product c = A dot B.
Definition: apu.c:136
void APUUnitCircle(uint16_t N, uint16_t M, uint16_t phase, uint16_t conj, void *pResult)
APU accelerator for generating points evenly distributed on unit circle.
Definition: apu.c:650
APUApi
Definition: apu.h:66
void APUMatrixNorm(uint16_t M, uint16_t N, void *pInput, void *pResult)
APU accelerator for Frobenius norm computation of a matrix.
Definition: apu.c:572
Definition: apu.h:85
void APUComputeIfft(uint16_t N, void *pX)
APU accelerator for invert Fast Fourier transform.
Definition: apu.c:612
Definition: apu.h:93
void APUComputeFft(uint16_t N, void *pX)
APU accelerator for Fast Fourier transform.
Definition: apu.c:593
Definition: apu.h:84
void APUNop(void)
APU NOP.
Definition: apu.c:124
Definition: apu.h:90
Definition: apu.h:92
Definition: apu.h:68
bool APUOperationDone(void)
Check if the APU has completed its operation.
Definition: apu.c:64
Definition: apu.h:83
void APUMatrixScalarMult(uint16_t M, uint16_t N, void *pInputA, void *pInputB, void *pResult)
APU accelerator for multiplication of a matrix A and a scalar b.
Definition: apu.c:406
Definition: apu.h:73
void APUHermLo(uint16_t N, void *pInput, void *pResult)
APU accelerator for converting Hermitian upper-triangular to lower-triangular.
Definition: apu.c:725
Definition: apu.h:76
void APUVectorPol2Cart(uint16_t N, void *pInput, void *pResult, void *pTemp)
APU accelerator for element-wise Polar-to-Cartesian transformation of a vector.
Definition: apu.c:446
void APUVectorMult(uint16_t N, void *pInputA, void *pInputB, void *pResult)
APU accelerator for element-wise product of two vectors.
Definition: apu.c:184
void APUVectorCart2Pol(uint16_t N, void *pInput, void *pResult)
APU accelerator for element-wise Cartesian-to-Polar transformation of a vector.
Definition: apu.c:428
Definition: apu.h:87
Definition: apu.h:69
void APUMatrixMultHerm(uint16_t M, void *pInputA, void *pInputB, void *pResult)
APU accelerator for matrix multiplication of two Hermitian matrices C = A*B.
Definition: apu.c:336
Definition: apu.h:75
Definition: apu.h:91
Definition: apu.h:77
void APUJacobiEVD(uint16_t N, void *pInput, void *pResultV, uint16_t maxIter, float minSum, float epsTol)
APU accelerator for Jacobi Eigen-Decomposition (EVD) of Hermitian Matrix.
Definition: apu.c:508
void APUConfigFft(uint16_t N, void *pX)
Configure APU accelerator for Fast Fourier transform.
Definition: apu.c:631
Definition: apu.h:72
Definition: apu.h:71
Definition: apu.h:88
void APUVectorDotConj(uint16_t N, void *pInputA, void *pInputB, void *pResult)
APU accelerator for vector dot product c = A dot conj(B)
Definition: apu.c:160