1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-30 08:24:11 +01:00

Fix calls to backup registers on F4

This commit is contained in:
James Cotton 2012-01-21 13:21:37 -06:00
parent bb0bfe0ae4
commit 838370b3a4
2 changed files with 18 additions and 12 deletions

View File

@ -79,7 +79,7 @@ void PIOS_IAP_Init( void )
PWR_BackupAccessCmd(ENABLE);
/* Clear Tamper pin Event(TE) pending flag */
BKP_ClearFlag();
RTC_ClearFlag();
#endif
}
@ -98,8 +98,8 @@ uint32_t PIOS_IAP_CheckRequest( void )
uint16_t reg1;
uint16_t reg2;
reg1 = BKP_ReadBackupRegister( MAGIC_REG_1 );
reg2 = BKP_ReadBackupRegister( MAGIC_REG_2 );
reg1 = RTC_ReadBackupRegister( MAGIC_REG_1 );
reg2 = RTC_ReadBackupRegister( MAGIC_REG_2 );
if( reg1 == IAP_MAGIC_WORD_1 && reg2 == IAP_MAGIC_WORD_2 ) {
// We have a match.
@ -123,31 +123,31 @@ uint32_t PIOS_IAP_CheckRequest( void )
void PIOS_IAP_SetRequest1(void)
{
#if 0
BKP_WriteBackupRegister( MAGIC_REG_1, IAP_MAGIC_WORD_1);
RTC_WriteBackupRegister( MAGIC_REG_1, IAP_MAGIC_WORD_1);
#endif
}
void PIOS_IAP_SetRequest2(void)
{
#if 0
BKP_WriteBackupRegister( MAGIC_REG_2, IAP_MAGIC_WORD_2);
RTC_WriteBackupRegister( MAGIC_REG_2, IAP_MAGIC_WORD_2);
#endif
}
void PIOS_IAP_ClearRequest(void)
{
#if 0
BKP_WriteBackupRegister( MAGIC_REG_1, 0);
BKP_WriteBackupRegister( MAGIC_REG_2, 0);
RTC_WriteBackupRegister( MAGIC_REG_1, 0);
RTC_WriteBackupRegister( MAGIC_REG_2, 0);
#endif
}
uint16_t PIOS_IAP_ReadBootCount(void)
{
return BKP_ReadBackupRegister ( IAP_BOOTCOUNT );
return RTC_ReadBackupRegister ( IAP_BOOTCOUNT );
}
void PIOS_IAP_WriteBootCount (uint16_t boot_count)
{
BKP_WriteBackupRegister ( IAP_BOOTCOUNT, boot_count );
RTC_WriteBackupRegister ( IAP_BOOTCOUNT, boot_count );
}

View File

@ -17,9 +17,15 @@
/*****************************************************************************************
* Public Definitions/Macros
****************************************************************************************/
#define MAGIC_REG_1 BKP_DR1
#define MAGIC_REG_2 BKP_DR2
#define IAP_BOOTCOUNT BKP_DR3
#if defined(STM32F4XX)
#define MAGIC_REG_1 RTC_BKP_DR1
#define MAGIC_REG_2 RTC_BKP_DR2
#define IAP_BOOTCOUNT RTC_BKP_DR3
#else
#define MAGIC_REG_1 BKP_DR1
#define MAGIC_REG_2 BKP_DR2
#define IAP_BOOTCOUNT BKP_DR3
#endif
/****************************************************************************************
* Public Functions