The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
Kojto
Date:
Tue Feb 14 11:24:20 2017 +0000
Revision:
136:ef9c61f8c49f
Parent:
116:c0f6e94411f5
Release 136 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

3432: Target STM USBHOST support https://github.com/ARMmbed/mbed-os/pull/3432
3181: NUCLEO_F207ZG extending PeripheralPins.c: all available alternate functions can be used now https://github.com/ARMmbed/mbed-os/pull/3181
3626: NUCLEO_F412ZG : Add USB Device +Host https://github.com/ARMmbed/mbed-os/pull/3626
3628: Fix warnings https://github.com/ARMmbed/mbed-os/pull/3628
3629: STM32: L0 LL layer https://github.com/ARMmbed/mbed-os/pull/3629
3632: IDE Export support for platform VK_RZ_A1H https://github.com/ARMmbed/mbed-os/pull/3632
3642: Missing IRQ pin fix for platform VK_RZ_A1H https://github.com/ARMmbed/mbed-os/pull/3642
3664: Fix ncs36510 sleep definitions https://github.com/ARMmbed/mbed-os/pull/3664
3655: [STM32F4] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3655
3657: [STM32L4] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3657
3658: [STM32F3] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3658
3685: STM32: I2C: reset state machine https://github.com/ARMmbed/mbed-os/pull/3685
3692: uVisor: Standardize available legacy heap and stack https://github.com/ARMmbed/mbed-os/pull/3692
3621: Fix for #2884, LPC824: export to LPCXpresso, target running with wron https://github.com/ARMmbed/mbed-os/pull/3621
3649: [STM32F7] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3649
3695: Enforce device_name is valid in targets.json https://github.com/ARMmbed/mbed-os/pull/3695
3723: NCS36510: spi_format function bug fix https://github.com/ARMmbed/mbed-os/pull/3723

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 108:34e6b704fe68 1 /**************************************************************************//**
Kojto 108:34e6b704fe68 2 * @file core_cmFunc.h
Kojto 108:34e6b704fe68 3 * @brief CMSIS Cortex-M Core Function Access Header File
Kojto 110:165afa46840b 4 * @version V4.10
Kojto 110:165afa46840b 5 * @date 18. March 2015
Kojto 108:34e6b704fe68 6 *
Kojto 108:34e6b704fe68 7 * @note
Kojto 108:34e6b704fe68 8 *
Kojto 108:34e6b704fe68 9 ******************************************************************************/
Kojto 110:165afa46840b 10 /* Copyright (c) 2009 - 2015 ARM LIMITED
Kojto 108:34e6b704fe68 11
Kojto 108:34e6b704fe68 12 All rights reserved.
Kojto 108:34e6b704fe68 13 Redistribution and use in source and binary forms, with or without
Kojto 108:34e6b704fe68 14 modification, are permitted provided that the following conditions are met:
Kojto 108:34e6b704fe68 15 - Redistributions of source code must retain the above copyright
Kojto 108:34e6b704fe68 16 notice, this list of conditions and the following disclaimer.
Kojto 108:34e6b704fe68 17 - Redistributions in binary form must reproduce the above copyright
Kojto 108:34e6b704fe68 18 notice, this list of conditions and the following disclaimer in the
Kojto 108:34e6b704fe68 19 documentation and/or other materials provided with the distribution.
Kojto 108:34e6b704fe68 20 - Neither the name of ARM nor the names of its contributors may be used
Kojto 108:34e6b704fe68 21 to endorse or promote products derived from this software without
Kojto 108:34e6b704fe68 22 specific prior written permission.
Kojto 108:34e6b704fe68 23 *
Kojto 108:34e6b704fe68 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 108:34e6b704fe68 25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 108:34e6b704fe68 26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Kojto 108:34e6b704fe68 27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
Kojto 108:34e6b704fe68 28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
Kojto 108:34e6b704fe68 29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
Kojto 108:34e6b704fe68 30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
Kojto 108:34e6b704fe68 31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
Kojto 108:34e6b704fe68 32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
Kojto 108:34e6b704fe68 33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Kojto 108:34e6b704fe68 34 POSSIBILITY OF SUCH DAMAGE.
Kojto 108:34e6b704fe68 35 ---------------------------------------------------------------------------*/
Kojto 108:34e6b704fe68 36
Kojto 108:34e6b704fe68 37
Kojto 108:34e6b704fe68 38 #ifndef __CORE_CMFUNC_H
Kojto 108:34e6b704fe68 39 #define __CORE_CMFUNC_H
Kojto 108:34e6b704fe68 40
Kojto 108:34e6b704fe68 41
Kojto 108:34e6b704fe68 42 /* ########################### Core Function Access ########################### */
Kojto 108:34e6b704fe68 43 /** \ingroup CMSIS_Core_FunctionInterface
Kojto 108:34e6b704fe68 44 \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
Kojto 108:34e6b704fe68 45 @{
Kojto 108:34e6b704fe68 46 */
Kojto 108:34e6b704fe68 47
Kojto 108:34e6b704fe68 48 #if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/
Kojto 108:34e6b704fe68 49 /* ARM armcc specific functions */
Kojto 108:34e6b704fe68 50
Kojto 108:34e6b704fe68 51 #if (__ARMCC_VERSION < 400677)
Kojto 108:34e6b704fe68 52 #error "Please use ARM Compiler Toolchain V4.0.677 or later!"
Kojto 108:34e6b704fe68 53 #endif
Kojto 108:34e6b704fe68 54
Kojto 108:34e6b704fe68 55 /* intrinsic void __enable_irq(); */
Kojto 108:34e6b704fe68 56 /* intrinsic void __disable_irq(); */
Kojto 108:34e6b704fe68 57
Kojto 108:34e6b704fe68 58 /** \brief Get Control Register
Kojto 108:34e6b704fe68 59
Kojto 108:34e6b704fe68 60 This function returns the content of the Control Register.
Kojto 108:34e6b704fe68 61
Kojto 108:34e6b704fe68 62 \return Control Register value
Kojto 108:34e6b704fe68 63 */
Kojto 108:34e6b704fe68 64 __STATIC_INLINE uint32_t __get_CONTROL(void)
Kojto 108:34e6b704fe68 65 {
Kojto 108:34e6b704fe68 66 register uint32_t __regControl __ASM("control");
Kojto 108:34e6b704fe68 67 return(__regControl);
Kojto 108:34e6b704fe68 68 }
Kojto 108:34e6b704fe68 69
Kojto 108:34e6b704fe68 70
Kojto 108:34e6b704fe68 71 /** \brief Set Control Register
Kojto 108:34e6b704fe68 72
Kojto 108:34e6b704fe68 73 This function writes the given value to the Control Register.
Kojto 108:34e6b704fe68 74
Kojto 108:34e6b704fe68 75 \param [in] control Control Register value to set
Kojto 108:34e6b704fe68 76 */
Kojto 108:34e6b704fe68 77 __STATIC_INLINE void __set_CONTROL(uint32_t control)
Kojto 108:34e6b704fe68 78 {
Kojto 108:34e6b704fe68 79 register uint32_t __regControl __ASM("control");
Kojto 108:34e6b704fe68 80 __regControl = control;
Kojto 108:34e6b704fe68 81 }
Kojto 108:34e6b704fe68 82
Kojto 108:34e6b704fe68 83
Kojto 108:34e6b704fe68 84 /** \brief Get IPSR Register
Kojto 108:34e6b704fe68 85
Kojto 108:34e6b704fe68 86 This function returns the content of the IPSR Register.
Kojto 108:34e6b704fe68 87
Kojto 108:34e6b704fe68 88 \return IPSR Register value
Kojto 108:34e6b704fe68 89 */
Kojto 108:34e6b704fe68 90 __STATIC_INLINE uint32_t __get_IPSR(void)
Kojto 108:34e6b704fe68 91 {
Kojto 108:34e6b704fe68 92 register uint32_t __regIPSR __ASM("ipsr");
Kojto 108:34e6b704fe68 93 return(__regIPSR);
Kojto 108:34e6b704fe68 94 }
Kojto 108:34e6b704fe68 95
Kojto 108:34e6b704fe68 96
Kojto 108:34e6b704fe68 97 /** \brief Get APSR Register
Kojto 108:34e6b704fe68 98
Kojto 108:34e6b704fe68 99 This function returns the content of the APSR Register.
Kojto 108:34e6b704fe68 100
Kojto 108:34e6b704fe68 101 \return APSR Register value
Kojto 108:34e6b704fe68 102 */
Kojto 108:34e6b704fe68 103 __STATIC_INLINE uint32_t __get_APSR(void)
Kojto 108:34e6b704fe68 104 {
Kojto 108:34e6b704fe68 105 register uint32_t __regAPSR __ASM("apsr");
Kojto 108:34e6b704fe68 106 return(__regAPSR);
Kojto 108:34e6b704fe68 107 }
Kojto 108:34e6b704fe68 108
Kojto 108:34e6b704fe68 109
Kojto 108:34e6b704fe68 110 /** \brief Get xPSR Register
Kojto 108:34e6b704fe68 111
Kojto 108:34e6b704fe68 112 This function returns the content of the xPSR Register.
Kojto 108:34e6b704fe68 113
Kojto 108:34e6b704fe68 114 \return xPSR Register value
Kojto 108:34e6b704fe68 115 */
Kojto 108:34e6b704fe68 116 __STATIC_INLINE uint32_t __get_xPSR(void)
Kojto 108:34e6b704fe68 117 {
Kojto 108:34e6b704fe68 118 register uint32_t __regXPSR __ASM("xpsr");
Kojto 108:34e6b704fe68 119 return(__regXPSR);
Kojto 108:34e6b704fe68 120 }
Kojto 108:34e6b704fe68 121
Kojto 108:34e6b704fe68 122
Kojto 108:34e6b704fe68 123 /** \brief Get Process Stack Pointer
Kojto 108:34e6b704fe68 124
Kojto 108:34e6b704fe68 125 This function returns the current value of the Process Stack Pointer (PSP).
Kojto 108:34e6b704fe68 126
Kojto 108:34e6b704fe68 127 \return PSP Register value
Kojto 108:34e6b704fe68 128 */
Kojto 108:34e6b704fe68 129 __STATIC_INLINE uint32_t __get_PSP(void)
Kojto 108:34e6b704fe68 130 {
Kojto 108:34e6b704fe68 131 register uint32_t __regProcessStackPointer __ASM("psp");
Kojto 108:34e6b704fe68 132 return(__regProcessStackPointer);
Kojto 108:34e6b704fe68 133 }
Kojto 108:34e6b704fe68 134
Kojto 108:34e6b704fe68 135
Kojto 108:34e6b704fe68 136 /** \brief Set Process Stack Pointer
Kojto 108:34e6b704fe68 137
Kojto 108:34e6b704fe68 138 This function assigns the given value to the Process Stack Pointer (PSP).
Kojto 108:34e6b704fe68 139
Kojto 108:34e6b704fe68 140 \param [in] topOfProcStack Process Stack Pointer value to set
Kojto 108:34e6b704fe68 141 */
Kojto 108:34e6b704fe68 142 __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
Kojto 108:34e6b704fe68 143 {
Kojto 108:34e6b704fe68 144 register uint32_t __regProcessStackPointer __ASM("psp");
Kojto 108:34e6b704fe68 145 __regProcessStackPointer = topOfProcStack;
Kojto 108:34e6b704fe68 146 }
Kojto 108:34e6b704fe68 147
Kojto 108:34e6b704fe68 148
Kojto 108:34e6b704fe68 149 /** \brief Get Main Stack Pointer
Kojto 108:34e6b704fe68 150
Kojto 108:34e6b704fe68 151 This function returns the current value of the Main Stack Pointer (MSP).
Kojto 108:34e6b704fe68 152
Kojto 108:34e6b704fe68 153 \return MSP Register value
Kojto 108:34e6b704fe68 154 */
Kojto 108:34e6b704fe68 155 __STATIC_INLINE uint32_t __get_MSP(void)
Kojto 108:34e6b704fe68 156 {
Kojto 108:34e6b704fe68 157 register uint32_t __regMainStackPointer __ASM("msp");
Kojto 108:34e6b704fe68 158 return(__regMainStackPointer);
Kojto 108:34e6b704fe68 159 }
Kojto 108:34e6b704fe68 160
Kojto 108:34e6b704fe68 161
Kojto 108:34e6b704fe68 162 /** \brief Set Main Stack Pointer
Kojto 108:34e6b704fe68 163
Kojto 108:34e6b704fe68 164 This function assigns the given value to the Main Stack Pointer (MSP).
Kojto 108:34e6b704fe68 165
Kojto 108:34e6b704fe68 166 \param [in] topOfMainStack Main Stack Pointer value to set
Kojto 108:34e6b704fe68 167 */
Kojto 108:34e6b704fe68 168 __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
Kojto 108:34e6b704fe68 169 {
Kojto 108:34e6b704fe68 170 register uint32_t __regMainStackPointer __ASM("msp");
Kojto 108:34e6b704fe68 171 __regMainStackPointer = topOfMainStack;
Kojto 108:34e6b704fe68 172 }
Kojto 108:34e6b704fe68 173
Kojto 108:34e6b704fe68 174
Kojto 108:34e6b704fe68 175 /** \brief Get Priority Mask
Kojto 108:34e6b704fe68 176
Kojto 108:34e6b704fe68 177 This function returns the current state of the priority mask bit from the Priority Mask Register.
Kojto 108:34e6b704fe68 178
Kojto 108:34e6b704fe68 179 \return Priority Mask value
Kojto 108:34e6b704fe68 180 */
Kojto 108:34e6b704fe68 181 __STATIC_INLINE uint32_t __get_PRIMASK(void)
Kojto 108:34e6b704fe68 182 {
Kojto 108:34e6b704fe68 183 register uint32_t __regPriMask __ASM("primask");
Kojto 108:34e6b704fe68 184 return(__regPriMask);
Kojto 108:34e6b704fe68 185 }
Kojto 108:34e6b704fe68 186
Kojto 108:34e6b704fe68 187
Kojto 108:34e6b704fe68 188 /** \brief Set Priority Mask
Kojto 108:34e6b704fe68 189
Kojto 108:34e6b704fe68 190 This function assigns the given value to the Priority Mask Register.
Kojto 108:34e6b704fe68 191
Kojto 108:34e6b704fe68 192 \param [in] priMask Priority Mask
Kojto 108:34e6b704fe68 193 */
Kojto 108:34e6b704fe68 194 __STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
Kojto 108:34e6b704fe68 195 {
Kojto 108:34e6b704fe68 196 register uint32_t __regPriMask __ASM("primask");
Kojto 108:34e6b704fe68 197 __regPriMask = (priMask);
Kojto 108:34e6b704fe68 198 }
Kojto 108:34e6b704fe68 199
Kojto 108:34e6b704fe68 200
Kojto 110:165afa46840b 201 #if (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300)
Kojto 108:34e6b704fe68 202
Kojto 108:34e6b704fe68 203 /** \brief Enable FIQ
Kojto 108:34e6b704fe68 204
Kojto 108:34e6b704fe68 205 This function enables FIQ interrupts by clearing the F-bit in the CPSR.
Kojto 108:34e6b704fe68 206 Can only be executed in Privileged modes.
Kojto 108:34e6b704fe68 207 */
Kojto 108:34e6b704fe68 208 #define __enable_fault_irq __enable_fiq
Kojto 108:34e6b704fe68 209
Kojto 108:34e6b704fe68 210
Kojto 108:34e6b704fe68 211 /** \brief Disable FIQ
Kojto 108:34e6b704fe68 212
Kojto 108:34e6b704fe68 213 This function disables FIQ interrupts by setting the F-bit in the CPSR.
Kojto 108:34e6b704fe68 214 Can only be executed in Privileged modes.
Kojto 108:34e6b704fe68 215 */
Kojto 108:34e6b704fe68 216 #define __disable_fault_irq __disable_fiq
Kojto 108:34e6b704fe68 217
Kojto 108:34e6b704fe68 218
Kojto 108:34e6b704fe68 219 /** \brief Get Base Priority
Kojto 108:34e6b704fe68 220
Kojto 108:34e6b704fe68 221 This function returns the current value of the Base Priority register.
Kojto 108:34e6b704fe68 222
Kojto 108:34e6b704fe68 223 \return Base Priority register value
Kojto 108:34e6b704fe68 224 */
Kojto 108:34e6b704fe68 225 __STATIC_INLINE uint32_t __get_BASEPRI(void)
Kojto 108:34e6b704fe68 226 {
Kojto 108:34e6b704fe68 227 register uint32_t __regBasePri __ASM("basepri");
Kojto 108:34e6b704fe68 228 return(__regBasePri);
Kojto 108:34e6b704fe68 229 }
Kojto 108:34e6b704fe68 230
Kojto 108:34e6b704fe68 231
Kojto 108:34e6b704fe68 232 /** \brief Set Base Priority
Kojto 108:34e6b704fe68 233
Kojto 108:34e6b704fe68 234 This function assigns the given value to the Base Priority register.
Kojto 108:34e6b704fe68 235
Kojto 108:34e6b704fe68 236 \param [in] basePri Base Priority value to set
Kojto 108:34e6b704fe68 237 */
Kojto 108:34e6b704fe68 238 __STATIC_INLINE void __set_BASEPRI(uint32_t basePri)
Kojto 108:34e6b704fe68 239 {
Kojto 108:34e6b704fe68 240 register uint32_t __regBasePri __ASM("basepri");
Kojto 108:34e6b704fe68 241 __regBasePri = (basePri & 0xff);
Kojto 108:34e6b704fe68 242 }
Kojto 108:34e6b704fe68 243
Kojto 108:34e6b704fe68 244
Kojto 110:165afa46840b 245 /** \brief Set Base Priority with condition
Kojto 110:165afa46840b 246
Kojto 110:165afa46840b 247 This function assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
Kojto 110:165afa46840b 248 or the new value increases the BASEPRI priority level.
Kojto 110:165afa46840b 249
Kojto 110:165afa46840b 250 \param [in] basePri Base Priority value to set
Kojto 110:165afa46840b 251 */
Kojto 110:165afa46840b 252 __STATIC_INLINE void __set_BASEPRI_MAX(uint32_t basePri)
Kojto 110:165afa46840b 253 {
Kojto 110:165afa46840b 254 register uint32_t __regBasePriMax __ASM("basepri_max");
Kojto 110:165afa46840b 255 __regBasePriMax = (basePri & 0xff);
Kojto 110:165afa46840b 256 }
Kojto 110:165afa46840b 257
Kojto 110:165afa46840b 258
Kojto 108:34e6b704fe68 259 /** \brief Get Fault Mask
Kojto 108:34e6b704fe68 260
Kojto 108:34e6b704fe68 261 This function returns the current value of the Fault Mask register.
Kojto 108:34e6b704fe68 262
Kojto 108:34e6b704fe68 263 \return Fault Mask register value
Kojto 108:34e6b704fe68 264 */
Kojto 108:34e6b704fe68 265 __STATIC_INLINE uint32_t __get_FAULTMASK(void)
Kojto 108:34e6b704fe68 266 {
Kojto 108:34e6b704fe68 267 register uint32_t __regFaultMask __ASM("faultmask");
Kojto 108:34e6b704fe68 268 return(__regFaultMask);
Kojto 108:34e6b704fe68 269 }
Kojto 108:34e6b704fe68 270
Kojto 108:34e6b704fe68 271
Kojto 108:34e6b704fe68 272 /** \brief Set Fault Mask
Kojto 108:34e6b704fe68 273
Kojto 108:34e6b704fe68 274 This function assigns the given value to the Fault Mask register.
Kojto 108:34e6b704fe68 275
Kojto 108:34e6b704fe68 276 \param [in] faultMask Fault Mask value to set
Kojto 108:34e6b704fe68 277 */
Kojto 108:34e6b704fe68 278 __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
Kojto 108:34e6b704fe68 279 {
Kojto 108:34e6b704fe68 280 register uint32_t __regFaultMask __ASM("faultmask");
Kojto 108:34e6b704fe68 281 __regFaultMask = (faultMask & (uint32_t)1);
Kojto 108:34e6b704fe68 282 }
Kojto 108:34e6b704fe68 283
Kojto 110:165afa46840b 284 #endif /* (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300) */
Kojto 108:34e6b704fe68 285
Kojto 108:34e6b704fe68 286
Kojto 110:165afa46840b 287 #if (__CORTEX_M == 0x04) || (__CORTEX_M == 0x07)
Kojto 108:34e6b704fe68 288
Kojto 108:34e6b704fe68 289 /** \brief Get FPSCR
Kojto 108:34e6b704fe68 290
Kojto 108:34e6b704fe68 291 This function returns the current value of the Floating Point Status/Control register.
Kojto 108:34e6b704fe68 292
Kojto 108:34e6b704fe68 293 \return Floating Point Status/Control register value
Kojto 108:34e6b704fe68 294 */
Kojto 108:34e6b704fe68 295 __STATIC_INLINE uint32_t __get_FPSCR(void)
Kojto 108:34e6b704fe68 296 {
Kojto 108:34e6b704fe68 297 #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
Kojto 108:34e6b704fe68 298 register uint32_t __regfpscr __ASM("fpscr");
Kojto 108:34e6b704fe68 299 return(__regfpscr);
Kojto 108:34e6b704fe68 300 #else
Kojto 108:34e6b704fe68 301 return(0);
Kojto 108:34e6b704fe68 302 #endif
Kojto 108:34e6b704fe68 303 }
Kojto 108:34e6b704fe68 304
Kojto 108:34e6b704fe68 305
Kojto 108:34e6b704fe68 306 /** \brief Set FPSCR
Kojto 108:34e6b704fe68 307
Kojto 108:34e6b704fe68 308 This function assigns the given value to the Floating Point Status/Control register.
Kojto 108:34e6b704fe68 309
Kojto 108:34e6b704fe68 310 \param [in] fpscr Floating Point Status/Control value to set
Kojto 108:34e6b704fe68 311 */
Kojto 108:34e6b704fe68 312 __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
Kojto 108:34e6b704fe68 313 {
Kojto 108:34e6b704fe68 314 #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
Kojto 108:34e6b704fe68 315 register uint32_t __regfpscr __ASM("fpscr");
Kojto 108:34e6b704fe68 316 __regfpscr = (fpscr);
Kojto 108:34e6b704fe68 317 #endif
Kojto 108:34e6b704fe68 318 }
Kojto 108:34e6b704fe68 319
Kojto 110:165afa46840b 320 #endif /* (__CORTEX_M == 0x04) || (__CORTEX_M == 0x07) */
Kojto 108:34e6b704fe68 321
Kojto 108:34e6b704fe68 322
Kojto 108:34e6b704fe68 323 #elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/
Kojto 108:34e6b704fe68 324 /* GNU gcc specific functions */
Kojto 108:34e6b704fe68 325
Kojto 108:34e6b704fe68 326 /** \brief Enable IRQ Interrupts
Kojto 108:34e6b704fe68 327
Kojto 108:34e6b704fe68 328 This function enables IRQ interrupts by clearing the I-bit in the CPSR.
Kojto 108:34e6b704fe68 329 Can only be executed in Privileged modes.
Kojto 108:34e6b704fe68 330 */
Kojto 108:34e6b704fe68 331 __attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_irq(void)
Kojto 108:34e6b704fe68 332 {
Kojto 108:34e6b704fe68 333 __ASM volatile ("cpsie i" : : : "memory");
Kojto 108:34e6b704fe68 334 }
Kojto 108:34e6b704fe68 335
Kojto 108:34e6b704fe68 336
Kojto 108:34e6b704fe68 337 /** \brief Disable IRQ Interrupts
Kojto 108:34e6b704fe68 338
Kojto 108:34e6b704fe68 339 This function disables IRQ interrupts by setting the I-bit in the CPSR.
Kojto 108:34e6b704fe68 340 Can only be executed in Privileged modes.
Kojto 108:34e6b704fe68 341 */
Kojto 108:34e6b704fe68 342 __attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_irq(void)
Kojto 108:34e6b704fe68 343 {
Kojto 108:34e6b704fe68 344 __ASM volatile ("cpsid i" : : : "memory");
Kojto 108:34e6b704fe68 345 }
Kojto 108:34e6b704fe68 346
Kojto 108:34e6b704fe68 347
Kojto 108:34e6b704fe68 348 /** \brief Get Control Register
Kojto 108:34e6b704fe68 349
Kojto 108:34e6b704fe68 350 This function returns the content of the Control Register.
Kojto 108:34e6b704fe68 351
Kojto 108:34e6b704fe68 352 \return Control Register value
Kojto 108:34e6b704fe68 353 */
Kojto 108:34e6b704fe68 354 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_CONTROL(void)
Kojto 108:34e6b704fe68 355 {
Kojto 108:34e6b704fe68 356 uint32_t result;
Kojto 108:34e6b704fe68 357
Kojto 108:34e6b704fe68 358 __ASM volatile ("MRS %0, control" : "=r" (result) );
Kojto 108:34e6b704fe68 359 return(result);
Kojto 108:34e6b704fe68 360 }
Kojto 108:34e6b704fe68 361
Kojto 108:34e6b704fe68 362
Kojto 108:34e6b704fe68 363 /** \brief Set Control Register
Kojto 108:34e6b704fe68 364
Kojto 108:34e6b704fe68 365 This function writes the given value to the Control Register.
Kojto 108:34e6b704fe68 366
Kojto 108:34e6b704fe68 367 \param [in] control Control Register value to set
Kojto 108:34e6b704fe68 368 */
Kojto 108:34e6b704fe68 369 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_CONTROL(uint32_t control)
Kojto 108:34e6b704fe68 370 {
Kojto 108:34e6b704fe68 371 __ASM volatile ("MSR control, %0" : : "r" (control) : "memory");
Kojto 108:34e6b704fe68 372 }
Kojto 108:34e6b704fe68 373
Kojto 108:34e6b704fe68 374
Kojto 108:34e6b704fe68 375 /** \brief Get IPSR Register
Kojto 108:34e6b704fe68 376
Kojto 108:34e6b704fe68 377 This function returns the content of the IPSR Register.
Kojto 108:34e6b704fe68 378
Kojto 108:34e6b704fe68 379 \return IPSR Register value
Kojto 108:34e6b704fe68 380 */
Kojto 108:34e6b704fe68 381 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_IPSR(void)
Kojto 108:34e6b704fe68 382 {
Kojto 108:34e6b704fe68 383 uint32_t result;
Kojto 108:34e6b704fe68 384
Kojto 108:34e6b704fe68 385 __ASM volatile ("MRS %0, ipsr" : "=r" (result) );
Kojto 108:34e6b704fe68 386 return(result);
Kojto 108:34e6b704fe68 387 }
Kojto 108:34e6b704fe68 388
Kojto 108:34e6b704fe68 389
Kojto 108:34e6b704fe68 390 /** \brief Get APSR Register
Kojto 108:34e6b704fe68 391
Kojto 108:34e6b704fe68 392 This function returns the content of the APSR Register.
Kojto 108:34e6b704fe68 393
Kojto 108:34e6b704fe68 394 \return APSR Register value
Kojto 108:34e6b704fe68 395 */
Kojto 108:34e6b704fe68 396 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_APSR(void)
Kojto 108:34e6b704fe68 397 {
Kojto 108:34e6b704fe68 398 uint32_t result;
Kojto 108:34e6b704fe68 399
Kojto 108:34e6b704fe68 400 __ASM volatile ("MRS %0, apsr" : "=r" (result) );
Kojto 108:34e6b704fe68 401 return(result);
Kojto 108:34e6b704fe68 402 }
Kojto 108:34e6b704fe68 403
Kojto 108:34e6b704fe68 404
Kojto 108:34e6b704fe68 405 /** \brief Get xPSR Register
Kojto 108:34e6b704fe68 406
Kojto 108:34e6b704fe68 407 This function returns the content of the xPSR Register.
Kojto 108:34e6b704fe68 408
Kojto 108:34e6b704fe68 409 \return xPSR Register value
Kojto 108:34e6b704fe68 410 */
Kojto 108:34e6b704fe68 411 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_xPSR(void)
Kojto 108:34e6b704fe68 412 {
Kojto 108:34e6b704fe68 413 uint32_t result;
Kojto 108:34e6b704fe68 414
Kojto 108:34e6b704fe68 415 __ASM volatile ("MRS %0, xpsr" : "=r" (result) );
Kojto 108:34e6b704fe68 416 return(result);
Kojto 108:34e6b704fe68 417 }
Kojto 108:34e6b704fe68 418
Kojto 108:34e6b704fe68 419
Kojto 108:34e6b704fe68 420 /** \brief Get Process Stack Pointer
Kojto 108:34e6b704fe68 421
Kojto 108:34e6b704fe68 422 This function returns the current value of the Process Stack Pointer (PSP).
Kojto 108:34e6b704fe68 423
Kojto 108:34e6b704fe68 424 \return PSP Register value
Kojto 108:34e6b704fe68 425 */
Kojto 108:34e6b704fe68 426 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PSP(void)
Kojto 108:34e6b704fe68 427 {
Kojto 108:34e6b704fe68 428 register uint32_t result;
Kojto 108:34e6b704fe68 429
Kojto 108:34e6b704fe68 430 __ASM volatile ("MRS %0, psp\n" : "=r" (result) );
Kojto 108:34e6b704fe68 431 return(result);
Kojto 108:34e6b704fe68 432 }
Kojto 108:34e6b704fe68 433
Kojto 108:34e6b704fe68 434
Kojto 108:34e6b704fe68 435 /** \brief Set Process Stack Pointer
Kojto 108:34e6b704fe68 436
Kojto 108:34e6b704fe68 437 This function assigns the given value to the Process Stack Pointer (PSP).
Kojto 108:34e6b704fe68 438
Kojto 108:34e6b704fe68 439 \param [in] topOfProcStack Process Stack Pointer value to set
Kojto 108:34e6b704fe68 440 */
Kojto 108:34e6b704fe68 441 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
Kojto 108:34e6b704fe68 442 {
Kojto 108:34e6b704fe68 443 __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : "sp");
Kojto 108:34e6b704fe68 444 }
Kojto 108:34e6b704fe68 445
Kojto 108:34e6b704fe68 446
Kojto 108:34e6b704fe68 447 /** \brief Get Main Stack Pointer
Kojto 108:34e6b704fe68 448
Kojto 108:34e6b704fe68 449 This function returns the current value of the Main Stack Pointer (MSP).
Kojto 108:34e6b704fe68 450
Kojto 108:34e6b704fe68 451 \return MSP Register value
Kojto 108:34e6b704fe68 452 */
Kojto 108:34e6b704fe68 453 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_MSP(void)
Kojto 108:34e6b704fe68 454 {
Kojto 108:34e6b704fe68 455 register uint32_t result;
Kojto 108:34e6b704fe68 456
Kojto 108:34e6b704fe68 457 __ASM volatile ("MRS %0, msp\n" : "=r" (result) );
Kojto 108:34e6b704fe68 458 return(result);
Kojto 108:34e6b704fe68 459 }
Kojto 108:34e6b704fe68 460
Kojto 108:34e6b704fe68 461
Kojto 108:34e6b704fe68 462 /** \brief Set Main Stack Pointer
Kojto 108:34e6b704fe68 463
Kojto 108:34e6b704fe68 464 This function assigns the given value to the Main Stack Pointer (MSP).
Kojto 108:34e6b704fe68 465
Kojto 108:34e6b704fe68 466 \param [in] topOfMainStack Main Stack Pointer value to set
Kojto 108:34e6b704fe68 467 */
Kojto 108:34e6b704fe68 468 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
Kojto 108:34e6b704fe68 469 {
Kojto 108:34e6b704fe68 470 __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp");
Kojto 108:34e6b704fe68 471 }
Kojto 108:34e6b704fe68 472
Kojto 108:34e6b704fe68 473
Kojto 108:34e6b704fe68 474 /** \brief Get Priority Mask
Kojto 108:34e6b704fe68 475
Kojto 108:34e6b704fe68 476 This function returns the current state of the priority mask bit from the Priority Mask Register.
Kojto 108:34e6b704fe68 477
Kojto 108:34e6b704fe68 478 \return Priority Mask value
Kojto 108:34e6b704fe68 479 */
Kojto 108:34e6b704fe68 480 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PRIMASK(void)
Kojto 108:34e6b704fe68 481 {
Kojto 108:34e6b704fe68 482 uint32_t result;
Kojto 108:34e6b704fe68 483
Kojto 108:34e6b704fe68 484 __ASM volatile ("MRS %0, primask" : "=r" (result) );
Kojto 108:34e6b704fe68 485 return(result);
Kojto 108:34e6b704fe68 486 }
Kojto 108:34e6b704fe68 487
Kojto 108:34e6b704fe68 488
Kojto 108:34e6b704fe68 489 /** \brief Set Priority Mask
Kojto 108:34e6b704fe68 490
Kojto 108:34e6b704fe68 491 This function assigns the given value to the Priority Mask Register.
Kojto 108:34e6b704fe68 492
Kojto 108:34e6b704fe68 493 \param [in] priMask Priority Mask
Kojto 108:34e6b704fe68 494 */
Kojto 108:34e6b704fe68 495 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
Kojto 108:34e6b704fe68 496 {
Kojto 108:34e6b704fe68 497 __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
Kojto 108:34e6b704fe68 498 }
Kojto 108:34e6b704fe68 499
Kojto 108:34e6b704fe68 500
Kojto 108:34e6b704fe68 501 #if (__CORTEX_M >= 0x03)
Kojto 108:34e6b704fe68 502
Kojto 108:34e6b704fe68 503 /** \brief Enable FIQ
Kojto 108:34e6b704fe68 504
Kojto 108:34e6b704fe68 505 This function enables FIQ interrupts by clearing the F-bit in the CPSR.
Kojto 108:34e6b704fe68 506 Can only be executed in Privileged modes.
Kojto 108:34e6b704fe68 507 */
Kojto 108:34e6b704fe68 508 __attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_fault_irq(void)
Kojto 108:34e6b704fe68 509 {
Kojto 108:34e6b704fe68 510 __ASM volatile ("cpsie f" : : : "memory");
Kojto 108:34e6b704fe68 511 }
Kojto 108:34e6b704fe68 512
Kojto 108:34e6b704fe68 513
Kojto 108:34e6b704fe68 514 /** \brief Disable FIQ
Kojto 108:34e6b704fe68 515
Kojto 108:34e6b704fe68 516 This function disables FIQ interrupts by setting the F-bit in the CPSR.
Kojto 108:34e6b704fe68 517 Can only be executed in Privileged modes.
Kojto 108:34e6b704fe68 518 */
Kojto 108:34e6b704fe68 519 __attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_fault_irq(void)
Kojto 108:34e6b704fe68 520 {
Kojto 108:34e6b704fe68 521 __ASM volatile ("cpsid f" : : : "memory");
Kojto 108:34e6b704fe68 522 }
Kojto 108:34e6b704fe68 523
Kojto 108:34e6b704fe68 524
Kojto 108:34e6b704fe68 525 /** \brief Get Base Priority
Kojto 108:34e6b704fe68 526
Kojto 108:34e6b704fe68 527 This function returns the current value of the Base Priority register.
Kojto 108:34e6b704fe68 528
Kojto 108:34e6b704fe68 529 \return Base Priority register value
Kojto 108:34e6b704fe68 530 */
Kojto 108:34e6b704fe68 531 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_BASEPRI(void)
Kojto 108:34e6b704fe68 532 {
Kojto 108:34e6b704fe68 533 uint32_t result;
Kojto 108:34e6b704fe68 534
Kojto 110:165afa46840b 535 __ASM volatile ("MRS %0, basepri" : "=r" (result) );
Kojto 108:34e6b704fe68 536 return(result);
Kojto 108:34e6b704fe68 537 }
Kojto 108:34e6b704fe68 538
Kojto 108:34e6b704fe68 539
Kojto 108:34e6b704fe68 540 /** \brief Set Base Priority
Kojto 108:34e6b704fe68 541
Kojto 108:34e6b704fe68 542 This function assigns the given value to the Base Priority register.
Kojto 108:34e6b704fe68 543
Kojto 108:34e6b704fe68 544 \param [in] basePri Base Priority value to set
Kojto 108:34e6b704fe68 545 */
Kojto 108:34e6b704fe68 546 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI(uint32_t value)
Kojto 108:34e6b704fe68 547 {
Kojto 108:34e6b704fe68 548 __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory");
Kojto 108:34e6b704fe68 549 }
Kojto 108:34e6b704fe68 550
Kojto 108:34e6b704fe68 551
Kojto 110:165afa46840b 552 /** \brief Set Base Priority with condition
Kojto 110:165afa46840b 553
Kojto 110:165afa46840b 554 This function assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
Kojto 110:165afa46840b 555 or the new value increases the BASEPRI priority level.
Kojto 110:165afa46840b 556
Kojto 110:165afa46840b 557 \param [in] basePri Base Priority value to set
Kojto 110:165afa46840b 558 */
Kojto 110:165afa46840b 559 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI_MAX(uint32_t value)
Kojto 110:165afa46840b 560 {
Kojto 110:165afa46840b 561 __ASM volatile ("MSR basepri_max, %0" : : "r" (value) : "memory");
Kojto 110:165afa46840b 562 }
Kojto 110:165afa46840b 563
Kojto 110:165afa46840b 564
Kojto 108:34e6b704fe68 565 /** \brief Get Fault Mask
Kojto 108:34e6b704fe68 566
Kojto 108:34e6b704fe68 567 This function returns the current value of the Fault Mask register.
Kojto 108:34e6b704fe68 568
Kojto 108:34e6b704fe68 569 \return Fault Mask register value
Kojto 108:34e6b704fe68 570 */
Kojto 108:34e6b704fe68 571 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FAULTMASK(void)
Kojto 108:34e6b704fe68 572 {
Kojto 108:34e6b704fe68 573 uint32_t result;
Kojto 108:34e6b704fe68 574
Kojto 108:34e6b704fe68 575 __ASM volatile ("MRS %0, faultmask" : "=r" (result) );
Kojto 108:34e6b704fe68 576 return(result);
Kojto 108:34e6b704fe68 577 }
Kojto 108:34e6b704fe68 578
Kojto 108:34e6b704fe68 579
Kojto 108:34e6b704fe68 580 /** \brief Set Fault Mask
Kojto 108:34e6b704fe68 581
Kojto 108:34e6b704fe68 582 This function assigns the given value to the Fault Mask register.
Kojto 108:34e6b704fe68 583
Kojto 108:34e6b704fe68 584 \param [in] faultMask Fault Mask value to set
Kojto 108:34e6b704fe68 585 */
Kojto 108:34e6b704fe68 586 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
Kojto 108:34e6b704fe68 587 {
Kojto 108:34e6b704fe68 588 __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory");
Kojto 108:34e6b704fe68 589 }
Kojto 108:34e6b704fe68 590
Kojto 108:34e6b704fe68 591 #endif /* (__CORTEX_M >= 0x03) */
Kojto 108:34e6b704fe68 592
Kojto 108:34e6b704fe68 593
Kojto 110:165afa46840b 594 #if (__CORTEX_M == 0x04) || (__CORTEX_M == 0x07)
Kojto 108:34e6b704fe68 595
Kojto 108:34e6b704fe68 596 /** \brief Get FPSCR
Kojto 108:34e6b704fe68 597
Kojto 108:34e6b704fe68 598 This function returns the current value of the Floating Point Status/Control register.
Kojto 108:34e6b704fe68 599
Kojto 108:34e6b704fe68 600 \return Floating Point Status/Control register value
Kojto 108:34e6b704fe68 601 */
Kojto 108:34e6b704fe68 602 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FPSCR(void)
Kojto 108:34e6b704fe68 603 {
Kojto 108:34e6b704fe68 604 #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
Kojto 108:34e6b704fe68 605 uint32_t result;
Kojto 108:34e6b704fe68 606
Kojto 108:34e6b704fe68 607 /* Empty asm statement works as a scheduling barrier */
Kojto 108:34e6b704fe68 608 __ASM volatile ("");
Kojto 108:34e6b704fe68 609 __ASM volatile ("VMRS %0, fpscr" : "=r" (result) );
Kojto 108:34e6b704fe68 610 __ASM volatile ("");
Kojto 108:34e6b704fe68 611 return(result);
Kojto 108:34e6b704fe68 612 #else
Kojto 108:34e6b704fe68 613 return(0);
Kojto 108:34e6b704fe68 614 #endif
Kojto 108:34e6b704fe68 615 }
Kojto 108:34e6b704fe68 616
Kojto 108:34e6b704fe68 617
Kojto 108:34e6b704fe68 618 /** \brief Set FPSCR
Kojto 108:34e6b704fe68 619
Kojto 108:34e6b704fe68 620 This function assigns the given value to the Floating Point Status/Control register.
Kojto 108:34e6b704fe68 621
Kojto 108:34e6b704fe68 622 \param [in] fpscr Floating Point Status/Control value to set
Kojto 108:34e6b704fe68 623 */
Kojto 108:34e6b704fe68 624 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
Kojto 108:34e6b704fe68 625 {
Kojto 108:34e6b704fe68 626 #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
Kojto 108:34e6b704fe68 627 /* Empty asm statement works as a scheduling barrier */
Kojto 108:34e6b704fe68 628 __ASM volatile ("");
Kojto 108:34e6b704fe68 629 __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc");
Kojto 108:34e6b704fe68 630 __ASM volatile ("");
Kojto 108:34e6b704fe68 631 #endif
Kojto 108:34e6b704fe68 632 }
Kojto 108:34e6b704fe68 633
Kojto 110:165afa46840b 634 #endif /* (__CORTEX_M == 0x04) || (__CORTEX_M == 0x07) */
Kojto 110:165afa46840b 635
Kojto 110:165afa46840b 636
Kojto 110:165afa46840b 637 #elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/
Kojto 110:165afa46840b 638 /* IAR iccarm specific functions */
Kojto 110:165afa46840b 639 #include <cmsis_iar.h>
Kojto 110:165afa46840b 640
Kojto 110:165afa46840b 641
Kojto 110:165afa46840b 642 #elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/
Kojto 110:165afa46840b 643 /* TI CCS specific functions */
Kojto 110:165afa46840b 644 #include <cmsis_ccs.h>
Kojto 108:34e6b704fe68 645
Kojto 108:34e6b704fe68 646
Kojto 108:34e6b704fe68 647 #elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/
Kojto 108:34e6b704fe68 648 /* TASKING carm specific functions */
Kojto 108:34e6b704fe68 649 /*
Kojto 108:34e6b704fe68 650 * The CMSIS functions have been implemented as intrinsics in the compiler.
Kojto 110:165afa46840b 651 * Please use "carm -?i" to get an up to date list of all intrinsics,
Kojto 108:34e6b704fe68 652 * Including the CMSIS ones.
Kojto 108:34e6b704fe68 653 */
Kojto 108:34e6b704fe68 654
Kojto 110:165afa46840b 655
Kojto 110:165afa46840b 656 #elif defined ( __CSMC__ ) /*------------------ COSMIC Compiler -------------------*/
Kojto 110:165afa46840b 657 /* Cosmic specific functions */
Kojto 110:165afa46840b 658 #include <cmsis_csm.h>
Kojto 110:165afa46840b 659
Kojto 108:34e6b704fe68 660 #endif
Kojto 108:34e6b704fe68 661
Kojto 108:34e6b704fe68 662 /*@} end of CMSIS_Core_RegAccFunctions */
Kojto 108:34e6b704fe68 663
Kojto 108:34e6b704fe68 664 #endif /* __CORE_CMFUNC_H */