PSPSDK 2024-10-31
|
#include <stdint.h>
Go to the source code of this file.
Macros | |
#define | PSP_FPU_RM_MASK 0x03 |
Mask value for rounding mode. | |
#define | PSP_FPU_FLAGS_POS 2 |
Bit position of the flag bits. | |
#define | PSP_FPU_ENABLE_POS 7 |
Bit position of the enable bits. | |
#define | PSP_FPU_CAUSE_POS 12 |
Bit position of the cause bits. | |
#define | PSP_FPU_CC0_POS 23 |
Bit position of the cc0 bit. | |
#define | PSP_FPU_FS_POS 24 |
Bit position of the fs bit. | |
#define | PSP_FPU_CC17_POS 25 |
Bit position of the cc1->7 bits. | |
#define | PSP_FPU_FLAGS_MASK (0x1F << PSP_FPU_FLAGS_POS) |
#define | PSP_FPU_ENABLE_MASK (0x1F << PSP_FPU_ENABLE_POS) |
#define | PSP_FPU_CAUSE_MASK (0x3F << PSP_FPU_CAUSE_POS) |
#define | PSP_FPU_CC0_MASK (1 << PSP_FPU_CC0_POS) |
#define | PSP_FPU_FS_MASK (1 << PSP_FPU_FS_POS) |
#define | PSP_FPU_CC17_MASK (0x7F << PSP_FPU_CC17_POS) |
Enumerations | |
enum | PspFpuRoundMode { PSP_FPU_RN = 0 , PSP_FPU_RZ = 1 , PSP_FPU_RP = 2 , PSP_FPU_RM = 3 } |
Enumeration for FPU rounding modes. More... | |
enum | PspFpuExceptions { PSP_FPU_EXCEPTION_INEXACT = 0x01 , PSP_FPU_EXCEPTION_UNDERFLOW = 0x02 , PSP_FPU_EXCEPTION_OVERFLOW = 0x04 , PSP_FPU_EXCEPTION_DIVBYZERO = 0x08 , PSP_FPU_EXCEPTION_INVALIDOP = 0x10 , PSP_FPU_EXCEPTION_UNIMPOP = 0x20 , PSP_FPU_EXCEPTION_ALL = 0x3F } |
Enumeration for FPU exceptions. More... | |
Functions | |
uint32_t | pspFpuGetFCR31 (void) |
Get the current value of the control/status register. | |
void | pspFpuSetFCR31 (uint32_t var) |
Set the current value of the control/status register. | |
void | pspFpuSetRoundmode (enum PspFpuRoundMode mode) |
Set the current round mode. | |
enum PspFpuRoundMode | pspFpuGetRoundmode (void) |
Get the current round mode. | |
uint32_t | pspFpuGetFlags (void) |
Get the exception flags (set when an exception occurs but the actual exception bit is not enabled) | |
void | pspFpuClearFlags (uint32_t clear) |
Clear the flags bits. | |
uint32_t | pspFpuGetEnable (void) |
Get the exception enable flags. | |
void | pspFpuSetEnable (uint32_t enable) |
Set the enable flags bits. | |
uint32_t | pspFpuGetCause (void) |
Get the cause bits (only useful if you installed your own exception handler) | |
void | pspFpuClearCause (uint32_t clear) |
Clear the cause bits. | |
uint32_t | pspFpuGetFS (void) |
Get the current value of the FS bit (if FS is 0 then an exception occurs with denormalized values, if 1 then they are rewritten as 0. | |
void | pspFpuSetFS (uint32_t fs) |
Set the FS bit. | |
uint32_t | pspFpuGetCondbits (void) |
Get the condition flags (8 bits) | |
void | pspFpuClearCondbits (uint32_t clear) |
Clear the condition bits. | |
float | pspFpuAbs (float f) |
returns absolute value | |
int | pspFpuCeil (float f) |
Round up. | |
int | pspFpuFloor (float f) |
Truncate. | |
float | pspFpuMax (float f1, float f2) |
select maximum value | |
float | pspFpuMin (float f1, float f2) |
select minimum value | |
float | pspFpuNeg (float f) |
Sign reversal. | |
int | pspFpuRound (float f) |
Round to nearest. | |
float | pspFpuRsqrt (float f) |
float | pspFpuSqrt (float f) |
Square root. | |
int | pspFpuTrunc (float f) |
Round towards zero. | |
float | pspFpuFmod (float fs, float fd) |
float | pspFpuFrac (float f) |
float | pspFpuReinterpretFloat (uint32_t ui) |
uint32_t | pspFpuReinterpretUint (float f) |
int | pspFpuIsEqual (float f1, float f2) |
float | pspFpuSignFloat (float f) |
int | pspFpuSignInt (float f) |
float | pspFpuPositiveZero (void) |
Positive zero. | |
float | pspFpuNegativeZero (void) |
Negative zero. | |
int | pspFpuIsZero (float f) |
Test for zero value. | |
int | pspFpuIsPositiveZero (float f) |
Test for positive zero. | |
int | pspFpuIsNegativeZero (float f) |
Test for negative zero. | |
int | pspFpuIsDenormal (float f) |
Test for denormalized number. | |
int | pspFpuIsZeroOrDenormal (float f) |
Test for zero or denormalized number. | |
float | pspFpuPositiveInf (void) |
Positive infinity. | |
float | pspFpuNegativeInf (void) |
Negative infinity. | |
int | pspFpuIsInf (float f) |
Test for infinity. | |
float | pspFpuPositiveNaN (void) |
NaN (positive SNaN) | |
float | pspFpuNegativeNaN (void) |
NaN (negative SNaN) | |
float | pspFpuPositiveQNaN (void) |
Quiet NaN (positive QNaN) | |
float | pspFpuNegativeQNaN (void) |
Quiet NaN (positive QNaN) | |
float | pspFpuPositiveSNaN (unsigned int uiSignal) |
Signaling NaN (positive SNaN) | |
float | pspFpuNegativeSNaN (unsigned int uiSignal) |
Signaling NaN (negative SNaN) | |
int | pspFpuIsNaN (float f) |
Test for NaN. | |
int | pspFpuIsInfOrNaN (float f) |
Test for infinity or NaN. | |
float | pspFpuNormalizePhase (float f) |
float | pspFpuSin (float x) |
Sine. | |
float | pspFpuCos (float x) |
Cosine. | |
float | pspFpuAtan (float x) |
Arc tangent. | |
float | pspFpuLog (float x) |
Natural Logarithm. | |
float | pspFpuExp (float x) |
Exponential. | |
float | pspFpuAsin (float x) |
ArcSin. | |
float | pspFpuAcos (float x) |
ArcCos. | |
double | pspFpuFloatToDouble (float a) |
convert float to double | |
float | pspFpuDoubleToFloat (double a) |
convert double to float | |
#define PSP_FPU_CAUSE_MASK (0x3F << PSP_FPU_CAUSE_POS) |
#define PSP_FPU_CAUSE_POS 12 |
Bit position of the cause bits.
#define PSP_FPU_CC0_MASK (1 << PSP_FPU_CC0_POS) |
#define PSP_FPU_CC0_POS 23 |
Bit position of the cc0 bit.
#define PSP_FPU_CC17_MASK (0x7F << PSP_FPU_CC17_POS) |
#define PSP_FPU_CC17_POS 25 |
Bit position of the cc1->7 bits.
#define PSP_FPU_ENABLE_MASK (0x1F << PSP_FPU_ENABLE_POS) |
#define PSP_FPU_ENABLE_POS 7 |
Bit position of the enable bits.
#define PSP_FPU_FLAGS_MASK (0x1F << PSP_FPU_FLAGS_POS) |
#define PSP_FPU_FLAGS_POS 2 |
Bit position of the flag bits.
#define PSP_FPU_FS_MASK (1 << PSP_FPU_FS_POS) |
#define PSP_FPU_FS_POS 24 |
Bit position of the fs bit.
#define PSP_FPU_RM_MASK 0x03 |
Mask value for rounding mode.
Enumeration for FPU exceptions.
ArcCos.
References pspFpuAtan(), and x.
ArcSin.
References pspFpuAtan(), and x.
Clear the cause bits.
clear | - Bitmask of the bits to clear, one or more of PspFpuExceptions |
References PSP_FPU_CAUSE_POS, pspFpuGetFCR31(), pspFpuSetFCR31(), and x.
Clear the condition bits.
clear | - Bitmask of the bits to clear |
References PSP_FPU_CC0_POS, PSP_FPU_CC17_POS, pspFpuGetFCR31(), pspFpuSetFCR31(), and x.
Clear the flags bits.
clear | - Bitmask of the bits to clear, one or more of PspFpuExceptions |
References PSP_FPU_FLAGS_POS, pspFpuGetFCR31(), pspFpuSetFCR31(), and x.
Cosine.
References COS_SIN_DIV, PSP_MATH_PI, x, and y.
Exponential.
References f, i, PSP_MATH_LN2, PSP_MATH_LOG2E, x, and z.
Get the cause bits (only useful if you installed your own exception handler)
References PSP_FPU_CAUSE_MASK, PSP_FPU_CAUSE_POS, pspFpuGetFCR31(), and x.
Get the condition flags (8 bits)
References PSP_FPU_CC0_MASK, PSP_FPU_CC0_POS, PSP_FPU_CC17_MASK, PSP_FPU_CC17_POS, pspFpuGetFCR31(), and x.
Get the exception enable flags.
References PSP_FPU_ENABLE_MASK, PSP_FPU_ENABLE_POS, pspFpuGetFCR31(), and x.
Get the current value of the control/status register.
References x.
Referenced by pspFpuClearCause(), pspFpuClearCondbits(), pspFpuClearFlags(), pspFpuGetCause(), pspFpuGetCondbits(), pspFpuGetEnable(), pspFpuGetFlags(), pspFpuGetFS(), pspFpuGetRoundmode(), pspFpuSetEnable(), pspFpuSetFS(), and pspFpuSetRoundmode().
Get the exception flags (set when an exception occurs but the actual exception bit is not enabled)
References PSP_FPU_FLAGS_MASK, PSP_FPU_FLAGS_POS, pspFpuGetFCR31(), and x.
Get the current value of the FS bit (if FS is 0 then an exception occurs with denormalized values, if 1 then they are rewritten as 0.
References PSP_FPU_FS_MASK, PSP_FPU_FS_POS, pspFpuGetFCR31(), and x.
enum PspFpuRoundMode pspFpuGetRoundmode | ( | void | ) |
Get the current round mode.
References PSP_FPU_RM_MASK, and pspFpuGetFCR31().
References PSP_MATH_TWOPI, and x.
Set the enable flags bits.
enable | - Bitmask of exceptions to enable, zero or more of PspFpuExceptions |
References PSP_FPU_ENABLE_POS, pspFpuGetFCR31(), pspFpuSetFCR31(), and x.
Set the current value of the control/status register.
var | - The value to set. |
References x.
Referenced by pspFpuClearCause(), pspFpuClearCondbits(), pspFpuClearFlags(), pspFpuSetEnable(), pspFpuSetFS(), and pspFpuSetRoundmode().
Set the FS bit.
fs | - 0 or 1 to unset or set fs |
References PSP_FPU_FS_POS, pspFpuGetFCR31(), pspFpuSetFCR31(), and x.
void pspFpuSetRoundmode | ( | enum PspFpuRoundMode | mode | ) |
Set the current round mode.
mode | - The rounding mode to set, one of PspFpuRoundMode |
References PSP_FPU_RM_MASK, pspFpuGetFCR31(), pspFpuSetFCR31(), and x.
Sine.
References COS_SIN_DIV, PSP_MATH_PI, x, and y.