Centralize definitions associated with CONFIG_DEBUG_RTC

This commit is contained in:
Gregory Nutt 2016-06-16 07:39:23 -06:00
parent 37b9742189
commit b7f0fbc073
11 changed files with 251 additions and 342 deletions

33
Kconfig
View file

@ -1188,14 +1188,43 @@ config DEBUG_PWM_INFO
endif # DEBUG_PWM
config DEBUG_RTC
bool "RTC Debug Output"
bool "RTC Debug Features"
default n
depends on RTC
---help---
Enable RTC driver debug SYSLOG output (disabled by default).
Enable RTC debug features.
Support for this debug option is architecture-specific and may not
be available for some MCUs.
if DEBUG_RTC
config DEBUG_RTC_ERROR
bool "RTC Error Output"
default n
depends on DEBUG_ERROR
---help---
Enable RTC driver error output to SYSLOG.
Support for this debug option is architecture-specific and may not
be available for some MCUs.
config DEBUG_RTC_WARN
bool "RTC Warnings Output"
default n
depends on DEBUG_WARN
---help---
Enable RTC driver warning output to SYSLOG.
config DEBUG_RTC_INFO
bool "RTC Informational Output"
default n
depends on DEBUG_INFO
---help---
Enable RTC driver informational output to SYSLOG.
endif # DEBUG_RTC
config DEBUG_SDIO
bool "SDIO Debug Output"
default n

View file

@ -130,16 +130,6 @@
#define __CNT_CARRY_REG EFM32_BURTC_RET_REG(0)
#define __CNT_ZERO_REG EFM32_BURTC_RET_REG(1)
#if defined CONFIG_DEBUG_FEATURES && defined CONFIG_RTC_DEBUG
# define burtcerr llerr
#else
# define burtcerr(x...)
#endif
/************************************************************************************
* Private Types
************************************************************************************/
/************************************************************************************
* Private Data
************************************************************************************/
@ -191,7 +181,7 @@ static int efm32_rtc_burtc_interrupt(int irq, void *context)
if (source & BURTC_IF_LFXOFAIL)
{
burtcerr("BURTC_IF_LFXOFAIL");
rtcerr("ERROR: BURTC_IF_LFXOFAIL");
}
#ifdef CONFIG_RTC_HIRES
@ -245,7 +235,7 @@ static void efm32_rtc_burtc_init(void)
regval = g_efm32_rstcause;
regval2 = getreg32(EFM32_BURTC_CTRL);
burtcerr("BURTC RESETCAUSE=0x%08X BURTC_CTRL=0x%08X\n", regval, regval2);
rtcinfo("BURTC RESETCAUSE=0x%08X BURTC_CTRL=0x%08X\n", regval, regval2);
if (!(regval2 & BURTC_CTRL_RSTEN) &&
!(regval & RMU_RSTCAUSE_BUBODREG) &&
@ -262,11 +252,11 @@ static void efm32_rtc_burtc_init(void)
/* restore saved base time */
burtcerr("BURTC OK\n");
rtcinfo("BURTC OK\n");
return;
}
burtcerr("BURTC RESETED\n");
rtcinfo("BURTC RESET\n");
/* Disable reset of BackupDomain */
@ -358,7 +348,7 @@ static uint64_t efm32_get_burtc_tick(void)
val = (uint64_t)cnt_carry*__CNT_TOP + cnt + cnt_zero;
burtcerr("Get Tick carry %u zero %u reg %u\n", cnt_carry, cnt_carry,cnt);
rtcinfo("Get Tick carry %u zero %u reg %u\n", cnt_carry, cnt_carry,cnt);
return val;
}
@ -449,7 +439,7 @@ int up_rtc_gettime(FAR struct timespec *tp)
tp->tv_sec = val / CONFIG_RTC_FREQUENCY;
tp->tv_nsec = (val % CONFIG_RTC_FREQUENCY)*(NSEC_PER_SEC/CONFIG_RTC_FREQUENCY);
burtcerr("Get RTC %u.%09u\n", tp->tv_sec, tp->tv_nsec);
rtcinfo("Get RTC %u.%09u\n", tp->tv_sec, tp->tv_nsec);
return OK;
}
@ -499,7 +489,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
cnt_carry = val / __CNT_TOP;
cnt = val % __CNT_TOP;
burtcerr("Set RTC %u.%09u carry %u zero %u reg %u\n",
rtcinfo("Set RTC %u.%09u carry %u zero %u reg %u\n",
tp->tv_sec, tp->tv_nsec, cnt_carry, cnt, cnt_reg);
putreg32(cnt_carry, __CNT_CARRY_REG);

View file

@ -72,30 +72,6 @@
# error "CONFIG_RTC_HIRES must NOT be set with this driver"
#endif
#ifndef CONFIG_DEBUG_FEATURES
# undef CONFIG_DEBUG_RTC
#endif
/* Constants ************************************************************************/
/* Debug ****************************************************************************/
#ifdef CONFIG_DEBUG_RTC
# define rtcerr err
# define rtcinfo info
# define rtcllerr llerr
# define rtcllinfo llinfo
#else
# define rtcerr(x...)
# define rtcinfo(x...)
# define rtcllerr(x...)
# define rtcllinfo(x...)
#endif
/************************************************************************************
* Private Types
************************************************************************************/
/************************************************************************************
* Private Data
************************************************************************************/
@ -131,12 +107,12 @@ volatile bool g_rtc_enabled = false;
*
************************************************************************************/
#ifdef CONFIG_DEBUG_RTC
#ifdef CONFIG_DEBUG_RTC_INFO
static void rtc_dumpregs(FAR const char *msg)
{
rtcllerr("%s:\n", msg);
rtcllerr(" DOM : %08x\n", (getreg32(LPC17_RTC_DOM) & RTC_DOM_MASK));
rtcllerr(" DOW : %08x\n", (getreg32(LPC17_RTC_DOW) & RTC_DOW_MASK));
rtcinfo("%s:\n", msg);
rtcinfo(" DOM : %08x\n", (getreg32(LPC17_RTC_DOM) & RTC_DOM_MASK));
rtcinfo(" DOW : %08x\n", (getreg32(LPC17_RTC_DOW) & RTC_DOW_MASK));
}
#else
# define rtc_dumpregs(msg)
@ -156,16 +132,16 @@ static void rtc_dumpregs(FAR const char *msg)
*
************************************************************************************/
#ifdef CONFIG_DEBUG_RTC
#ifdef CONFIG_DEBUG_RTC_INFO
static void rtc_dumptime(FAR struct tm *tp, FAR const char *msg)
{
rtcllerr("%s:\n", msg);
rtcllerr(" tm_sec: %08x\n", tp->tm_sec);
rtcllerr(" tm_min: %08x\n", tp->tm_min);
rtcllerr(" tm_hour: %08x\n", tp->tm_hour);
rtcllerr(" tm_mday: %08x\n", tp->tm_mday);
rtcllerr(" tm_mon: %08x\n", tp->tm_mon);
rtcllerr(" tm_year: %08x\n", tp->tm_year);
rtcinfo("%s:\n", msg);
rtcinfo(" tm_sec: %08x\n", tp->tm_sec);
rtcinfo(" tm_min: %08x\n", tp->tm_min);
rtcinfo(" tm_hour: %08x\n", tp->tm_hour);
rtcinfo(" tm_mday: %08x\n", tp->tm_mday);
rtcinfo(" tm_mon: %08x\n", tp->tm_mon);
rtcinfo(" tm_year: %08x\n", tp->tm_year);
}
#else
# define rtc_dumptime(tp, msg)

View file

@ -80,30 +80,6 @@
#define RTC_MAGIC 0xdeadbeef
#ifndef CONFIG_DEBUG_FEATURES
# undef CONFIG_DEBUG_RTC
#endif
/* Constants ************************************************************************/
/* Debug ****************************************************************************/
#ifdef CONFIG_DEBUG_RTC
# define rtcerr err
# define rtcinfo info
# define rtcllerr llerr
# define rtcllinfo llinfo
#else
# define rtcerr(x...)
# define rtcinfo(x...)
# define rtcllerr(x...)
# define rtcllinfo(x...)
#endif
/************************************************************************************
* Private Types
************************************************************************************/
/************************************************************************************
* Private Data
************************************************************************************/
@ -146,19 +122,19 @@ uint32_t g_rtt_offset = 0;
*
************************************************************************************/
#ifdef CONFIG_DEBUG_RTC
#ifdef CONFIG_DEBUG_RTC_INFO
static void rtc_dumpregs(FAR const char *msg)
{
rtcllerr("%s:\n", msg);
rtcllerr(" CR: %08x\n", getreg32(SAM_RTC_CR));
rtcllerr(" MR: %08x\n", getreg32(SAM_RTC_MR));
rtcllerr(" TIMR: %08x\n", getreg32(SAM_RTC_TIMR));
rtcllerr(" CALR: %08x\n", getreg32(SAM_RTC_CALR));
rtcllerr(" TIMALR: %08x\n", getreg32(SAM_RTC_TIMALR));
rtcllerr(" CALALR: %08x\n", getreg32(SAM_RTC_CALALR));
rtcllerr(" SR: %08x\n", getreg32(SAM_RTC_SR));
rtcllerr(" IMR: %08x\n", getreg32(SAM_RTC_IMR));
rtcllerr(" VER: %08x\n", getreg32(SAM_RTC_VER));
rtcinfo("%s:\n", msg);
rtcinfo(" CR: %08x\n", getreg32(SAM_RTC_CR));
rtcinfo(" MR: %08x\n", getreg32(SAM_RTC_MR));
rtcinfo(" TIMR: %08x\n", getreg32(SAM_RTC_TIMR));
rtcinfo(" CALR: %08x\n", getreg32(SAM_RTC_CALR));
rtcinfo(" TIMALR: %08x\n", getreg32(SAM_RTC_TIMALR));
rtcinfo(" CALALR: %08x\n", getreg32(SAM_RTC_CALALR));
rtcinfo(" SR: %08x\n", getreg32(SAM_RTC_SR));
rtcinfo(" IMR: %08x\n", getreg32(SAM_RTC_IMR));
rtcinfo(" VER: %08x\n", getreg32(SAM_RTC_VER));
}
#else
# define rtc_dumpregs(msg)
@ -178,16 +154,16 @@ static void rtc_dumpregs(FAR const char *msg)
*
************************************************************************************/
#ifdef CONFIG_DEBUG_RTC
#ifdef CONFIG_DEBUG_RTC_INFO
static void rtc_dumptime(FAR struct tm *tp, FAR const char *msg)
{
rtcllerr("%s:\n", msg);
rtcllerr(" tm_sec: %08x\n", tp->tm_sec);
rtcllerr(" tm_min: %08x\n", tp->tm_min);
rtcllerr(" tm_hour: %08x\n", tp->tm_hour);
rtcllerr(" tm_mday: %08x\n", tp->tm_mday);
rtcllerr(" tm_mon: %08x\n", tp->tm_mon);
rtcllerr(" tm_year: %08x\n", tp->tm_year);
rtcinfo("%s:\n", msg);
rtcinfo(" tm_sec: %08x\n", tp->tm_sec);
rtcinfo(" tm_min: %08x\n", tp->tm_min);
rtcinfo(" tm_hour: %08x\n", tp->tm_hour);
rtcinfo(" tm_mday: %08x\n", tp->tm_mday);
rtcinfo(" tm_mon: %08x\n", tp->tm_mon);
rtcinfo(" tm_year: %08x\n", tp->tm_year);
}
#else
# define rtc_dumptime(tp, msg)

View file

@ -77,30 +77,6 @@
#define RTC_MAGIC 0xdeadbeef
#ifndef CONFIG_DEBUG_FEATURES
# undef CONFIG_DEBUG_RTC
#endif
/* Constants ************************************************************************/
/* Debug ****************************************************************************/
#ifdef CONFIG_DEBUG_RTC
# define rtcerr err
# define rtcinfo info
# define rtcllerr llerr
# define rtcllinfo llinfo
#else
# define rtcerr(x...)
# define rtcinfo(x...)
# define rtcllerr(x...)
# define rtcllinfo(x...)
#endif
/************************************************************************************
* Private Types
************************************************************************************/
/************************************************************************************
* Private Data
************************************************************************************/
@ -137,19 +113,19 @@ volatile bool g_rtc_enabled = false;
*
************************************************************************************/
#ifdef CONFIG_DEBUG_RTC
#ifdef CONFIG_DEBUG_RTC_INFO
static void rtc_dumpregs(FAR const char *msg)
{
rtcllerr("%s:\n", msg);
rtcllerr(" CR: %08x\n", getreg32(SAM_RTC_CR));
rtcllerr(" MR: %08x\n", getreg32(SAM_RTC_MR));
rtcllerr(" TIMR: %08x\n", getreg32(SAM_RTC_TIMR));
rtcllerr(" CALR: %08x\n", getreg32(SAM_RTC_CALR));
rtcllerr(" TIMALR: %08x\n", getreg32(SAM_RTC_TIMALR));
rtcllerr(" CALALR: %08x\n", getreg32(SAM_RTC_CALALR));
rtcllerr(" SR: %08x\n", getreg32(SAM_RTC_SR));
rtcllerr(" IMR: %08x\n", getreg32(SAM_RTC_IMR));
rtcllerr(" VER: %08x\n", getreg32(SAM_RTC_VER));
rtcinfo("%s:\n", msg);
rtcinfo(" CR: %08x\n", getreg32(SAM_RTC_CR));
rtcinfo(" MR: %08x\n", getreg32(SAM_RTC_MR));
rtcinfo(" TIMR: %08x\n", getreg32(SAM_RTC_TIMR));
rtcinfo(" CALR: %08x\n", getreg32(SAM_RTC_CALR));
rtcinfo(" TIMALR: %08x\n", getreg32(SAM_RTC_TIMALR));
rtcinfo(" CALALR: %08x\n", getreg32(SAM_RTC_CALALR));
rtcinfo(" SR: %08x\n", getreg32(SAM_RTC_SR));
rtcinfo(" IMR: %08x\n", getreg32(SAM_RTC_IMR));
rtcinfo(" VER: %08x\n", getreg32(SAM_RTC_VER));
}
#else
# define rtc_dumpregs(msg)
@ -169,16 +145,16 @@ static void rtc_dumpregs(FAR const char *msg)
*
************************************************************************************/
#ifdef CONFIG_DEBUG_RTC
#ifdef CONFIG_DEBUG_RTC_INFO
static void rtc_dumptime(FAR struct tm *tp, FAR const char *msg)
{
rtcllerr("%s:\n", msg);
rtcllerr(" tm_sec: %08x\n", tp->tm_sec);
rtcllerr(" tm_min: %08x\n", tp->tm_min);
rtcllerr(" tm_hour: %08x\n", tp->tm_hour);
rtcllerr(" tm_mday: %08x\n", tp->tm_mday);
rtcllerr(" tm_mon: %08x\n", tp->tm_mon);
rtcllerr(" tm_year: %08x\n", tp->tm_year);
rtcinfo("%s:\n", msg);
rtcinfo(" tm_sec: %08x\n", tp->tm_sec);
rtcinfo(" tm_min: %08x\n", tp->tm_min);
rtcinfo(" tm_hour: %08x\n", tp->tm_hour);
rtcinfo(" tm_mday: %08x\n", tp->tm_mday);
rtcinfo(" tm_mon: %08x\n", tp->tm_mon);
rtcinfo(" tm_year: %08x\n", tp->tm_year);
}
#else
# define rtc_dumptime(tp, msg)

View file

@ -76,10 +76,6 @@
# error "CONFIG_STM32_PWR must selected to use this driver"
#endif
#ifndef CONFIG_DEBUG_FEATURES
# undef CONFIG_DEBUG_RTC
#endif
#ifdef CONFIG_STM32_STM32L15XX
# if defined(CONFIG_RTC_HSECLOCK)
# error "RTC with HSE clock not yet implemented for STM32L15XXX"
@ -123,24 +119,6 @@
# define RCC_XXX_RTCSEL_HSE RCC_BDCR_RTCSEL_HSE
#endif
/* Debug ****************************************************************************/
#ifdef CONFIG_DEBUG_RTC
# define rtcerr err
# define rtcinfo info
# define rtcllerr llerr
# define rtcllinfo llinfo
#else
# define rtcerr(x...)
# define rtcinfo(x...)
# define rtcllerr(x...)
# define rtcllinfo(x...)
#endif
/************************************************************************************
* Private Types
************************************************************************************/
/************************************************************************************
* Private Data
************************************************************************************/
@ -176,30 +154,30 @@ volatile bool g_rtc_enabled = false;
*
************************************************************************************/
#ifdef CONFIG_DEBUG_RTC
#ifdef CONFIG_DEBUG_RTC_INFO
static void rtc_dumpregs(FAR const char *msg)
{
rtcllerr("%s:\n", msg);
rtcllerr(" TR: %08x\n", getreg32(STM32_RTC_TR));
rtcllerr(" DR: %08x\n", getreg32(STM32_RTC_DR));
rtcllerr(" CR: %08x\n", getreg32(STM32_RTC_CR));
rtcllerr(" ISR: %08x\n", getreg32(STM32_RTC_ISR));
rtcllerr(" PRER: %08x\n", getreg32(STM32_RTC_PRER));
rtcllerr(" WUTR: %08x\n", getreg32(STM32_RTC_WUTR));
rtcinfo("%s:\n", msg);
rtcinfo(" TR: %08x\n", getreg32(STM32_RTC_TR));
rtcinfo(" DR: %08x\n", getreg32(STM32_RTC_DR));
rtcinfo(" CR: %08x\n", getreg32(STM32_RTC_CR));
rtcinfo(" ISR: %08x\n", getreg32(STM32_RTC_ISR));
rtcinfo(" PRER: %08x\n", getreg32(STM32_RTC_PRER));
rtcinfo(" WUTR: %08x\n", getreg32(STM32_RTC_WUTR));
#ifndef CONFIG_STM32_STM32F30XX
rtcllerr(" CALIBR: %08x\n", getreg32(STM32_RTC_CALIBR));
rtcinfo(" CALIBR: %08x\n", getreg32(STM32_RTC_CALIBR));
#endif
rtcllerr(" ALRMAR: %08x\n", getreg32(STM32_RTC_ALRMAR));
rtcllerr(" ALRMBR: %08x\n", getreg32(STM32_RTC_ALRMBR));
rtcllerr(" SHIFTR: %08x\n", getreg32(STM32_RTC_SHIFTR));
rtcllerr(" TSTR: %08x\n", getreg32(STM32_RTC_TSTR));
rtcllerr(" TSDR: %08x\n", getreg32(STM32_RTC_TSDR));
rtcllerr(" TSSSR: %08x\n", getreg32(STM32_RTC_TSSSR));
rtcllerr(" CALR: %08x\n", getreg32(STM32_RTC_CALR));
rtcllerr(" TAFCR: %08x\n", getreg32(STM32_RTC_TAFCR));
rtcllerr("ALRMASSR: %08x\n", getreg32(STM32_RTC_ALRMASSR));
rtcllerr("ALRMBSSR: %08x\n", getreg32(STM32_RTC_ALRMBSSR));
rtcllerr("MAGICREG: %08x\n", getreg32(RTC_MAGIC_REG));
rtcinfo(" ALRMAR: %08x\n", getreg32(STM32_RTC_ALRMAR));
rtcinfo(" ALRMBR: %08x\n", getreg32(STM32_RTC_ALRMBR));
rtcinfo(" SHIFTR: %08x\n", getreg32(STM32_RTC_SHIFTR));
rtcinfo(" TSTR: %08x\n", getreg32(STM32_RTC_TSTR));
rtcinfo(" TSDR: %08x\n", getreg32(STM32_RTC_TSDR));
rtcinfo(" TSSSR: %08x\n", getreg32(STM32_RTC_TSSSR));
rtcinfo(" CALR: %08x\n", getreg32(STM32_RTC_CALR));
rtcinfo(" TAFCR: %08x\n", getreg32(STM32_RTC_TAFCR));
rtcinfo("ALRMASSR: %08x\n", getreg32(STM32_RTC_ALRMASSR));
rtcinfo("ALRMBSSR: %08x\n", getreg32(STM32_RTC_ALRMBSSR));
rtcinfo("MAGICREG: %08x\n", getreg32(RTC_MAGIC_REG));
}
#else
# define rtc_dumpregs(msg)
@ -219,16 +197,16 @@ static void rtc_dumpregs(FAR const char *msg)
*
************************************************************************************/
#ifdef CONFIG_DEBUG_RTC
#ifdef CONFIG_DEBUG_RTC_INFO
static void rtc_dumptime(FAR struct tm *tp, FAR const char *msg)
{
rtcllerr("%s:\n", msg);
rtcllerr(" tm_sec: %08x\n", tp->tm_sec);
rtcllerr(" tm_min: %08x\n", tp->tm_min);
rtcllerr(" tm_hour: %08x\n", tp->tm_hour);
rtcllerr(" tm_mday: %08x\n", tp->tm_mday);
rtcllerr(" tm_mon: %08x\n", tp->tm_mon);
rtcllerr(" tm_year: %08x\n", tp->tm_year);
rtcinfo("%s:\n", msg);
rtcinfo(" tm_sec: %08x\n", tp->tm_sec);
rtcinfo(" tm_min: %08x\n", tp->tm_min);
rtcinfo(" tm_hour: %08x\n", tp->tm_hour);
rtcinfo(" tm_mday: %08x\n", tp->tm_mday);
rtcinfo(" tm_mon: %08x\n", tp->tm_mon);
rtcinfo(" tm_year: %08x\n", tp->tm_year);
}
#else
# define rtc_dumptime(tp, msg)

View file

@ -81,10 +81,6 @@
# error "CONFIG_STM32_PWR must selected to use this driver"
#endif
#ifndef CONFIG_DEBUG_FEATURES
# undef CONFIG_DEBUG_RTC
#endif
#if !defined(CONFIG_RTC_MAGIC)
# define CONFIG_RTC_MAGIC (0xfacefeee)
#endif
@ -131,20 +127,6 @@
#define RTC_ALRMR_DIS_DATE_MASK (RTC_ALRMR_MSK4)
#define RTC_ALRMR_ENABLE (0)
/* Debug ****************************************************************************/
#ifdef CONFIG_DEBUG_RTC
# define rtcerr err
# define rtcinfo info
# define rtcllerr llerr
# define rtcllinfo llinfo
#else
# define rtcerr(x...)
# define rtcinfo(x...)
# define rtcllerr(x...)
# define rtcllinfo(x...)
#endif
/************************************************************************************
* Private Types
************************************************************************************/
@ -208,36 +190,36 @@ static int rtchw_set_alrmbr(rtc_alarmreg_t alarmreg);
*
************************************************************************************/
#ifdef CONFIG_DEBUG_RTC
#ifdef CONFIG_DEBUG_RTC_INFO
static void rtc_dumpregs(FAR const char *msg)
{
int rtc_state;
rtcllerr("%s:\n", msg);
rtcllerr(" TR: %08x\n", getreg32(STM32_RTC_TR));
rtcllerr(" DR: %08x\n", getreg32(STM32_RTC_DR));
rtcllerr(" CR: %08x\n", getreg32(STM32_RTC_CR));
rtcllerr(" ISR: %08x\n", getreg32(STM32_RTC_ISR));
rtcllerr(" PRER: %08x\n", getreg32(STM32_RTC_PRER));
rtcllerr(" WUTR: %08x\n", getreg32(STM32_RTC_WUTR));
rtcllerr(" ALRMAR: %08x\n", getreg32(STM32_RTC_ALRMAR));
rtcllerr(" ALRMBR: %08x\n", getreg32(STM32_RTC_ALRMBR));
rtcllerr(" SHIFTR: %08x\n", getreg32(STM32_RTC_SHIFTR));
rtcllerr(" TSTR: %08x\n", getreg32(STM32_RTC_TSTR));
rtcllerr(" TSDR: %08x\n", getreg32(STM32_RTC_TSDR));
rtcllerr(" TSSSR: %08x\n", getreg32(STM32_RTC_TSSSR));
rtcllerr(" CALR: %08x\n", getreg32(STM32_RTC_CALR));
rtcllerr(" TAFCR: %08x\n", getreg32(STM32_RTC_TAFCR));
rtcllerr("ALRMASSR: %08x\n", getreg32(STM32_RTC_ALRMASSR));
rtcllerr("ALRMBSSR: %08x\n", getreg32(STM32_RTC_ALRMBSSR));
rtcllerr("MAGICREG: %08x\n", getreg32(RTC_MAGIC_REG));
rtcinfo("%s:\n", msg);
rtcinfo(" TR: %08x\n", getreg32(STM32_RTC_TR));
rtcinfo(" DR: %08x\n", getreg32(STM32_RTC_DR));
rtcinfo(" CR: %08x\n", getreg32(STM32_RTC_CR));
rtcinfo(" ISR: %08x\n", getreg32(STM32_RTC_ISR));
rtcinfo(" PRER: %08x\n", getreg32(STM32_RTC_PRER));
rtcinfo(" WUTR: %08x\n", getreg32(STM32_RTC_WUTR));
rtcinfo(" ALRMAR: %08x\n", getreg32(STM32_RTC_ALRMAR));
rtcinfo(" ALRMBR: %08x\n", getreg32(STM32_RTC_ALRMBR));
rtcinfo(" SHIFTR: %08x\n", getreg32(STM32_RTC_SHIFTR));
rtcinfo(" TSTR: %08x\n", getreg32(STM32_RTC_TSTR));
rtcinfo(" TSDR: %08x\n", getreg32(STM32_RTC_TSDR));
rtcinfo(" TSSSR: %08x\n", getreg32(STM32_RTC_TSSSR));
rtcinfo(" CALR: %08x\n", getreg32(STM32_RTC_CALR));
rtcinfo(" TAFCR: %08x\n", getreg32(STM32_RTC_TAFCR));
rtcinfo("ALRMASSR: %08x\n", getreg32(STM32_RTC_ALRMASSR));
rtcinfo("ALRMBSSR: %08x\n", getreg32(STM32_RTC_ALRMBSSR));
rtcinfo("MAGICREG: %08x\n", getreg32(RTC_MAGIC_REG));
rtc_state =
((getreg32(STM32_EXTI_RTSR) & EXTI_RTC_ALARM) ? 0x1000 : 0) |
((getreg32(STM32_EXTI_FTSR) & EXTI_RTC_ALARM) ? 0x0100 : 0) |
((getreg32(STM32_EXTI_IMR) & EXTI_RTC_ALARM) ? 0x0010 : 0) |
((getreg32(STM32_EXTI_EMR) & EXTI_RTC_ALARM) ? 0x0001 : 0);
rtcllerr("EXTI (RTSR FTSR ISR EVT): %01x\n",rtc_state);
rtcinfo("EXTI (RTSR FTSR ISR EVT): %01x\n",rtc_state);
}
#else
# define rtc_dumpregs(msg)
@ -257,16 +239,16 @@ static void rtc_dumpregs(FAR const char *msg)
*
************************************************************************************/
#ifdef CONFIG_DEBUG_RTC
#ifdef CONFIG_DEBUG_RTC_INFO
static void rtc_dumptime(FAR const struct tm *tp, FAR const char *msg)
{
rtcllerr("%s:\n", msg);
rtcllerr(" tm_sec: %08x\n", tp->tm_sec);
rtcllerr(" tm_min: %08x\n", tp->tm_min);
rtcllerr(" tm_hour: %08x\n", tp->tm_hour);
rtcllerr(" tm_mday: %08x\n", tp->tm_mday);
rtcllerr(" tm_mon: %08x\n", tp->tm_mon);
rtcllerr(" tm_year: %08x\n", tp->tm_year);
rtcinfo("%s:\n", msg);
rtcinfo(" tm_sec: %08x\n", tp->tm_sec);
rtcinfo(" tm_min: %08x\n", tp->tm_min);
rtcinfo(" tm_hour: %08x\n", tp->tm_hour);
rtcinfo(" tm_mday: %08x\n", tp->tm_mday);
rtcinfo(" tm_mon: %08x\n", tp->tm_mon);
rtcinfo(" tm_year: %08x\n", tp->tm_year);
}
#else
# define rtc_dumptime(tp, msg)

View file

@ -83,10 +83,6 @@
# error "CONFIG_STM32L4_PWR must selected to use this driver"
#endif
#ifndef CONFIG_DEBUG_FEATURES
# undef CONFIG_DEBUG_RTC
#endif
#if !defined(CONFIG_RTC_MAGIC)
# define CONFIG_RTC_MAGIC (0xfacefeee)
#endif
@ -116,20 +112,6 @@
#define RTC_ALRMR_ENABLE (0x80000000)
/* Debug ****************************************************************************/
#ifdef CONFIG_DEBUG_RTC
# define rtcerr err
# define rtcinfo info
# define rtcllerr llerr
# define rtcllinfo llinfo
#else
# define rtcerr(x...)
# define rtcinfo(x...)
# define rtcllerr(x...)
# define rtcllinfo(x...)
#endif
/************************************************************************************
* Private Types
************************************************************************************/
@ -191,27 +173,27 @@ static int rtchw_set_alrmbr(rtc_alarmreg_t alarmreg);
*
************************************************************************************/
#ifdef CONFIG_DEBUG_RTC
#ifdef CONFIG_DEBUG_RTC_INFO
static void rtc_dumpregs(FAR const char *msg)
{
rtcllerr("%s:\n", msg);
rtcllerr(" TR: %08x\n", getreg32(STM32L4_RTC_TR));
rtcllerr(" DR: %08x\n", getreg32(STM32L4_RTC_DR));
rtcllerr(" CR: %08x\n", getreg32(STM32L4_RTC_CR));
rtcllerr(" ISR: %08x\n", getreg32(STM32L4_RTC_ISR));
rtcllerr(" PRER: %08x\n", getreg32(STM32L4_RTC_PRER));
rtcllerr(" WUTR: %08x\n", getreg32(STM32L4_RTC_WUTR));
rtcinfo("%s:\n", msg);
rtcinfo(" TR: %08x\n", getreg32(STM32L4_RTC_TR));
rtcinfo(" DR: %08x\n", getreg32(STM32L4_RTC_DR));
rtcinfo(" CR: %08x\n", getreg32(STM32L4_RTC_CR));
rtcinfo(" ISR: %08x\n", getreg32(STM32L4_RTC_ISR));
rtcinfo(" PRER: %08x\n", getreg32(STM32L4_RTC_PRER));
rtcinfo(" WUTR: %08x\n", getreg32(STM32L4_RTC_WUTR));
rtcllerr(" ALRMAR: %08x\n", getreg32(STM32L4_RTC_ALRMAR));
rtcllerr(" ALRMBR: %08x\n", getreg32(STM32L4_RTC_ALRMBR));
rtcllerr(" SHIFTR: %08x\n", getreg32(STM32L4_RTC_SHIFTR));
rtcllerr(" TSTR: %08x\n", getreg32(STM32L4_RTC_TSTR));
rtcllerr(" TSDR: %08x\n", getreg32(STM32L4_RTC_TSDR));
rtcllerr(" TSSSR: %08x\n", getreg32(STM32L4_RTC_TSSSR));
rtcllerr(" CALR: %08x\n", getreg32(STM32L4_RTC_CALR));
rtcllerr(" TAMPCR: %08x\n", getreg32(STM32L4_RTC_TAMPCR));
rtcllerr("ALRMASSR: %08x\n", getreg32(STM32L4_RTC_ALRMASSR));
rtcllerr("ALRMBSSR: %08x\n", getreg32(STM32L4_RTC_ALRMBSSR));
rtcinfo(" ALRMAR: %08x\n", getreg32(STM32L4_RTC_ALRMAR));
rtcinfo(" ALRMBR: %08x\n", getreg32(STM32L4_RTC_ALRMBR));
rtcinfo(" SHIFTR: %08x\n", getreg32(STM32L4_RTC_SHIFTR));
rtcinfo(" TSTR: %08x\n", getreg32(STM32L4_RTC_TSTR));
rtcinfo(" TSDR: %08x\n", getreg32(STM32L4_RTC_TSDR));
rtcinfo(" TSSSR: %08x\n", getreg32(STM32L4_RTC_TSSSR));
rtcinfo(" CALR: %08x\n", getreg32(STM32L4_RTC_CALR));
rtcinfo(" TAMPCR: %08x\n", getreg32(STM32L4_RTC_TAMPCR));
rtcinfo("ALRMASSR: %08x\n", getreg32(STM32L4_RTC_ALRMASSR));
rtcinfo("ALRMBSSR: %08x\n", getreg32(STM32L4_RTC_ALRMBSSR));
}
#else
# define rtc_dumpregs(msg)
@ -231,21 +213,21 @@ static void rtc_dumpregs(FAR const char *msg)
*
************************************************************************************/
#ifdef CONFIG_DEBUG_RTC
#ifdef CONFIG_DEBUG_RTC_INFO
static void rtc_dumptime(FAR const struct tm *tp, FAR const char *msg)
{
rtcllerr("%s:\n", msg);
rtcinfo("%s:\n", msg);
#if 0
rtcllerr(" tm_sec: %08x\n", tp->tm_sec);
rtcllerr(" tm_min: %08x\n", tp->tm_min);
rtcllerr(" tm_hour: %08x\n", tp->tm_hour);
rtcllerr(" tm_mday: %08x\n", tp->tm_mday);
rtcllerr(" tm_mon: %08x\n", tp->tm_mon);
rtcllerr(" tm_year: %08x\n", tp->tm_year);
rtcinfo(" tm_sec: %08x\n", tp->tm_sec);
rtcinfo(" tm_min: %08x\n", tp->tm_min);
rtcinfo(" tm_hour: %08x\n", tp->tm_hour);
rtcinfo(" tm_mday: %08x\n", tp->tm_mday);
rtcinfo(" tm_mon: %08x\n", tp->tm_mon);
rtcinfo(" tm_year: %08x\n", tp->tm_year);
#else
rtcllerr(" tm: %04d-%02d-%02d %02d:%02d:%02d\n",
tp->tm_year+1900, tp->tm_mon+1, tp->tm_mday,
tp->tm_hour, tp->tm_min, tp->tm_sec);
rtcinfo(" tm: %04d-%02d-%02d %02d:%02d:%02d\n",
tp->tm_year+1900, tp->tm_mon+1, tp->tm_mday,
tp->tm_hour, tp->tm_min, tp->tm_sec);
#endif
}
#else

View file

@ -77,24 +77,6 @@
#define DS3231_I2C_ADDRESS 0x68
#ifndef CONFIG_DEBUG_FEATURES
# undef CONFIG_DEBUG_RTC
#endif
/* Debug ****************************************************************************/
#ifdef CONFIG_DEBUG_RTC
# define rtcerr err
# define rtcinfo info
# define rtcllerr llerr
# define rtcllinfo llinfo
#else
# define rtcerr(x...)
# define rtcinfo(x...)
# define rtcllerr(x...)
# define rtcllinfo(x...)
#endif
/************************************************************************************
* Priviate Types
************************************************************************************/
@ -140,20 +122,20 @@ static struct ds3231_dev_s g_ds3231;
*
************************************************************************************/
#if defined(CONFIG_DEBUG_RTC) && defined(CONFIG_DEBUG_INFO)
#ifdef CONFIG_DEBUG_RTC_INFO
static void rtc_dumptime(FAR struct tm *tp, FAR const char *msg)
{
rtcllinfo("%s:\n", msg);
rtcllinfo(" tm_sec: %08x\n", tp->tm_sec);
rtcllinfo(" tm_min: %08x\n", tp->tm_min);
rtcllinfo(" tm_hour: %08x\n", tp->tm_hour);
rtcllinfo(" tm_mday: %08x\n", tp->tm_mday);
rtcllinfo(" tm_mon: %08x\n", tp->tm_mon);
rtcllinfo(" tm_year: %08x\n", tp->tm_year);
rtcinfo("%s:\n", msg);
rtcinfo(" tm_sec: %08x\n", tp->tm_sec);
rtcinfo(" tm_min: %08x\n", tp->tm_min);
rtcinfo(" tm_hour: %08x\n", tp->tm_hour);
rtcinfo(" tm_mday: %08x\n", tp->tm_mday);
rtcinfo(" tm_mon: %08x\n", tp->tm_mon);
rtcinfo(" tm_year: %08x\n", tp->tm_year);
#if defined(CONFIG_LIBC_LOCALTIME) || defined(CONFIG_TIME_EXTENDED)
rtcllinfo(" tm_wday: %08x\n", tp->tm_wday);
rtcllinfo(" tm_yday: %08x\n", tp->tm_yday);
rtcllinfo(" tm_isdst: %08x\n", tp->tm_isdst);
rtcinfo(" tm_wday: %08x\n", tp->tm_wday);
rtcinfo(" tm_yday: %08x\n", tp->tm_yday);
rtcinfo(" tm_isdst: %08x\n", tp->tm_isdst);
#endif
}
#else

View file

@ -77,24 +77,6 @@
#define PCF85263_I2C_ADDRESS 0x51
#ifndef CONFIG_DEBUG_FEATURES
# undef CONFIG_DEBUG_RTC
#endif
/* Debug ****************************************************************************/
#ifdef CONFIG_DEBUG_RTC
# define rtcerr err
# define rtcinfo info
# define rtcllerr llerr
# define rtcllinfo llinfo
#else
# define rtcerr(x...)
# define rtcinfo(x...)
# define rtcllerr(x...)
# define rtcllinfo(x...)
#endif
/************************************************************************************
* Priviate Types
************************************************************************************/
@ -140,20 +122,20 @@ static struct pcf85263_dev_s g_pcf85263;
*
************************************************************************************/
#if defined(CONFIG_DEBUG_RTC) && defined(CONFIG_DEBUG_INFO)
#ifdef CONFIG_DEBUG_RTC_INFO
static void rtc_dumptime(FAR struct tm *tp, FAR const char *msg)
{
rtcllinfo("%s:\n", msg);
rtcllinfo(" tm_sec: %08x\n", tp->tm_sec);
rtcllinfo(" tm_min: %08x\n", tp->tm_min);
rtcllinfo(" tm_hour: %08x\n", tp->tm_hour);
rtcllinfo(" tm_mday: %08x\n", tp->tm_mday);
rtcllinfo(" tm_mon: %08x\n", tp->tm_mon);
rtcllinfo(" tm_year: %08x\n", tp->tm_year);
rtcinfo("%s:\n", msg);
rtcinfo(" tm_sec: %08x\n", tp->tm_sec);
rtcinfo(" tm_min: %08x\n", tp->tm_min);
rtcinfo(" tm_hour: %08x\n", tp->tm_hour);
rtcinfo(" tm_mday: %08x\n", tp->tm_mday);
rtcinfo(" tm_mon: %08x\n", tp->tm_mon);
rtcinfo(" tm_year: %08x\n", tp->tm_year);
#if defined(CONFIG_LIBC_LOCALTIME) || defined(CONFIG_TIME_EXTENDED)
rtcllinfo(" tm_wday: %08x\n", tp->tm_wday);
rtcllinfo(" tm_yday: %08x\n", tp->tm_yday);
rtcllinfo(" tm_isdst: %08x\n", tp->tm_isdst);
rtcinfo(" tm_wday: %08x\n", tp->tm_wday);
rtcinfo(" tm_yday: %08x\n", tp->tm_yday);
rtcinfo(" tm_isdst: %08x\n", tp->tm_isdst);
#endif
}
#else

View file

@ -693,6 +693,30 @@
# define pwmllinfo(x...)
#endif
#ifdef CONFIG_DEBUG_RTC_ERROR
# define rtcerr(format, ...) err(format, ##__VA_ARGS__)
# define rtcllerr(format, ...) llerr(format, ##__VA_ARGS__)
#else
# define rtcerr(x...)
# define rtcllerr(x...)
#endif
#ifdef CONFIG_DEBUG_RTC_WARN
# define rtcwarn(format, ...) warn(format, ##__VA_ARGS__)
# define rtcllwarn(format, ...) llwarn(format, ##__VA_ARGS__)
#else
# define rtcwarn(x...)
# define rtcllwarn(x...)
#endif
#ifdef CONFIG_DEBUG_RTC_INFO
# define rtcinfo(format, ...) info(format, ##__VA_ARGS__)
# define rtcllinfo(format, ...) llinfo(format, ##__VA_ARGS__)
#else
# define rtcinfo(x...)
# define rtcllinfo(x...)
#endif
#ifdef CONFIG_DEBUG_SENSORS_ERROR
# define snerr(format, ...) err(format, ##__VA_ARGS__)
# define snllerr(format, ...) llerr(format, ##__VA_ARGS__)
@ -1354,6 +1378,30 @@
# define pwmllinfo (void)
#endif
#ifdef CONFIG_DEBUG_RTC_ERROR
# define rtcerr err
# define rtcllerr llerr
#else
# define rtcerr (void)
# define rtcllerr (void)
#endif
#ifdef CONFIG_DEBUG_RTC_WARN
# define rtcwarn warn
# define rtcllwarn llwarn
#else
# define rtcwarn (void)
# define rtcllwarn (void)
#endif
#ifdef CONFIG_DEBUG_RTC_INFO
# define rtcinfo info
# define rtcllinfo llinfo
#else
# define rtcinfo (void)
# define rtcllinfo (void)
#endif
#ifdef CONFIG_DEBUG_SENSORS_ERROR
# define snerr err
# define snllerr llerr
@ -1652,6 +1700,14 @@
# define pwminfodumpbuffer(m,b,n)
#endif
#ifdef CONFIG_DEBUG_RTC
# define rtcerrdumpbuffer(m,b,n) errdumpbuffer(m,b,n)
# define rtcinfodumpbuffer(m,b,n) infodumpbuffer(m,b,n)
#else
# define rtcerrdumpbuffer(m,b,n)
# define rtcinfodumpbuffer(m,b,n)
#endif
#ifdef CONFIG_DEBUG_SENSORS
# define snerrdumpbuffer(m,b,n) errdumpbuffer(m,b,n)
# define sninfodumpbuffer(m,b,n) infodumpbuffer(m,b,n)