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:
115:87f2f5183dfb
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 98:8ab26030e058 1 /**************************************************************************//**
Kojto 98:8ab26030e058 2 * @file core_ca9.h
Kojto 98:8ab26030e058 3 * @brief CMSIS Cortex-A9 Core Peripheral Access Layer Header File
Kojto 98:8ab26030e058 4 * @version
Kojto 98:8ab26030e058 5 * @date 25 March 2013
Kojto 98:8ab26030e058 6 *
Kojto 98:8ab26030e058 7 * @note
Kojto 98:8ab26030e058 8 *
Kojto 98:8ab26030e058 9 ******************************************************************************/
Kojto 98:8ab26030e058 10 /* Copyright (c) 2009 - 2012 ARM LIMITED
Kojto 98:8ab26030e058 11
Kojto 98:8ab26030e058 12 All rights reserved.
Kojto 98:8ab26030e058 13 Redistribution and use in source and binary forms, with or without
Kojto 98:8ab26030e058 14 modification, are permitted provided that the following conditions are met:
Kojto 98:8ab26030e058 15 - Redistributions of source code must retain the above copyright
Kojto 98:8ab26030e058 16 notice, this list of conditions and the following disclaimer.
Kojto 98:8ab26030e058 17 - Redistributions in binary form must reproduce the above copyright
Kojto 98:8ab26030e058 18 notice, this list of conditions and the following disclaimer in the
Kojto 98:8ab26030e058 19 documentation and/or other materials provided with the distribution.
Kojto 98:8ab26030e058 20 - Neither the name of ARM nor the names of its contributors may be used
Kojto 98:8ab26030e058 21 to endorse or promote products derived from this software without
Kojto 98:8ab26030e058 22 specific prior written permission.
Kojto 98:8ab26030e058 23 *
Kojto 98:8ab26030e058 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 98:8ab26030e058 25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 98:8ab26030e058 26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Kojto 98:8ab26030e058 27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
Kojto 98:8ab26030e058 28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
Kojto 98:8ab26030e058 29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
Kojto 98:8ab26030e058 30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
Kojto 98:8ab26030e058 31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
Kojto 98:8ab26030e058 32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
Kojto 98:8ab26030e058 33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Kojto 98:8ab26030e058 34 POSSIBILITY OF SUCH DAMAGE.
Kojto 98:8ab26030e058 35 ---------------------------------------------------------------------------*/
Kojto 98:8ab26030e058 36
Kojto 98:8ab26030e058 37
Kojto 98:8ab26030e058 38 #if defined ( __ICCARM__ )
Kojto 98:8ab26030e058 39 #pragma system_include /* treat file as system include file for MISRA check */
Kojto 98:8ab26030e058 40 #endif
Kojto 98:8ab26030e058 41
Kojto 98:8ab26030e058 42 #ifdef __cplusplus
Kojto 98:8ab26030e058 43 extern "C" {
Kojto 98:8ab26030e058 44 #endif
Kojto 98:8ab26030e058 45
Kojto 98:8ab26030e058 46 #ifndef __CORE_CA9_H_GENERIC
Kojto 98:8ab26030e058 47 #define __CORE_CA9_H_GENERIC
Kojto 98:8ab26030e058 48
Kojto 98:8ab26030e058 49
Kojto 98:8ab26030e058 50 /** \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
Kojto 98:8ab26030e058 51 CMSIS violates the following MISRA-C:2004 rules:
Kojto 98:8ab26030e058 52
Kojto 98:8ab26030e058 53 \li Required Rule 8.5, object/function definition in header file.<br>
Kojto 98:8ab26030e058 54 Function definitions in header files are used to allow 'inlining'.
Kojto 98:8ab26030e058 55
Kojto 98:8ab26030e058 56 \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
Kojto 98:8ab26030e058 57 Unions are used for effective representation of core registers.
Kojto 98:8ab26030e058 58
Kojto 98:8ab26030e058 59 \li Advisory Rule 19.7, Function-like macro defined.<br>
Kojto 98:8ab26030e058 60 Function-like macros are used to allow more efficient code.
Kojto 98:8ab26030e058 61 */
Kojto 98:8ab26030e058 62
Kojto 98:8ab26030e058 63
Kojto 98:8ab26030e058 64 /*******************************************************************************
Kojto 98:8ab26030e058 65 * CMSIS definitions
Kojto 98:8ab26030e058 66 ******************************************************************************/
Kojto 98:8ab26030e058 67 /** \ingroup Cortex_A9
Kojto 98:8ab26030e058 68 @{
Kojto 98:8ab26030e058 69 */
Kojto 98:8ab26030e058 70
Kojto 98:8ab26030e058 71 /* CMSIS CA9 definitions */
Kojto 98:8ab26030e058 72 #define __CA9_CMSIS_VERSION_MAIN (0x03) /*!< [31:16] CMSIS HAL main version */
Kojto 98:8ab26030e058 73 #define __CA9_CMSIS_VERSION_SUB (0x10) /*!< [15:0] CMSIS HAL sub version */
Kojto 98:8ab26030e058 74 #define __CA9_CMSIS_VERSION ((__CA9_CMSIS_VERSION_MAIN << 16) | \
Kojto 98:8ab26030e058 75 __CA9_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */
Kojto 98:8ab26030e058 76
Kojto 98:8ab26030e058 77 #define __CORTEX_A (0x09) /*!< Cortex-A Core */
Kojto 98:8ab26030e058 78
Kojto 98:8ab26030e058 79
Kojto 98:8ab26030e058 80 #if defined ( __CC_ARM )
Kojto 98:8ab26030e058 81 #define __ASM __asm /*!< asm keyword for ARM Compiler */
Kojto 98:8ab26030e058 82 #define __INLINE __inline /*!< inline keyword for ARM Compiler */
Kojto 98:8ab26030e058 83 #define __STATIC_INLINE static __inline
Kojto 98:8ab26030e058 84 #define __STATIC_ASM static __asm
Kojto 98:8ab26030e058 85
Kojto 98:8ab26030e058 86 #elif defined ( __ICCARM__ )
Kojto 98:8ab26030e058 87 #define __ASM __asm /*!< asm keyword for IAR Compiler */
Kojto 98:8ab26030e058 88 #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
Kojto 98:8ab26030e058 89 #define __STATIC_INLINE static inline
Kojto 98:8ab26030e058 90 #define __STATIC_ASM static __asm
Kojto 98:8ab26030e058 91
Kojto 115:87f2f5183dfb 92 #include <stdint.h>
Kojto 115:87f2f5183dfb 93 inline uint32_t __get_PSR(void) {
Kojto 115:87f2f5183dfb 94 __ASM("mrs r0, cpsr");
Kojto 115:87f2f5183dfb 95 }
Kojto 115:87f2f5183dfb 96
Kojto 98:8ab26030e058 97 #elif defined ( __TMS470__ )
Kojto 98:8ab26030e058 98 #define __ASM __asm /*!< asm keyword for TI CCS Compiler */
Kojto 98:8ab26030e058 99 #define __STATIC_INLINE static inline
Kojto 98:8ab26030e058 100 #define __STATIC_ASM static __asm
Kojto 98:8ab26030e058 101
Kojto 98:8ab26030e058 102 #elif defined ( __GNUC__ )
Kojto 98:8ab26030e058 103 #define __ASM __asm /*!< asm keyword for GNU Compiler */
Kojto 98:8ab26030e058 104 #define __INLINE inline /*!< inline keyword for GNU Compiler */
Kojto 98:8ab26030e058 105 #define __STATIC_INLINE static inline
Kojto 98:8ab26030e058 106 #define __STATIC_ASM static __asm
Kojto 98:8ab26030e058 107
Kojto 98:8ab26030e058 108 #elif defined ( __TASKING__ )
Kojto 98:8ab26030e058 109 #define __ASM __asm /*!< asm keyword for TASKING Compiler */
Kojto 98:8ab26030e058 110 #define __INLINE inline /*!< inline keyword for TASKING Compiler */
Kojto 98:8ab26030e058 111 #define __STATIC_INLINE static inline
Kojto 98:8ab26030e058 112 #define __STATIC_ASM static __asm
Kojto 98:8ab26030e058 113
Kojto 98:8ab26030e058 114 #endif
Kojto 98:8ab26030e058 115
Kojto 98:8ab26030e058 116 /** __FPU_USED indicates whether an FPU is used or not. For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions.
Kojto 98:8ab26030e058 117 */
Kojto 98:8ab26030e058 118 #if defined ( __CC_ARM )
Kojto 98:8ab26030e058 119 #if defined __TARGET_FPU_VFP
Kojto 98:8ab26030e058 120 #if (__FPU_PRESENT == 1)
Kojto 98:8ab26030e058 121 #define __FPU_USED 1
Kojto 98:8ab26030e058 122 #else
Kojto 98:8ab26030e058 123 #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
Kojto 98:8ab26030e058 124 #define __FPU_USED 0
Kojto 98:8ab26030e058 125 #endif
Kojto 98:8ab26030e058 126 #else
Kojto 98:8ab26030e058 127 #define __FPU_USED 0
Kojto 98:8ab26030e058 128 #endif
Kojto 98:8ab26030e058 129
Kojto 98:8ab26030e058 130 #elif defined ( __ICCARM__ )
Kojto 98:8ab26030e058 131 #if defined __ARMVFP__
Kojto 98:8ab26030e058 132 #if (__FPU_PRESENT == 1)
Kojto 98:8ab26030e058 133 #define __FPU_USED 1
Kojto 98:8ab26030e058 134 #else
Kojto 98:8ab26030e058 135 #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
Kojto 98:8ab26030e058 136 #define __FPU_USED 0
Kojto 98:8ab26030e058 137 #endif
Kojto 98:8ab26030e058 138 #else
Kojto 98:8ab26030e058 139 #define __FPU_USED 0
Kojto 98:8ab26030e058 140 #endif
Kojto 98:8ab26030e058 141
Kojto 98:8ab26030e058 142 #elif defined ( __TMS470__ )
Kojto 98:8ab26030e058 143 #if defined __TI_VFP_SUPPORT__
Kojto 98:8ab26030e058 144 #if (__FPU_PRESENT == 1)
Kojto 98:8ab26030e058 145 #define __FPU_USED 1
Kojto 98:8ab26030e058 146 #else
Kojto 98:8ab26030e058 147 #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
Kojto 98:8ab26030e058 148 #define __FPU_USED 0
Kojto 98:8ab26030e058 149 #endif
Kojto 98:8ab26030e058 150 #else
Kojto 98:8ab26030e058 151 #define __FPU_USED 0
Kojto 98:8ab26030e058 152 #endif
Kojto 98:8ab26030e058 153
Kojto 98:8ab26030e058 154 #elif defined ( __GNUC__ )
Kojto 98:8ab26030e058 155 #if defined (__VFP_FP__) && !defined(__SOFTFP__)
Kojto 98:8ab26030e058 156 #if (__FPU_PRESENT == 1)
Kojto 98:8ab26030e058 157 #define __FPU_USED 1
Kojto 98:8ab26030e058 158 #else
Kojto 98:8ab26030e058 159 #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
Kojto 98:8ab26030e058 160 #define __FPU_USED 0
Kojto 98:8ab26030e058 161 #endif
Kojto 98:8ab26030e058 162 #else
Kojto 98:8ab26030e058 163 #define __FPU_USED 0
Kojto 98:8ab26030e058 164 #endif
Kojto 98:8ab26030e058 165
Kojto 98:8ab26030e058 166 #elif defined ( __TASKING__ )
Kojto 98:8ab26030e058 167 #if defined __FPU_VFP__
Kojto 98:8ab26030e058 168 #if (__FPU_PRESENT == 1)
Kojto 98:8ab26030e058 169 #define __FPU_USED 1
Kojto 98:8ab26030e058 170 #else
Kojto 98:8ab26030e058 171 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
Kojto 98:8ab26030e058 172 #define __FPU_USED 0
Kojto 98:8ab26030e058 173 #endif
Kojto 98:8ab26030e058 174 #else
Kojto 98:8ab26030e058 175 #define __FPU_USED 0
Kojto 98:8ab26030e058 176 #endif
Kojto 98:8ab26030e058 177 #endif
Kojto 98:8ab26030e058 178
Kojto 98:8ab26030e058 179 #include <stdint.h> /*!< standard types definitions */
Kojto 98:8ab26030e058 180 #include "core_caInstr.h" /*!< Core Instruction Access */
Kojto 98:8ab26030e058 181 #include "core_caFunc.h" /*!< Core Function Access */
Kojto 98:8ab26030e058 182 #include "core_cm4_simd.h" /*!< Compiler specific SIMD Intrinsics */
Kojto 98:8ab26030e058 183
Kojto 98:8ab26030e058 184 #endif /* __CORE_CA9_H_GENERIC */
Kojto 98:8ab26030e058 185
Kojto 98:8ab26030e058 186 #ifndef __CMSIS_GENERIC
Kojto 98:8ab26030e058 187
Kojto 98:8ab26030e058 188 #ifndef __CORE_CA9_H_DEPENDANT
Kojto 98:8ab26030e058 189 #define __CORE_CA9_H_DEPENDANT
Kojto 98:8ab26030e058 190
Kojto 98:8ab26030e058 191 /* check device defines and use defaults */
Kojto 98:8ab26030e058 192 #if defined __CHECK_DEVICE_DEFINES
Kojto 98:8ab26030e058 193 #ifndef __CA9_REV
Kojto 98:8ab26030e058 194 #define __CA9_REV 0x0000
Kojto 98:8ab26030e058 195 #warning "__CA9_REV not defined in device header file; using default!"
Kojto 98:8ab26030e058 196 #endif
Kojto 98:8ab26030e058 197
Kojto 98:8ab26030e058 198 #ifndef __FPU_PRESENT
Kojto 98:8ab26030e058 199 #define __FPU_PRESENT 1
Kojto 98:8ab26030e058 200 #warning "__FPU_PRESENT not defined in device header file; using default!"
Kojto 98:8ab26030e058 201 #endif
Kojto 98:8ab26030e058 202
Kojto 98:8ab26030e058 203 #ifndef __Vendor_SysTickConfig
Kojto 98:8ab26030e058 204 #define __Vendor_SysTickConfig 1
Kojto 98:8ab26030e058 205 #endif
Kojto 98:8ab26030e058 206
Kojto 98:8ab26030e058 207 #if __Vendor_SysTickConfig == 0
Kojto 98:8ab26030e058 208 #error "__Vendor_SysTickConfig set to 0, but vendor systick timer must be supplied for Cortex-A9"
Kojto 98:8ab26030e058 209 #endif
Kojto 98:8ab26030e058 210 #endif
Kojto 98:8ab26030e058 211
Kojto 98:8ab26030e058 212 /* IO definitions (access restrictions to peripheral registers) */
Kojto 98:8ab26030e058 213 /**
Kojto 98:8ab26030e058 214 \defgroup CMSIS_glob_defs CMSIS Global Defines
Kojto 98:8ab26030e058 215
Kojto 98:8ab26030e058 216 <strong>IO Type Qualifiers</strong> are used
Kojto 98:8ab26030e058 217 \li to specify the access to peripheral variables.
Kojto 98:8ab26030e058 218 \li for automatic generation of peripheral register debug information.
Kojto 98:8ab26030e058 219 */
Kojto 98:8ab26030e058 220 #ifdef __cplusplus
Kojto 98:8ab26030e058 221 #define __I volatile /*!< Defines 'read only' permissions */
Kojto 98:8ab26030e058 222 #else
Kojto 98:8ab26030e058 223 #define __I volatile const /*!< Defines 'read only' permissions */
Kojto 98:8ab26030e058 224 #endif
Kojto 98:8ab26030e058 225 #define __O volatile /*!< Defines 'write only' permissions */
Kojto 98:8ab26030e058 226 #define __IO volatile /*!< Defines 'read / write' permissions */
Kojto 98:8ab26030e058 227
Kojto 98:8ab26030e058 228 /*@} end of group Cortex_A9 */
Kojto 98:8ab26030e058 229
Kojto 98:8ab26030e058 230
Kojto 98:8ab26030e058 231 /*******************************************************************************
Kojto 98:8ab26030e058 232 * Register Abstraction
Kojto 98:8ab26030e058 233 ******************************************************************************/
Kojto 98:8ab26030e058 234 /** \defgroup CMSIS_core_register Defines and Type Definitions
Kojto 98:8ab26030e058 235 \brief Type definitions and defines for Cortex-A processor based devices.
Kojto 98:8ab26030e058 236 */
Kojto 98:8ab26030e058 237
Kojto 98:8ab26030e058 238 /** \ingroup CMSIS_core_register
Kojto 98:8ab26030e058 239 \defgroup CMSIS_CORE Status and Control Registers
Kojto 98:8ab26030e058 240 \brief Core Register type definitions.
Kojto 98:8ab26030e058 241 @{
Kojto 98:8ab26030e058 242 */
Kojto 98:8ab26030e058 243
Kojto 98:8ab26030e058 244 /** \brief Union type to access the Application Program Status Register (APSR).
Kojto 98:8ab26030e058 245 */
Kojto 98:8ab26030e058 246 typedef union
Kojto 98:8ab26030e058 247 {
Kojto 98:8ab26030e058 248 struct
Kojto 98:8ab26030e058 249 {
Kojto 98:8ab26030e058 250 uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */
Kojto 98:8ab26030e058 251 uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
Kojto 98:8ab26030e058 252 uint32_t reserved1:7; /*!< bit: 20..23 Reserved */
Kojto 98:8ab26030e058 253 uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
Kojto 98:8ab26030e058 254 uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
Kojto 98:8ab26030e058 255 uint32_t C:1; /*!< bit: 29 Carry condition code flag */
Kojto 98:8ab26030e058 256 uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
Kojto 98:8ab26030e058 257 uint32_t N:1; /*!< bit: 31 Negative condition code flag */
Kojto 98:8ab26030e058 258 } b; /*!< Structure used for bit access */
Kojto 98:8ab26030e058 259 uint32_t w; /*!< Type used for word access */
Kojto 98:8ab26030e058 260 } APSR_Type;
Kojto 98:8ab26030e058 261
Kojto 98:8ab26030e058 262
Kojto 98:8ab26030e058 263 /*@} end of group CMSIS_CORE */
Kojto 98:8ab26030e058 264
Kojto 98:8ab26030e058 265 /*@} end of CMSIS_Core_FPUFunctions */
Kojto 98:8ab26030e058 266
Kojto 98:8ab26030e058 267
Kojto 98:8ab26030e058 268 #endif /* __CORE_CA9_H_GENERIC */
Kojto 98:8ab26030e058 269
Kojto 98:8ab26030e058 270 #endif /* __CMSIS_GENERIC */
Kojto 98:8ab26030e058 271
Kojto 98:8ab26030e058 272 #ifdef __cplusplus
Kojto 98:8ab26030e058 273 }
Kojto 98:8ab26030e058 274
Kojto 98:8ab26030e058 275
Kojto 98:8ab26030e058 276 #endif