1 /* 2 * Copyright (c) 2013 Heather Lee Wilson 3 * 4 * Use of this source code is governed by a MIT-style 5 * license that can be found in the LICENSE file or at 6 * https://opensource.org/licenses/MIT 7 */ 8 #include <norfs_test_helper.h> 9 #include <lib/norfs.h> 10 #include <dev/flash_nor.h> 11 #include <platform/flash_nor_config.h> 12 #include <lk/debug.h> 13 dump_bank(void)14void dump_bank(void) { 15 const struct flash_nor_bank *bank; 16 bank = flash_nor_get_bank(0); 17 printf("\n\n**DUMP BANK**\n"); 18 uint8_t *addr = (uint8_t *)bank->base; 19 for (int i = 0; i < 8 * FLASH_PAGE_SIZE; i++) { 20 if (i%4 == 0) printf(" "); 21 if (i%FLASH_PAGE_SIZE == 0) 22 printf("\n\n\n\n\n\ni: %d\n", i); 23 printf("%02X ", *(addr + i)); 24 } 25 } 26 wipe_fs(void)27void wipe_fs(void) { 28 norfs_unmount_fs(); 29 flash_nor_begin(0); 30 flash_nor_erase_pages(0, 0 + norfs_nvram_offset, 8 * FLASH_PAGE_SIZE); 31 flash_nor_end(0); 32 } 33