Added I-Class APIs to the RTC driver.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3807 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
gdisirio 2012-01-14 08:45:34 +00:00
parent a2672b8dbb
commit d29e6e338e
2 changed files with 77 additions and 5 deletions

View File

@ -79,6 +79,68 @@ typedef struct RTCTime RTCTime;
/* Driver macros. */
/*===========================================================================*/
/**
* @brief Set current time.
*
* @param[in] rtcp pointer to RTC driver structure
* @param[in] timespec pointer to a @p RTCTime structure
*
* @iclass
*/
#define rtcSetTimeI(rtcp, timespec) rtc_lld_set_time(rtcp, timespec)
/**
* @brief Get current time.
*
* @param[in] rtcp pointer to RTC driver structure
* @param[out] timespec pointer to a @p RTCTime structure
*
* @iclass
*/
#define rtcGetTimeI(rtcp, timespec) rtc_lld_get_time(rtcp, timespec)
#if (RTC_ALARMS > 0) || defined(__DOXYGEN__)
/**
* @brief Set alarm time.
*
* @param[in] rtcp pointer to RTC driver structure
* @param[in] alarm alarm identifier
* @param[in] alarmspec pointer to a @p RTCAlarm structure or @p NULL
*
* @iclass
*/
#define rtcSetAlarmI(rtcp, alarm, alarmspec) \
rtc_lld_set_alarm(rtcp, alarm, alarmspec)
/**
* @brief Get current alarm.
* @note If an alarm has not been set then the returned alarm specification
* is not meaningful.
*
* @param[in] rtcp pointer to RTC driver structure
* @param[in] alarm alarm identifier
* @param[out] alarmspec pointer to a @p RTCAlarm structure
*
* @iclass
*/
#define rtcGetAlarmI(rtcp, alarm, alarmspec) \
rtc_lld_get_alarm(rtcp, alarm, alarmspec)
#endif /* RTC_ALARMS > 0 */
#if RTC_SUPPORTS_CALLBACKS || defined(__DOXYGEN__)
/**
* @brief Enables or disables RTC callbacks.
* @details This function enables or disables the callback, use a @p NULL
* pointer in order to disable it.
*
* @param[in] rtcp pointer to RTC driver structure
* @param[in] callback callback function pointer or @p NULL
*
* @iclass
*/
#define rtcSetCallbackI(rtcp, callback) rtc_lld_set_callback(rtcp, callback)
#endif /* RTC_SUPPORTS_CALLBACKS */
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/

View File

@ -79,7 +79,9 @@ void rtcSetTime(RTCDriver *rtcp, const RTCTime *timespec) {
chDbgCheck((rtcp != NULL) && (timespec != NULL), "rtcSetTime");
rtc_lld_set_time(rtcp, timespec);
chSysLock();
rtcSetTimeI(rtcp, timespec);
chSysUnlock();
}
/**
@ -94,7 +96,9 @@ void rtcGetTime(RTCDriver *rtcp, RTCTime *timespec) {
chDbgCheck((rtcp != NULL) && (timespec != NULL), "rtcGetTime");
rtc_lld_get_time(rtcp, timespec);
chSysLock();
rtcGetTimeI(rtcp, timespec);
chSysUnlock();
}
#if (RTC_ALARMS > 0) || defined(__DOXYGEN__)
@ -113,7 +117,9 @@ void rtcSetAlarm(RTCDriver *rtcp,
chDbgCheck((rtcp != NULL) && (alarm < RTC_ALARMS), "rtcSetAlarm");
rtc_lld_set_alarm(rtcp, alarm, alarmspec);
chSysLock();
rtcSetAlarmI(rtcp, alarm, alarmspec);
chSysUnlock();
}
/**
@ -134,7 +140,9 @@ void rtcGetAlarm(RTCDriver *rtcp,
chDbgCheck((rtcp != NULL) && (alarm < RTC_ALARMS) && (alarmspec != NULL),
"rtcGetAlarm");
rtc_lld_get_alarm(rtcp, alarm, alarmspec);
chSysLock();
rtcGetAlarmI(rtcp, alarm, alarmspec);
chSysUnlock();
}
#endif /* RTC_ALARMS > 0 */
@ -153,7 +161,9 @@ void rtcSetCallback(RTCDriver *rtcp, rtccb_t callback) {
chDbgCheck((rtcp != NULL), "rtcSetCallback");
rtc_lld_set_callback(rtcp, callback);
chSysLock();
rtcSetCallbackI(rtcp, callback);
chSysUnlock();
}
#endif /* RTC_SUPPORTS_CALLBACKS */