File: /usr/src/linux/arch/arm/nwfpe/fpa11.h

1     /*
2         NetWinder Floating Point Emulator
3         (c) Rebel.com, 1998-1999
4         
5         Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
6     
7         This program is free software; you can redistribute it and/or modify
8         it under the terms of the GNU General Public License as published by
9         the Free Software Foundation; either version 2 of the License, or
10         (at your option) any later version.
11     
12         This program is distributed in the hope that it will be useful,
13         but WITHOUT ANY WARRANTY; without even the implied warranty of
14         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15         GNU General Public License for more details.
16     
17         You should have received a copy of the GNU General Public License
18         along with this program; if not, write to the Free Software
19         Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20     */
21     
22     #ifndef __FPA11_H__
23     #define __FPA11_H__
24     
25     /* includes */
26     #include "fpsr.h"		/* FP control and status register definitions */
27     #include "softfloat.h"
28     
29     /* Need task_struct */
30     #include <linux/sched.h>
31     
32     #define		typeNone		0x00
33     #define		typeSingle		0x01
34     #define		typeDouble		0x02
35     #define		typeExtended		0x03
36     
37     typedef union tagFPREG {
38        float32  fSingle;
39        float64  fDouble;
40        floatx80 fExtended;
41     } FPREG;
42     
43     /* FPA11 device model */
44     typedef struct tagFPA11 {
45       unsigned int *userRegisters;
46       FPREG fpreg[8];		/* 8 floating point registers */
47       FPSR fpsr;			/* floating point status register */
48       FPCR fpcr;			/* floating point control register */
49       unsigned char fType[8];	/* type of floating point value held in
50     				   floating point registers.  One of none
51     				   single, double or extended. */
52       int initflag;			/* this is special.  The kernel guarantees
53     				   to set it to 0 when a thread is launched,
54     				   so we can use it to detect whether this
55     				   instance of the emulator needs to be
56     				   initialised. */
57     } FPA11;
58     
59     extern void resetFPA11(void);
60     extern void SetRoundingMode(const unsigned int);
61     extern void SetRoundingPrecision(const unsigned int);
62     
63     #define GET_FPA11() ((FPA11 *)(&current->thread.fpstate))
64     #define GET_USERREG() (GET_FPA11()->userRegisters)
65     
66     #endif
67