|
PSPSDK 2025-10-12
|
#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) |
Referenced by pspFpuGetCause().
| #define PSP_FPU_CAUSE_POS 12 |
Bit position of the cause bits.
Referenced by pspFpuClearCause(), and pspFpuGetCause().
| #define PSP_FPU_CC0_MASK (1 << PSP_FPU_CC0_POS) |
Referenced by pspFpuGetCondbits().
| #define PSP_FPU_CC0_POS 23 |
Bit position of the cc0 bit.
Referenced by pspFpuClearCondbits(), and pspFpuGetCondbits().
| #define PSP_FPU_CC17_MASK (0x7F << PSP_FPU_CC17_POS) |
Referenced by pspFpuGetCondbits().
| #define PSP_FPU_CC17_POS 25 |
Bit position of the cc1->7 bits.
Referenced by pspFpuClearCondbits(), and pspFpuGetCondbits().
| #define PSP_FPU_ENABLE_MASK (0x1F << PSP_FPU_ENABLE_POS) |
Referenced by pspFpuGetEnable().
| #define PSP_FPU_ENABLE_POS 7 |
Bit position of the enable bits.
Referenced by pspFpuGetEnable(), and pspFpuSetEnable().
| #define PSP_FPU_FLAGS_MASK (0x1F << PSP_FPU_FLAGS_POS) |
Referenced by pspFpuGetFlags().
| #define PSP_FPU_FLAGS_POS 2 |
Bit position of the flag bits.
Referenced by pspFpuClearFlags(), and pspFpuGetFlags().
| #define PSP_FPU_FS_MASK (1 << PSP_FPU_FS_POS) |
Referenced by pspFpuGetFS().
| #define PSP_FPU_FS_POS 24 |
Bit position of the fs bit.
Referenced by pspFpuGetFS(), and pspFpuSetFS().
| #define PSP_FPU_RM_MASK 0x03 |
Mask value for rounding mode.
Referenced by pspFpuGetRoundmode(), and pspFpuSetRoundmode().
| enum PspFpuExceptions |
Enumeration for FPU exceptions.
| enum PspFpuRoundMode |
| float pspFpuAbs | ( | float | f | ) |
returns absolute value
| float pspFpuAcos | ( | float | x | ) |
ArcCos.
References pspFpuAtan().
| float pspFpuAsin | ( | float | x | ) |
ArcSin.
References pspFpuAtan().
| float pspFpuAtan | ( | float | x | ) |
| int pspFpuCeil | ( | float | f | ) |
Round up.
| void pspFpuClearCause | ( | uint32_t | clear | ) |
Clear the cause bits.
| clear | - Bitmask of the bits to clear, one or more of PspFpuExceptions |
References PSP_FPU_CAUSE_POS, pspFpuGetFCR31(), and pspFpuSetFCR31().
| void pspFpuClearCondbits | ( | uint32_t | clear | ) |
Clear the condition bits.
| clear | - Bitmask of the bits to clear |
References PSP_FPU_CC0_POS, PSP_FPU_CC17_POS, pspFpuGetFCR31(), and pspFpuSetFCR31().
| void pspFpuClearFlags | ( | uint32_t | clear | ) |
Clear the flags bits.
| clear | - Bitmask of the bits to clear, one or more of PspFpuExceptions |
References PSP_FPU_FLAGS_POS, pspFpuGetFCR31(), and pspFpuSetFCR31().
| float pspFpuCos | ( | float | x | ) |
Cosine.
References COS_SIN_DIV, and PSP_MATH_PI.
| float pspFpuDoubleToFloat | ( | double | a | ) |
convert double to float
| float pspFpuExp | ( | float | x | ) |
Exponential.
References PSP_MATH_LN2, and PSP_MATH_LOG2E.
| double pspFpuFloatToDouble | ( | float | a | ) |
convert float to double
| int pspFpuFloor | ( | float | f | ) |
Truncate.
| float pspFpuFmod | ( | float | fs, |
| float | fd ) |
| float pspFpuFrac | ( | float | f | ) |
| uint32_t pspFpuGetCause | ( | void | ) |
Get the cause bits (only useful if you installed your own exception handler)
References PSP_FPU_CAUSE_MASK, PSP_FPU_CAUSE_POS, and pspFpuGetFCR31().
| uint32_t pspFpuGetCondbits | ( | void | ) |
Get the condition flags (8 bits)
References PSP_FPU_CC0_MASK, PSP_FPU_CC0_POS, PSP_FPU_CC17_MASK, PSP_FPU_CC17_POS, and pspFpuGetFCR31().
| uint32_t pspFpuGetEnable | ( | void | ) |
Get the exception enable flags.
References PSP_FPU_ENABLE_MASK, PSP_FPU_ENABLE_POS, and pspFpuGetFCR31().
| uint32_t pspFpuGetFCR31 | ( | void | ) |
Get the current value of the control/status register.
Referenced by pspFpuClearCause(), pspFpuClearCondbits(), pspFpuClearFlags(), pspFpuGetCause(), pspFpuGetCondbits(), pspFpuGetEnable(), pspFpuGetFlags(), pspFpuGetFS(), pspFpuGetRoundmode(), pspFpuSetEnable(), pspFpuSetFS(), and pspFpuSetRoundmode().
| uint32_t pspFpuGetFlags | ( | void | ) |
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, and pspFpuGetFCR31().
| 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.
References PSP_FPU_FS_MASK, PSP_FPU_FS_POS, and pspFpuGetFCR31().
| enum PspFpuRoundMode pspFpuGetRoundmode | ( | void | ) |
Get the current round mode.
References PSP_FPU_RM_MASK, and pspFpuGetFCR31().
| int pspFpuIsDenormal | ( | float | f | ) |
Test for denormalized number.
| int pspFpuIsEqual | ( | float | f1, |
| float | f2 ) |
| int pspFpuIsInf | ( | float | f | ) |
Test for infinity.
| int pspFpuIsInfOrNaN | ( | float | f | ) |
Test for infinity or NaN.
| int pspFpuIsNaN | ( | float | f | ) |
Test for NaN.
| int pspFpuIsNegativeZero | ( | float | f | ) |
Test for negative zero.
| int pspFpuIsPositiveZero | ( | float | f | ) |
Test for positive zero.
| int pspFpuIsZero | ( | float | f | ) |
Test for zero value.
| int pspFpuIsZeroOrDenormal | ( | float | f | ) |
Test for zero or denormalized number.
| float pspFpuLog | ( | float | x | ) |
Natural Logarithm.
| float pspFpuMax | ( | float | f1, |
| float | f2 ) |
select maximum value
| float pspFpuMin | ( | float | f1, |
| float | f2 ) |
select minimum value
| float pspFpuNeg | ( | float | f | ) |
Sign reversal.
| float pspFpuNegativeInf | ( | void | ) |
Negative infinity.
| float pspFpuNegativeNaN | ( | void | ) |
NaN (negative SNaN)
| float pspFpuNegativeQNaN | ( | void | ) |
Quiet NaN (positive QNaN)
| float pspFpuNegativeSNaN | ( | unsigned int | uiSignal | ) |
Signaling NaN (negative SNaN)
| float pspFpuNegativeZero | ( | void | ) |
Negative zero.
| float pspFpuNormalizePhase | ( | float | f | ) |
References PSP_MATH_TWOPI.
| float pspFpuPositiveInf | ( | void | ) |
Positive infinity.
| float pspFpuPositiveNaN | ( | void | ) |
NaN (positive SNaN)
| float pspFpuPositiveQNaN | ( | void | ) |
Quiet NaN (positive QNaN)
| float pspFpuPositiveSNaN | ( | unsigned int | uiSignal | ) |
Signaling NaN (positive SNaN)
| float pspFpuPositiveZero | ( | void | ) |
Positive zero.
| float pspFpuReinterpretFloat | ( | uint32_t | ui | ) |
| uint32_t pspFpuReinterpretUint | ( | float | f | ) |
| int pspFpuRound | ( | float | f | ) |
Round to nearest.
| float pspFpuRsqrt | ( | float | f | ) |
| void pspFpuSetEnable | ( | uint32_t | enable | ) |
Set the enable flags bits.
| enable | - Bitmask of exceptions to enable, zero or more of PspFpuExceptions |
References PSP_FPU_ENABLE_POS, pspFpuGetFCR31(), and pspFpuSetFCR31().
| void pspFpuSetFCR31 | ( | uint32_t | var | ) |
Set the current value of the control/status register.
| var | - The value to set. |
Referenced by pspFpuClearCause(), pspFpuClearCondbits(), pspFpuClearFlags(), pspFpuSetEnable(), pspFpuSetFS(), and pspFpuSetRoundmode().
| void pspFpuSetFS | ( | uint32_t | fs | ) |
Set the FS bit.
| fs | - 0 or 1 to unset or set fs |
References PSP_FPU_FS_POS, pspFpuGetFCR31(), and pspFpuSetFCR31().
| 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(), and pspFpuSetFCR31().
| float pspFpuSignFloat | ( | float | f | ) |
| int pspFpuSignInt | ( | float | f | ) |
| float pspFpuSin | ( | float | x | ) |
Sine.
References COS_SIN_DIV, and PSP_MATH_PI.
| float pspFpuSqrt | ( | float | f | ) |
Square root.
| int pspFpuTrunc | ( | float | f | ) |
Round towards zero.