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 mbed official

Committer:
maxxir
Date:
Tue Nov 07 16:46:29 2017 +0000
Revision:
177:619788de047e
Parent:
157:ff67d9f36b67
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?

UserRevisionLine numberNew contents of line
<> 157:ff67d9f36b67 1 /**
<> 157:ff67d9f36b67 2 * @file
<> 157:ff67d9f36b67 3 * @brief Flash Controller (FLC) function prototypes and data types.
<> 157:ff67d9f36b67 4 */
<> 157:ff67d9f36b67 5
<> 157:ff67d9f36b67 6 /* ****************************************************************************
<> 157:ff67d9f36b67 7 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
<> 157:ff67d9f36b67 8 *
<> 157:ff67d9f36b67 9 * Permission is hereby granted, free of charge, to any person obtaining a
<> 157:ff67d9f36b67 10 * copy of this software and associated documentation files (the "Software"),
<> 157:ff67d9f36b67 11 * to deal in the Software without restriction, including without limitation
<> 157:ff67d9f36b67 12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
<> 157:ff67d9f36b67 13 * and/or sell copies of the Software, and to permit persons to whom the
<> 157:ff67d9f36b67 14 * Software is furnished to do so, subject to the following conditions:
<> 157:ff67d9f36b67 15 *
<> 157:ff67d9f36b67 16 * The above copyright notice and this permission notice shall be included
<> 157:ff67d9f36b67 17 * in all copies or substantial portions of the Software.
<> 157:ff67d9f36b67 18 *
<> 157:ff67d9f36b67 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
<> 157:ff67d9f36b67 20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
<> 157:ff67d9f36b67 21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
<> 157:ff67d9f36b67 22 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
<> 157:ff67d9f36b67 23 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
<> 157:ff67d9f36b67 24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
<> 157:ff67d9f36b67 25 * OTHER DEALINGS IN THE SOFTWARE.
<> 157:ff67d9f36b67 26 *
<> 157:ff67d9f36b67 27 * Except as contained in this notice, the name of Maxim Integrated
<> 157:ff67d9f36b67 28 * Products, Inc. shall not be used except as stated in the Maxim Integrated
<> 157:ff67d9f36b67 29 * Products, Inc. Branding Policy.
<> 157:ff67d9f36b67 30 *
<> 157:ff67d9f36b67 31 * The mere transfer of this software does not imply any licenses
<> 157:ff67d9f36b67 32 * of trade secrets, proprietary technology, copyrights, patents,
<> 157:ff67d9f36b67 33 * trademarks, maskwork rights, or any other form of intellectual
<> 157:ff67d9f36b67 34 * property whatsoever. Maxim Integrated Products, Inc. retains all
<> 157:ff67d9f36b67 35 * ownership rights.
<> 157:ff67d9f36b67 36 *
<> 157:ff67d9f36b67 37 * $Date: 2016-10-10 18:54:04 -0500 (Mon, 10 Oct 2016) $
<> 157:ff67d9f36b67 38 * $Revision: 24658 $
<> 157:ff67d9f36b67 39 *
<> 157:ff67d9f36b67 40 *************************************************************************** */
<> 157:ff67d9f36b67 41
<> 157:ff67d9f36b67 42 /* Define to prevent redundant inclusion */
<> 157:ff67d9f36b67 43 #ifndef _FLC_H_
<> 157:ff67d9f36b67 44 #define _FLC_H_
<> 157:ff67d9f36b67 45
<> 157:ff67d9f36b67 46 /* **** Includes **** */
<> 157:ff67d9f36b67 47 #include "flc_regs.h"
<> 157:ff67d9f36b67 48
<> 157:ff67d9f36b67 49 #ifdef __cplusplus
<> 157:ff67d9f36b67 50 extern "C" {
<> 157:ff67d9f36b67 51 #endif
<> 157:ff67d9f36b67 52
<> 157:ff67d9f36b67 53 /**
<> 157:ff67d9f36b67 54 * @ingroup sysconfig
<> 157:ff67d9f36b67 55 * @defgroup flc Flash Controller (FLC)
<> 157:ff67d9f36b67 56 * @{
<> 157:ff67d9f36b67 57 */
<> 157:ff67d9f36b67 58
<> 157:ff67d9f36b67 59 /* **** Definitions **** */
<> 157:ff67d9f36b67 60
<> 157:ff67d9f36b67 61 /* **** Globals **** */
<> 157:ff67d9f36b67 62
<> 157:ff67d9f36b67 63 /* **** Function Prototypes **** */
<> 157:ff67d9f36b67 64
<> 157:ff67d9f36b67 65 /**
<> 157:ff67d9f36b67 66 * @brief Prepares the Flash Controller for in-application flash operations. This function
<> 157:ff67d9f36b67 67 * only needs to be called one time after a reset event.
<> 157:ff67d9f36b67 68 *
<> 157:ff67d9f36b67 69 * @return #E_NO_ERROR if flash controller initialized correctly, error if
<> 157:ff67d9f36b67 70 * unsuccessful.
<> 157:ff67d9f36b67 71 */
<> 157:ff67d9f36b67 72 int FLC_Init(void);
<> 157:ff67d9f36b67 73
<> 157:ff67d9f36b67 74 /**
<> 157:ff67d9f36b67 75 * @brief This function will erase a single page of flash.
<> 157:ff67d9f36b67 76 *
<> 157:ff67d9f36b67 77 * @param address Address of the page to be erased.
<> 157:ff67d9f36b67 78 * @param erase_code Flash erase code; defined as
<> 157:ff67d9f36b67 79 * #MXC_V_FLC_ERASE_CODE_PAGE_ERASE for page erase
<> 157:ff67d9f36b67 80 * @param unlock_key Unlock key, #MXC_V_FLC_FLSH_UNLOCK_KEY.
<> 157:ff67d9f36b67 81 *
<> 157:ff67d9f36b67 82 * @returns #E_NO_ERROR if page erase successful, error if unsuccessful.
<> 157:ff67d9f36b67 83 */
<> 157:ff67d9f36b67 84 int FLC_PageErase(uint32_t address, uint8_t erase_code, uint8_t unlock_key);
<> 157:ff67d9f36b67 85
<> 157:ff67d9f36b67 86 /**
<> 157:ff67d9f36b67 87 * @brief This function writes data to the flash device through the flash
<> 157:ff67d9f36b67 88 * controller interface
<> 157:ff67d9f36b67 89 *
<> 157:ff67d9f36b67 90 * @param address Start address for desired write. @note This address
<> 157:ff67d9f36b67 91 * must be 32-bit word aligned
<> 157:ff67d9f36b67 92 * @param data A pointer to the buffer containing the data to write.
<> 157:ff67d9f36b67 93 * @param length Size of the data to write in bytes. @note The length
<> 157:ff67d9f36b67 94 * must be in 32-bit multiples.
<> 157:ff67d9f36b67 95 * @param unlock_key Unlock key, #MXC_V_FLC_FLSH_UNLOCK_KEY.
<> 157:ff67d9f36b67 96 *
<> 157:ff67d9f36b67 97 * @returns #E_NO_ERROR if data written successfully, error if unsuccessful.
<> 157:ff67d9f36b67 98 */
<> 157:ff67d9f36b67 99 int FLC_Write(uint32_t address, const void *data, uint32_t length, uint8_t unlock_key);
<> 157:ff67d9f36b67 100
<> 157:ff67d9f36b67 101 /**
<> 157:ff67d9f36b67 102 * @brief This function will mass erase the flash.
<> 157:ff67d9f36b67 103 *
<> 157:ff67d9f36b67 104 * @param erase_code Flash erase code, #MXC_V_FLC_ERASE_CODE_MASS_ERASE.
<> 157:ff67d9f36b67 105 * @param unlock_key Unlock key, #MXC_V_FLC_FLSH_UNLOCK_KEY.
<> 157:ff67d9f36b67 106 *
<> 157:ff67d9f36b67 107 * @returns #E_NO_ERROR if device mass erase successful, error if unsuccessful.
<> 157:ff67d9f36b67 108 */
<> 157:ff67d9f36b67 109 int FLC_MassErase(uint8_t erase_code, uint8_t unlock_key);
<> 157:ff67d9f36b67 110
<> 157:ff67d9f36b67 111 /**@} end of group flc */
<> 157:ff67d9f36b67 112
<> 157:ff67d9f36b67 113 #ifdef __cplusplus
<> 157:ff67d9f36b67 114 }
<> 157:ff67d9f36b67 115 #endif
<> 157:ff67d9f36b67 116
<> 157:ff67d9f36b67 117 #endif /* _FLC_H_ */