1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 19:40:31 +03:00

flash_w25n - remove macro with hidden variable reference (#13680)

This commit is contained in:
Petr Ledvina 2024-06-16 04:06:37 +02:00 committed by GitHub
parent dc40b8f655
commit e0483ada8f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -39,9 +39,8 @@
#define W25N_BB_MARKER_BLOCKS 1 #define W25N_BB_MARKER_BLOCKS 1
#define W25N_BB_REPLACEMENT_BLOCKS 20 #define W25N_BB_REPLACEMENT_BLOCKS 20
#define W25N_BB_MANAGEMENT_BLOCKS (W25N_BB_REPLACEMENT_BLOCKS + W25N_BB_MARKER_BLOCKS) #define W25N_BB_MANAGEMENT_BLOCKS (W25N_BB_REPLACEMENT_BLOCKS + W25N_BB_MARKER_BLOCKS)
// blocks are zero-based index // blocks are zero-based index; when negative, it is from end of flash
#define W25N_BB_REPLACEMENT_START_BLOCK (fdevice->geometry.sectors - W25N_BB_REPLACEMENT_BLOCKS) #define W25N_BB_MANAGEMENT_START_BLOCK (-W25N_BB_MANAGEMENT_BLOCKS)
#define W25N_BB_MANAGEMENT_START_BLOCK (fdevice->geometry.sectors - W25N_BB_MANAGEMENT_BLOCKS)
// Instructions // Instructions
@ -361,9 +360,10 @@ bool w25n_identify(flashDevice_t *fdevice, uint32_t jedecID)
fdevice->geometry.sectorSize = fdevice->geometry.pagesPerSector * fdevice->geometry.pageSize; fdevice->geometry.sectorSize = fdevice->geometry.pagesPerSector * fdevice->geometry.pageSize;
fdevice->geometry.totalSize = fdevice->geometry.sectorSize * fdevice->geometry.sectors; fdevice->geometry.totalSize = fdevice->geometry.sectorSize * fdevice->geometry.sectors;
const uint32_t managementStartBlock = W25N_BB_MANAGEMENT_START_BLOCK >= 0 ? W25N_BB_MANAGEMENT_START_BLOCK : fdevice->geometry.sectors + W25N_BB_MANAGEMENT_START_BLOCK;
flashPartitionSet(FLASH_PARTITION_TYPE_BADBLOCK_MANAGEMENT, flashPartitionSet(FLASH_PARTITION_TYPE_BADBLOCK_MANAGEMENT,
W25N_BB_MANAGEMENT_START_BLOCK, managementStartBlock,
W25N_BB_MANAGEMENT_START_BLOCK + W25N_BB_MANAGEMENT_BLOCKS - 1); managementStartBlock + W25N_BB_MANAGEMENT_BLOCKS - 1);
fdevice->couldBeBusy = true; // Just for luck we'll assume the chip could be busy even though it isn't specced to be fdevice->couldBeBusy = true; // Just for luck we'll assume the chip could be busy even though it isn't specced to be
fdevice->vTable = &w25n_vTable; fdevice->vTable = &w25n_vTable;