|
AM64x MCU+ SDK
09.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 <drivers/hw_include/am263px/cslr_tmu.h>
46 #include <drivers/hw_include/am263px/cslr_soc_r5_baseaddress.h>
52 #ifndef ReciprocalOf2PI
53 #define ReciprocalOf2PI 0.159154943091895335768f
57 #define TwoPI 6.283185307F
61 #define Log2ofe 1.44269F
65 #define OnebyLog2ofe 0.693147F
68 #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));
69 #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));
89 __asm__
volatile(
"str %0, [%1]\n\t"
92 :
"r" (anglePU),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_SINPUF32_R0));
94 return *((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R0));
110 __asm__
volatile(
"str %0, [%1]\n\t"
113 :
"r" (anglePU),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_COSPUF32_R0));
115 return *((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R0));
132 __asm__
volatile(
"str %0, [%1]\n\t"
135 :
"r" (x),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_ATANPUF32_R2));
137 return *((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R2));
156 __asm__
volatile(
"str %0, [%1]\n\t"
159 :
"r" (x),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_LOG2F32_R3));
161 return *((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R3));
177 __asm__
volatile(
"str %0, [%1]\n\t"
180 :
"r" (x),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_LOG2F32_R3));
182 return (*((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R3))) *
OnebyLog2ofe;
199 __asm__
volatile(
"str %0, [%1]\n\t"
202 :
"r" (x),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_IEXP2F32_R3));
204 return *((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R3));
219 __asm__
volatile(
"str %0, [%1]\n\t"
222 :
"r" (x *
Log2ofe),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_IEXP2F32_R3));
224 return *((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R3));
242 __asm__
volatile(
"str %0, [%1]\n\t"
245 :
"r" (angleRad *
ReciprocalOf2PI),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_SINPUF32_R0));
247 return *((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R0));
264 __asm__
volatile(
"str %0, [%1]\n\t"
267 :
"r" (angleRad *
ReciprocalOf2PI),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_COSPUF32_R1));
269 return *((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R1));
285 __asm__
volatile(
"str %0, [%1]\n\t"
288 :
"r" (x),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_ATANPUF32_R2));
290 return (*((
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R2))) *
TwoPI;
307 __asm__
volatile(
"str %1, [%2, #0x240] \n\t"
308 "str %0, [%2, #0x1F0] \n\t"
310 "ldr %0, [%2, #0x2B0] \n\t"
311 "str %0, [%2, #0xC0] \n\t"
314 :
"r" (x),
"r" (y),
"r" (CSL_MSS_TMU_BASE));
316 return (
TwoPI * ((*(
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R0)) + (*(
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R7))));
333 __asm__
volatile(
"str %0, [%1]\n\t"
336 ".rept 4 ; nop ; .endr\n\t"
338 :
"r" (anglePU),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_SINPUF32_R0),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_COSPUF32_R1));
340 *sin_val = *(
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R0);
341 *cos_val = *(
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R1);
356 static inline void ti_tmu_sincos(
float angleRad,
float *sin_val,
float *cos_val)
358 __asm__
volatile(
"str %0, [%1]\n\t"
361 ".rept 4 ; nop ; .endr\n\t"
363 :
"r" (angleRad *
ReciprocalOf2PI),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_SINPUF32_R0),
"r" (CSL_MSS_TMU_BASE + CSL_TMU_COSPUF32_R1));
365 *sin_val = *(
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R0);
366 *cos_val = *(
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R1);
384 __asm__
volatile(
"str %0, [%1, #0x180] \n\t"
387 :
"r" (x),
"r" (CSL_MSS_TMU_BASE));
389 float res = (*(
float *)(CSL_MSS_TMU_BASE + CSL_TMU_RESULT_R0)) * y;
391 __asm__
volatile(
"str %0, [%1, #0x148] \n\t"
394 :
"r" (res),
"r" (CSL_MSS_TMU_BASE));
396 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:154
static float ti_tmu_iexp_pu(float x)
Computes the inverse exponential value of the input using TMU.
Definition: ti_tmu_trig.h:197
static float ti_tmu_atan_pu(float x)
Computes the trigonometric atan value of the input using TMU.
Definition: ti_tmu_trig.h:130
static float ti_tmu_cos_pu(float anglePU)
Computes the trigonometric cosine value of the input angle using TMU.
Definition: ti_tmu_trig.h:108
static float ti_tmu_powf(float x, float y)
Computes the power of the input value.
Definition: ti_tmu_trig.h:382
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:331
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:356
#define ReciprocalOf2PI
Definition: ti_tmu_trig.h:53
#define Log2ofe
Definition: ti_tmu_trig.h:61
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:175
#define TwoPI
Definition: ti_tmu_trig.h:57
static float ti_tmu_atan(float x)
Computes the trigonometric atan value of the input angle using TMU.
Definition: ti_tmu_trig.h:283
#define OnebyLog2ofe
Definition: ti_tmu_trig.h:65
static float ti_tmu_cos(float angleRad)
Computes the trigonometric cosine value of the input angle using TMU.
Definition: ti_tmu_trig.h:262
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:217
static float ti_tmu_sin_pu(float anglePU)
Computes the trigonometric sine value of the input angle using TMU.
Definition: ti_tmu_trig.h:87
static float ti_tmu_sin(float angleRad)
Computes the trigonometric sine value of the input angle using TMU.
Definition: ti_tmu_trig.h:240
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:305