t
Fork of mbed-dev by
targets/hal/TARGET_ONSEMI/TARGET_NCS36510/rtc_api.c@144:ef7eb2e8f9f7, 2016-09-02 (annotated)
- Committer:
- <>
- Date:
- Fri Sep 02 15:07:44 2016 +0100
- Revision:
- 144:ef7eb2e8f9f7
- Child:
- 147:30b64687e01f
This updates the lib to the mbed lib v125
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 144:ef7eb2e8f9f7 | 1 | /** |
<> | 144:ef7eb2e8f9f7 | 2 | ****************************************************************************** |
<> | 144:ef7eb2e8f9f7 | 3 | * @file rtc_api.c |
<> | 144:ef7eb2e8f9f7 | 4 | * @brief Implementation of a RTC driver |
<> | 144:ef7eb2e8f9f7 | 5 | * @internal |
<> | 144:ef7eb2e8f9f7 | 6 | * @author ON Semiconductor |
<> | 144:ef7eb2e8f9f7 | 7 | * $Rev: 0.1 $ |
<> | 144:ef7eb2e8f9f7 | 8 | * $Date: 2016-01-20 12:09:00 +0530 (Wed, 20 Jan 2016) $ |
<> | 144:ef7eb2e8f9f7 | 9 | ****************************************************************************** |
<> | 144:ef7eb2e8f9f7 | 10 | * @copyright (c) 2012 ON Semiconductor. All rights reserved. |
<> | 144:ef7eb2e8f9f7 | 11 | * ON Semiconductor is supplying this software for use with ON Semiconductor |
<> | 144:ef7eb2e8f9f7 | 12 | * processor based microcontrollers only. |
<> | 144:ef7eb2e8f9f7 | 13 | * |
<> | 144:ef7eb2e8f9f7 | 14 | * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED |
<> | 144:ef7eb2e8f9f7 | 15 | * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF |
<> | 144:ef7eb2e8f9f7 | 16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. |
<> | 144:ef7eb2e8f9f7 | 17 | * ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, |
<> | 144:ef7eb2e8f9f7 | 18 | * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
<> | 144:ef7eb2e8f9f7 | 19 | * @endinternal |
<> | 144:ef7eb2e8f9f7 | 20 | * |
<> | 144:ef7eb2e8f9f7 | 21 | * @ingroup rtc |
<> | 144:ef7eb2e8f9f7 | 22 | * |
<> | 144:ef7eb2e8f9f7 | 23 | */ |
<> | 144:ef7eb2e8f9f7 | 24 | #include "rtc_api.h" |
<> | 144:ef7eb2e8f9f7 | 25 | #if DEVICE_RTC |
<> | 144:ef7eb2e8f9f7 | 26 | #include "device.h" |
<> | 144:ef7eb2e8f9f7 | 27 | |
<> | 144:ef7eb2e8f9f7 | 28 | #include "cmsis.h" |
<> | 144:ef7eb2e8f9f7 | 29 | #include "pinmap.h" |
<> | 144:ef7eb2e8f9f7 | 30 | #include "PeripheralPins.h" |
<> | 144:ef7eb2e8f9f7 | 31 | #include "mbed_assert.h" |
<> | 144:ef7eb2e8f9f7 | 32 | #include <string.h> |
<> | 144:ef7eb2e8f9f7 | 33 | #include "rtc.h" |
<> | 144:ef7eb2e8f9f7 | 34 | #include "cmsis_nvic.h" |
<> | 144:ef7eb2e8f9f7 | 35 | |
<> | 144:ef7eb2e8f9f7 | 36 | static IRQn_Type Irq; |
<> | 144:ef7eb2e8f9f7 | 37 | |
<> | 144:ef7eb2e8f9f7 | 38 | /* See rtc_apc.h for description */ |
<> | 144:ef7eb2e8f9f7 | 39 | |
<> | 144:ef7eb2e8f9f7 | 40 | void rtc_init(void) |
<> | 144:ef7eb2e8f9f7 | 41 | { |
<> | 144:ef7eb2e8f9f7 | 42 | fRtcInit(); |
<> | 144:ef7eb2e8f9f7 | 43 | } |
<> | 144:ef7eb2e8f9f7 | 44 | |
<> | 144:ef7eb2e8f9f7 | 45 | /* See rtc_apc.h for description */ |
<> | 144:ef7eb2e8f9f7 | 46 | void rtc_free(void) |
<> | 144:ef7eb2e8f9f7 | 47 | { |
<> | 144:ef7eb2e8f9f7 | 48 | fRtcFree(); |
<> | 144:ef7eb2e8f9f7 | 49 | } |
<> | 144:ef7eb2e8f9f7 | 50 | |
<> | 144:ef7eb2e8f9f7 | 51 | /* See rtc_apc.h for description */ |
<> | 144:ef7eb2e8f9f7 | 52 | int rtc_isenabled(void) |
<> | 144:ef7eb2e8f9f7 | 53 | { |
<> | 144:ef7eb2e8f9f7 | 54 | return(fIsRtcEnabled()); |
<> | 144:ef7eb2e8f9f7 | 55 | } |
<> | 144:ef7eb2e8f9f7 | 56 | |
<> | 144:ef7eb2e8f9f7 | 57 | /* See rtc_apc.h for description */ |
<> | 144:ef7eb2e8f9f7 | 58 | time_t rtc_read(void) |
<> | 144:ef7eb2e8f9f7 | 59 | { |
<> | 144:ef7eb2e8f9f7 | 60 | return (uint32_t)(fRtcRead() & 0xFFFFFFFF); /* TODO Truncating 64 bit value to 32 bit */ |
<> | 144:ef7eb2e8f9f7 | 61 | } |
<> | 144:ef7eb2e8f9f7 | 62 | |
<> | 144:ef7eb2e8f9f7 | 63 | /* See rtc_apc.h for description */ |
<> | 144:ef7eb2e8f9f7 | 64 | void rtc_write(time_t t) |
<> | 144:ef7eb2e8f9f7 | 65 | { |
<> | 144:ef7eb2e8f9f7 | 66 | fRtcWrite(t); |
<> | 144:ef7eb2e8f9f7 | 67 | } |
<> | 144:ef7eb2e8f9f7 | 68 | |
<> | 144:ef7eb2e8f9f7 | 69 | #endif /* DEVICE_RTC */ |