RTC alarms: getalarmdatetime functions are private and should be declared static.
This commit is contained in:
parent
789e204141
commit
5f67fc8f1b
@ -860,6 +860,50 @@ static inline void rtc_enable_alarm(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_rtc_getalarmdatetime
|
||||
*
|
||||
* Description:
|
||||
* Get the current date and time for a RTC alarm.
|
||||
*
|
||||
* Input Parameters:
|
||||
* reg - RTC alarm register
|
||||
* tp - The location to return the high resolution time value.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno on failure
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
static int stm32_rtc_getalarmdatetime(rtc_alarmreg_t reg, FAR struct tm *tp)
|
||||
{
|
||||
uint32_t data, tmp;
|
||||
|
||||
ASSERT(tp != NULL);
|
||||
|
||||
/* Sample the data time register. */
|
||||
|
||||
data = getreg32(reg);
|
||||
|
||||
/* Convert the RTC time to fields in struct tm format. All of the STM32
|
||||
* All of the ranges of values correspond between struct tm and the time
|
||||
* register.
|
||||
*/
|
||||
|
||||
tmp = (data & (RTC_ALRMR_SU_MASK | RTC_ALRMR_ST_MASK)) >> RTC_ALRMR_SU_SHIFT;
|
||||
tp->tm_sec = rtc_bcd2bin(tmp);
|
||||
|
||||
tmp = (data & (RTC_ALRMR_MNU_MASK | RTC_ALRMR_MNT_MASK)) >> RTC_ALRMR_MNU_SHIFT;
|
||||
tp->tm_min = rtc_bcd2bin(tmp);
|
||||
|
||||
tmp = (data & (RTC_ALRMR_HU_MASK | RTC_ALRMR_HT_MASK)) >> RTC_ALRMR_HU_SHIFT;
|
||||
tp->tm_hour = rtc_bcd2bin(tmp);
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -1552,50 +1596,6 @@ errout_with_wprunlock:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
/************************************************************************************
|
||||
* Name: stm32_rtc_getalarmdatetime
|
||||
*
|
||||
* Description:
|
||||
* Get the current date and time for a RTC alarm.
|
||||
*
|
||||
* Input Parameters:
|
||||
* reg - RTC alarm register
|
||||
* tp - The location to return the high resolution time value.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno on failure
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int stm32_rtc_getalarmdatetime(rtc_alarmreg_t reg, FAR struct tm *tp)
|
||||
{
|
||||
uint32_t data, tmp;
|
||||
|
||||
ASSERT(tp != NULL);
|
||||
|
||||
/* Sample the data time register. */
|
||||
|
||||
data = getreg32(reg);
|
||||
|
||||
/* Convert the RTC time to fields in struct tm format. All of the STM32
|
||||
* All of the ranges of values correspond between struct tm and the time
|
||||
* register.
|
||||
*/
|
||||
|
||||
tmp = (data & (RTC_ALRMR_SU_MASK | RTC_ALRMR_ST_MASK)) >> RTC_ALRMR_SU_SHIFT;
|
||||
tp->tm_sec = rtc_bcd2bin(tmp);
|
||||
|
||||
tmp = (data & (RTC_ALRMR_MNU_MASK | RTC_ALRMR_MNT_MASK)) >> RTC_ALRMR_MNU_SHIFT;
|
||||
tp->tm_min = rtc_bcd2bin(tmp);
|
||||
|
||||
tmp = (data & (RTC_ALRMR_HU_MASK | RTC_ALRMR_HT_MASK)) >> RTC_ALRMR_HU_SHIFT;
|
||||
tp->tm_hour = rtc_bcd2bin(tmp);
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_rtc_rdalarm
|
||||
*
|
||||
|
@ -817,6 +817,50 @@ rtchw_set_alrmbr_exit:
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_rtc_getalarmdatetime
|
||||
*
|
||||
* Description:
|
||||
* Get the current date and time for a RTC alarm.
|
||||
*
|
||||
* Input Parameters:
|
||||
* reg - RTC alarm register
|
||||
* tp - The location to return the high resolution time value.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno on failure
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
static int stm32_rtc_getalarmdatetime(rtc_alarmreg_t reg, FAR struct tm *tp)
|
||||
{
|
||||
uint32_t data, tmp;
|
||||
|
||||
ASSERT(tp != NULL);
|
||||
|
||||
/* Sample the data time register. */
|
||||
|
||||
data = getreg32(reg);
|
||||
|
||||
/* Convert the RTC time to fields in struct tm format. All of the STM32
|
||||
* All of the ranges of values correspond between struct tm and the time
|
||||
* register.
|
||||
*/
|
||||
|
||||
tmp = (data & (RTC_ALRMR_SU_MASK | RTC_ALRMR_ST_MASK)) >> RTC_ALRMR_SU_SHIFT;
|
||||
tp->tm_sec = rtc_bcd2bin(tmp);
|
||||
|
||||
tmp = (data & (RTC_ALRMR_MNU_MASK | RTC_ALRMR_MNT_MASK)) >> RTC_ALRMR_MNU_SHIFT;
|
||||
tp->tm_min = rtc_bcd2bin(tmp);
|
||||
|
||||
tmp = (data & (RTC_ALRMR_HU_MASK | RTC_ALRMR_HT_MASK)) >> RTC_ALRMR_HU_SHIFT;
|
||||
tp->tm_hour = rtc_bcd2bin(tmp);
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -1559,50 +1603,6 @@ errout_with_wprunlock:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
/************************************************************************************
|
||||
* Name: stm32_rtc_getalarmdatetime
|
||||
*
|
||||
* Description:
|
||||
* Get the current date and time for a RTC alarm.
|
||||
*
|
||||
* Input Parameters:
|
||||
* reg - RTC alarm register
|
||||
* tp - The location to return the high resolution time value.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno on failure
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int stm32_rtc_getalarmdatetime(rtc_alarmreg_t reg, FAR struct tm *tp)
|
||||
{
|
||||
uint32_t data, tmp;
|
||||
|
||||
ASSERT(tp != NULL);
|
||||
|
||||
/* Sample the data time register. */
|
||||
|
||||
data = getreg32(reg);
|
||||
|
||||
/* Convert the RTC time to fields in struct tm format. All of the STM32
|
||||
* All of the ranges of values correspond between struct tm and the time
|
||||
* register.
|
||||
*/
|
||||
|
||||
tmp = (data & (RTC_ALRMR_SU_MASK | RTC_ALRMR_ST_MASK)) >> RTC_ALRMR_SU_SHIFT;
|
||||
tp->tm_sec = rtc_bcd2bin(tmp);
|
||||
|
||||
tmp = (data & (RTC_ALRMR_MNU_MASK | RTC_ALRMR_MNT_MASK)) >> RTC_ALRMR_MNU_SHIFT;
|
||||
tp->tm_min = rtc_bcd2bin(tmp);
|
||||
|
||||
tmp = (data & (RTC_ALRMR_HU_MASK | RTC_ALRMR_HT_MASK)) >> RTC_ALRMR_HU_SHIFT;
|
||||
tp->tm_hour = rtc_bcd2bin(tmp);
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_rtc_rdalarm
|
||||
*
|
||||
|
@ -815,6 +815,50 @@ static inline void rtc_enable_alarm(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32l4_rtc_getalarmdatetime
|
||||
*
|
||||
* Description:
|
||||
* Get the current date and time for a RTC alarm.
|
||||
*
|
||||
* Input Parameters:
|
||||
* reg - RTC alarm register
|
||||
* tp - The location to return the high resolution time value.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno on failure
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
static int stm32l4_rtc_getalarmdatetime(rtc_alarmreg_t reg, FAR struct tm *tp)
|
||||
{
|
||||
uint32_t data, tmp;
|
||||
|
||||
ASSERT(tp != NULL);
|
||||
|
||||
/* Sample the data time register. */
|
||||
|
||||
data = getreg32(reg);
|
||||
|
||||
/* Convert the RTC time to fields in struct tm format. All of the STM32
|
||||
* All of the ranges of values correspond between struct tm and the time
|
||||
* register.
|
||||
*/
|
||||
|
||||
tmp = (data & (RTC_ALRMR_SU_MASK | RTC_ALRMR_ST_MASK)) >> RTC_ALRMR_SU_SHIFT;
|
||||
tp->tm_sec = rtc_bcd2bin(tmp);
|
||||
|
||||
tmp = (data & (RTC_ALRMR_MNU_MASK | RTC_ALRMR_MNT_MASK)) >> RTC_ALRMR_MNU_SHIFT;
|
||||
tp->tm_min = rtc_bcd2bin(tmp);
|
||||
|
||||
tmp = (data & (RTC_ALRMR_HU_MASK | RTC_ALRMR_HT_MASK)) >> RTC_ALRMR_HU_SHIFT;
|
||||
tp->tm_hour = rtc_bcd2bin(tmp);
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
@ -1479,50 +1523,6 @@ errout_with_wprunlock:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
/************************************************************************************
|
||||
* Name: stm32l4_rtc_getalarmdatetime
|
||||
*
|
||||
* Description:
|
||||
* Get the current date and time for a RTC alarm.
|
||||
*
|
||||
* Input Parameters:
|
||||
* reg - RTC alarm register
|
||||
* tp - The location to return the high resolution time value.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno on failure
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int stm32l4_rtc_getalarmdatetime(rtc_alarmreg_t reg, FAR struct tm *tp)
|
||||
{
|
||||
uint32_t data, tmp;
|
||||
|
||||
ASSERT(tp != NULL);
|
||||
|
||||
/* Sample the data time register. */
|
||||
|
||||
data = getreg32(reg);
|
||||
|
||||
/* Convert the RTC time to fields in struct tm format. All of the STM32
|
||||
* All of the ranges of values correspond between struct tm and the time
|
||||
* register.
|
||||
*/
|
||||
|
||||
tmp = (data & (RTC_ALRMR_SU_MASK | RTC_ALRMR_ST_MASK)) >> RTC_ALRMR_SU_SHIFT;
|
||||
tp->tm_sec = rtc_bcd2bin(tmp);
|
||||
|
||||
tmp = (data & (RTC_ALRMR_MNU_MASK | RTC_ALRMR_MNT_MASK)) >> RTC_ALRMR_MNU_SHIFT;
|
||||
tp->tm_min = rtc_bcd2bin(tmp);
|
||||
|
||||
tmp = (data & (RTC_ALRMR_HU_MASK | RTC_ALRMR_HT_MASK)) >> RTC_ALRMR_HU_SHIFT;
|
||||
tp->tm_hour = rtc_bcd2bin(tmp);
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32l4_rtc_rdalarm
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user