 |
AM261x MCU+ SDK
10.02.00
|
|
Go to the documentation of this file.
40 #ifndef TI_TMU_TRIG_H_
41 #define TI_TMU_TRIG_H_
44 #include <drivers/hw_include/cslr.h>
45 #include <mathlib/trig/soc/tmu_soc.h>
51 #ifndef ReciprocalOf2PI
52 #define ReciprocalOf2PI 0.159154943091895335768f
56 #define TwoPI 6.283185307F
60 #define Log2ofe 1.44269F
64 #define OnebyLog2ofe 0.693147F
67 #define ISR_TMU_CONTEXT_SAVE HW_WR_REG32((CSL_MSS_TMU_BASE + CSL_TMU_CONTEXT_SAVE), HW_RD_REG32(CSL_MSS_TMU_BASE + CSL_TMU_CONTEXT_SAVE)| (1));
68 #define ISR_TMU_CONTEXT_RESTORE HW_WR_REG32((CSL_MSS_TMU_BASE + CSL_TMU_CONTEXT_RESTORE), HW_RD_REG32(CSL_MSS_TMU_BASE + CSL_TMU_CONTEXT_RESTORE)| (1));
88 __asm__
volatile(
"str %0, [%1]\n\t"
91 :
"r" (anglePU),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_SINPUF32_R0));
93 return *((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R0));
109 __asm__
volatile(
"str %0, [%1]\n\t"
112 :
"r" (anglePU),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_COSPUF32_R0));
114 return *((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R0));
131 __asm__
volatile(
"str %0, [%1]\n\t"
134 :
"r" (x),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_ATANPUF32_R2));
136 return *((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R2));
155 __asm__
volatile(
"str %0, [%1]\n\t"
158 :
"r" (x),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_LOG2F32_R3));
160 return *((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R3));
176 __asm__
volatile(
"str %0, [%1]\n\t"
179 :
"r" (x),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_LOG2F32_R3));
181 return (*((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R3))) *
OnebyLog2ofe;
198 __asm__
volatile(
"str %0, [%1]\n\t"
201 :
"r" (x),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_IEXP2F32_R3));
203 return *((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R3));
218 __asm__
volatile(
"str %0, [%1]\n\t"
221 :
"r" (x *
Log2ofe),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_IEXP2F32_R3));
223 return *((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R3));
241 __asm__
volatile(
"str %0, [%1]\n\t"
244 :
"r" (angleRad *
ReciprocalOf2PI),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_SINPUF32_R0));
246 return *((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R0));
263 __asm__
volatile(
"str %0, [%1]\n\t"
266 :
"r" (angleRad *
ReciprocalOf2PI),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_COSPUF32_R1));
268 return *((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R1));
284 __asm__
volatile(
"str %0, [%1]\n\t"
287 :
"r" (x),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_ATANPUF32_R2));
289 return (*((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R2))) *
TwoPI;
306 __asm__
volatile(
"str %1, [%2, #0x240] \n\t"
307 "str %0, [%2, #0x1F0] \n\t"
309 "ldr %0, [%2, #0x2B0] \n\t"
310 "str %0, [%2, #0xC0] \n\t"
313 :
"r" (x),
"r" (y),
"r" (CSL_MSS_TMU_BASE));
315 return (
TwoPI * ((*(
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R0)) + (*(
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R7))));
332 __asm__
volatile(
"str %0, [%1]\n\t"
335 ".rept 4 ; nop ; .endr\n\t"
337 :
"r" (anglePU),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_SINPUF32_R0),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_COSPUF32_R1));
339 *sin_val = *(
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R0);
340 *cos_val = *(
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R1);
355 static inline void ti_tmu_sincos(
float angleRad,
float *sin_val,
float *cos_val)
357 __asm__
volatile(
"str %0, [%1]\n\t"
360 ".rept 4 ; nop ; .endr\n\t"
362 :
"r" (angleRad *
ReciprocalOf2PI),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_SINPUF32_R0),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_COSPUF32_R1));
364 *sin_val = *(
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R0);
365 *cos_val = *(
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R1);
383 __asm__
volatile(
"str %0, [%1, #0x180] \n\t"
386 :
"r" (x),
"r" (CSL_MSS_TMU_BASE));
388 float res = (*(
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R0)) * y;
390 __asm__
volatile(
"str %0, [%1, #0x148] \n\t"
393 :
"r" (res),
"r" (CSL_MSS_TMU_BASE));
395 return res > 0 ? *(
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R1) : (1.0f / (*(
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R1)));
static float ti_tmu_log_pu(float x)
Computes the logarithmic value of the input using TMU.
Definition: ti_tmu_trig.h:153
static float ti_tmu_iexp_pu(float x)
Computes the inverse exponential value of the input using TMU.
Definition: ti_tmu_trig.h:196
static float ti_tmu_atan_pu(float x)
Computes the trigonometric atan value of the input using TMU.
Definition: ti_tmu_trig.h:129
static float ti_tmu_cos_pu(float anglePU)
Computes the trigonometric cosine value of the input angle using TMU.
Definition: ti_tmu_trig.h:107
static float ti_tmu_powf(float x, float y)
Computes the power of the input value.
Definition: ti_tmu_trig.h:381
static void ti_tmu_sincos_pu(float anglePU, float *sin_val, float *cos_val)
Computes the trigonometric sine and cosine value of the input using TMU.
Definition: ti_tmu_trig.h:330
static void ti_tmu_sincos(float angleRad, float *sin_val, float *cos_val)
Computes the trigonometric sine and cosine value of the input using TMU.
Definition: ti_tmu_trig.h:355
#define ReciprocalOf2PI
Definition: ti_tmu_trig.h:52
#define Log2ofe
Definition: ti_tmu_trig.h:60
static float ti_tmu_log_e_pu(float x)
Computes the logarithmic value to the base e of the input using TMU.
Definition: ti_tmu_trig.h:174
#define TwoPI
Definition: ti_tmu_trig.h:56
static float ti_tmu_atan(float x)
Computes the trigonometric atan value of the input angle using TMU.
Definition: ti_tmu_trig.h:282
#define OnebyLog2ofe
Definition: ti_tmu_trig.h:64
static float ti_tmu_cos(float angleRad)
Computes the trigonometric cosine value of the input angle using TMU.
Definition: ti_tmu_trig.h:261
static float ti_tmu_iexp_e_pu(float x)
Computes the inverse exponential value to the base e of the input using TMU.
Definition: ti_tmu_trig.h:216
static float ti_tmu_sin_pu(float anglePU)
Computes the trigonometric sine value of the input angle using TMU.
Definition: ti_tmu_trig.h:86
static float ti_tmu_sin(float angleRad)
Computes the trigonometric sine value of the input angle using TMU.
Definition: ti_tmu_trig.h:239
static float ti_tmu_atan2(float x, float y)
Computes the trigonometric atan2 value of the input values using TMU. Uses the quadratic built in TMU...
Definition: ti_tmu_trig.h:304