Back to home page

OSCL-LXR

 
 

    


0001 /*
0002     NetWinder Floating Point Emulator
0003     (c) Rebel.COM, 1998,1999
0004 
0005     Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
0006 
0007     This program is free software; you can redistribute it and/or modify
0008     it under the terms of the GNU General Public License as published by
0009     the Free Software Foundation; either version 2 of the License, or
0010     (at your option) any later version.
0011 
0012     This program is distributed in the hope that it will be useful,
0013     but WITHOUT ANY WARRANTY; without even the implied warranty of
0014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0015     GNU General Public License for more details.
0016 
0017     You should have received a copy of the GNU General Public License
0018     along with this program; if not, write to the Free Software
0019     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
0020 */
0021 
0022 #include "fpa11.h"
0023 
0024 /* Read and write floating point status register */
0025 static inline unsigned int readFPSR(void)
0026 {
0027         FPA11 *fpa11 = GET_FPA11();
0028         return (fpa11->fpsr);
0029 }
0030 
0031 static inline void writeFPSR(FPSR reg)
0032 {
0033         FPA11 *fpa11 = GET_FPA11();
0034         /* the sysid byte in the status register is readonly */
0035         fpa11->fpsr = (fpa11->fpsr & MASK_SYSID) | (reg & ~MASK_SYSID);
0036 }
0037 
0038 /* Read and write floating point control register */
0039 static inline FPCR readFPCR(void)
0040 {
0041         FPA11 *fpa11 = GET_FPA11();
0042         /* clear SB, AB and DA bits before returning FPCR */
0043         return (fpa11->fpcr & ~MASK_RFC);
0044 }
0045 
0046 static inline void writeFPCR(FPCR reg)
0047 {
0048         FPA11 *fpa11 = GET_FPA11();
0049         fpa11->fpcr &= ~MASK_WFC;               /* clear SB, AB and DA bits */
0050         fpa11->fpcr |= (reg & MASK_WFC);        /* write SB, AB and DA bits */
0051 }