mbed library sources. Supersedes mbed-src. Fixed broken STM32F1xx RTC on rtc_api.c
Dependents: Nucleo_F103RB_RTC_battery_bkup_pwr_off_okay
Fork of mbed-dev by
cmsis/tz_context.h@177:619788de047e, 2017-11-07 (annotated)
- Committer:
- maxxir
- Date:
- Tue Nov 07 16:46:29 2017 +0000
- Revision:
- 177:619788de047e
- Parent:
- 167:e84263d55307
To fix broken RTC on Nucleo_F103RB / STM32F103 BluePill etc..; Used direct RTC register manipulation for STM32F1xx; rtc_read() && rtc_write() (native rtc_init() - works good); also added stub for non-working on STM32F1xx rtc_read_subseconds().
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 167:e84263d55307 | 1 | /* |
AnnaBridge | 167:e84263d55307 | 2 | * Copyright (c) 2015-2016 ARM Limited. All rights reserved. |
AnnaBridge | 167:e84263d55307 | 3 | * |
AnnaBridge | 167:e84263d55307 | 4 | * SPDX-License-Identifier: Apache-2.0 |
AnnaBridge | 167:e84263d55307 | 5 | * |
AnnaBridge | 167:e84263d55307 | 6 | * Licensed under the Apache License, Version 2.0 (the License); you may |
AnnaBridge | 167:e84263d55307 | 7 | * not use this file except in compliance with the License. |
AnnaBridge | 167:e84263d55307 | 8 | * You may obtain a copy of the License at |
AnnaBridge | 167:e84263d55307 | 9 | * |
AnnaBridge | 167:e84263d55307 | 10 | * www.apache.org/licenses/LICENSE-2.0 |
AnnaBridge | 167:e84263d55307 | 11 | * |
AnnaBridge | 167:e84263d55307 | 12 | * Unless required by applicable law or agreed to in writing, software |
AnnaBridge | 167:e84263d55307 | 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
AnnaBridge | 167:e84263d55307 | 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
AnnaBridge | 167:e84263d55307 | 15 | * See the License for the specific language governing permissions and |
AnnaBridge | 167:e84263d55307 | 16 | * limitations under the License. |
AnnaBridge | 167:e84263d55307 | 17 | * |
AnnaBridge | 167:e84263d55307 | 18 | * ---------------------------------------------------------------------------- |
AnnaBridge | 167:e84263d55307 | 19 | * |
AnnaBridge | 167:e84263d55307 | 20 | * $Date: 21. September 2016 |
AnnaBridge | 167:e84263d55307 | 21 | * $Revision: V1.0 |
AnnaBridge | 167:e84263d55307 | 22 | * |
AnnaBridge | 167:e84263d55307 | 23 | * Project: TrustZone for ARMv8-M |
AnnaBridge | 167:e84263d55307 | 24 | * Title: Context Management for ARMv8-M TrustZone |
AnnaBridge | 167:e84263d55307 | 25 | * |
AnnaBridge | 167:e84263d55307 | 26 | * Version 1.0 |
AnnaBridge | 167:e84263d55307 | 27 | * Initial Release |
AnnaBridge | 167:e84263d55307 | 28 | *---------------------------------------------------------------------------*/ |
AnnaBridge | 167:e84263d55307 | 29 | |
AnnaBridge | 167:e84263d55307 | 30 | #ifndef TZ_CONTEXT_H |
AnnaBridge | 167:e84263d55307 | 31 | #define TZ_CONTEXT_H |
AnnaBridge | 167:e84263d55307 | 32 | |
AnnaBridge | 167:e84263d55307 | 33 | #include <stdint.h> |
AnnaBridge | 167:e84263d55307 | 34 | |
AnnaBridge | 167:e84263d55307 | 35 | #ifndef TZ_MODULEID_T |
AnnaBridge | 167:e84263d55307 | 36 | #define TZ_MODULEID_T |
AnnaBridge | 167:e84263d55307 | 37 | /// \details Data type that identifies secure software modules called by a process. |
AnnaBridge | 167:e84263d55307 | 38 | typedef uint32_t TZ_ModuleId_t; |
AnnaBridge | 167:e84263d55307 | 39 | #endif |
AnnaBridge | 167:e84263d55307 | 40 | |
AnnaBridge | 167:e84263d55307 | 41 | /// \details TZ Memory ID identifies an allocated memory slot. |
AnnaBridge | 167:e84263d55307 | 42 | typedef uint32_t TZ_MemoryId_t; |
AnnaBridge | 167:e84263d55307 | 43 | |
AnnaBridge | 167:e84263d55307 | 44 | /// Initialize secure context memory system |
AnnaBridge | 167:e84263d55307 | 45 | /// \return execution status (1: success, 0: error) |
AnnaBridge | 167:e84263d55307 | 46 | uint32_t TZ_InitContextSystem_S (void); |
AnnaBridge | 167:e84263d55307 | 47 | |
AnnaBridge | 167:e84263d55307 | 48 | /// Allocate context memory for calling secure software modules in TrustZone |
AnnaBridge | 167:e84263d55307 | 49 | /// \param[in] module identifies software modules called from non-secure mode |
AnnaBridge | 167:e84263d55307 | 50 | /// \return value != 0 id TrustZone memory slot identifier |
AnnaBridge | 167:e84263d55307 | 51 | /// \return value 0 no memory available or internal error |
AnnaBridge | 167:e84263d55307 | 52 | TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module); |
AnnaBridge | 167:e84263d55307 | 53 | |
AnnaBridge | 167:e84263d55307 | 54 | /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S |
AnnaBridge | 167:e84263d55307 | 55 | /// \param[in] id TrustZone memory slot identifier |
AnnaBridge | 167:e84263d55307 | 56 | /// \return execution status (1: success, 0: error) |
AnnaBridge | 167:e84263d55307 | 57 | uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id); |
AnnaBridge | 167:e84263d55307 | 58 | |
AnnaBridge | 167:e84263d55307 | 59 | /// Load secure context (called on RTOS thread context switch) |
AnnaBridge | 167:e84263d55307 | 60 | /// \param[in] id TrustZone memory slot identifier |
AnnaBridge | 167:e84263d55307 | 61 | /// \return execution status (1: success, 0: error) |
AnnaBridge | 167:e84263d55307 | 62 | uint32_t TZ_LoadContext_S (TZ_MemoryId_t id); |
AnnaBridge | 167:e84263d55307 | 63 | |
AnnaBridge | 167:e84263d55307 | 64 | /// Store secure context (called on RTOS thread context switch) |
AnnaBridge | 167:e84263d55307 | 65 | /// \param[in] id TrustZone memory slot identifier |
AnnaBridge | 167:e84263d55307 | 66 | /// \return execution status (1: success, 0: error) |
AnnaBridge | 167:e84263d55307 | 67 | uint32_t TZ_StoreContext_S (TZ_MemoryId_t id); |
AnnaBridge | 167:e84263d55307 | 68 | |
AnnaBridge | 167:e84263d55307 | 69 | #endif // TZ_CONTEXT_H |