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:
Fri Oct 02 07:35:07 2015 +0200
Revision:
108:34e6b704fe68
Child:
110:165afa46840b
Release 108  of the mbed library

Changes:
- new platforms - ELMO_F411RE, WIZNET_7500P, ARM_MPS2_BEID
- EFM32 - bugfixes in rtc, serial
- Cortex A cmsis - update files
- STML4 - RAM fixes

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 108:34e6b704fe68 4 * @version V3.20
Kojto 108:34e6b704fe68 5 * @date 25. February 2013
Kojto 108:34e6b704fe68 6 *
Kojto 108:34e6b704fe68 7 * @note
Kojto 108:34e6b704fe68 8 *
Kojto 108:34e6b704fe68 9 ******************************************************************************/
Kojto 108:34e6b704fe68 10 /* Copyright (c) 2009 - 2013 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 108:34e6b704fe68 201 #if (__CORTEX_M >= 0x03)
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 108:34e6b704fe68 245 /** \brief Get Fault Mask
Kojto 108:34e6b704fe68 246
Kojto 108:34e6b704fe68 247 This function returns the current value of the Fault Mask register.
Kojto 108:34e6b704fe68 248
Kojto 108:34e6b704fe68 249 \return Fault Mask register value
Kojto 108:34e6b704fe68 250 */
Kojto 108:34e6b704fe68 251 __STATIC_INLINE uint32_t __get_FAULTMASK(void)
Kojto 108:34e6b704fe68 252 {
Kojto 108:34e6b704fe68 253 register uint32_t __regFaultMask __ASM("faultmask");
Kojto 108:34e6b704fe68 254 return(__regFaultMask);
Kojto 108:34e6b704fe68 255 }
Kojto 108:34e6b704fe68 256
Kojto 108:34e6b704fe68 257
Kojto 108:34e6b704fe68 258 /** \brief Set Fault Mask
Kojto 108:34e6b704fe68 259
Kojto 108:34e6b704fe68 260 This function assigns the given value to the Fault Mask register.
Kojto 108:34e6b704fe68 261
Kojto 108:34e6b704fe68 262 \param [in] faultMask Fault Mask value to set
Kojto 108:34e6b704fe68 263 */
Kojto 108:34e6b704fe68 264 __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
Kojto 108:34e6b704fe68 265 {
Kojto 108:34e6b704fe68 266 register uint32_t __regFaultMask __ASM("faultmask");
Kojto 108:34e6b704fe68 267 __regFaultMask = (faultMask & (uint32_t)1);
Kojto 108:34e6b704fe68 268 }
Kojto 108:34e6b704fe68 269
Kojto 108:34e6b704fe68 270 #endif /* (__CORTEX_M >= 0x03) */
Kojto 108:34e6b704fe68 271
Kojto 108:34e6b704fe68 272
Kojto 108:34e6b704fe68 273 #if (__CORTEX_M == 0x04)
Kojto 108:34e6b704fe68 274
Kojto 108:34e6b704fe68 275 /** \brief Get FPSCR
Kojto 108:34e6b704fe68 276
Kojto 108:34e6b704fe68 277 This function returns the current value of the Floating Point Status/Control register.
Kojto 108:34e6b704fe68 278
Kojto 108:34e6b704fe68 279 \return Floating Point Status/Control register value
Kojto 108:34e6b704fe68 280 */
Kojto 108:34e6b704fe68 281 __STATIC_INLINE uint32_t __get_FPSCR(void)
Kojto 108:34e6b704fe68 282 {
Kojto 108:34e6b704fe68 283 #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
Kojto 108:34e6b704fe68 284 register uint32_t __regfpscr __ASM("fpscr");
Kojto 108:34e6b704fe68 285 return(__regfpscr);
Kojto 108:34e6b704fe68 286 #else
Kojto 108:34e6b704fe68 287 return(0);
Kojto 108:34e6b704fe68 288 #endif
Kojto 108:34e6b704fe68 289 }
Kojto 108:34e6b704fe68 290
Kojto 108:34e6b704fe68 291
Kojto 108:34e6b704fe68 292 /** \brief Set FPSCR
Kojto 108:34e6b704fe68 293
Kojto 108:34e6b704fe68 294 This function assigns the given value to the Floating Point Status/Control register.
Kojto 108:34e6b704fe68 295
Kojto 108:34e6b704fe68 296 \param [in] fpscr Floating Point Status/Control value to set
Kojto 108:34e6b704fe68 297 */
Kojto 108:34e6b704fe68 298 __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
Kojto 108:34e6b704fe68 299 {
Kojto 108:34e6b704fe68 300 #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
Kojto 108:34e6b704fe68 301 register uint32_t __regfpscr __ASM("fpscr");
Kojto 108:34e6b704fe68 302 __regfpscr = (fpscr);
Kojto 108:34e6b704fe68 303 #endif
Kojto 108:34e6b704fe68 304 }
Kojto 108:34e6b704fe68 305
Kojto 108:34e6b704fe68 306 #endif /* (__CORTEX_M == 0x04) */
Kojto 108:34e6b704fe68 307
Kojto 108:34e6b704fe68 308
Kojto 108:34e6b704fe68 309 #elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/
Kojto 108:34e6b704fe68 310 /* IAR iccarm specific functions */
Kojto 108:34e6b704fe68 311
Kojto 108:34e6b704fe68 312 #include <cmsis_iar.h>
Kojto 108:34e6b704fe68 313
Kojto 108:34e6b704fe68 314
Kojto 108:34e6b704fe68 315 #elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/
Kojto 108:34e6b704fe68 316 /* TI CCS specific functions */
Kojto 108:34e6b704fe68 317
Kojto 108:34e6b704fe68 318 #include <cmsis_ccs.h>
Kojto 108:34e6b704fe68 319
Kojto 108:34e6b704fe68 320
Kojto 108:34e6b704fe68 321 #elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/
Kojto 108:34e6b704fe68 322 /* GNU gcc specific functions */
Kojto 108:34e6b704fe68 323
Kojto 108:34e6b704fe68 324 /** \brief Enable IRQ Interrupts
Kojto 108:34e6b704fe68 325
Kojto 108:34e6b704fe68 326 This function enables IRQ interrupts by clearing the I-bit in the CPSR.
Kojto 108:34e6b704fe68 327 Can only be executed in Privileged modes.
Kojto 108:34e6b704fe68 328 */
Kojto 108:34e6b704fe68 329 __attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_irq(void)
Kojto 108:34e6b704fe68 330 {
Kojto 108:34e6b704fe68 331 __ASM volatile ("cpsie i" : : : "memory");
Kojto 108:34e6b704fe68 332 }
Kojto 108:34e6b704fe68 333
Kojto 108:34e6b704fe68 334
Kojto 108:34e6b704fe68 335 /** \brief Disable IRQ Interrupts
Kojto 108:34e6b704fe68 336
Kojto 108:34e6b704fe68 337 This function disables IRQ interrupts by setting the I-bit in the CPSR.
Kojto 108:34e6b704fe68 338 Can only be executed in Privileged modes.
Kojto 108:34e6b704fe68 339 */
Kojto 108:34e6b704fe68 340 __attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_irq(void)
Kojto 108:34e6b704fe68 341 {
Kojto 108:34e6b704fe68 342 __ASM volatile ("cpsid i" : : : "memory");
Kojto 108:34e6b704fe68 343 }
Kojto 108:34e6b704fe68 344
Kojto 108:34e6b704fe68 345
Kojto 108:34e6b704fe68 346 /** \brief Get Control Register
Kojto 108:34e6b704fe68 347
Kojto 108:34e6b704fe68 348 This function returns the content of the Control Register.
Kojto 108:34e6b704fe68 349
Kojto 108:34e6b704fe68 350 \return Control Register value
Kojto 108:34e6b704fe68 351 */
Kojto 108:34e6b704fe68 352 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_CONTROL(void)
Kojto 108:34e6b704fe68 353 {
Kojto 108:34e6b704fe68 354 uint32_t result;
Kojto 108:34e6b704fe68 355
Kojto 108:34e6b704fe68 356 __ASM volatile ("MRS %0, control" : "=r" (result) );
Kojto 108:34e6b704fe68 357 return(result);
Kojto 108:34e6b704fe68 358 }
Kojto 108:34e6b704fe68 359
Kojto 108:34e6b704fe68 360
Kojto 108:34e6b704fe68 361 /** \brief Set Control Register
Kojto 108:34e6b704fe68 362
Kojto 108:34e6b704fe68 363 This function writes the given value to the Control Register.
Kojto 108:34e6b704fe68 364
Kojto 108:34e6b704fe68 365 \param [in] control Control Register value to set
Kojto 108:34e6b704fe68 366 */
Kojto 108:34e6b704fe68 367 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_CONTROL(uint32_t control)
Kojto 108:34e6b704fe68 368 {
Kojto 108:34e6b704fe68 369 __ASM volatile ("MSR control, %0" : : "r" (control) : "memory");
Kojto 108:34e6b704fe68 370 }
Kojto 108:34e6b704fe68 371
Kojto 108:34e6b704fe68 372
Kojto 108:34e6b704fe68 373 /** \brief Get IPSR Register
Kojto 108:34e6b704fe68 374
Kojto 108:34e6b704fe68 375 This function returns the content of the IPSR Register.
Kojto 108:34e6b704fe68 376
Kojto 108:34e6b704fe68 377 \return IPSR Register value
Kojto 108:34e6b704fe68 378 */
Kojto 108:34e6b704fe68 379 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_IPSR(void)
Kojto 108:34e6b704fe68 380 {
Kojto 108:34e6b704fe68 381 uint32_t result;
Kojto 108:34e6b704fe68 382
Kojto 108:34e6b704fe68 383 __ASM volatile ("MRS %0, ipsr" : "=r" (result) );
Kojto 108:34e6b704fe68 384 return(result);
Kojto 108:34e6b704fe68 385 }
Kojto 108:34e6b704fe68 386
Kojto 108:34e6b704fe68 387
Kojto 108:34e6b704fe68 388 /** \brief Get APSR Register
Kojto 108:34e6b704fe68 389
Kojto 108:34e6b704fe68 390 This function returns the content of the APSR Register.
Kojto 108:34e6b704fe68 391
Kojto 108:34e6b704fe68 392 \return APSR Register value
Kojto 108:34e6b704fe68 393 */
Kojto 108:34e6b704fe68 394 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_APSR(void)
Kojto 108:34e6b704fe68 395 {
Kojto 108:34e6b704fe68 396 uint32_t result;
Kojto 108:34e6b704fe68 397
Kojto 108:34e6b704fe68 398 __ASM volatile ("MRS %0, apsr" : "=r" (result) );
Kojto 108:34e6b704fe68 399 return(result);
Kojto 108:34e6b704fe68 400 }
Kojto 108:34e6b704fe68 401
Kojto 108:34e6b704fe68 402
Kojto 108:34e6b704fe68 403 /** \brief Get xPSR Register
Kojto 108:34e6b704fe68 404
Kojto 108:34e6b704fe68 405 This function returns the content of the xPSR Register.
Kojto 108:34e6b704fe68 406
Kojto 108:34e6b704fe68 407 \return xPSR Register value
Kojto 108:34e6b704fe68 408 */
Kojto 108:34e6b704fe68 409 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_xPSR(void)
Kojto 108:34e6b704fe68 410 {
Kojto 108:34e6b704fe68 411 uint32_t result;
Kojto 108:34e6b704fe68 412
Kojto 108:34e6b704fe68 413 __ASM volatile ("MRS %0, xpsr" : "=r" (result) );
Kojto 108:34e6b704fe68 414 return(result);
Kojto 108:34e6b704fe68 415 }
Kojto 108:34e6b704fe68 416
Kojto 108:34e6b704fe68 417
Kojto 108:34e6b704fe68 418 /** \brief Get Process Stack Pointer
Kojto 108:34e6b704fe68 419
Kojto 108:34e6b704fe68 420 This function returns the current value of the Process Stack Pointer (PSP).
Kojto 108:34e6b704fe68 421
Kojto 108:34e6b704fe68 422 \return PSP Register value
Kojto 108:34e6b704fe68 423 */
Kojto 108:34e6b704fe68 424 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PSP(void)
Kojto 108:34e6b704fe68 425 {
Kojto 108:34e6b704fe68 426 register uint32_t result;
Kojto 108:34e6b704fe68 427
Kojto 108:34e6b704fe68 428 __ASM volatile ("MRS %0, psp\n" : "=r" (result) );
Kojto 108:34e6b704fe68 429 return(result);
Kojto 108:34e6b704fe68 430 }
Kojto 108:34e6b704fe68 431
Kojto 108:34e6b704fe68 432
Kojto 108:34e6b704fe68 433 /** \brief Set Process Stack Pointer
Kojto 108:34e6b704fe68 434
Kojto 108:34e6b704fe68 435 This function assigns the given value to the Process Stack Pointer (PSP).
Kojto 108:34e6b704fe68 436
Kojto 108:34e6b704fe68 437 \param [in] topOfProcStack Process Stack Pointer value to set
Kojto 108:34e6b704fe68 438 */
Kojto 108:34e6b704fe68 439 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
Kojto 108:34e6b704fe68 440 {
Kojto 108:34e6b704fe68 441 __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : "sp");
Kojto 108:34e6b704fe68 442 }
Kojto 108:34e6b704fe68 443
Kojto 108:34e6b704fe68 444
Kojto 108:34e6b704fe68 445 /** \brief Get Main Stack Pointer
Kojto 108:34e6b704fe68 446
Kojto 108:34e6b704fe68 447 This function returns the current value of the Main Stack Pointer (MSP).
Kojto 108:34e6b704fe68 448
Kojto 108:34e6b704fe68 449 \return MSP Register value
Kojto 108:34e6b704fe68 450 */
Kojto 108:34e6b704fe68 451 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_MSP(void)
Kojto 108:34e6b704fe68 452 {
Kojto 108:34e6b704fe68 453 register uint32_t result;
Kojto 108:34e6b704fe68 454
Kojto 108:34e6b704fe68 455 __ASM volatile ("MRS %0, msp\n" : "=r" (result) );
Kojto 108:34e6b704fe68 456 return(result);
Kojto 108:34e6b704fe68 457 }
Kojto 108:34e6b704fe68 458
Kojto 108:34e6b704fe68 459
Kojto 108:34e6b704fe68 460 /** \brief Set Main Stack Pointer
Kojto 108:34e6b704fe68 461
Kojto 108:34e6b704fe68 462 This function assigns the given value to the Main Stack Pointer (MSP).
Kojto 108:34e6b704fe68 463
Kojto 108:34e6b704fe68 464 \param [in] topOfMainStack Main Stack Pointer value to set
Kojto 108:34e6b704fe68 465 */
Kojto 108:34e6b704fe68 466 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
Kojto 108:34e6b704fe68 467 {
Kojto 108:34e6b704fe68 468 __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp");
Kojto 108:34e6b704fe68 469 }
Kojto 108:34e6b704fe68 470
Kojto 108:34e6b704fe68 471
Kojto 108:34e6b704fe68 472 /** \brief Get Priority Mask
Kojto 108:34e6b704fe68 473
Kojto 108:34e6b704fe68 474 This function returns the current state of the priority mask bit from the Priority Mask Register.
Kojto 108:34e6b704fe68 475
Kojto 108:34e6b704fe68 476 \return Priority Mask value
Kojto 108:34e6b704fe68 477 */
Kojto 108:34e6b704fe68 478 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PRIMASK(void)
Kojto 108:34e6b704fe68 479 {
Kojto 108:34e6b704fe68 480 uint32_t result;
Kojto 108:34e6b704fe68 481
Kojto 108:34e6b704fe68 482 __ASM volatile ("MRS %0, primask" : "=r" (result) );
Kojto 108:34e6b704fe68 483 return(result);
Kojto 108:34e6b704fe68 484 }
Kojto 108:34e6b704fe68 485
Kojto 108:34e6b704fe68 486
Kojto 108:34e6b704fe68 487 /** \brief Set Priority Mask
Kojto 108:34e6b704fe68 488
Kojto 108:34e6b704fe68 489 This function assigns the given value to the Priority Mask Register.
Kojto 108:34e6b704fe68 490
Kojto 108:34e6b704fe68 491 \param [in] priMask Priority Mask
Kojto 108:34e6b704fe68 492 */
Kojto 108:34e6b704fe68 493 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
Kojto 108:34e6b704fe68 494 {
Kojto 108:34e6b704fe68 495 __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
Kojto 108:34e6b704fe68 496 }
Kojto 108:34e6b704fe68 497
Kojto 108:34e6b704fe68 498
Kojto 108:34e6b704fe68 499 #if (__CORTEX_M >= 0x03)
Kojto 108:34e6b704fe68 500
Kojto 108:34e6b704fe68 501 /** \brief Enable FIQ
Kojto 108:34e6b704fe68 502
Kojto 108:34e6b704fe68 503 This function enables FIQ interrupts by clearing the F-bit in the CPSR.
Kojto 108:34e6b704fe68 504 Can only be executed in Privileged modes.
Kojto 108:34e6b704fe68 505 */
Kojto 108:34e6b704fe68 506 __attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_fault_irq(void)
Kojto 108:34e6b704fe68 507 {
Kojto 108:34e6b704fe68 508 __ASM volatile ("cpsie f" : : : "memory");
Kojto 108:34e6b704fe68 509 }
Kojto 108:34e6b704fe68 510
Kojto 108:34e6b704fe68 511
Kojto 108:34e6b704fe68 512 /** \brief Disable FIQ
Kojto 108:34e6b704fe68 513
Kojto 108:34e6b704fe68 514 This function disables FIQ interrupts by setting the F-bit in the CPSR.
Kojto 108:34e6b704fe68 515 Can only be executed in Privileged modes.
Kojto 108:34e6b704fe68 516 */
Kojto 108:34e6b704fe68 517 __attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_fault_irq(void)
Kojto 108:34e6b704fe68 518 {
Kojto 108:34e6b704fe68 519 __ASM volatile ("cpsid f" : : : "memory");
Kojto 108:34e6b704fe68 520 }
Kojto 108:34e6b704fe68 521
Kojto 108:34e6b704fe68 522
Kojto 108:34e6b704fe68 523 /** \brief Get Base Priority
Kojto 108:34e6b704fe68 524
Kojto 108:34e6b704fe68 525 This function returns the current value of the Base Priority register.
Kojto 108:34e6b704fe68 526
Kojto 108:34e6b704fe68 527 \return Base Priority register value
Kojto 108:34e6b704fe68 528 */
Kojto 108:34e6b704fe68 529 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_BASEPRI(void)
Kojto 108:34e6b704fe68 530 {
Kojto 108:34e6b704fe68 531 uint32_t result;
Kojto 108:34e6b704fe68 532
Kojto 108:34e6b704fe68 533 __ASM volatile ("MRS %0, basepri_max" : "=r" (result) );
Kojto 108:34e6b704fe68 534 return(result);
Kojto 108:34e6b704fe68 535 }
Kojto 108:34e6b704fe68 536
Kojto 108:34e6b704fe68 537
Kojto 108:34e6b704fe68 538 /** \brief Set Base Priority
Kojto 108:34e6b704fe68 539
Kojto 108:34e6b704fe68 540 This function assigns the given value to the Base Priority register.
Kojto 108:34e6b704fe68 541
Kojto 108:34e6b704fe68 542 \param [in] basePri Base Priority value to set
Kojto 108:34e6b704fe68 543 */
Kojto 108:34e6b704fe68 544 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI(uint32_t value)
Kojto 108:34e6b704fe68 545 {
Kojto 108:34e6b704fe68 546 __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory");
Kojto 108:34e6b704fe68 547 }
Kojto 108:34e6b704fe68 548
Kojto 108:34e6b704fe68 549
Kojto 108:34e6b704fe68 550 /** \brief Get Fault Mask
Kojto 108:34e6b704fe68 551
Kojto 108:34e6b704fe68 552 This function returns the current value of the Fault Mask register.
Kojto 108:34e6b704fe68 553
Kojto 108:34e6b704fe68 554 \return Fault Mask register value
Kojto 108:34e6b704fe68 555 */
Kojto 108:34e6b704fe68 556 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FAULTMASK(void)
Kojto 108:34e6b704fe68 557 {
Kojto 108:34e6b704fe68 558 uint32_t result;
Kojto 108:34e6b704fe68 559
Kojto 108:34e6b704fe68 560 __ASM volatile ("MRS %0, faultmask" : "=r" (result) );
Kojto 108:34e6b704fe68 561 return(result);
Kojto 108:34e6b704fe68 562 }
Kojto 108:34e6b704fe68 563
Kojto 108:34e6b704fe68 564
Kojto 108:34e6b704fe68 565 /** \brief Set Fault Mask
Kojto 108:34e6b704fe68 566
Kojto 108:34e6b704fe68 567 This function assigns the given value to the Fault Mask register.
Kojto 108:34e6b704fe68 568
Kojto 108:34e6b704fe68 569 \param [in] faultMask Fault Mask value to set
Kojto 108:34e6b704fe68 570 */
Kojto 108:34e6b704fe68 571 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
Kojto 108:34e6b704fe68 572 {
Kojto 108:34e6b704fe68 573 __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory");
Kojto 108:34e6b704fe68 574 }
Kojto 108:34e6b704fe68 575
Kojto 108:34e6b704fe68 576 #endif /* (__CORTEX_M >= 0x03) */
Kojto 108:34e6b704fe68 577
Kojto 108:34e6b704fe68 578
Kojto 108:34e6b704fe68 579 #if (__CORTEX_M == 0x04)
Kojto 108:34e6b704fe68 580
Kojto 108:34e6b704fe68 581 /** \brief Get FPSCR
Kojto 108:34e6b704fe68 582
Kojto 108:34e6b704fe68 583 This function returns the current value of the Floating Point Status/Control register.
Kojto 108:34e6b704fe68 584
Kojto 108:34e6b704fe68 585 \return Floating Point Status/Control register value
Kojto 108:34e6b704fe68 586 */
Kojto 108:34e6b704fe68 587 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FPSCR(void)
Kojto 108:34e6b704fe68 588 {
Kojto 108:34e6b704fe68 589 #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
Kojto 108:34e6b704fe68 590 uint32_t result;
Kojto 108:34e6b704fe68 591
Kojto 108:34e6b704fe68 592 /* Empty asm statement works as a scheduling barrier */
Kojto 108:34e6b704fe68 593 __ASM volatile ("");
Kojto 108:34e6b704fe68 594 __ASM volatile ("VMRS %0, fpscr" : "=r" (result) );
Kojto 108:34e6b704fe68 595 __ASM volatile ("");
Kojto 108:34e6b704fe68 596 return(result);
Kojto 108:34e6b704fe68 597 #else
Kojto 108:34e6b704fe68 598 return(0);
Kojto 108:34e6b704fe68 599 #endif
Kojto 108:34e6b704fe68 600 }
Kojto 108:34e6b704fe68 601
Kojto 108:34e6b704fe68 602
Kojto 108:34e6b704fe68 603 /** \brief Set FPSCR
Kojto 108:34e6b704fe68 604
Kojto 108:34e6b704fe68 605 This function assigns the given value to the Floating Point Status/Control register.
Kojto 108:34e6b704fe68 606
Kojto 108:34e6b704fe68 607 \param [in] fpscr Floating Point Status/Control value to set
Kojto 108:34e6b704fe68 608 */
Kojto 108:34e6b704fe68 609 __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
Kojto 108:34e6b704fe68 610 {
Kojto 108:34e6b704fe68 611 #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
Kojto 108:34e6b704fe68 612 /* Empty asm statement works as a scheduling barrier */
Kojto 108:34e6b704fe68 613 __ASM volatile ("");
Kojto 108:34e6b704fe68 614 __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc");
Kojto 108:34e6b704fe68 615 __ASM volatile ("");
Kojto 108:34e6b704fe68 616 #endif
Kojto 108:34e6b704fe68 617 }
Kojto 108:34e6b704fe68 618
Kojto 108:34e6b704fe68 619 #endif /* (__CORTEX_M == 0x04) */
Kojto 108:34e6b704fe68 620
Kojto 108:34e6b704fe68 621
Kojto 108:34e6b704fe68 622 #elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/
Kojto 108:34e6b704fe68 623 /* TASKING carm specific functions */
Kojto 108:34e6b704fe68 624
Kojto 108:34e6b704fe68 625 /*
Kojto 108:34e6b704fe68 626 * The CMSIS functions have been implemented as intrinsics in the compiler.
Kojto 108:34e6b704fe68 627 * Please use "carm -?i" to get an up to date list of all instrinsics,
Kojto 108:34e6b704fe68 628 * Including the CMSIS ones.
Kojto 108:34e6b704fe68 629 */
Kojto 108:34e6b704fe68 630
Kojto 108:34e6b704fe68 631 #endif
Kojto 108:34e6b704fe68 632
Kojto 108:34e6b704fe68 633 /*@} end of CMSIS_Core_RegAccFunctions */
Kojto 108:34e6b704fe68 634
Kojto 108:34e6b704fe68 635
Kojto 108:34e6b704fe68 636 #endif /* __CORE_CMFUNC_H */