mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
<>
Date:
Fri Oct 28 11:17:30 2016 +0100
Revision:
149:156823d33999
Child:
150:02e0a0aed4ec
This updates the lib to the mbed lib v128

NOTE: This release includes a restructuring of the file and directory locations and thus some
include paths in your code may need updating accordingly.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1 /**
<> 149:156823d33999 2 ******************************************************************************
<> 149:156823d33999 3 * @file rtc.h
<> 149:156823d33999 4 * @brief (API) Public header of RTC driver
<> 149:156823d33999 5 * @internal
<> 149:156823d33999 6 * @author ON Semiconductor
<> 149:156823d33999 7 * $Rev: 3485 $
<> 149:156823d33999 8 * $Date: 2015-07-14 15:20:11 +0530 (Tue, 14 Jul 2015) $
<> 149:156823d33999 9 ******************************************************************************
<> 149:156823d33999 10 * Copyright 2016 Semiconductor Components Industries LLC (d/b/a “ON Semiconductor”).
<> 149:156823d33999 11 * All rights reserved. This software and/or documentation is licensed by ON Semiconductor
<> 149:156823d33999 12 * under limited terms and conditions. The terms and conditions pertaining to the software
<> 149:156823d33999 13 * and/or documentation are available at http://www.onsemi.com/site/pdf/ONSEMI_T&C.pdf
<> 149:156823d33999 14 * (“ON Semiconductor Standard Terms and Conditions of Sale, Section 8 Software”) and
<> 149:156823d33999 15 * if applicable the software license agreement. Do not use this software and/or
<> 149:156823d33999 16 * documentation unless you have carefully read and you agree to the limited terms and
<> 149:156823d33999 17 * conditions. By using this software and/or documentation, you agree to the limited
<> 149:156823d33999 18 * terms and conditions.
<> 149:156823d33999 19 *
<> 149:156823d33999 20 * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
<> 149:156823d33999 21 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
<> 149:156823d33999 22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
<> 149:156823d33999 23 * ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL,
<> 149:156823d33999 24 * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
<> 149:156823d33999 25 * @endinternal
<> 149:156823d33999 26 *
<> 149:156823d33999 27 * @ingroup rtc
<> 149:156823d33999 28 */
<> 149:156823d33999 29
<> 149:156823d33999 30 #ifndef RTC_H_
<> 149:156823d33999 31 #define RTC_H_
<> 149:156823d33999 32
<> 149:156823d33999 33 #include "rtc_map.h"
<> 149:156823d33999 34 #include "clock.h"
<> 149:156823d33999 35 #include "memory_map.h"
<> 149:156823d33999 36
<> 149:156823d33999 37 #define RTC_CLOCK_HZ 32768
<> 149:156823d33999 38 #define RTC_SEC_TO_US 1000000
<> 149:156823d33999 39 #define RTC_SUB_SEC_MASK 0x7FFF
<> 149:156823d33999 40 #define RTC_SEC_MASK 0xFFFFFFFF
<> 149:156823d33999 41 #define RTC_SEC_INT_STATUS_MASK 0x2
<> 149:156823d33999 42
<> 149:156823d33999 43 #define RTC_SUBSEC_INTERRUPT_BIT_VAL 0x1
<> 149:156823d33999 44 #define RTC_SEC_INTERRUPT_BIT_VAL 0x2
<> 149:156823d33999 45 #define RTC_ALL_INTERRUPT_BIT_VAL 0x3
<> 149:156823d33999 46
<> 149:156823d33999 47 #define RTC_INT_CLR_SUB_SEC_BIT_POS 0
<> 149:156823d33999 48 #define RTC_INT_CLR_SEC_BIT_POS 1
<> 149:156823d33999 49
<> 149:156823d33999 50 #define RTC_CONTROL_SUBSEC_CNT_START_BIT_POS 0
<> 149:156823d33999 51 #define RTC_CONTROL_SEC_CNT_START_BIT_POS 1
<> 149:156823d33999 52 #define RTC_CONTROL_SUBSEC_CNT_INT_BIT_POS 2
<> 149:156823d33999 53 #define RTC_CONTROL_SEC_CNT_INT_BIT_POS 3
<> 149:156823d33999 54
<> 149:156823d33999 55 #define RTC_STATUS_SUB_SEC_INT_CLR_WRT_BIT_POS 9
<> 149:156823d33999 56 #define RTC_STATUS_SEC_INT_CLR_WRT_BIT_POS 10
<> 149:156823d33999 57
<> 149:156823d33999 58 /* FUnction pointer for call back */
<> 149:156823d33999 59 typedef void (* fRtcCallBack)(void);
<> 149:156823d33999 60
<> 149:156823d33999 61 /**
<> 149:156823d33999 62 * @details
<> 149:156823d33999 63 * Initializes RTC, enable RTC & register call back function
<> 149:156823d33999 64 *
<> 149:156823d33999 65 * @param RtcCallBack Function pointer for RTC call back funtion
<> 149:156823d33999 66 * @return None
<> 149:156823d33999 67 */
<> 149:156823d33999 68 void fRtcInit(void);
<> 149:156823d33999 69
<> 149:156823d33999 70 /**
<> 149:156823d33999 71 * @details
<> 149:156823d33999 72 * Disable RTC
<> 149:156823d33999 73 *
<> 149:156823d33999 74 * @param None
<> 149:156823d33999 75 * @return None
<> 149:156823d33999 76 */
<> 149:156823d33999 77 void fRtcFree(void);
<> 149:156823d33999 78
<> 149:156823d33999 79 /**
<> 149:156823d33999 80 * @details
<> 149:156823d33999 81 * Set up alram for RTC interrupt in micro second
<> 149:156823d33999 82 * Pre-requisite: Both second & sub second interrupts should be cleared.
<> 149:156823d33999 83 * @param TimeStamp in micro seconds
<> 149:156823d33999 84 * @return None
<> 149:156823d33999 85 */
<> 149:156823d33999 86 void fRtcSetInterrupt(uint32_t timestamp);
<> 149:156823d33999 87
<> 149:156823d33999 88 /**
<> 149:156823d33999 89 * @details
<> 149:156823d33999 90 * Disable interrupt
<> 149:156823d33999 91 *
<> 149:156823d33999 92 * @param None
<> 149:156823d33999 93 * @return None
<> 149:156823d33999 94 */
<> 149:156823d33999 95 void fRtcDisableInterrupt(void);
<> 149:156823d33999 96
<> 149:156823d33999 97 /**
<> 149:156823d33999 98 * @details
<> 149:156823d33999 99 * Enable interrupt
<> 149:156823d33999 100 *
<> 149:156823d33999 101 * @param None
<> 149:156823d33999 102 * @return None
<> 149:156823d33999 103 */
<> 149:156823d33999 104 void fRtcEnableInterrupt(void);
<> 149:156823d33999 105
<> 149:156823d33999 106 /**
<> 149:156823d33999 107 * @details
<> 149:156823d33999 108 * Clear interrupt
<> 149:156823d33999 109 *
<> 149:156823d33999 110 * @param None
<> 149:156823d33999 111 * @return None
<> 149:156823d33999 112 */
<> 149:156823d33999 113 void fRtcClearInterrupt(void);
<> 149:156823d33999 114
<> 149:156823d33999 115 /**
<> 149:156823d33999 116 * @details
<> 149:156823d33999 117 * Returns RTC time in micro seconds
<> 149:156823d33999 118 *
<> 149:156823d33999 119 * @param None
<> 149:156823d33999 120 * @return RTC Time in micro second
<> 149:156823d33999 121 */
<> 149:156823d33999 122 uint64_t fRtcRead(void);
<> 149:156823d33999 123
<> 149:156823d33999 124 /**
<> 149:156823d33999 125 * @details
<> 149:156823d33999 126 * Set RTC time in micro seconds
<> 149:156823d33999 127 *
<> 149:156823d33999 128 * @param RtcTime in micro Seconds
<> 149:156823d33999 129 * @return None
<> 149:156823d33999 130 */
<> 149:156823d33999 131 void fRtcWrite(uint64_t RtcTimeus);
<> 149:156823d33999 132
<> 149:156823d33999 133 /**
<> 149:156823d33999 134 * @details
<> 149:156823d33999 135 * RTC interrupt handler
<> 149:156823d33999 136 *
<> 149:156823d33999 137 * @param None
<> 149:156823d33999 138 * @return None
<> 149:156823d33999 139 */
<> 149:156823d33999 140 void fRtcHandler(void);
<> 149:156823d33999 141
<> 149:156823d33999 142 /**
<> 149:156823d33999 143 * @details
<> 149:156823d33999 144 * Is RTC enabled?
<> 149:156823d33999 145 *
<> 149:156823d33999 146 * @param None
<> 149:156823d33999 147 * @return RTC status
<> 149:156823d33999 148 */
<> 149:156823d33999 149 boolean fIsRtcEnabled(void);
<> 149:156823d33999 150 #endif /* RTC_H_ */