RP basic RTC functional

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14144 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
cinsights 2021-04-07 09:16:49 +00:00
parent 653da0da2e
commit 54e5352a0e
3 changed files with 6 additions and 6 deletions

View File

@ -73,14 +73,14 @@ void rtc_lld_init(void) {
RTCD1.rtc = RTC;
/* Get clock parameters. */
clock = hal_lld_get_clock(clk_rtc);
uint32_t clock = hal_lld_get_clock(clk_rtc);
osalDbgAssert((clock > 0U) || (clock - 1 <= RTC_CLKDIV_M1_BITS), "bad clock");
/* Take RTC out of reset. */
hal_lld_peripheral_unreset(RESETS_ALLREG_RTC);
/* Set divider. */
RTCD1.rtc.CLKDIVM1 = clock - 1;
RTCD1.rtc->CLKDIVM1 = clock - 1;
}
/**
@ -107,7 +107,7 @@ void rtc_lld_set_time(RTCDriver *rtcp, const RTCDateTime *timespec) {
rtcp->rtc->CTRL = 0;
/* Wait for RTC to go inactive. */
while (rtccp->rtc->CTRL & RTC_CTRL_RTC_ACTIVE_BITS != 0)
while ((rtcp->rtc->CTRL & RTC_CTRL_RTC_ACTIVE_BITS) != 0)
;
/* Write setup to pre-load registers. */
@ -126,7 +126,7 @@ void rtc_lld_set_time(RTCDriver *rtcp, const RTCDateTime *timespec) {
/* Enable RTC and wait for active. */
rtcp->rtc->CTRL = RTC_CTRL_RTC_ENABLE_BITS;
while (rtccp->rtc->CTRL & RTC_CTRL_RTC_ACTIVE_BITS == 0)
while ((rtcp->rtc->CTRL & RTC_CTRL_RTC_ACTIVE_BITS) == 0)
;
}

View File

@ -77,7 +77,6 @@
/* Driver data structures and types. */
/*===========================================================================*/
#if (RTC_SUPPORTS_CALLBACKS == TRUE) || defined(__DOXYGEN__)
/**
* @brief Type of an RTC event.
*/
@ -89,7 +88,7 @@ typedef enum {
* @brief Type of a generic RTC callback.
*/
typedef void (*rtccb_t)(RTCDriver *rtcp, rtcevent_t event);
#endif
/**
* @brief Type of a structure representing an RTC alarm time stamp.

View File

@ -28,6 +28,7 @@ endif
include $(CHIBIOS)/os/hal/ports/RP/LLD/GPIOv1/driver.mk
include $(CHIBIOS)/os/hal/ports/RP/LLD/TIMERv1/driver.mk
include $(CHIBIOS)/os/hal/ports/RP/LLD/UARTv1/driver.mk
include $(CHIBIOS)/os/hal/ports/RP/LLD/RTCv1/driver.mk
# Shared variables
ALLCSRC += $(PLATFORMSRC)