STM32 RTCC: Make back-up register and magic value used by RTCC configurable. From David Sidrane

This commit is contained in:
Gregory Nutt 2015-04-06 16:26:59 -06:00
parent 6058d3dc73
commit 4d5cb13c9d
3 changed files with 31 additions and 10 deletions

View File

@ -3406,6 +3406,17 @@ config STM32_HAVE_RTC_SUBSECONDS
bool bool
default n default n
config RTC_MAGIC_REG
int "The BKP register used to store/check the Magic value to determine if RTC is set already"
default 0
range 0 19
depends on RTC
config RTC_MAGIC
hex "Value used as Magic to determine if RTC is set already"
default 0xfacefeee
depends on RTC
choice choice
prompt "RTC clock source" prompt "RTC clock source"
default RTC_LSECLOCK default RTC_LSECLOCK

View File

@ -87,11 +87,20 @@
# endif # endif
#endif #endif
#if !defined(CONFIG_RTC_MAGIC)
# define CONFIG_RTC_MAGIC (0xfacefeee)
#endif
#if !defined(CONFIG_RTC_MAGIC_REG)
# define CONFIG_RTC_MAGIC_REG STM32_RTC_BKR(0)
#endif
/* Constants ************************************************************************/ /* Constants ************************************************************************/
#define SYNCHRO_TIMEOUT (0x00020000) #define SYNCHRO_TIMEOUT (0x00020000)
#define INITMODE_TIMEOUT (0x00010000) #define INITMODE_TIMEOUT (0x00010000)
#define RTC_MAGIC (0xfacefeee) #define RTC_MAGIC CONFIG_RTC_MAGIC
#define RTC_MAGIC_REG CONFIG_RTC_MAGIC_REG
/* Proxy definitions to make the same code work for all the STM32 series ************/ /* Proxy definitions to make the same code work for all the STM32 series ************/
@ -189,7 +198,7 @@ static void rtc_dumpregs(FAR const char *msg)
rtclldbg(" TAFCR: %08x\n", getreg32(STM32_RTC_TAFCR)); rtclldbg(" TAFCR: %08x\n", getreg32(STM32_RTC_TAFCR));
rtclldbg("ALRMASSR: %08x\n", getreg32(STM32_RTC_ALRMASSR)); rtclldbg("ALRMASSR: %08x\n", getreg32(STM32_RTC_ALRMASSR));
rtclldbg("ALRMBSSR: %08x\n", getreg32(STM32_RTC_ALRMBSSR)); rtclldbg("ALRMBSSR: %08x\n", getreg32(STM32_RTC_ALRMBSSR));
rtclldbg(" BK0: %08x\n", getreg32(STM32_RTC_BK0R)); rtclldbg("MAGICREG: %08x\n", getreg32(RTC_MAGIC_REG));
} }
#else #else
# define rtc_dumpregs(msg) # define rtc_dumpregs(msg)
@ -616,7 +625,7 @@ int up_rtcinitialize(void)
/* Select the clock source */ /* Select the clock source */
/* Save the token before losing it when resetting */ /* Save the token before losing it when resetting */
regval = getreg32(STM32_RTC_BK0R); regval = getreg32(RTC_MAGIC_REG);
stm32_pwr_enablebkp(true); stm32_pwr_enablebkp(true);
@ -688,7 +697,7 @@ int up_rtcinitialize(void)
/* Remember that the RTC is initialized */ /* Remember that the RTC is initialized */
putreg32(RTC_MAGIC, STM32_RTC_BK0R); putreg32(RTC_MAGIC, RTC_MAGIC_REG);
/* Enable the RTC Clock by setting the RTCEN bit in the RCC register */ /* Enable the RTC Clock by setting the RTCEN bit in the RCC register */
@ -751,7 +760,7 @@ int up_rtcinitialize(void)
/* Remember that the RTC is initialized */ /* Remember that the RTC is initialized */
putreg32(RTC_MAGIC, STM32_RTC_BK0R); putreg32(RTC_MAGIC, RTC_MAGIC_REG);
} }
else else
{ {

View File

@ -103,12 +103,13 @@ The BASIC nsh configuration is fully function (as desribed below under
At this point, work has stopped because I am stuck. The problem is that At this point, work has stopped because I am stuck. The problem is that
bus events are not occurring: Nothing is detected by the USBHS when the bus events are not occurring: Nothing is detected by the USBHS when the
host is connected; no activity is seen on the bus by a USB analyzer when host is connected; no activity is seen on the bus by a USB analyzer when
the host is connected. Possibilities: (1) the pullups on DM and DP are the host is connected. Possibilities: (1) the pull-ups on DM and DP are
not working. This would prevent the host from detecting the presence of not working. This would prevent the host from detecting the presence of
the device. the DETACH bit is, however, being correctly cleared or (2) the device. The DETACH bit is, however, being correctly cleared and the
some issue with clocking or configuration of the UTMI. I see nothing USB is in the suspend sate. Or (2) some issue with clocking or
wrong this this case. I have done extensive comparison of the Atmel configuration of the UTMI. I see nothing wrong in this case. I have
sample code and study of the data sheet, but I have not found the key to done extensive comparison of the Atmel sample code and study of the data
sheet, but I have not found the key to
solving this. solving this.
6. Partial support for the maXTouch Xplained Pro LCD is in place. The 6. Partial support for the maXTouch Xplained Pro LCD is in place. The