2 * -------------------------------------------
3 * MSP432 DriverLib - v01_04_00_18
4 * -------------------------------------------
6 * --COPYRIGHT--,BSD,BSD
7 * Copyright (c) 2015, Texas Instruments Incorporated
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
17 * * Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
21 * * Neither the name of Texas Instruments Incorporated nor the names of
22 * its contributors may be used to endorse or promote products derived
23 * from this software without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
29 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 //*****************************************************************************
43 //! \addtogroup fpu_api
46 //*****************************************************************************
48 //*****************************************************************************
50 // If building with a C++ compiler, make all of the definitions in this header
53 //*****************************************************************************
62 //*****************************************************************************
64 // Values that can be passed to FPUHalfPrecisionSet as the mode parameter.
66 //*****************************************************************************
67 #define FPU_HALF_IEEE 0x00000000
68 #define FPU_HALF_ALTERNATE 0x04000000
70 //*****************************************************************************
72 // Values that can be passed to FPU_setNaNMode as the mode parameter.
74 //*****************************************************************************
75 #define FPU_NAN_PROPAGATE 0x00000000
76 #define FPU_NAN_DEFAULT 0x02000000
78 //*****************************************************************************
80 // Values that can be passed to FPU_setFlushToZeroMode as the mode parameter.
82 //*****************************************************************************
83 #define FPU_FLUSH_TO_ZERO_DIS 0x00000000
84 #define FPU_FLUSH_TO_ZERO_EN 0x01000000
86 //*****************************************************************************
88 // Values that can be passed to FPU_setRoundingMode as the mode parameter.
90 //*****************************************************************************
91 #define FPU_ROUND_NEAREST 0x00000000
92 #define FPU_ROUND_POS_INF 0x00400000
93 #define FPU_ROUND_NEG_INF 0x00800000
94 #define FPU_ROUND_ZERO 0x00c00000
96 //*****************************************************************************
98 //! Enables the floating-point unit.
100 //! This function enables the floating-point unit, allowing the floating-point
101 //! instructions to be executed. This function must be called prior to
102 //! performing any hardware floating-point operations; failure to do so results
103 //! in a NOCP usage fault.
107 //*****************************************************************************
108 extern void FPU_enableModule(void);
110 //*****************************************************************************
112 //! Disables the floating-point unit.
114 //! This function disables the floating-point unit, preventing floating-point
115 //! instructions from executing (generating a NOCP usage fault instead).
119 //*****************************************************************************
120 extern void FPU_disableModule(void);
122 //*****************************************************************************
124 //! Enables the stacking of floating-point registers.
126 //! This function enables the stacking of floating-point registers s0-s15 when
127 //! an interrupt is handled. When enabled, space is reserved on the stack for
128 //! the floating-point context and the floating-point state is saved into this
129 //! stack space. Upon return from the interrupt, the floating-point context is
132 //! If the floating-point registers are not stacked, floating-point
133 //! instructions cannot be safely executed in an interrupt handler because the
134 //! values of s0-s15 are not likely to be preserved for the interrupted code.
135 //! On the other hand, stacking the floating-point registers increases the
136 //! stacking operation from 8 words to 26 words, also increasing the interrupt
137 //! response latency.
141 //*****************************************************************************
142 extern void FPU_enableStacking(void);
144 //*****************************************************************************
146 //! Enables the lazy stacking of floating-point registers.
148 //! This function enables the lazy stacking of floating-point registers s0-s15
149 //! when an interrupt is handled. When lazy stacking is enabled, space is
150 //! reserved on the stack for the floating-point context, but the
151 //! floating-point state is not saved. If a floating-point instruction is
152 //! executed from within the interrupt context, the floating-point context is
153 //! first saved into the space reserved on the stack. On completion of the
154 //! interrupt handler, the floating-point context is only restored if it was
155 //! saved (as the result of executing a floating-point instruction).
157 //! This method provides a compromise between fast interrupt response (because
158 //! the floating-point state is not saved on interrupt entry) and the ability
159 //! to use floating-point in interrupt handlers (because the floating-point
160 //! state is saved if floating-point instructions are used).
164 //*****************************************************************************
165 extern void FPU_enableLazyStacking(void);
167 //*****************************************************************************
169 //! Disables the stacking of floating-point registers.
171 //! This function disables the stacking of floating-point registers s0-s15 when
172 //! an interrupt is handled. When floating-point context stacking is disabled,
173 //! floating-point operations performed in an interrupt handler destroy the
174 //! floating-point context of the main thread of execution.
178 //*****************************************************************************
179 extern void FPU_disableStacking(void);
181 //*****************************************************************************
183 //! Selects the format of half-precision floating-point values.
185 //! \param mode is the format for half-precision floating-point value, which
186 //! is either \b FPU_HALF_IEEE or \b FPU_HALF_ALTERNATE.
188 //! This function selects between the IEEE half-precision floating-point
189 //! representation and the Cortex-M processor alternative representation. The
190 //! alternative representation has a larger range but does not have a way to
191 //! encode infinity (positive or negative) or NaN (quiet or signalling). The
192 //! default setting is the IEEE format.
194 //! \note Unless this function is called prior to executing any floating-point
195 //! instructions, the default mode is used.
199 //*****************************************************************************
200 extern void FPU_setHalfPrecisionMode(uint32_t mode);
202 //*****************************************************************************
204 //! Selects the NaN mode.
206 //! \param mode is the mode for NaN results; which is
207 //! either \b FPU_NAN_PROPAGATE or \b FPU_NAN_DEFAULT.
209 //! This function selects the handling of NaN results during floating-point
210 //! computations. NaNs can either propagate (the default), or they can return
213 //! \note Unless this function is called prior to executing any floating-point
214 //! instructions, the default mode is used.
218 //*****************************************************************************
219 extern void FPU_setNaNMode(uint32_t mode);
221 //*****************************************************************************
223 //! Selects the flush-to-zero mode.
225 //! \param mode is the flush-to-zero mode; which is either
226 //! \b FPU_FLUSH_TO_ZERO_DIS or \b FPU_FLUSH_TO_ZERO_EN.
228 //! This function enables or disables the flush-to-zero mode of the
229 //! floating-point unit. When disabled (the default), the floating-point unit
230 //! is fully IEEE compliant. When enabled, values close to zero are treated as
231 //! zero, greatly improving the execution speed at the expense of some accuracy
232 //! (as well as IEEE compliance).
234 //! \note Unless this function is called prior to executing any floating-point
235 //! instructions, the default mode is used.
239 //*****************************************************************************
240 extern void FPU_setFlushToZeroMode(uint32_t mode);
242 //*****************************************************************************
244 //! Selects the rounding mode for floating-point results.
246 //! \param mode is the rounding mode.
248 //! This function selects the rounding mode for floating-point results. After
249 //! a floating-point operation, the result is rounded toward the specified
250 //! value. The default mode is \b FPU_ROUND_NEAREST.
252 //! The following rounding modes are available (as specified by \e mode):
254 //! - \b FPU_ROUND_NEAREST - round toward the nearest value
255 //! - \b FPU_ROUND_POS_INF - round toward positive infinity
256 //! - \b FPU_ROUND_NEG_INF - round toward negative infinity
257 //! - \b FPU_ROUND_ZERO - round toward zero
259 //! \note Unless this function is called prior to executing any floating-point
260 //! instructions, the default mode is used.
264 //*****************************************************************************
265 extern void FPU_setRoundingMode(uint32_t mode);
267 //*****************************************************************************
269 // Mark the end of the C bindings section for C++ compilers.
271 //*****************************************************************************
277 //*****************************************************************************
279 // Close the Doxygen group.
282 //*****************************************************************************