mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
iap: extend API to support read/write of boot counter
Also clean up unused/obsolete definitions.
This commit is contained in:
parent
1543a6dbd3
commit
b91f40eb94
@ -20,17 +20,6 @@
|
||||
#define IAP_MAGIC_WORD_1 0x1122
|
||||
#define IAP_MAGIC_WORD_2 0xAA55
|
||||
|
||||
#define IAP_REQLOC_1 BKP_DR1
|
||||
#define IAP_CRCLOC_LOW BKP_DR2
|
||||
#define IAP_CRCLOC_UPPER BKP_DR3
|
||||
#define IAP_PORTLOC BKP_DR4
|
||||
#define IAP_REQLOC_2 BKP_RR5
|
||||
|
||||
#define IAP_UPLOAD_REQ_1 0x20AA
|
||||
#define IAP_UPLOAD_REQ_2 0x2055
|
||||
#define IAP_DNLOAD_REQ_1 0x30AA
|
||||
#define IAP_DNLOAD_REQ_2 0x3055
|
||||
|
||||
#define UPPERWORD16(lw) (uint16_t)((uint32_t)(lw)>>16)
|
||||
#define LOWERWORD16(lw) (uint16_t)((uint32_t)(lw)&0x0000ffff)
|
||||
#define UPPERBYTE(w) (uint8_t)((w)>>8)
|
||||
@ -121,3 +110,13 @@ void PIOS_IAP_ClearRequest(void)
|
||||
BKP_WriteBackupRegister( MAGIC_REG_1, 0);
|
||||
BKP_WriteBackupRegister( MAGIC_REG_2, 0);
|
||||
}
|
||||
|
||||
uint16_t PIOS_IAP_ReadBootCount(void)
|
||||
{
|
||||
return BKP_ReadBackupRegister ( IAP_BOOTCOUNT );
|
||||
}
|
||||
|
||||
void PIOS_IAP_WriteBootCount (uint16_t boot_count)
|
||||
{
|
||||
BKP_WriteBackupRegister ( IAP_BOOTCOUNT, boot_count );
|
||||
}
|
||||
|
@ -19,27 +19,18 @@
|
||||
****************************************************************************************/
|
||||
#define MAGIC_REG_1 BKP_DR1
|
||||
#define MAGIC_REG_2 BKP_DR2
|
||||
#define IAP_COMM BKP_DR3
|
||||
|
||||
#define IAP_COMM_INVALID 0
|
||||
#define IAP_COMM_USB 1
|
||||
#define IAP_COMM_TELEMETRY 2
|
||||
#define IAP_COMM_SPI_AHRS 3
|
||||
#define IAP_COMM_I2C 4
|
||||
// Additional types can be added along with the proper support code.
|
||||
#define IAP_BOOTCOUNT BKP_DR3
|
||||
|
||||
/****************************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************************/
|
||||
void PIOS_IAP_Init(void);
|
||||
uint32_t PIOS_IAP_CRCVerify( void );
|
||||
uint32_t PIOS_IAP_CheckRequest( void );
|
||||
void PIOS_IAP_SetCommInput( uint16_t comm );
|
||||
uint16_t PIOS_IAP_GetCommInput( void );
|
||||
void PIOS_IAP_SetRequest1(void);
|
||||
void PIOS_IAP_SetRequest2(void);
|
||||
void PIOS_IAP_ClearRequest(void);
|
||||
void PIOS_IAP_SetCRC( uint32_t crcval );
|
||||
uint16_t PIOS_IAP_ReadBootCount(void);
|
||||
void PIOS_IAP_WriteBootCount(uint16_t);
|
||||
|
||||
/****************************************************************************************
|
||||
* Public Data
|
||||
|
Loading…
x
Reference in New Issue
Block a user