mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-06-11 21:08:16 +02:00
Fix readin cached pages.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -41,6 +41,10 @@ uint8_t *map = NULL;
|
|||||||
|
|
||||||
#define TOTAL_FLASH_PAGES 4
|
#define TOTAL_FLASH_PAGES 4
|
||||||
|
|
||||||
|
extern const uintptr_t start_data_pool;
|
||||||
|
extern const uintptr_t end_rom_pool;
|
||||||
|
|
||||||
|
|
||||||
typedef struct page_flash {
|
typedef struct page_flash {
|
||||||
uint8_t page[FLASH_SECTOR_SIZE];
|
uint8_t page[FLASH_SECTOR_SIZE];
|
||||||
uintptr_t address;
|
uintptr_t address;
|
||||||
@@ -175,7 +179,7 @@ page_flash_t *find_free_page(uintptr_t addr) {
|
|||||||
#ifndef ENABLE_EMULATION
|
#ifndef ENABLE_EMULATION
|
||||||
memcpy(p->page, (uint8_t *)addr_alg, FLASH_SECTOR_SIZE);
|
memcpy(p->page, (uint8_t *)addr_alg, FLASH_SECTOR_SIZE);
|
||||||
#else
|
#else
|
||||||
memcpy(p->page, (uint8_t *)(map+addr_alg), FLASH_SECTOR_SIZE);
|
memcpy(p->page, (addr >= start_data_pool && addr <= end_rom_pool) ? (uint8_t *)(map+addr_alg) : (uint8_t *)addr_alg, FLASH_SECTOR_SIZE);
|
||||||
#endif
|
#endif
|
||||||
ready_pages++;
|
ready_pages++;
|
||||||
p->address = addr_alg;
|
p->address = addr_alg;
|
||||||
@@ -231,9 +235,6 @@ int flash_program_uintptr (uintptr_t addr, uintptr_t data) {
|
|||||||
return flash_program_block(addr, (const uint8_t *)&data, sizeof(uintptr_t));
|
return flash_program_block(addr, (const uint8_t *)&data, sizeof(uintptr_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const uintptr_t start_data_pool;
|
|
||||||
extern const uintptr_t end_rom_pool;
|
|
||||||
|
|
||||||
uint8_t *flash_read(uintptr_t addr) {
|
uint8_t *flash_read(uintptr_t addr) {
|
||||||
uintptr_t addr_alg = addr & -FLASH_SECTOR_SIZE;
|
uintptr_t addr_alg = addr & -FLASH_SECTOR_SIZE;
|
||||||
#ifndef ENABLE_EMULATION
|
#ifndef ENABLE_EMULATION
|
||||||
|
|||||||
Reference in New Issue
Block a user