aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-09-01 18:09:40 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-09-01 18:09:40 +0000
commitac429a2a76727c72d6a7b8273c9643560fcd6222 (patch)
treef91f25ec391366a1e6c747ec9e7b8a596ad1b862
parentca3cc2d5554a99aad1c499fabb9ce3d72fd7aacb (diff)
downloadChibiOS-ac429a2a76727c72d6a7b8273c9643560fcd6222.tar.gz
ChibiOS-ac429a2a76727c72d6a7b8273c9643560fcd6222.tar.bz2
ChibiOS-ac429a2a76727c72d6a7b8273c9643560fcd6222.zip
RTC. Added state checks.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/rtc_dev@3279 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/hal/platforms/STM32/rtc_lld.c6
-rw-r--r--os/hal/src/rtc.c6
2 files changed, 7 insertions, 5 deletions
diff --git a/os/hal/platforms/STM32/rtc_lld.c b/os/hal/platforms/STM32/rtc_lld.c
index ba89a3c9e..1ddbc0903 100644
--- a/os/hal/platforms/STM32/rtc_lld.c
+++ b/os/hal/platforms/STM32/rtc_lld.c
@@ -241,13 +241,13 @@ void rtc_lld_set_alarm(uint32_t tv_alarm){
RTC->ALRL = (uint16_t)(tv_alarm & 0xFFFF);
RTC->CRL &= ~RTC_CRL_CNF; /* switch off configure mode */
- while(!(RTC->CRL & RTC_CRL_RTOFF)) /* wait for completion */
- ;
-
#if !(RTC_SUPPORTS_CALLBACKS)
RTC->CRL &= ~RTC_CRL_ALRF;
RTC->CRH |= RTC_CRH_ALRIE;
#endif /* !(RTC_SUPPORTS_CALLBACKS) */
+
+ while(!(RTC->CRL & RTC_CRL_RTOFF)) /* wait for completion */
+ ;
}
/**
diff --git a/os/hal/src/rtc.c b/os/hal/src/rtc.c
index f1aa03a34..1341bb2dd 100644
--- a/os/hal/src/rtc.c
+++ b/os/hal/src/rtc.c
@@ -68,7 +68,8 @@ void rtcInit(void){
* @param[in] rtccfgp - pointer to RTC config structure.
*/
#if RTC_SUPPORTS_CALLBACKS
-void rtcStart(RTCDriver *rtcp, const RTCConfig *rtccfgp){
+void rtcStartI(RTCDriver *rtcp, const RTCConfig *rtccfgp){
+ chDbgCheckClassI();
chDbgCheck(((rtcp != NULL) && (rtccfgp != NULL)), "rtcStart");
rtc_lld_start(rtcp, rtccfgp);
}
@@ -76,7 +77,8 @@ void rtcStart(RTCDriver *rtcp, const RTCConfig *rtccfgp){
/**
* @brief Stop interrupt servicing routines.
*/
-void rtcStop(void){
+void rtcStopI(void){
+ chDbgCheckClassI();
rtc_lld_stop();
}
#endif /* RTC_SUPPORTS_CALLBACKS */