same stuff from mbed trunk (LPC17xx.h, etc.) but nothing else
Dependents: registers-example test test Tweeting_Machine_HelloWorld_WIZwiki-W750
same as the mbed trunk dated december 20th, 2012
(latest version is here: http://mbed.org/projects/libraries/svn/mbed/trunk/LPC1768/ARM)
core_cmFunc.h@0:f86e6135dcbc, 2012-12-21 (annotated)
- Committer:
- elevatorguy
- Date:
- Fri Dec 21 01:54:37 2012 +0000
- Revision:
- 0:f86e6135dcbc
standard library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
elevatorguy | 0:f86e6135dcbc | 1 | /**************************************************************************//** |
elevatorguy | 0:f86e6135dcbc | 2 | * @file core_cmFunc.h |
elevatorguy | 0:f86e6135dcbc | 3 | * @brief CMSIS Cortex-M Core Function Access Header File |
elevatorguy | 0:f86e6135dcbc | 4 | * @version V3.00 |
elevatorguy | 0:f86e6135dcbc | 5 | * @date 09. December 2011 |
elevatorguy | 0:f86e6135dcbc | 6 | * |
elevatorguy | 0:f86e6135dcbc | 7 | * @note |
elevatorguy | 0:f86e6135dcbc | 8 | * Copyright (C) 2009-2011 ARM Limited. All rights reserved. |
elevatorguy | 0:f86e6135dcbc | 9 | * |
elevatorguy | 0:f86e6135dcbc | 10 | * @par |
elevatorguy | 0:f86e6135dcbc | 11 | * ARM Limited (ARM) is supplying this software for use with Cortex-M |
elevatorguy | 0:f86e6135dcbc | 12 | * processor based microcontrollers. This file can be freely distributed |
elevatorguy | 0:f86e6135dcbc | 13 | * within development tools that are supporting such ARM based processors. |
elevatorguy | 0:f86e6135dcbc | 14 | * |
elevatorguy | 0:f86e6135dcbc | 15 | * @par |
elevatorguy | 0:f86e6135dcbc | 16 | * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED |
elevatorguy | 0:f86e6135dcbc | 17 | * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF |
elevatorguy | 0:f86e6135dcbc | 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. |
elevatorguy | 0:f86e6135dcbc | 19 | * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR |
elevatorguy | 0:f86e6135dcbc | 20 | * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
elevatorguy | 0:f86e6135dcbc | 21 | * |
elevatorguy | 0:f86e6135dcbc | 22 | ******************************************************************************/ |
elevatorguy | 0:f86e6135dcbc | 23 | |
elevatorguy | 0:f86e6135dcbc | 24 | #ifndef __CORE_CMFUNC_H |
elevatorguy | 0:f86e6135dcbc | 25 | #define __CORE_CMFUNC_H |
elevatorguy | 0:f86e6135dcbc | 26 | |
elevatorguy | 0:f86e6135dcbc | 27 | |
elevatorguy | 0:f86e6135dcbc | 28 | /* ########################### Core Function Access ########################### */ |
elevatorguy | 0:f86e6135dcbc | 29 | /** \ingroup CMSIS_Core_FunctionInterface |
elevatorguy | 0:f86e6135dcbc | 30 | \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions |
elevatorguy | 0:f86e6135dcbc | 31 | @{ |
elevatorguy | 0:f86e6135dcbc | 32 | */ |
elevatorguy | 0:f86e6135dcbc | 33 | |
elevatorguy | 0:f86e6135dcbc | 34 | #if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/ |
elevatorguy | 0:f86e6135dcbc | 35 | /* ARM armcc specific functions */ |
elevatorguy | 0:f86e6135dcbc | 36 | |
elevatorguy | 0:f86e6135dcbc | 37 | #if (__ARMCC_VERSION < 400677) |
elevatorguy | 0:f86e6135dcbc | 38 | #error "Please use ARM Compiler Toolchain V4.0.677 or later!" |
elevatorguy | 0:f86e6135dcbc | 39 | #endif |
elevatorguy | 0:f86e6135dcbc | 40 | |
elevatorguy | 0:f86e6135dcbc | 41 | /* intrinsic void __enable_irq(); */ |
elevatorguy | 0:f86e6135dcbc | 42 | /* intrinsic void __disable_irq(); */ |
elevatorguy | 0:f86e6135dcbc | 43 | |
elevatorguy | 0:f86e6135dcbc | 44 | /** \brief Get Control Register |
elevatorguy | 0:f86e6135dcbc | 45 | |
elevatorguy | 0:f86e6135dcbc | 46 | This function returns the content of the Control Register. |
elevatorguy | 0:f86e6135dcbc | 47 | |
elevatorguy | 0:f86e6135dcbc | 48 | \return Control Register value |
elevatorguy | 0:f86e6135dcbc | 49 | */ |
elevatorguy | 0:f86e6135dcbc | 50 | static __INLINE uint32_t __get_CONTROL(void) |
elevatorguy | 0:f86e6135dcbc | 51 | { |
elevatorguy | 0:f86e6135dcbc | 52 | register uint32_t __regControl __ASM("control"); |
elevatorguy | 0:f86e6135dcbc | 53 | return(__regControl); |
elevatorguy | 0:f86e6135dcbc | 54 | } |
elevatorguy | 0:f86e6135dcbc | 55 | |
elevatorguy | 0:f86e6135dcbc | 56 | |
elevatorguy | 0:f86e6135dcbc | 57 | /** \brief Set Control Register |
elevatorguy | 0:f86e6135dcbc | 58 | |
elevatorguy | 0:f86e6135dcbc | 59 | This function writes the given value to the Control Register. |
elevatorguy | 0:f86e6135dcbc | 60 | |
elevatorguy | 0:f86e6135dcbc | 61 | \param [in] control Control Register value to set |
elevatorguy | 0:f86e6135dcbc | 62 | */ |
elevatorguy | 0:f86e6135dcbc | 63 | static __INLINE void __set_CONTROL(uint32_t control) |
elevatorguy | 0:f86e6135dcbc | 64 | { |
elevatorguy | 0:f86e6135dcbc | 65 | register uint32_t __regControl __ASM("control"); |
elevatorguy | 0:f86e6135dcbc | 66 | __regControl = control; |
elevatorguy | 0:f86e6135dcbc | 67 | } |
elevatorguy | 0:f86e6135dcbc | 68 | |
elevatorguy | 0:f86e6135dcbc | 69 | |
elevatorguy | 0:f86e6135dcbc | 70 | /** \brief Get IPSR Register |
elevatorguy | 0:f86e6135dcbc | 71 | |
elevatorguy | 0:f86e6135dcbc | 72 | This function returns the content of the IPSR Register. |
elevatorguy | 0:f86e6135dcbc | 73 | |
elevatorguy | 0:f86e6135dcbc | 74 | \return IPSR Register value |
elevatorguy | 0:f86e6135dcbc | 75 | */ |
elevatorguy | 0:f86e6135dcbc | 76 | static __INLINE uint32_t __get_IPSR(void) |
elevatorguy | 0:f86e6135dcbc | 77 | { |
elevatorguy | 0:f86e6135dcbc | 78 | register uint32_t __regIPSR __ASM("ipsr"); |
elevatorguy | 0:f86e6135dcbc | 79 | return(__regIPSR); |
elevatorguy | 0:f86e6135dcbc | 80 | } |
elevatorguy | 0:f86e6135dcbc | 81 | |
elevatorguy | 0:f86e6135dcbc | 82 | |
elevatorguy | 0:f86e6135dcbc | 83 | /** \brief Get APSR Register |
elevatorguy | 0:f86e6135dcbc | 84 | |
elevatorguy | 0:f86e6135dcbc | 85 | This function returns the content of the APSR Register. |
elevatorguy | 0:f86e6135dcbc | 86 | |
elevatorguy | 0:f86e6135dcbc | 87 | \return APSR Register value |
elevatorguy | 0:f86e6135dcbc | 88 | */ |
elevatorguy | 0:f86e6135dcbc | 89 | static __INLINE uint32_t __get_APSR(void) |
elevatorguy | 0:f86e6135dcbc | 90 | { |
elevatorguy | 0:f86e6135dcbc | 91 | register uint32_t __regAPSR __ASM("apsr"); |
elevatorguy | 0:f86e6135dcbc | 92 | return(__regAPSR); |
elevatorguy | 0:f86e6135dcbc | 93 | } |
elevatorguy | 0:f86e6135dcbc | 94 | |
elevatorguy | 0:f86e6135dcbc | 95 | |
elevatorguy | 0:f86e6135dcbc | 96 | /** \brief Get xPSR Register |
elevatorguy | 0:f86e6135dcbc | 97 | |
elevatorguy | 0:f86e6135dcbc | 98 | This function returns the content of the xPSR Register. |
elevatorguy | 0:f86e6135dcbc | 99 | |
elevatorguy | 0:f86e6135dcbc | 100 | \return xPSR Register value |
elevatorguy | 0:f86e6135dcbc | 101 | */ |
elevatorguy | 0:f86e6135dcbc | 102 | static __INLINE uint32_t __get_xPSR(void) |
elevatorguy | 0:f86e6135dcbc | 103 | { |
elevatorguy | 0:f86e6135dcbc | 104 | register uint32_t __regXPSR __ASM("xpsr"); |
elevatorguy | 0:f86e6135dcbc | 105 | return(__regXPSR); |
elevatorguy | 0:f86e6135dcbc | 106 | } |
elevatorguy | 0:f86e6135dcbc | 107 | |
elevatorguy | 0:f86e6135dcbc | 108 | |
elevatorguy | 0:f86e6135dcbc | 109 | /** \brief Get Process Stack Pointer |
elevatorguy | 0:f86e6135dcbc | 110 | |
elevatorguy | 0:f86e6135dcbc | 111 | This function returns the current value of the Process Stack Pointer (PSP). |
elevatorguy | 0:f86e6135dcbc | 112 | |
elevatorguy | 0:f86e6135dcbc | 113 | \return PSP Register value |
elevatorguy | 0:f86e6135dcbc | 114 | */ |
elevatorguy | 0:f86e6135dcbc | 115 | static __INLINE uint32_t __get_PSP(void) |
elevatorguy | 0:f86e6135dcbc | 116 | { |
elevatorguy | 0:f86e6135dcbc | 117 | register uint32_t __regProcessStackPointer __ASM("psp"); |
elevatorguy | 0:f86e6135dcbc | 118 | return(__regProcessStackPointer); |
elevatorguy | 0:f86e6135dcbc | 119 | } |
elevatorguy | 0:f86e6135dcbc | 120 | |
elevatorguy | 0:f86e6135dcbc | 121 | |
elevatorguy | 0:f86e6135dcbc | 122 | /** \brief Set Process Stack Pointer |
elevatorguy | 0:f86e6135dcbc | 123 | |
elevatorguy | 0:f86e6135dcbc | 124 | This function assigns the given value to the Process Stack Pointer (PSP). |
elevatorguy | 0:f86e6135dcbc | 125 | |
elevatorguy | 0:f86e6135dcbc | 126 | \param [in] topOfProcStack Process Stack Pointer value to set |
elevatorguy | 0:f86e6135dcbc | 127 | */ |
elevatorguy | 0:f86e6135dcbc | 128 | static __INLINE void __set_PSP(uint32_t topOfProcStack) |
elevatorguy | 0:f86e6135dcbc | 129 | { |
elevatorguy | 0:f86e6135dcbc | 130 | register uint32_t __regProcessStackPointer __ASM("psp"); |
elevatorguy | 0:f86e6135dcbc | 131 | __regProcessStackPointer = topOfProcStack; |
elevatorguy | 0:f86e6135dcbc | 132 | } |
elevatorguy | 0:f86e6135dcbc | 133 | |
elevatorguy | 0:f86e6135dcbc | 134 | |
elevatorguy | 0:f86e6135dcbc | 135 | /** \brief Get Main Stack Pointer |
elevatorguy | 0:f86e6135dcbc | 136 | |
elevatorguy | 0:f86e6135dcbc | 137 | This function returns the current value of the Main Stack Pointer (MSP). |
elevatorguy | 0:f86e6135dcbc | 138 | |
elevatorguy | 0:f86e6135dcbc | 139 | \return MSP Register value |
elevatorguy | 0:f86e6135dcbc | 140 | */ |
elevatorguy | 0:f86e6135dcbc | 141 | static __INLINE uint32_t __get_MSP(void) |
elevatorguy | 0:f86e6135dcbc | 142 | { |
elevatorguy | 0:f86e6135dcbc | 143 | register uint32_t __regMainStackPointer __ASM("msp"); |
elevatorguy | 0:f86e6135dcbc | 144 | return(__regMainStackPointer); |
elevatorguy | 0:f86e6135dcbc | 145 | } |
elevatorguy | 0:f86e6135dcbc | 146 | |
elevatorguy | 0:f86e6135dcbc | 147 | |
elevatorguy | 0:f86e6135dcbc | 148 | /** \brief Set Main Stack Pointer |
elevatorguy | 0:f86e6135dcbc | 149 | |
elevatorguy | 0:f86e6135dcbc | 150 | This function assigns the given value to the Main Stack Pointer (MSP). |
elevatorguy | 0:f86e6135dcbc | 151 | |
elevatorguy | 0:f86e6135dcbc | 152 | \param [in] topOfMainStack Main Stack Pointer value to set |
elevatorguy | 0:f86e6135dcbc | 153 | */ |
elevatorguy | 0:f86e6135dcbc | 154 | static __INLINE void __set_MSP(uint32_t topOfMainStack) |
elevatorguy | 0:f86e6135dcbc | 155 | { |
elevatorguy | 0:f86e6135dcbc | 156 | register uint32_t __regMainStackPointer __ASM("msp"); |
elevatorguy | 0:f86e6135dcbc | 157 | __regMainStackPointer = topOfMainStack; |
elevatorguy | 0:f86e6135dcbc | 158 | } |
elevatorguy | 0:f86e6135dcbc | 159 | |
elevatorguy | 0:f86e6135dcbc | 160 | |
elevatorguy | 0:f86e6135dcbc | 161 | /** \brief Get Priority Mask |
elevatorguy | 0:f86e6135dcbc | 162 | |
elevatorguy | 0:f86e6135dcbc | 163 | This function returns the current state of the priority mask bit from the Priority Mask Register. |
elevatorguy | 0:f86e6135dcbc | 164 | |
elevatorguy | 0:f86e6135dcbc | 165 | \return Priority Mask value |
elevatorguy | 0:f86e6135dcbc | 166 | */ |
elevatorguy | 0:f86e6135dcbc | 167 | static __INLINE uint32_t __get_PRIMASK(void) |
elevatorguy | 0:f86e6135dcbc | 168 | { |
elevatorguy | 0:f86e6135dcbc | 169 | register uint32_t __regPriMask __ASM("primask"); |
elevatorguy | 0:f86e6135dcbc | 170 | return(__regPriMask); |
elevatorguy | 0:f86e6135dcbc | 171 | } |
elevatorguy | 0:f86e6135dcbc | 172 | |
elevatorguy | 0:f86e6135dcbc | 173 | |
elevatorguy | 0:f86e6135dcbc | 174 | /** \brief Set Priority Mask |
elevatorguy | 0:f86e6135dcbc | 175 | |
elevatorguy | 0:f86e6135dcbc | 176 | This function assigns the given value to the Priority Mask Register. |
elevatorguy | 0:f86e6135dcbc | 177 | |
elevatorguy | 0:f86e6135dcbc | 178 | \param [in] priMask Priority Mask |
elevatorguy | 0:f86e6135dcbc | 179 | */ |
elevatorguy | 0:f86e6135dcbc | 180 | static __INLINE void __set_PRIMASK(uint32_t priMask) |
elevatorguy | 0:f86e6135dcbc | 181 | { |
elevatorguy | 0:f86e6135dcbc | 182 | register uint32_t __regPriMask __ASM("primask"); |
elevatorguy | 0:f86e6135dcbc | 183 | __regPriMask = (priMask); |
elevatorguy | 0:f86e6135dcbc | 184 | } |
elevatorguy | 0:f86e6135dcbc | 185 | |
elevatorguy | 0:f86e6135dcbc | 186 | |
elevatorguy | 0:f86e6135dcbc | 187 | #if (__CORTEX_M >= 0x03) |
elevatorguy | 0:f86e6135dcbc | 188 | |
elevatorguy | 0:f86e6135dcbc | 189 | /** \brief Enable FIQ |
elevatorguy | 0:f86e6135dcbc | 190 | |
elevatorguy | 0:f86e6135dcbc | 191 | This function enables FIQ interrupts by clearing the F-bit in the CPSR. |
elevatorguy | 0:f86e6135dcbc | 192 | Can only be executed in Privileged modes. |
elevatorguy | 0:f86e6135dcbc | 193 | */ |
elevatorguy | 0:f86e6135dcbc | 194 | #define __enable_fault_irq __enable_fiq |
elevatorguy | 0:f86e6135dcbc | 195 | |
elevatorguy | 0:f86e6135dcbc | 196 | |
elevatorguy | 0:f86e6135dcbc | 197 | /** \brief Disable FIQ |
elevatorguy | 0:f86e6135dcbc | 198 | |
elevatorguy | 0:f86e6135dcbc | 199 | This function disables FIQ interrupts by setting the F-bit in the CPSR. |
elevatorguy | 0:f86e6135dcbc | 200 | Can only be executed in Privileged modes. |
elevatorguy | 0:f86e6135dcbc | 201 | */ |
elevatorguy | 0:f86e6135dcbc | 202 | #define __disable_fault_irq __disable_fiq |
elevatorguy | 0:f86e6135dcbc | 203 | |
elevatorguy | 0:f86e6135dcbc | 204 | |
elevatorguy | 0:f86e6135dcbc | 205 | /** \brief Get Base Priority |
elevatorguy | 0:f86e6135dcbc | 206 | |
elevatorguy | 0:f86e6135dcbc | 207 | This function returns the current value of the Base Priority register. |
elevatorguy | 0:f86e6135dcbc | 208 | |
elevatorguy | 0:f86e6135dcbc | 209 | \return Base Priority register value |
elevatorguy | 0:f86e6135dcbc | 210 | */ |
elevatorguy | 0:f86e6135dcbc | 211 | static __INLINE uint32_t __get_BASEPRI(void) |
elevatorguy | 0:f86e6135dcbc | 212 | { |
elevatorguy | 0:f86e6135dcbc | 213 | register uint32_t __regBasePri __ASM("basepri"); |
elevatorguy | 0:f86e6135dcbc | 214 | return(__regBasePri); |
elevatorguy | 0:f86e6135dcbc | 215 | } |
elevatorguy | 0:f86e6135dcbc | 216 | |
elevatorguy | 0:f86e6135dcbc | 217 | |
elevatorguy | 0:f86e6135dcbc | 218 | /** \brief Set Base Priority |
elevatorguy | 0:f86e6135dcbc | 219 | |
elevatorguy | 0:f86e6135dcbc | 220 | This function assigns the given value to the Base Priority register. |
elevatorguy | 0:f86e6135dcbc | 221 | |
elevatorguy | 0:f86e6135dcbc | 222 | \param [in] basePri Base Priority value to set |
elevatorguy | 0:f86e6135dcbc | 223 | */ |
elevatorguy | 0:f86e6135dcbc | 224 | static __INLINE void __set_BASEPRI(uint32_t basePri) |
elevatorguy | 0:f86e6135dcbc | 225 | { |
elevatorguy | 0:f86e6135dcbc | 226 | register uint32_t __regBasePri __ASM("basepri"); |
elevatorguy | 0:f86e6135dcbc | 227 | __regBasePri = (basePri & 0xff); |
elevatorguy | 0:f86e6135dcbc | 228 | } |
elevatorguy | 0:f86e6135dcbc | 229 | |
elevatorguy | 0:f86e6135dcbc | 230 | |
elevatorguy | 0:f86e6135dcbc | 231 | /** \brief Get Fault Mask |
elevatorguy | 0:f86e6135dcbc | 232 | |
elevatorguy | 0:f86e6135dcbc | 233 | This function returns the current value of the Fault Mask register. |
elevatorguy | 0:f86e6135dcbc | 234 | |
elevatorguy | 0:f86e6135dcbc | 235 | \return Fault Mask register value |
elevatorguy | 0:f86e6135dcbc | 236 | */ |
elevatorguy | 0:f86e6135dcbc | 237 | static __INLINE uint32_t __get_FAULTMASK(void) |
elevatorguy | 0:f86e6135dcbc | 238 | { |
elevatorguy | 0:f86e6135dcbc | 239 | register uint32_t __regFaultMask __ASM("faultmask"); |
elevatorguy | 0:f86e6135dcbc | 240 | return(__regFaultMask); |
elevatorguy | 0:f86e6135dcbc | 241 | } |
elevatorguy | 0:f86e6135dcbc | 242 | |
elevatorguy | 0:f86e6135dcbc | 243 | |
elevatorguy | 0:f86e6135dcbc | 244 | /** \brief Set Fault Mask |
elevatorguy | 0:f86e6135dcbc | 245 | |
elevatorguy | 0:f86e6135dcbc | 246 | This function assigns the given value to the Fault Mask register. |
elevatorguy | 0:f86e6135dcbc | 247 | |
elevatorguy | 0:f86e6135dcbc | 248 | \param [in] faultMask Fault Mask value to set |
elevatorguy | 0:f86e6135dcbc | 249 | */ |
elevatorguy | 0:f86e6135dcbc | 250 | static __INLINE void __set_FAULTMASK(uint32_t faultMask) |
elevatorguy | 0:f86e6135dcbc | 251 | { |
elevatorguy | 0:f86e6135dcbc | 252 | register uint32_t __regFaultMask __ASM("faultmask"); |
elevatorguy | 0:f86e6135dcbc | 253 | __regFaultMask = (faultMask & (uint32_t)1); |
elevatorguy | 0:f86e6135dcbc | 254 | } |
elevatorguy | 0:f86e6135dcbc | 255 | |
elevatorguy | 0:f86e6135dcbc | 256 | #endif /* (__CORTEX_M >= 0x03) */ |
elevatorguy | 0:f86e6135dcbc | 257 | |
elevatorguy | 0:f86e6135dcbc | 258 | |
elevatorguy | 0:f86e6135dcbc | 259 | #if (__CORTEX_M == 0x04) |
elevatorguy | 0:f86e6135dcbc | 260 | |
elevatorguy | 0:f86e6135dcbc | 261 | /** \brief Get FPSCR |
elevatorguy | 0:f86e6135dcbc | 262 | |
elevatorguy | 0:f86e6135dcbc | 263 | This function returns the current value of the Floating Point Status/Control register. |
elevatorguy | 0:f86e6135dcbc | 264 | |
elevatorguy | 0:f86e6135dcbc | 265 | \return Floating Point Status/Control register value |
elevatorguy | 0:f86e6135dcbc | 266 | */ |
elevatorguy | 0:f86e6135dcbc | 267 | static __INLINE uint32_t __get_FPSCR(void) |
elevatorguy | 0:f86e6135dcbc | 268 | { |
elevatorguy | 0:f86e6135dcbc | 269 | #if (__FPU_PRESENT == 1) && (__FPU_USED == 1) |
elevatorguy | 0:f86e6135dcbc | 270 | register uint32_t __regfpscr __ASM("fpscr"); |
elevatorguy | 0:f86e6135dcbc | 271 | return(__regfpscr); |
elevatorguy | 0:f86e6135dcbc | 272 | #else |
elevatorguy | 0:f86e6135dcbc | 273 | return(0); |
elevatorguy | 0:f86e6135dcbc | 274 | #endif |
elevatorguy | 0:f86e6135dcbc | 275 | } |
elevatorguy | 0:f86e6135dcbc | 276 | |
elevatorguy | 0:f86e6135dcbc | 277 | |
elevatorguy | 0:f86e6135dcbc | 278 | /** \brief Set FPSCR |
elevatorguy | 0:f86e6135dcbc | 279 | |
elevatorguy | 0:f86e6135dcbc | 280 | This function assigns the given value to the Floating Point Status/Control register. |
elevatorguy | 0:f86e6135dcbc | 281 | |
elevatorguy | 0:f86e6135dcbc | 282 | \param [in] fpscr Floating Point Status/Control value to set |
elevatorguy | 0:f86e6135dcbc | 283 | */ |
elevatorguy | 0:f86e6135dcbc | 284 | static __INLINE void __set_FPSCR(uint32_t fpscr) |
elevatorguy | 0:f86e6135dcbc | 285 | { |
elevatorguy | 0:f86e6135dcbc | 286 | #if (__FPU_PRESENT == 1) && (__FPU_USED == 1) |
elevatorguy | 0:f86e6135dcbc | 287 | register uint32_t __regfpscr __ASM("fpscr"); |
elevatorguy | 0:f86e6135dcbc | 288 | __regfpscr = (fpscr); |
elevatorguy | 0:f86e6135dcbc | 289 | #endif |
elevatorguy | 0:f86e6135dcbc | 290 | } |
elevatorguy | 0:f86e6135dcbc | 291 | |
elevatorguy | 0:f86e6135dcbc | 292 | #endif /* (__CORTEX_M == 0x04) */ |
elevatorguy | 0:f86e6135dcbc | 293 | |
elevatorguy | 0:f86e6135dcbc | 294 | |
elevatorguy | 0:f86e6135dcbc | 295 | #elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/ |
elevatorguy | 0:f86e6135dcbc | 296 | /* IAR iccarm specific functions */ |
elevatorguy | 0:f86e6135dcbc | 297 | |
elevatorguy | 0:f86e6135dcbc | 298 | #include <cmsis_iar.h> |
elevatorguy | 0:f86e6135dcbc | 299 | |
elevatorguy | 0:f86e6135dcbc | 300 | #elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/ |
elevatorguy | 0:f86e6135dcbc | 301 | /* GNU gcc specific functions */ |
elevatorguy | 0:f86e6135dcbc | 302 | |
elevatorguy | 0:f86e6135dcbc | 303 | /** \brief Enable IRQ Interrupts |
elevatorguy | 0:f86e6135dcbc | 304 | |
elevatorguy | 0:f86e6135dcbc | 305 | This function enables IRQ interrupts by clearing the I-bit in the CPSR. |
elevatorguy | 0:f86e6135dcbc | 306 | Can only be executed in Privileged modes. |
elevatorguy | 0:f86e6135dcbc | 307 | */ |
elevatorguy | 0:f86e6135dcbc | 308 | __attribute__( ( always_inline ) ) static __INLINE void __enable_irq(void) |
elevatorguy | 0:f86e6135dcbc | 309 | { |
elevatorguy | 0:f86e6135dcbc | 310 | __ASM volatile ("cpsie i"); |
elevatorguy | 0:f86e6135dcbc | 311 | } |
elevatorguy | 0:f86e6135dcbc | 312 | |
elevatorguy | 0:f86e6135dcbc | 313 | |
elevatorguy | 0:f86e6135dcbc | 314 | /** \brief Disable IRQ Interrupts |
elevatorguy | 0:f86e6135dcbc | 315 | |
elevatorguy | 0:f86e6135dcbc | 316 | This function disables IRQ interrupts by setting the I-bit in the CPSR. |
elevatorguy | 0:f86e6135dcbc | 317 | Can only be executed in Privileged modes. |
elevatorguy | 0:f86e6135dcbc | 318 | */ |
elevatorguy | 0:f86e6135dcbc | 319 | __attribute__( ( always_inline ) ) static __INLINE void __disable_irq(void) |
elevatorguy | 0:f86e6135dcbc | 320 | { |
elevatorguy | 0:f86e6135dcbc | 321 | __ASM volatile ("cpsid i"); |
elevatorguy | 0:f86e6135dcbc | 322 | } |
elevatorguy | 0:f86e6135dcbc | 323 | |
elevatorguy | 0:f86e6135dcbc | 324 | |
elevatorguy | 0:f86e6135dcbc | 325 | /** \brief Get Control Register |
elevatorguy | 0:f86e6135dcbc | 326 | |
elevatorguy | 0:f86e6135dcbc | 327 | This function returns the content of the Control Register. |
elevatorguy | 0:f86e6135dcbc | 328 | |
elevatorguy | 0:f86e6135dcbc | 329 | \return Control Register value |
elevatorguy | 0:f86e6135dcbc | 330 | */ |
elevatorguy | 0:f86e6135dcbc | 331 | __attribute__( ( always_inline ) ) static __INLINE uint32_t __get_CONTROL(void) |
elevatorguy | 0:f86e6135dcbc | 332 | { |
elevatorguy | 0:f86e6135dcbc | 333 | uint32_t result; |
elevatorguy | 0:f86e6135dcbc | 334 | |
elevatorguy | 0:f86e6135dcbc | 335 | __ASM volatile ("MRS %0, control" : "=r" (result) ); |
elevatorguy | 0:f86e6135dcbc | 336 | return(result); |
elevatorguy | 0:f86e6135dcbc | 337 | } |
elevatorguy | 0:f86e6135dcbc | 338 | |
elevatorguy | 0:f86e6135dcbc | 339 | |
elevatorguy | 0:f86e6135dcbc | 340 | /** \brief Set Control Register |
elevatorguy | 0:f86e6135dcbc | 341 | |
elevatorguy | 0:f86e6135dcbc | 342 | This function writes the given value to the Control Register. |
elevatorguy | 0:f86e6135dcbc | 343 | |
elevatorguy | 0:f86e6135dcbc | 344 | \param [in] control Control Register value to set |
elevatorguy | 0:f86e6135dcbc | 345 | */ |
elevatorguy | 0:f86e6135dcbc | 346 | __attribute__( ( always_inline ) ) static __INLINE void __set_CONTROL(uint32_t control) |
elevatorguy | 0:f86e6135dcbc | 347 | { |
elevatorguy | 0:f86e6135dcbc | 348 | __ASM volatile ("MSR control, %0" : : "r" (control) ); |
elevatorguy | 0:f86e6135dcbc | 349 | } |
elevatorguy | 0:f86e6135dcbc | 350 | |
elevatorguy | 0:f86e6135dcbc | 351 | |
elevatorguy | 0:f86e6135dcbc | 352 | /** \brief Get IPSR Register |
elevatorguy | 0:f86e6135dcbc | 353 | |
elevatorguy | 0:f86e6135dcbc | 354 | This function returns the content of the IPSR Register. |
elevatorguy | 0:f86e6135dcbc | 355 | |
elevatorguy | 0:f86e6135dcbc | 356 | \return IPSR Register value |
elevatorguy | 0:f86e6135dcbc | 357 | */ |
elevatorguy | 0:f86e6135dcbc | 358 | __attribute__( ( always_inline ) ) static __INLINE uint32_t __get_IPSR(void) |
elevatorguy | 0:f86e6135dcbc | 359 | { |
elevatorguy | 0:f86e6135dcbc | 360 | uint32_t result; |
elevatorguy | 0:f86e6135dcbc | 361 | |
elevatorguy | 0:f86e6135dcbc | 362 | __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); |
elevatorguy | 0:f86e6135dcbc | 363 | return(result); |
elevatorguy | 0:f86e6135dcbc | 364 | } |
elevatorguy | 0:f86e6135dcbc | 365 | |
elevatorguy | 0:f86e6135dcbc | 366 | |
elevatorguy | 0:f86e6135dcbc | 367 | /** \brief Get APSR Register |
elevatorguy | 0:f86e6135dcbc | 368 | |
elevatorguy | 0:f86e6135dcbc | 369 | This function returns the content of the APSR Register. |
elevatorguy | 0:f86e6135dcbc | 370 | |
elevatorguy | 0:f86e6135dcbc | 371 | \return APSR Register value |
elevatorguy | 0:f86e6135dcbc | 372 | */ |
elevatorguy | 0:f86e6135dcbc | 373 | __attribute__( ( always_inline ) ) static __INLINE uint32_t __get_APSR(void) |
elevatorguy | 0:f86e6135dcbc | 374 | { |
elevatorguy | 0:f86e6135dcbc | 375 | uint32_t result; |
elevatorguy | 0:f86e6135dcbc | 376 | |
elevatorguy | 0:f86e6135dcbc | 377 | __ASM volatile ("MRS %0, apsr" : "=r" (result) ); |
elevatorguy | 0:f86e6135dcbc | 378 | return(result); |
elevatorguy | 0:f86e6135dcbc | 379 | } |
elevatorguy | 0:f86e6135dcbc | 380 | |
elevatorguy | 0:f86e6135dcbc | 381 | |
elevatorguy | 0:f86e6135dcbc | 382 | /** \brief Get xPSR Register |
elevatorguy | 0:f86e6135dcbc | 383 | |
elevatorguy | 0:f86e6135dcbc | 384 | This function returns the content of the xPSR Register. |
elevatorguy | 0:f86e6135dcbc | 385 | |
elevatorguy | 0:f86e6135dcbc | 386 | \return xPSR Register value |
elevatorguy | 0:f86e6135dcbc | 387 | */ |
elevatorguy | 0:f86e6135dcbc | 388 | __attribute__( ( always_inline ) ) static __INLINE uint32_t __get_xPSR(void) |
elevatorguy | 0:f86e6135dcbc | 389 | { |
elevatorguy | 0:f86e6135dcbc | 390 | uint32_t result; |
elevatorguy | 0:f86e6135dcbc | 391 | |
elevatorguy | 0:f86e6135dcbc | 392 | __ASM volatile ("MRS %0, xpsr" : "=r" (result) ); |
elevatorguy | 0:f86e6135dcbc | 393 | return(result); |
elevatorguy | 0:f86e6135dcbc | 394 | } |
elevatorguy | 0:f86e6135dcbc | 395 | |
elevatorguy | 0:f86e6135dcbc | 396 | |
elevatorguy | 0:f86e6135dcbc | 397 | /** \brief Get Process Stack Pointer |
elevatorguy | 0:f86e6135dcbc | 398 | |
elevatorguy | 0:f86e6135dcbc | 399 | This function returns the current value of the Process Stack Pointer (PSP). |
elevatorguy | 0:f86e6135dcbc | 400 | |
elevatorguy | 0:f86e6135dcbc | 401 | \return PSP Register value |
elevatorguy | 0:f86e6135dcbc | 402 | */ |
elevatorguy | 0:f86e6135dcbc | 403 | __attribute__( ( always_inline ) ) static __INLINE uint32_t __get_PSP(void) |
elevatorguy | 0:f86e6135dcbc | 404 | { |
elevatorguy | 0:f86e6135dcbc | 405 | register uint32_t result; |
elevatorguy | 0:f86e6135dcbc | 406 | |
elevatorguy | 0:f86e6135dcbc | 407 | __ASM volatile ("MRS %0, psp\n" : "=r" (result) ); |
elevatorguy | 0:f86e6135dcbc | 408 | return(result); |
elevatorguy | 0:f86e6135dcbc | 409 | } |
elevatorguy | 0:f86e6135dcbc | 410 | |
elevatorguy | 0:f86e6135dcbc | 411 | |
elevatorguy | 0:f86e6135dcbc | 412 | /** \brief Set Process Stack Pointer |
elevatorguy | 0:f86e6135dcbc | 413 | |
elevatorguy | 0:f86e6135dcbc | 414 | This function assigns the given value to the Process Stack Pointer (PSP). |
elevatorguy | 0:f86e6135dcbc | 415 | |
elevatorguy | 0:f86e6135dcbc | 416 | \param [in] topOfProcStack Process Stack Pointer value to set |
elevatorguy | 0:f86e6135dcbc | 417 | */ |
elevatorguy | 0:f86e6135dcbc | 418 | __attribute__( ( always_inline ) ) static __INLINE void __set_PSP(uint32_t topOfProcStack) |
elevatorguy | 0:f86e6135dcbc | 419 | { |
elevatorguy | 0:f86e6135dcbc | 420 | __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) ); |
elevatorguy | 0:f86e6135dcbc | 421 | } |
elevatorguy | 0:f86e6135dcbc | 422 | |
elevatorguy | 0:f86e6135dcbc | 423 | |
elevatorguy | 0:f86e6135dcbc | 424 | /** \brief Get Main Stack Pointer |
elevatorguy | 0:f86e6135dcbc | 425 | |
elevatorguy | 0:f86e6135dcbc | 426 | This function returns the current value of the Main Stack Pointer (MSP). |
elevatorguy | 0:f86e6135dcbc | 427 | |
elevatorguy | 0:f86e6135dcbc | 428 | \return MSP Register value |
elevatorguy | 0:f86e6135dcbc | 429 | */ |
elevatorguy | 0:f86e6135dcbc | 430 | __attribute__( ( always_inline ) ) static __INLINE uint32_t __get_MSP(void) |
elevatorguy | 0:f86e6135dcbc | 431 | { |
elevatorguy | 0:f86e6135dcbc | 432 | register uint32_t result; |
elevatorguy | 0:f86e6135dcbc | 433 | |
elevatorguy | 0:f86e6135dcbc | 434 | __ASM volatile ("MRS %0, msp\n" : "=r" (result) ); |
elevatorguy | 0:f86e6135dcbc | 435 | return(result); |
elevatorguy | 0:f86e6135dcbc | 436 | } |
elevatorguy | 0:f86e6135dcbc | 437 | |
elevatorguy | 0:f86e6135dcbc | 438 | |
elevatorguy | 0:f86e6135dcbc | 439 | /** \brief Set Main Stack Pointer |
elevatorguy | 0:f86e6135dcbc | 440 | |
elevatorguy | 0:f86e6135dcbc | 441 | This function assigns the given value to the Main Stack Pointer (MSP). |
elevatorguy | 0:f86e6135dcbc | 442 | |
elevatorguy | 0:f86e6135dcbc | 443 | \param [in] topOfMainStack Main Stack Pointer value to set |
elevatorguy | 0:f86e6135dcbc | 444 | */ |
elevatorguy | 0:f86e6135dcbc | 445 | __attribute__( ( always_inline ) ) static __INLINE void __set_MSP(uint32_t topOfMainStack) |
elevatorguy | 0:f86e6135dcbc | 446 | { |
elevatorguy | 0:f86e6135dcbc | 447 | __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) ); |
elevatorguy | 0:f86e6135dcbc | 448 | } |
elevatorguy | 0:f86e6135dcbc | 449 | |
elevatorguy | 0:f86e6135dcbc | 450 | |
elevatorguy | 0:f86e6135dcbc | 451 | /** \brief Get Priority Mask |
elevatorguy | 0:f86e6135dcbc | 452 | |
elevatorguy | 0:f86e6135dcbc | 453 | This function returns the current state of the priority mask bit from the Priority Mask Register. |
elevatorguy | 0:f86e6135dcbc | 454 | |
elevatorguy | 0:f86e6135dcbc | 455 | \return Priority Mask value |
elevatorguy | 0:f86e6135dcbc | 456 | */ |
elevatorguy | 0:f86e6135dcbc | 457 | __attribute__( ( always_inline ) ) static __INLINE uint32_t __get_PRIMASK(void) |
elevatorguy | 0:f86e6135dcbc | 458 | { |
elevatorguy | 0:f86e6135dcbc | 459 | uint32_t result; |
elevatorguy | 0:f86e6135dcbc | 460 | |
elevatorguy | 0:f86e6135dcbc | 461 | __ASM volatile ("MRS %0, primask" : "=r" (result) ); |
elevatorguy | 0:f86e6135dcbc | 462 | return(result); |
elevatorguy | 0:f86e6135dcbc | 463 | } |
elevatorguy | 0:f86e6135dcbc | 464 | |
elevatorguy | 0:f86e6135dcbc | 465 | |
elevatorguy | 0:f86e6135dcbc | 466 | /** \brief Set Priority Mask |
elevatorguy | 0:f86e6135dcbc | 467 | |
elevatorguy | 0:f86e6135dcbc | 468 | This function assigns the given value to the Priority Mask Register. |
elevatorguy | 0:f86e6135dcbc | 469 | |
elevatorguy | 0:f86e6135dcbc | 470 | \param [in] priMask Priority Mask |
elevatorguy | 0:f86e6135dcbc | 471 | */ |
elevatorguy | 0:f86e6135dcbc | 472 | __attribute__( ( always_inline ) ) static __INLINE void __set_PRIMASK(uint32_t priMask) |
elevatorguy | 0:f86e6135dcbc | 473 | { |
elevatorguy | 0:f86e6135dcbc | 474 | __ASM volatile ("MSR primask, %0" : : "r" (priMask) ); |
elevatorguy | 0:f86e6135dcbc | 475 | } |
elevatorguy | 0:f86e6135dcbc | 476 | |
elevatorguy | 0:f86e6135dcbc | 477 | |
elevatorguy | 0:f86e6135dcbc | 478 | #if (__CORTEX_M >= 0x03) |
elevatorguy | 0:f86e6135dcbc | 479 | |
elevatorguy | 0:f86e6135dcbc | 480 | /** \brief Enable FIQ |
elevatorguy | 0:f86e6135dcbc | 481 | |
elevatorguy | 0:f86e6135dcbc | 482 | This function enables FIQ interrupts by clearing the F-bit in the CPSR. |
elevatorguy | 0:f86e6135dcbc | 483 | Can only be executed in Privileged modes. |
elevatorguy | 0:f86e6135dcbc | 484 | */ |
elevatorguy | 0:f86e6135dcbc | 485 | __attribute__( ( always_inline ) ) static __INLINE void __enable_fault_irq(void) |
elevatorguy | 0:f86e6135dcbc | 486 | { |
elevatorguy | 0:f86e6135dcbc | 487 | __ASM volatile ("cpsie f"); |
elevatorguy | 0:f86e6135dcbc | 488 | } |
elevatorguy | 0:f86e6135dcbc | 489 | |
elevatorguy | 0:f86e6135dcbc | 490 | |
elevatorguy | 0:f86e6135dcbc | 491 | /** \brief Disable FIQ |
elevatorguy | 0:f86e6135dcbc | 492 | |
elevatorguy | 0:f86e6135dcbc | 493 | This function disables FIQ interrupts by setting the F-bit in the CPSR. |
elevatorguy | 0:f86e6135dcbc | 494 | Can only be executed in Privileged modes. |
elevatorguy | 0:f86e6135dcbc | 495 | */ |
elevatorguy | 0:f86e6135dcbc | 496 | __attribute__( ( always_inline ) ) static __INLINE void __disable_fault_irq(void) |
elevatorguy | 0:f86e6135dcbc | 497 | { |
elevatorguy | 0:f86e6135dcbc | 498 | __ASM volatile ("cpsid f"); |
elevatorguy | 0:f86e6135dcbc | 499 | } |
elevatorguy | 0:f86e6135dcbc | 500 | |
elevatorguy | 0:f86e6135dcbc | 501 | |
elevatorguy | 0:f86e6135dcbc | 502 | /** \brief Get Base Priority |
elevatorguy | 0:f86e6135dcbc | 503 | |
elevatorguy | 0:f86e6135dcbc | 504 | This function returns the current value of the Base Priority register. |
elevatorguy | 0:f86e6135dcbc | 505 | |
elevatorguy | 0:f86e6135dcbc | 506 | \return Base Priority register value |
elevatorguy | 0:f86e6135dcbc | 507 | */ |
elevatorguy | 0:f86e6135dcbc | 508 | __attribute__( ( always_inline ) ) static __INLINE uint32_t __get_BASEPRI(void) |
elevatorguy | 0:f86e6135dcbc | 509 | { |
elevatorguy | 0:f86e6135dcbc | 510 | uint32_t result; |
elevatorguy | 0:f86e6135dcbc | 511 | |
elevatorguy | 0:f86e6135dcbc | 512 | __ASM volatile ("MRS %0, basepri_max" : "=r" (result) ); |
elevatorguy | 0:f86e6135dcbc | 513 | return(result); |
elevatorguy | 0:f86e6135dcbc | 514 | } |
elevatorguy | 0:f86e6135dcbc | 515 | |
elevatorguy | 0:f86e6135dcbc | 516 | |
elevatorguy | 0:f86e6135dcbc | 517 | /** \brief Set Base Priority |
elevatorguy | 0:f86e6135dcbc | 518 | |
elevatorguy | 0:f86e6135dcbc | 519 | This function assigns the given value to the Base Priority register. |
elevatorguy | 0:f86e6135dcbc | 520 | |
elevatorguy | 0:f86e6135dcbc | 521 | \param [in] basePri Base Priority value to set |
elevatorguy | 0:f86e6135dcbc | 522 | */ |
elevatorguy | 0:f86e6135dcbc | 523 | __attribute__( ( always_inline ) ) static __INLINE void __set_BASEPRI(uint32_t value) |
elevatorguy | 0:f86e6135dcbc | 524 | { |
elevatorguy | 0:f86e6135dcbc | 525 | __ASM volatile ("MSR basepri, %0" : : "r" (value) ); |
elevatorguy | 0:f86e6135dcbc | 526 | } |
elevatorguy | 0:f86e6135dcbc | 527 | |
elevatorguy | 0:f86e6135dcbc | 528 | |
elevatorguy | 0:f86e6135dcbc | 529 | /** \brief Get Fault Mask |
elevatorguy | 0:f86e6135dcbc | 530 | |
elevatorguy | 0:f86e6135dcbc | 531 | This function returns the current value of the Fault Mask register. |
elevatorguy | 0:f86e6135dcbc | 532 | |
elevatorguy | 0:f86e6135dcbc | 533 | \return Fault Mask register value |
elevatorguy | 0:f86e6135dcbc | 534 | */ |
elevatorguy | 0:f86e6135dcbc | 535 | __attribute__( ( always_inline ) ) static __INLINE uint32_t __get_FAULTMASK(void) |
elevatorguy | 0:f86e6135dcbc | 536 | { |
elevatorguy | 0:f86e6135dcbc | 537 | uint32_t result; |
elevatorguy | 0:f86e6135dcbc | 538 | |
elevatorguy | 0:f86e6135dcbc | 539 | __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); |
elevatorguy | 0:f86e6135dcbc | 540 | return(result); |
elevatorguy | 0:f86e6135dcbc | 541 | } |
elevatorguy | 0:f86e6135dcbc | 542 | |
elevatorguy | 0:f86e6135dcbc | 543 | |
elevatorguy | 0:f86e6135dcbc | 544 | /** \brief Set Fault Mask |
elevatorguy | 0:f86e6135dcbc | 545 | |
elevatorguy | 0:f86e6135dcbc | 546 | This function assigns the given value to the Fault Mask register. |
elevatorguy | 0:f86e6135dcbc | 547 | |
elevatorguy | 0:f86e6135dcbc | 548 | \param [in] faultMask Fault Mask value to set |
elevatorguy | 0:f86e6135dcbc | 549 | */ |
elevatorguy | 0:f86e6135dcbc | 550 | __attribute__( ( always_inline ) ) static __INLINE void __set_FAULTMASK(uint32_t faultMask) |
elevatorguy | 0:f86e6135dcbc | 551 | { |
elevatorguy | 0:f86e6135dcbc | 552 | __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) ); |
elevatorguy | 0:f86e6135dcbc | 553 | } |
elevatorguy | 0:f86e6135dcbc | 554 | |
elevatorguy | 0:f86e6135dcbc | 555 | #endif /* (__CORTEX_M >= 0x03) */ |
elevatorguy | 0:f86e6135dcbc | 556 | |
elevatorguy | 0:f86e6135dcbc | 557 | |
elevatorguy | 0:f86e6135dcbc | 558 | #if (__CORTEX_M == 0x04) |
elevatorguy | 0:f86e6135dcbc | 559 | |
elevatorguy | 0:f86e6135dcbc | 560 | /** \brief Get FPSCR |
elevatorguy | 0:f86e6135dcbc | 561 | |
elevatorguy | 0:f86e6135dcbc | 562 | This function returns the current value of the Floating Point Status/Control register. |
elevatorguy | 0:f86e6135dcbc | 563 | |
elevatorguy | 0:f86e6135dcbc | 564 | \return Floating Point Status/Control register value |
elevatorguy | 0:f86e6135dcbc | 565 | */ |
elevatorguy | 0:f86e6135dcbc | 566 | __attribute__( ( always_inline ) ) static __INLINE uint32_t __get_FPSCR(void) |
elevatorguy | 0:f86e6135dcbc | 567 | { |
elevatorguy | 0:f86e6135dcbc | 568 | #if (__FPU_PRESENT == 1) && (__FPU_USED == 1) |
elevatorguy | 0:f86e6135dcbc | 569 | uint32_t result; |
elevatorguy | 0:f86e6135dcbc | 570 | |
elevatorguy | 0:f86e6135dcbc | 571 | __ASM volatile ("VMRS %0, fpscr" : "=r" (result) ); |
elevatorguy | 0:f86e6135dcbc | 572 | return(result); |
elevatorguy | 0:f86e6135dcbc | 573 | #else |
elevatorguy | 0:f86e6135dcbc | 574 | return(0); |
elevatorguy | 0:f86e6135dcbc | 575 | #endif |
elevatorguy | 0:f86e6135dcbc | 576 | } |
elevatorguy | 0:f86e6135dcbc | 577 | |
elevatorguy | 0:f86e6135dcbc | 578 | |
elevatorguy | 0:f86e6135dcbc | 579 | /** \brief Set FPSCR |
elevatorguy | 0:f86e6135dcbc | 580 | |
elevatorguy | 0:f86e6135dcbc | 581 | This function assigns the given value to the Floating Point Status/Control register. |
elevatorguy | 0:f86e6135dcbc | 582 | |
elevatorguy | 0:f86e6135dcbc | 583 | \param [in] fpscr Floating Point Status/Control value to set |
elevatorguy | 0:f86e6135dcbc | 584 | */ |
elevatorguy | 0:f86e6135dcbc | 585 | __attribute__( ( always_inline ) ) static __INLINE void __set_FPSCR(uint32_t fpscr) |
elevatorguy | 0:f86e6135dcbc | 586 | { |
elevatorguy | 0:f86e6135dcbc | 587 | #if (__FPU_PRESENT == 1) && (__FPU_USED == 1) |
elevatorguy | 0:f86e6135dcbc | 588 | __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) ); |
elevatorguy | 0:f86e6135dcbc | 589 | #endif |
elevatorguy | 0:f86e6135dcbc | 590 | } |
elevatorguy | 0:f86e6135dcbc | 591 | |
elevatorguy | 0:f86e6135dcbc | 592 | #endif /* (__CORTEX_M == 0x04) */ |
elevatorguy | 0:f86e6135dcbc | 593 | |
elevatorguy | 0:f86e6135dcbc | 594 | |
elevatorguy | 0:f86e6135dcbc | 595 | #elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/ |
elevatorguy | 0:f86e6135dcbc | 596 | /* TASKING carm specific functions */ |
elevatorguy | 0:f86e6135dcbc | 597 | |
elevatorguy | 0:f86e6135dcbc | 598 | /* |
elevatorguy | 0:f86e6135dcbc | 599 | * The CMSIS functions have been implemented as intrinsics in the compiler. |
elevatorguy | 0:f86e6135dcbc | 600 | * Please use "carm -?i" to get an up to date list of all instrinsics, |
elevatorguy | 0:f86e6135dcbc | 601 | * Including the CMSIS ones. |
elevatorguy | 0:f86e6135dcbc | 602 | */ |
elevatorguy | 0:f86e6135dcbc | 603 | |
elevatorguy | 0:f86e6135dcbc | 604 | #endif |
elevatorguy | 0:f86e6135dcbc | 605 | |
elevatorguy | 0:f86e6135dcbc | 606 | /*@} end of CMSIS_Core_RegAccFunctions */ |
elevatorguy | 0:f86e6135dcbc | 607 | |
elevatorguy | 0:f86e6135dcbc | 608 | |
elevatorguy | 0:f86e6135dcbc | 609 | #endif /* __CORE_CMFUNC_H */ |