mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
logfs: use f3-safe slot and arena states for all chips
Filesystem magic value has been updated to deal with the format change. Conflicts: flight/targets/board_hw_defs/discoveryf4/board_hw_defs.c flight/targets/board_hw_defs/flyingf4/board_hw_defs.c flight/targets/board_hw_defs/freedom/board_hw_defs.c flight/targets/board_hw_defs/quanton/board_hw_defs.c
This commit is contained in:
parent
d611207789
commit
7726b9e2a9
@ -79,13 +79,12 @@ static uintptr_t logfs_get_addr(uint8_t arena_id, uint16_t slot_id)
|
||||
* of earlier ones in NOR flash without an erase cycle.
|
||||
*/
|
||||
enum arena_state {
|
||||
#ifdef STM32F30X
|
||||
/*
|
||||
* The STM32F30X flash subsystem is only capable of
|
||||
* writing words or halfwords. In this case we use halfwords.
|
||||
* In addition to that it is only capable to write to erased
|
||||
* cells (0xffff) or write a cell from anything to (0x0000).
|
||||
* To cope with this, the F3 gets different enum values.
|
||||
* To cope with this, the F3 needs carefully crafted enum values.
|
||||
* For this to work the underlying flash driver has to
|
||||
* check each halfword if it has changed before writing.
|
||||
*/
|
||||
@ -93,12 +92,6 @@ enum arena_state {
|
||||
ARENA_STATE_RESERVED = 0xE6E6FFFF,
|
||||
ARENA_STATE_ACTIVE = 0xE6E66666,
|
||||
ARENA_STATE_OBSOLETE = 0x00000000,
|
||||
#else
|
||||
ARENA_STATE_ERASED = 0xEEEEEEEE,
|
||||
ARENA_STATE_RESERVED = 0xE6E6E6E6,
|
||||
ARENA_STATE_ACTIVE = 0x66666666,
|
||||
ARENA_STATE_OBSOLETE = 0x44444444,
|
||||
#endif
|
||||
};
|
||||
|
||||
struct arena_header {
|
||||
@ -320,13 +313,12 @@ static int32_t logfs_find_active_arena()
|
||||
* of earlier ones in NOR flash without an erase cycle.
|
||||
*/
|
||||
enum slot_state {
|
||||
#ifdef STM32F30X
|
||||
/*
|
||||
* The STM32F30X flash subsystem is only capable of
|
||||
* writing words or halfwords. In this case we use halfwords.
|
||||
* In addition to that it is only capable to write to erased
|
||||
* cells (0xffff) or write a cell from anything to (0x0000).
|
||||
* To cope with this, the F3 gets different enum values.
|
||||
* To cope with this, the F3 needs carfully crafted enum values.
|
||||
* For this to work the underlying flash driver has to
|
||||
* check each halfword if it has changed before writing.
|
||||
*/
|
||||
@ -334,12 +326,6 @@ enum slot_state {
|
||||
SLOT_STATE_RESERVED = 0xFAFAFFFF,
|
||||
SLOT_STATE_ACTIVE = 0xFAFAAAAA,
|
||||
SLOT_STATE_OBSOLETE = 0x00000000,
|
||||
#else
|
||||
SLOT_STATE_EMPTY = 0xFFFFFFFF,
|
||||
SLOT_STATE_RESERVED = 0xFAFAFAFA,
|
||||
SLOT_STATE_ACTIVE = 0xAAAAAAAA,
|
||||
SLOT_STATE_OBSOLETE = 0x88888888,
|
||||
#endif
|
||||
};
|
||||
|
||||
struct slot_header {
|
||||
|
@ -404,7 +404,7 @@ void PIOS_SPI_flash_accel_irq_handler(void)
|
||||
#include "pios_flash_jedec_priv.h"
|
||||
|
||||
static const struct flashfs_logfs_cfg flashfs_w25x_cfg = {
|
||||
.fs_magic = 0x89abcdef,
|
||||
.fs_magic = 0x99abcdef,
|
||||
.total_fs_size = 0x00080000, /* 512K bytes (128 sectors = entire chip) */
|
||||
.arena_size = 0x00010000, /* 256 * slot size */
|
||||
.slot_size = 0x00000100, /* 256 bytes */
|
||||
@ -420,7 +420,7 @@ static const struct pios_flash_jedec_cfg flash_w25x_cfg = {
|
||||
};
|
||||
|
||||
static const struct flashfs_logfs_cfg flashfs_m25p_cfg = {
|
||||
.fs_magic = 0x89abceef,
|
||||
.fs_magic = 0x99abceef,
|
||||
.total_fs_size = 0x00200000, /* 2M bytes (32 sectors = entire chip) */
|
||||
.arena_size = 0x00010000, /* 256 * slot size */
|
||||
.slot_size = 0x00000100, /* 256 bytes */
|
||||
|
@ -452,7 +452,7 @@ void PIOS_SPI_flash_irq_handler(void)
|
||||
#include "pios_flash_jedec_priv.h"
|
||||
|
||||
static const struct flashfs_logfs_cfg flashfs_m25p_cfg = {
|
||||
.fs_magic = 0x89abceef,
|
||||
.fs_magic = 0x99abceef,
|
||||
.total_fs_size = 0x00200000, /* 2M bytes (32 sectors = entire chip) */
|
||||
.arena_size = 0x00010000, /* 256 * slot size */
|
||||
.slot_size = 0x00000100, /* 256 bytes */
|
||||
|
@ -567,7 +567,7 @@ const struct pios_rfm22b_cfg * PIOS_BOARD_HW_DEFS_GetRfm22Cfg (uint32_t board_re
|
||||
#include "pios_flash_jedec_priv.h"
|
||||
|
||||
static const struct flashfs_logfs_cfg flashfs_m25p_cfg = {
|
||||
.fs_magic = 0x89abceef,
|
||||
.fs_magic = 0x99abceef,
|
||||
.total_fs_size = 0x00200000, /* 2M bytes (32 sectors = entire chip) */
|
||||
.arena_size = 0x00010000, /* 256 * slot size */
|
||||
.slot_size = 0x00000100, /* 256 bytes */
|
||||
|
Loading…
x
Reference in New Issue
Block a user