qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

wear_leveling_flash_spi_config.h (1177B)


      1 // Copyright 2022 Nick Brassel (@tzarc)
      2 // SPDX-License-Identifier: GPL-2.0-or-later
      3 #pragma once
      4 
      5 #ifndef __ASSEMBLER__
      6 #    include <stdlib.h>
      7 #    include <stdint.h>
      8 #    include "flash_spi.h"
      9 #endif
     10 
     11 // Use 1 block -- check the config for the SPI flash to determine how big it is
     12 #ifndef WEAR_LEVELING_EXTERNAL_FLASH_BLOCK_COUNT
     13 #    define WEAR_LEVELING_EXTERNAL_FLASH_BLOCK_COUNT 1
     14 #endif // WEAR_LEVELING_EXTERNAL_FLASH_BLOCK_COUNT
     15 
     16 // Start at the first block of the external flash
     17 #ifndef WEAR_LEVELING_EXTERNAL_FLASH_BLOCK_OFFSET
     18 #    define WEAR_LEVELING_EXTERNAL_FLASH_BLOCK_OFFSET 0
     19 #endif // WEAR_LEVELING_EXTERNAL_FLASH_BLOCK_OFFSET
     20 
     21 // 8-byte writes by default
     22 #ifndef BACKING_STORE_WRITE_SIZE
     23 #    define BACKING_STORE_WRITE_SIZE 8
     24 #endif
     25 
     26 // The space allocated by the block
     27 #ifndef WEAR_LEVELING_BACKING_SIZE
     28 #    define WEAR_LEVELING_BACKING_SIZE ((EXTERNAL_FLASH_BLOCK_SIZE) * (WEAR_LEVELING_EXTERNAL_FLASH_BLOCK_COUNT))
     29 #endif // WEAR_LEVELING_BACKING_SIZE
     30 
     31 // Use half of the backing size for logical EEPROM
     32 #ifndef WEAR_LEVELING_LOGICAL_SIZE
     33 #    define WEAR_LEVELING_LOGICAL_SIZE ((WEAR_LEVELING_BACKING_SIZE) / 2)
     34 #endif // WEAR_LEVELING_LOGICAL_SIZE