1 /**************************************************************************//**
\r
3 * @brief CMSIS Cortex-M0 Core Peripheral Access Layer Source File
\r
5 * @date 10. September 2010
\r
8 * Copyright (C) 2009-2010 ARM Limited. All rights reserved.
\r
11 * ARM Limited (ARM) is supplying this software for use with Cortex-M
\r
12 * processor based microcontrollers. This file can be freely distributed
\r
13 * within development tools that are supporting such ARM based processors.
\r
16 * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
\r
17 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
\r
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
\r
19 * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
\r
20 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
\r
22 ******************************************************************************/
\r
26 /* define compiler specific symbols */
\r
27 #if defined ( __CC_ARM )
\r
28 #define __ASM __asm /*!< asm keyword for ARM Compiler */
\r
29 #define __INLINE __inline /*!< inline keyword for ARM Compiler */
\r
31 #elif defined ( __ICCARM__ )
\r
32 #define __ASM __asm /*!< asm keyword for IAR Compiler */
\r
33 #define __INLINE inline /*!< inline keyword for IAR Compiler. Only avaiable in High optimization mode! */
\r
35 #elif defined ( __GNUC__ )
\r
36 #define __ASM __asm /*!< asm keyword for GNU Compiler */
\r
37 #define __INLINE inline /*!< inline keyword for GNU Compiler */
\r
39 #elif defined ( __TASKING__ )
\r
40 #define __ASM __asm /*!< asm keyword for TASKING Compiler */
\r
41 #define __INLINE inline /*!< inline keyword for TASKING Compiler */
\r
46 /* ########################## Core Instruction Access ######################### */
\r
48 #if defined ( __CC_ARM ) /*------------------ RealView Compiler ----------------*/
\r
50 /** \brief Reverse byte order (16 bit)
\r
52 This function reverses the byte order in two unsigned short values.
\r
54 \param [in] value Value to reverse
\r
55 \return Reversed value
\r
57 #if (__ARMCC_VERSION < 400677)
\r
58 __ASM uint32_t __REV16(uint32_t value)
\r
63 #endif /* __ARMCC_VERSION */
\r
66 /** \brief Reverse byte order in signed short value
\r
68 This function reverses the byte order in a signed short value with sign extension to integer.
\r
70 \param [in] value Value to reverse
\r
71 \return Reversed value
\r
73 #if (__ARMCC_VERSION < 400677)
\r
74 __ASM int32_t __REVSH(int32_t value)
\r
79 #endif /* __ARMCC_VERSION */
\r
82 /** \brief Remove the exclusive lock
\r
84 This function removes the exclusive lock which is created by LDREX.
\r
87 #if (__ARMCC_VERSION < 400000)
\r
88 __ASM void __CLREX(void)
\r
92 #endif /* __ARMCC_VERSION */
\r
95 #elif (defined (__ICCARM__)) /*---------------- ICC Compiler ---------------------*/
\r
97 #elif (defined (__GNUC__)) /*------------------ GNU Compiler ---------------------*/
\r
99 #elif (defined (__TASKING__)) /*--------------- TASKING Compiler -----------------*/
\r
104 /* ########################### Core Function Access ########################### */
\r
106 #if defined ( __CC_ARM ) /*------------------ RealView Compiler ----------------*/
\r
108 /** \brief Get Control Register
\r
110 This function returns the content of the Control Register.
\r
112 \return Control Register value
\r
114 #if (__ARMCC_VERSION < 400000)
\r
115 __ASM uint32_t __get_CONTROL(void)
\r
120 #endif /* __ARMCC_VERSION */
\r
123 /** \brief Set Control Register
\r
125 This function writes the given value to the Control Register.
\r
127 \param [in] control Control Register value to set
\r
129 #if (__ARMCC_VERSION < 400000)
\r
130 __ASM void __set_CONTROL(uint32_t control)
\r
135 #endif /* __ARMCC_VERSION */
\r
138 /** \brief Get ISPR Register
\r
140 This function returns the content of the ISPR Register.
\r
142 \return ISPR Register value
\r
144 #if (__ARMCC_VERSION < 400000)
\r
145 __ASM uint32_t __get_IPSR(void)
\r
150 #endif /* __ARMCC_VERSION */
\r
153 /** \brief Get APSR Register
\r
155 This function returns the content of the APSR Register.
\r
157 \return APSR Register value
\r
159 #if (__ARMCC_VERSION < 400000)
\r
160 __ASM uint32_t __get_APSR(void)
\r
165 #endif /* __ARMCC_VERSION */
\r
168 /** \brief Get xPSR Register
\r
170 This function returns the content of the xPSR Register.
\r
172 \return xPSR Register value
\r
174 #if (__ARMCC_VERSION < 400000)
\r
175 __ASM uint32_t __get_xPSR(void)
\r
180 #endif /* __ARMCC_VERSION */
\r
183 /** \brief Get Process Stack Pointer
\r
185 This function returns the current value of the Process Stack Pointer (PSP).
\r
187 \return PSP Register value
\r
189 #if (__ARMCC_VERSION < 400000)
\r
190 __ASM uint32_t __get_PSP(void)
\r
195 #endif /* __ARMCC_VERSION */
\r
198 /** \brief Set Process Stack Pointer
\r
200 This function assigns the given value to the Process Stack Pointer (PSP).
\r
202 \param [in] topOfProcStack Process Stack Pointer value to set
\r
204 #if (__ARMCC_VERSION < 400000)
\r
205 __ASM void __set_PSP(uint32_t topOfProcStack)
\r
210 #endif /* __ARMCC_VERSION */
\r
213 /** \brief Get Main Stack Pointer
\r
215 This function returns the current value of the Main Stack Pointer (MSP).
\r
217 \return MSP Register value
\r
219 #if (__ARMCC_VERSION < 400000)
\r
220 __ASM uint32_t __get_MSP(void)
\r
225 #endif /* __ARMCC_VERSION */
\r
228 /** \brief Set Main Stack Pointer
\r
230 This function assigns the given value to the Main Stack Pointer (MSP).
\r
232 \param [in] topOfMainStack Main Stack Pointer value to set
\r
234 #if (__ARMCC_VERSION < 400000)
\r
235 __ASM void __set_MSP(uint32_t mainStackPointer)
\r
240 #endif /* __ARMCC_VERSION */
\r
243 /** \brief Get Priority Mask
\r
245 This function returns the current state of the priority mask bit from the Priority Mask Register.
\r
247 \return Priority Mask value
\r
249 #if (__ARMCC_VERSION < 400000)
\r
250 __ASM uint32_t __get_PRIMASK(void)
\r
255 #endif /* __ARMCC_VERSION */
\r
258 /** \brief Set Priority Mask
\r
260 This function assigns the given value to the Priority Mask Register.
\r
262 \param [in] priMask Priority Mask
\r
264 #if (__ARMCC_VERSION < 400000)
\r
265 __ASM void __set_PRIMASK(uint32_t priMask)
\r
270 #endif /* __ARMCC_VERSION */
\r
273 #elif (defined (__ICCARM__)) /*---------------- ICC Compiler ---------------------*/
\r
275 #elif (defined (__GNUC__)) /*------------------ GNU Compiler ---------------------*/
\r
277 #elif (defined (__TASKING__)) /*--------------- TASKING Compiler -----------------*/
\r