OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uC-libc/] [include/] [m68k/] [fpu_control.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/* Copyright (C) 1993  Olaf Flebbe
2
This file is part of the Linux C Library.
3
 
4
The Linux C Library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public License as
6
published by the Free Software Foundation; either version 2 of the
7
License, or (at your option) any later version.
8
 
9
The Linux C Library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
Library General Public License for more details.  */
13
 
14
#ifndef _M68K_FPU_CONTROL_H
15
#define _M68K_FPU_CONTROL_H
16
 
17
/*
18
 * Motorola floating point control register bits.
19
 *
20
 * 31-16  -> reserved (read as 0, ignored on write)
21
 * 15     -> enable trap for BSUN exception
22
 * 14     -> enable trap for SNAN exception
23
 * 13     -> enable trap for OPERR exception
24
 * 12     -> enable trap for OVFL exception
25
 * 11     -> enable trap for UNFL exception
26
 * 10     -> enable trap for DZ exception
27
 *  9     -> enable trap for INEX2 exception
28
 *  8     -> enable trap for INEX1 exception
29
 *  7-6   -> Precision Control
30
 *  5-4   -> Rounding Control
31
 *  3-0   -> zero (read as 0, write as 0)
32
 *
33
 *
34
 * Precision Control:
35
 * 00 - round to extended precision
36
 * 01 - round to single precision
37
 * 10 - round to double precision
38
 * 11 - undefined
39
 *
40
 * Rounding Control:
41
 * 00 - rounding to nearest (RN)
42
 * 01 - rounding toward zero (RZ)
43
 * 10 - rounding (down)toward minus infinity (RM)
44
 * 11 - rounding (up) toward plus infinity (RP)
45
 *
46
 * The hardware default is 0x0000. I choose 0x5400.
47
 */
48
 
49
#include <features.h>
50
 
51
/* masking of interrupts */
52
#define _FPU_MASK_BSUN  0x8000  
53
#define _FPU_MASK_SNAN  0x4000
54
#define _FPU_MASK_OPERR 0x2000
55
#define _FPU_MASK_OVFL  0x1000
56
#define _FPU_MASK_UNFL  0x0800
57
#define _FPU_MASK_DZ    0x0400
58
#define _FPU_MASK_INEX1 0x0200
59
#define _FPU_MASK_INEX2 0x0100
60
 
61
/* precision control */
62
#define _FPU_EXTENDED 0x00   /* RECOMMENDED */
63
#define _FPU_DOUBLE   0x80
64
#define _FPU_SINGLE   0x40     /* DO NOT USE */
65
 
66
/* rounding control */
67
#define _FPU_RC_NEAREST 0x00    /* RECOMMENDED */
68
#define _FPU_RC_ZERO    0x10
69
#define _FPU_RC_DOWN    0x20
70
#define _FPU_RC_UP      0x30
71
 
72
#define _FPU_RESERVED 0xFFFF000F  /* Reserved bits in cw */
73
 
74
 
75
/* Now two recommended cw */
76
 
77
/* Linux default:
78
     - extended precision
79
     - rounding to nearest
80
     - exceptions on overflow, zero divide and NaN */
81
#if 0
82
#define _FPU_DEFAULT  0x00005400
83
#else
84
/* Don't enable execptions any more.  It caused too much grief.  */
85
#define _FPU_DEFAULT  0x00000000
86
#endif
87
 
88
/* IEEE:  same as above, but exceptions.  We must make it non-zero so
89
   that __setfpucw works.  This bit will be ignored.  */
90
#define _FPU_IEEE     0x00000001
91
 
92
/* private namespace. It should only be used by crt0.o. */
93
extern unsigned long __fpu_control;
94
 
95
__BEGIN_DECLS
96
 
97
/* called by crt0.o. It can be used to manipulate fpu control register. */
98
extern void __setfpucw __P ((unsigned long));
99
 
100
__END_DECLS
101
 
102
#endif /* _M68K_FPU_CONTROL_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.