pspfpu.h

Go to the documentation of this file.
00001 /*
00002  * PSP Software Development Kit - http://www.pspdev.org
00003  * -----------------------------------------------------------------------
00004  * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
00005  *
00006  * pspfpu.h - Prototypes for the FPU library
00007  *
00008  * Copyright (c) 2006 TyRaNiD (James F.) 
00009  *
00010  * $Id: pspfpu.h 1782 2006-02-04 12:57:05Z tyranid $
00011  */
00012 #ifndef __PSPFPU_H__
00013 #define __PSPFPU_H__
00014 
00015 #include <stdint.h>
00016 
00017 /* Note the bit settings in here come from an NEC MIPSv4 document,
00018  * they seem sensible.
00019  */
00020 
00021 #ifdef __cplusplus
00022 extern "C" {
00023 #endif
00024 
00026 enum FpuRoundMode
00027 {
00029         FPU_RN = 0,
00031         FPU_RZ = 1,
00033         FPU_RP = 2,
00035         FPU_RM = 3,
00036 };
00037 
00039 #define FPU_RM_MASK 0x03 
00040 
00042 enum FpuExceptions
00043 {
00045         FPU_EXCEPTION_INEXACT   = 0x01,
00047         FPU_EXCEPTION_UNDERFLOW = 0x02,
00049         FPU_EXCEPTION_OVERFLOW  = 0x04,
00051         FPU_EXCEPTION_DIVBYZERO = 0x08,
00053         FPU_EXCEPTION_INVALIDOP = 0x10,
00055         FPU_EXCEPTION_UNIMPOP   = 0x20,
00057         FPU_EXCEPTION_ALL       = 0x3F
00058 };
00059 
00061 #define FPU_FLAGS_POS   2
00062 
00063 #define FPU_ENABLE_POS 7
00064 
00065 #define FPU_CAUSE_POS  12
00066 
00067 #define FPU_CC0_POS    23
00068 
00069 #define FPU_FS_POS     24
00070 
00071 #define FPU_CC17_POS   25
00072 
00073 #define FPU_FLAGS_MASK  (0x1F << FPU_FLAGS_POS)
00074 #define FPU_ENABLE_MASK (0x1F << FPU_ENABLE_POS)
00075 #define FPU_CAUSE_MASK  (0x3F << FPU_CAUSE_POS)
00076 #define FPU_CC0_MASK    (1 << FPU_CC0_POS)
00077 #define FPU_FS_MASK     (1 << FPU_FS_POS)
00078 #define FPU_CC17_MASK   (0x7F << FPU_CC17_POS)
00079 
00085 uint32_t pspfpu_get_fcr31(void);
00086 
00092 void pspfpu_set_fcr31(uint32_t var);
00093 
00099 void pspfpu_set_roundmode(enum FpuRoundMode mode);
00100 
00106 enum FpuRoundMode pspfpu_get_roundmode(void);
00107 
00114 uint32_t pspfpu_get_flags(void);
00115 
00121 void pspfpu_clear_flags(uint32_t clear);
00122 
00128 uint32_t pspfpu_get_enable(void);
00129 
00135 void pspfpu_set_enable(uint32_t enable);
00136 
00142 uint32_t pspfpu_get_cause(void);
00143 
00150 void pspfpu_clear_cause(uint32_t clear);
00151 
00158 uint32_t pspfpu_get_fs(void);
00159 
00165 void pspfpu_set_fs(uint32_t fs);
00166 
00172 uint32_t pspfpu_get_condbits(void);
00173 
00179 void pspfpu_clear_condbits(uint32_t clear);
00180 
00181 #ifdef __cplusplus
00182 }
00183 #endif
00184 
00185 #endif  /* __PSPFPU_H__ */

Generated on Tue Jul 24 15:21:22 2007 for PSPSDK-Rev2272 by  doxygen 1.5.2