diff options
author | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-04-17 18:09:27 +0000 |
---|---|---|
committer | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-04-17 18:09:27 +0000 |
commit | 72e66cd47c5f003b97b2c78edf86b900257c0e65 (patch) | |
tree | e9855a128f7ecdd0a5aae9170762e5c7efb2753f /os/hal/platforms/STM32/RTCv2 | |
parent | c53f70238122ce394eb45aa471feebc54515b9ca (diff) | |
parent | 469211b330aaa187de511a8e3963feac1db51053 (diff) | |
download | ChibiOS-72e66cd47c5f003b97b2c78edf86b900257c0e65.tar.gz ChibiOS-72e66cd47c5f003b97b2c78edf86b900257c0e65.tar.bz2 ChibiOS-72e66cd47c5f003b97b2c78edf86b900257c0e65.zip |
SDC. Merged code from development branch.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4106 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32/RTCv2')
-rw-r--r-- | os/hal/platforms/STM32/RTCv2/rtc_lld.c | 97 | ||||
-rw-r--r-- | os/hal/platforms/STM32/RTCv2/rtc_lld.h | 4 |
2 files changed, 0 insertions, 101 deletions
diff --git a/os/hal/platforms/STM32/RTCv2/rtc_lld.c b/os/hal/platforms/STM32/RTCv2/rtc_lld.c index cae3f812b..870734fba 100644 --- a/os/hal/platforms/STM32/RTCv2/rtc_lld.c +++ b/os/hal/platforms/STM32/RTCv2/rtc_lld.c @@ -264,103 +264,6 @@ void rtcGetPeriodicWakeup_v2(RTCDriver *rtcp, RTCWakeup *wakeupspec){ wakeupspec->wakeup |= (((uint32_t)rtcp->id_rtc->CR) & 0x7) << 16;
}
-/**
- * @brief Converts from STM32 BCD to canonicalized time format.
- *
- * @param[out] timp pointer to a @p tm structure defined in time.h
- * @param[in] timespec pointer to a @p RTCTime structure
- *
- * @api
- */
-void stm32_rtc_bcd2tm(struct tm *timp, RTCTime *timespec){
- uint32_t tv_time = timespec->tv_time;
- uint32_t tv_date = timespec->tv_date;
-
-#if CH_DBG_ENABLE_CHECKS
- timp->tm_isdst = 0;
- timp->tm_wday = 0;
- timp->tm_mday = 0;
- timp->tm_yday = 0;
- timp->tm_mon = 0;
- timp->tm_year = 0;
- timp->tm_sec = 0;
- timp->tm_min = 0;
- timp->tm_hour = 0;
-#endif
-
- timp->tm_isdst = -1;
-
- timp->tm_wday = (tv_date & RTC_DR_WDU) >> RTC_DR_WDU_OFFSET;
- if(timp->tm_wday == 7)
- timp->tm_wday = 0;
-
- timp->tm_mday = (tv_date & RTC_DR_DU) >> RTC_DR_DU_OFFSET;
- timp->tm_mday += ((tv_date & RTC_DR_DT) >> RTC_DR_DT_OFFSET) * 10;
-
- timp->tm_mon = (tv_date & RTC_DR_MU) >> RTC_DR_MU_OFFSET;
- timp->tm_mon += ((tv_date & RTC_DR_MT) >> RTC_DR_MT_OFFSET) * 10;
- timp->tm_mon -= 1;
-
- timp->tm_year = (tv_date & RTC_DR_YU) >> RTC_DR_YU_OFFSET;
- timp->tm_year += ((tv_date & RTC_DR_YT) >> RTC_DR_YT_OFFSET) * 10;
- timp->tm_year += 2000 - 1900;
-
- timp->tm_sec = (tv_time & RTC_TR_SU) >> RTC_TR_SU_OFFSET;
- timp->tm_sec += ((tv_time & RTC_TR_ST) >> RTC_TR_ST_OFFSET) * 10;
-
- timp->tm_min = (tv_time & RTC_TR_MNU) >> RTC_TR_MNU_OFFSET;
- timp->tm_min += ((tv_time & RTC_TR_MNT) >> RTC_TR_MNT_OFFSET) * 10;
-
- timp->tm_hour = (tv_time & RTC_TR_HU) >> RTC_TR_HU_OFFSET;
- timp->tm_hour += ((tv_time & RTC_TR_HT) >> RTC_TR_HT_OFFSET) * 10;
- timp->tm_hour += 12 * ((tv_time & RTC_TR_PM) >> RTC_TR_PM_OFFSET);
-}
-
-/**
- * @brief Converts from canonicalized to STM32 BCD time format.
- *
- * @param[in] timp pointer to a @p tm structure defined in time.h
- * @param[out] timespec pointer to a @p RTCTime structure
- *
- * @api
- */
-void stm32_rtc_tm2bcd(struct tm *timp, RTCTime *timespec){
- uint32_t v = 0;
-
- timespec->tv_date = 0;
- timespec->tv_time = 0;
-
- v = timp->tm_year - 100;
- timespec->tv_date |= ((v / 10) << RTC_DR_YT_OFFSET) & RTC_DR_YT;
- timespec->tv_date |= (v % 10) << RTC_DR_YU_OFFSET;
-
- if (timp->tm_wday == 0)
- v = 7;
- else
- v = timp->tm_wday;
- timespec->tv_date |= (v << RTC_DR_WDU_OFFSET) & RTC_DR_WDU;
-
- v = timp->tm_mon + 1;
- timespec->tv_date |= ((v / 10) << RTC_DR_MT_OFFSET) & RTC_DR_MT;
- timespec->tv_date |= (v % 10) << RTC_DR_MU_OFFSET;
-
- v = timp->tm_mday;
- timespec->tv_date |= ((v / 10) << RTC_DR_DT_OFFSET) & RTC_DR_DT;
- timespec->tv_date |= (v % 10) << RTC_DR_DU_OFFSET;
-
- v = timp->tm_hour;
- timespec->tv_time |= ((v / 10) << RTC_TR_HT_OFFSET) & RTC_TR_HT;
- timespec->tv_time |= (v % 10) << RTC_TR_HU_OFFSET;
-
- v = timp->tm_min;
- timespec->tv_time |= ((v / 10) << RTC_TR_MNT_OFFSET) & RTC_TR_MNT;
- timespec->tv_time |= (v % 10) << RTC_TR_MNU_OFFSET;
-
- v = timp->tm_sec;
- timespec->tv_time |= ((v / 10) << RTC_TR_ST_OFFSET) & RTC_TR_ST;
- timespec->tv_time |= (v % 10) << RTC_TR_SU_OFFSET;
-}
-
#endif /* HAL_USE_RTC */
/** @} */
diff --git a/os/hal/platforms/STM32/RTCv2/rtc_lld.h b/os/hal/platforms/STM32/RTCv2/rtc_lld.h index 3f0139f00..4cae5744d 100644 --- a/os/hal/platforms/STM32/RTCv2/rtc_lld.h +++ b/os/hal/platforms/STM32/RTCv2/rtc_lld.h @@ -35,8 +35,6 @@ #if HAL_USE_RTC || defined(__DOXYGEN__)
-#include <time.h>
-
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
@@ -200,8 +198,6 @@ extern "C" { RTCAlarm *alarmspec);
void rtcSetPeriodicWakeup_v2(RTCDriver *rtcp, RTCWakeup *wakeupspec);
void rtcGetPeriodicWakeup_v2(RTCDriver *rtcp, RTCWakeup *wakeupspec);
- void stm32_rtc_bcd2tm(struct tm *timp, RTCTime *timespec);
- void stm32_rtc_tm2bcd(struct tm *timp, RTCTime *timespec);
#ifdef __cplusplus
}
#endif
|