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:
<>
Date:
Tue Mar 14 16:20:51 2017 +0000
Revision:
138:093f2bd7b9eb
Parent:
136:ef9c61f8c49f
Release 138 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

3716: fix for issue #3715: correction in startup files for ARM and IAR, alignment of system_stm32f429xx.c files https://github.com/ARMmbed/mbed-os/pull/3716
3741: STM32 remove warning in hal_tick_32b.c file https://github.com/ARMmbed/mbed-os/pull/3741
3780: STM32L4 : Fix GPIO G port compatibility https://github.com/ARMmbed/mbed-os/pull/3780
3831: NCS36510: SPISLAVE enabled (Conflict resolved) https://github.com/ARMmbed/mbed-os/pull/3831
3836: Allow to redefine nRF's PSTORAGE_NUM_OF_PAGES outside of the mbed-os https://github.com/ARMmbed/mbed-os/pull/3836
3840: STM32: gpio SPEED - always set High Speed by default https://github.com/ARMmbed/mbed-os/pull/3840
3844: STM32 GPIO: Typo correction. Update comment (GPIO_IP_WITHOUT_BRR) https://github.com/ARMmbed/mbed-os/pull/3844
3850: STM32: change spi error to debug warning https://github.com/ARMmbed/mbed-os/pull/3850
3860: Define GPIO_IP_WITHOUT_BRR for xDot platform https://github.com/ARMmbed/mbed-os/pull/3860
3880: DISCO_F469NI: allow the use of CAN2 instance when CAN1 is not activated https://github.com/ARMmbed/mbed-os/pull/3880
3795: Fix pwm period calc https://github.com/ARMmbed/mbed-os/pull/3795
3828: STM32 CAN API: correct format and type https://github.com/ARMmbed/mbed-os/pull/3828
3842: TARGET_NRF: corrected spi_init() to properly handle re-initialization https://github.com/ARMmbed/mbed-os/pull/3842
3843: STM32L476xG: set APB2 clock to 80MHz (instead of 40MHz) https://github.com/ARMmbed/mbed-os/pull/3843
3879: NUCLEO_F446ZE: Add missing AnalogIn pins on PF_3, PF_5 and PF_10. https://github.com/ARMmbed/mbed-os/pull/3879
3902: Fix heap and stack size for NUCLEO_F746ZG https://github.com/ARMmbed/mbed-os/pull/3902
3829: can_write(): return error code when no tx mailboxes are available https://github.com/ARMmbed/mbed-os/pull/3829

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 125:2e9cc70d1897 1 /**************************************************************************//**
AnnaBridge 125:2e9cc70d1897 2 * @file core_cmSecureAccess.h
AnnaBridge 125:2e9cc70d1897 3 * @brief CMSIS Cortex-M Core Secure Access Header File
AnnaBridge 125:2e9cc70d1897 4 * @version XXX
AnnaBridge 125:2e9cc70d1897 5 * @date 10. June 2016
AnnaBridge 125:2e9cc70d1897 6 *
AnnaBridge 125:2e9cc70d1897 7 * @note
AnnaBridge 125:2e9cc70d1897 8 *
AnnaBridge 125:2e9cc70d1897 9 ******************************************************************************/
AnnaBridge 125:2e9cc70d1897 10 /* Copyright (c) 2016 ARM LIMITED
AnnaBridge 125:2e9cc70d1897 11
AnnaBridge 125:2e9cc70d1897 12 All rights reserved.
AnnaBridge 125:2e9cc70d1897 13 Redistribution and use in source and binary forms, with or without
AnnaBridge 125:2e9cc70d1897 14 modification, are permitted provided that the following conditions are met:
AnnaBridge 125:2e9cc70d1897 15 - Redistributions of source code must retain the above copyright
AnnaBridge 125:2e9cc70d1897 16 notice, this list of conditions and the following disclaimer.
AnnaBridge 125:2e9cc70d1897 17 - Redistributions in binary form must reproduce the above copyright
AnnaBridge 125:2e9cc70d1897 18 notice, this list of conditions and the following disclaimer in the
AnnaBridge 125:2e9cc70d1897 19 documentation and/or other materials provided with the distribution.
AnnaBridge 125:2e9cc70d1897 20 - Neither the name of ARM nor the names of its contributors may be used
AnnaBridge 125:2e9cc70d1897 21 to endorse or promote products derived from this software without
AnnaBridge 125:2e9cc70d1897 22 specific prior written permission.
AnnaBridge 125:2e9cc70d1897 23 *
AnnaBridge 125:2e9cc70d1897 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AnnaBridge 125:2e9cc70d1897 25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
AnnaBridge 125:2e9cc70d1897 26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
AnnaBridge 125:2e9cc70d1897 27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
AnnaBridge 125:2e9cc70d1897 28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
AnnaBridge 125:2e9cc70d1897 29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
AnnaBridge 125:2e9cc70d1897 30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
AnnaBridge 125:2e9cc70d1897 31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
AnnaBridge 125:2e9cc70d1897 32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
AnnaBridge 125:2e9cc70d1897 33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
AnnaBridge 125:2e9cc70d1897 34 POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 125:2e9cc70d1897 35 ---------------------------------------------------------------------------*/
AnnaBridge 125:2e9cc70d1897 36
AnnaBridge 125:2e9cc70d1897 37
AnnaBridge 125:2e9cc70d1897 38 #ifndef __CORE_CM_SECURE_ACCESS_H
AnnaBridge 125:2e9cc70d1897 39 #define __CORE_CM_SECURE_ACCESS_H
AnnaBridge 125:2e9cc70d1897 40
AnnaBridge 125:2e9cc70d1897 41
AnnaBridge 125:2e9cc70d1897 42 /* ########################### Core Secure Access ########################### */
AnnaBridge 125:2e9cc70d1897 43
AnnaBridge 125:2e9cc70d1897 44 #ifdef FEATURE_UVISOR
Kojto 136:ef9c61f8c49f 45 #include "uvisor-lib/uvisor-lib.h"
AnnaBridge 125:2e9cc70d1897 46
AnnaBridge 125:2e9cc70d1897 47 /* Secure uVisor implementation. */
AnnaBridge 125:2e9cc70d1897 48
AnnaBridge 125:2e9cc70d1897 49 /** Set the value at the target address.
AnnaBridge 125:2e9cc70d1897 50 *
AnnaBridge 125:2e9cc70d1897 51 * Equivalent to: `*address = value`.
AnnaBridge 125:2e9cc70d1897 52 * @param address[in] Target address
AnnaBridge 125:2e9cc70d1897 53 * @param value[in] Value to write at the address location.
AnnaBridge 125:2e9cc70d1897 54 */
AnnaBridge 125:2e9cc70d1897 55 #define SECURE_WRITE(address, value) \
<> 138:093f2bd7b9eb 56 uvisor_write(public_box, UVISOR_RGW_SHARED, address, value, UVISOR_RGW_OP_WRITE, 0xFFFFFFFFUL)
AnnaBridge 125:2e9cc70d1897 57
AnnaBridge 125:2e9cc70d1897 58 /** Get the value at the target address.
AnnaBridge 125:2e9cc70d1897 59 *
AnnaBridge 125:2e9cc70d1897 60 * @param address[in] Target address
AnnaBridge 125:2e9cc70d1897 61 * @returns The value `*address`.
AnnaBridge 125:2e9cc70d1897 62 */
AnnaBridge 125:2e9cc70d1897 63 #define SECURE_READ(address) \
<> 138:093f2bd7b9eb 64 uvisor_read(public_box, UVISOR_RGW_SHARED, address, UVISOR_RGW_OP_READ, 0xFFFFFFFFUL)
AnnaBridge 125:2e9cc70d1897 65
AnnaBridge 125:2e9cc70d1897 66 /** Get the selected bits at the target address.
AnnaBridge 125:2e9cc70d1897 67 *
AnnaBridge 125:2e9cc70d1897 68 * @param address[in] Target address
AnnaBridge 125:2e9cc70d1897 69 * @param mask[in] Bits to select out of the target address
AnnaBridge 125:2e9cc70d1897 70 * @returns The value `*address & mask`.
AnnaBridge 125:2e9cc70d1897 71 */
AnnaBridge 125:2e9cc70d1897 72 #define SECURE_BITS_GET(address, mask) \
<> 138:093f2bd7b9eb 73 UVISOR_BITS_GET(public_box, UVISOR_RGW_SHARED, address, mask)
AnnaBridge 125:2e9cc70d1897 74
AnnaBridge 125:2e9cc70d1897 75 /** Check the selected bits at the target address.
AnnaBridge 125:2e9cc70d1897 76 *
AnnaBridge 125:2e9cc70d1897 77 * @param address[in] Address at which to check the bits
AnnaBridge 125:2e9cc70d1897 78 * @param mask[in] Bits to select out of the target address
AnnaBridge 125:2e9cc70d1897 79 * @returns The value `((*address & mask) == mask)`.
AnnaBridge 125:2e9cc70d1897 80 */
AnnaBridge 125:2e9cc70d1897 81 #define SECURE_BITS_CHECK(address, mask) \
<> 138:093f2bd7b9eb 82 UVISOR_BITS_CHECK(public_box, UVISOR_RGW_SHARED, address, mask)
AnnaBridge 125:2e9cc70d1897 83
AnnaBridge 125:2e9cc70d1897 84 /** Set the selected bits to 1 at the target address.
AnnaBridge 125:2e9cc70d1897 85 *
AnnaBridge 125:2e9cc70d1897 86 * Equivalent to: `*address |= mask`.
AnnaBridge 125:2e9cc70d1897 87 * @param address[in] Target address
AnnaBridge 125:2e9cc70d1897 88 * @param mask[in] Bits to select out of the target address
AnnaBridge 125:2e9cc70d1897 89 */
AnnaBridge 125:2e9cc70d1897 90 #define SECURE_BITS_SET(address, mask) \
<> 138:093f2bd7b9eb 91 UVISOR_BITS_SET(public_box, UVISOR_RGW_SHARED, address, mask)
AnnaBridge 125:2e9cc70d1897 92
AnnaBridge 125:2e9cc70d1897 93 /** Clear the selected bits at the target address.
AnnaBridge 125:2e9cc70d1897 94 *
AnnaBridge 125:2e9cc70d1897 95 * Equivalent to: `*address &= ~mask`.
AnnaBridge 125:2e9cc70d1897 96 * @param address[in] Target address
AnnaBridge 125:2e9cc70d1897 97 * @param mask[in] Bits to select out of the target address
AnnaBridge 125:2e9cc70d1897 98 */
AnnaBridge 125:2e9cc70d1897 99 #define SECURE_BITS_CLEAR(address, mask) \
<> 138:093f2bd7b9eb 100 UVISOR_BITS_CLEAR(public_box, UVISOR_RGW_SHARED, address, mask)
AnnaBridge 125:2e9cc70d1897 101
AnnaBridge 125:2e9cc70d1897 102 /** Set the selected bits at the target address to the given value.
AnnaBridge 125:2e9cc70d1897 103 *
AnnaBridge 125:2e9cc70d1897 104 * Equivalent to: `*address = (*address & ~mask) | (value & mask)`.
AnnaBridge 125:2e9cc70d1897 105 * @param address[in] Target address
AnnaBridge 125:2e9cc70d1897 106 * @param mask[in] Bits to select out of the target address
AnnaBridge 125:2e9cc70d1897 107 * @param value[in] Value to write at the address location. Note: The value
AnnaBridge 125:2e9cc70d1897 108 * must be already shifted to the correct bit position
AnnaBridge 125:2e9cc70d1897 109 */
AnnaBridge 125:2e9cc70d1897 110 #define SECURE_BITS_SET_VALUE(address, mask, value) \
<> 138:093f2bd7b9eb 111 UVISOR_BITS_SET_VALUE(public_box, UVISOR_RGW_SHARED, address, mask, value)
AnnaBridge 125:2e9cc70d1897 112
AnnaBridge 125:2e9cc70d1897 113 /** Toggle the selected bits at the target address.
AnnaBridge 125:2e9cc70d1897 114 *
AnnaBridge 125:2e9cc70d1897 115 * Equivalent to: `*address ^= mask`.
AnnaBridge 125:2e9cc70d1897 116 * @param address[in] Target address
AnnaBridge 125:2e9cc70d1897 117 * @param mask[in] Bits to select out of the target address
AnnaBridge 125:2e9cc70d1897 118 */
AnnaBridge 125:2e9cc70d1897 119 #define SECURE_BITS_TOGGLE(address, mask) \
<> 138:093f2bd7b9eb 120 UVISOR_BITS_TOGGLE(public_box, UVISOR_RGW_SHARED, address, mask)
AnnaBridge 125:2e9cc70d1897 121
AnnaBridge 125:2e9cc70d1897 122 #else
AnnaBridge 125:2e9cc70d1897 123
AnnaBridge 125:2e9cc70d1897 124 /* Insecure fallback implementation. */
AnnaBridge 125:2e9cc70d1897 125
AnnaBridge 125:2e9cc70d1897 126 /** Set the value at the target address.
AnnaBridge 125:2e9cc70d1897 127 *
AnnaBridge 125:2e9cc70d1897 128 * Equivalent to: `*address = value`.
AnnaBridge 125:2e9cc70d1897 129 * @param address[in] Target address
AnnaBridge 125:2e9cc70d1897 130 * @param value[in] Value to write at the address location.
AnnaBridge 125:2e9cc70d1897 131 */
AnnaBridge 125:2e9cc70d1897 132 #define SECURE_WRITE(address, value) \
AnnaBridge 125:2e9cc70d1897 133 *(address) = (value)
AnnaBridge 125:2e9cc70d1897 134
AnnaBridge 125:2e9cc70d1897 135 /** Get the value at the target address.
AnnaBridge 125:2e9cc70d1897 136 *
AnnaBridge 125:2e9cc70d1897 137 * @param address[in] Target address
AnnaBridge 125:2e9cc70d1897 138 * @returns The value `*address`.
AnnaBridge 125:2e9cc70d1897 139 */
AnnaBridge 125:2e9cc70d1897 140 #define SECURE_READ(address) \
AnnaBridge 125:2e9cc70d1897 141 (*(address))
AnnaBridge 125:2e9cc70d1897 142
AnnaBridge 125:2e9cc70d1897 143 /** Get the selected bits at the target address.
AnnaBridge 125:2e9cc70d1897 144 *
AnnaBridge 125:2e9cc70d1897 145 * @param address[in] Target address
AnnaBridge 125:2e9cc70d1897 146 * @param mask[in] Bits to select out of the target address
AnnaBridge 125:2e9cc70d1897 147 * @returns The value `*address & mask`.
AnnaBridge 125:2e9cc70d1897 148 */
AnnaBridge 125:2e9cc70d1897 149 #define SECURE_BITS_GET(address, mask) \
AnnaBridge 125:2e9cc70d1897 150 (*(address) & (mask))
AnnaBridge 125:2e9cc70d1897 151
AnnaBridge 125:2e9cc70d1897 152 /** Check the selected bits at the target address.
AnnaBridge 125:2e9cc70d1897 153 *
AnnaBridge 125:2e9cc70d1897 154 * @param address[in] Address at which to check the bits
AnnaBridge 125:2e9cc70d1897 155 * @param mask[in] Bits to select out of the target address
AnnaBridge 125:2e9cc70d1897 156 * @returns The value `((*address & mask) == mask)`.
AnnaBridge 125:2e9cc70d1897 157 */
AnnaBridge 125:2e9cc70d1897 158 #define SECURE_BITS_CHECK(address, mask) \
AnnaBridge 125:2e9cc70d1897 159 ((*(address) & (mask)) == (mask))
AnnaBridge 125:2e9cc70d1897 160
AnnaBridge 125:2e9cc70d1897 161 /** Set the selected bits to 1 at the target address.
AnnaBridge 125:2e9cc70d1897 162 *
AnnaBridge 125:2e9cc70d1897 163 * Equivalent to: `*address |= mask`.
AnnaBridge 125:2e9cc70d1897 164 * @param address[in] Target address
AnnaBridge 125:2e9cc70d1897 165 * @param mask[in] Bits to select out of the target address
AnnaBridge 125:2e9cc70d1897 166 */
AnnaBridge 125:2e9cc70d1897 167 #define SECURE_BITS_SET(address, mask) \
AnnaBridge 125:2e9cc70d1897 168 *(address) |= (mask)
AnnaBridge 125:2e9cc70d1897 169
AnnaBridge 125:2e9cc70d1897 170 /** Clear the selected bits at the target address.
AnnaBridge 125:2e9cc70d1897 171 *
AnnaBridge 125:2e9cc70d1897 172 * Equivalent to: `*address &= ~mask`.
AnnaBridge 125:2e9cc70d1897 173 * @param address[in] Target address
AnnaBridge 125:2e9cc70d1897 174 * @param mask[in] Bits to select out of the target address
AnnaBridge 125:2e9cc70d1897 175 */
AnnaBridge 125:2e9cc70d1897 176 #define SECURE_BITS_CLEAR(address, mask) \
AnnaBridge 125:2e9cc70d1897 177 *(address) &= ~(mask)
AnnaBridge 125:2e9cc70d1897 178
AnnaBridge 125:2e9cc70d1897 179 /** Set the selected bits at the target address to the given value.
AnnaBridge 125:2e9cc70d1897 180 *
AnnaBridge 125:2e9cc70d1897 181 * Equivalent to: `*address = (*address & ~mask) | (value & mask)`.
AnnaBridge 125:2e9cc70d1897 182 * @param address[in] Target address
AnnaBridge 125:2e9cc70d1897 183 * @param mask[in] Bits to select out of the target address
AnnaBridge 125:2e9cc70d1897 184 * @param value[in] Value to write at the address location. Note: The value
AnnaBridge 125:2e9cc70d1897 185 * must be already shifted to the correct bit position
AnnaBridge 125:2e9cc70d1897 186 */
AnnaBridge 125:2e9cc70d1897 187 #define SECURE_BITS_SET_VALUE(address, mask, value) \
AnnaBridge 125:2e9cc70d1897 188 *(address) = (*(address) & ~(mask)) | ((value) & (mask))
AnnaBridge 125:2e9cc70d1897 189
AnnaBridge 125:2e9cc70d1897 190 /** Toggle the selected bits at the target address.
AnnaBridge 125:2e9cc70d1897 191 *
AnnaBridge 125:2e9cc70d1897 192 * Equivalent to: `*address ^= mask`.
AnnaBridge 125:2e9cc70d1897 193 * @param address[in] Target address
AnnaBridge 125:2e9cc70d1897 194 * @param mask[in] Bits to select out of the target address
AnnaBridge 125:2e9cc70d1897 195 */
AnnaBridge 125:2e9cc70d1897 196 #define SECURE_BITS_TOGGLE(address, mask) \
AnnaBridge 125:2e9cc70d1897 197 *(address) ^= (mask)
AnnaBridge 125:2e9cc70d1897 198
AnnaBridge 125:2e9cc70d1897 199 #endif
AnnaBridge 125:2e9cc70d1897 200
AnnaBridge 125:2e9cc70d1897 201 #endif /* __CORE_CM_SECURE_ACCESS_H */