From fdc2f6a39d40d5ed1608548db6d3ffe473b397fb Mon Sep 17 00:00:00 2001 From: Jan Pochyla Date: Tue, 17 Oct 2017 15:11:58 +0200 Subject: [PATCH] modtrezorconfig: use new flash API --- embed/extmod/modtrezorconfig/modtrezorconfig.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/embed/extmod/modtrezorconfig/modtrezorconfig.c b/embed/extmod/modtrezorconfig/modtrezorconfig.c index b330333b..cbd42994 100644 --- a/embed/extmod/modtrezorconfig/modtrezorconfig.c +++ b/embed/extmod/modtrezorconfig/modtrezorconfig.c @@ -13,10 +13,12 @@ #include #include #include "norcow.h" -#include "flash.h" +#include "../../trezorhal/flash.h" #define MAX_WRONG_PINS 15 -#define FAIL_SECTOR_LEN 16 * 1024 + +#define FAIL_SECTOR_LEN 0x4000 + #define STORAGE_KEY_PIN 0x00 static void pin_fails_reset(uint32_t ofs) @@ -25,7 +27,7 @@ static void pin_fails_reset(uint32_t ofs) // ofs points to the last word of the PIN fails area. Because there is // no space left, we recycle the sector (set all words to 0xffffffff). // On next unlock attempt, we start counting from the the first word. - flash_erase_sectors(FLASH_SECTOR_PIN_AREA, FLASH_SECTOR_PIN_AREA, NULL); + flash_erase_sectors((uint8_t[]) { FLASH_SECTOR_PIN_AREA }, 1, NULL); } else { // Mark this counter as exhausted. On next unlock attempt, pinfails_get // seeks to the next word.