mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-26 16:15:11 +02:00
Remove carriage return \r for better debug.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -247,7 +247,7 @@ void scan_region(bool persistent) {
|
||||
}
|
||||
|
||||
uint16_t fid = flash_read_uint16(base + sizeof(uintptr_t) + sizeof(uintptr_t));
|
||||
printf("[%x] scan fid %x, len %d\r\n", (unsigned int) base, fid,
|
||||
printf("[%x] scan fid %x, len %d\n", (unsigned int) base, fid,
|
||||
flash_read_uint16(base + sizeof(uintptr_t) + sizeof(uintptr_t) + sizeof(uint16_t)));
|
||||
file_t *file = (file_t *) search_by_fid(fid, NULL, SPECIFY_EF);
|
||||
if (!file) {
|
||||
@@ -267,7 +267,7 @@ void scan_flash() {
|
||||
initialize_flash(false); //soft initialization
|
||||
if (*(uintptr_t *) flash_read(end_rom_pool) == 0xffffffff &&
|
||||
*(uintptr_t *) flash_read(end_rom_pool + sizeof(uintptr_t)) == 0xffffffff) {
|
||||
printf("First initialization (or corrupted!)\r\n");
|
||||
printf("First initialization (or corrupted!)\n");
|
||||
uint8_t empty[sizeof(uintptr_t) * 2 + sizeof(uint32_t)];
|
||||
memset(empty, 0, sizeof(empty));
|
||||
flash_program_block(end_data_pool, empty, sizeof(empty));
|
||||
@@ -275,7 +275,7 @@ void scan_flash() {
|
||||
//low_flash_available();
|
||||
//wait_flash_finish();
|
||||
}
|
||||
printf("SCAN\r\n");
|
||||
printf("SCAN\n");
|
||||
scan_region(true);
|
||||
scan_region(false);
|
||||
}
|
||||
|
||||
@@ -83,8 +83,8 @@ uintptr_t allocate_free_addr(uint16_t size, bool persistent) {
|
||||
uintptr_t addr_alg = base & -FLASH_SECTOR_SIZE; //start address of sector
|
||||
uintptr_t potential_addr = base - real_size;
|
||||
next_base = flash_read_uintptr(base);
|
||||
//printf("nb %x %x %x %x\r\n",base,next_base,addr_alg,potential_addr);
|
||||
//printf("fid %x\r\n",flash_read_uint16(next_base+sizeof(uintptr_t)));
|
||||
//printf("nb %x %x %x %x\n",base,next_base,addr_alg,potential_addr);
|
||||
//printf("fid %x\n",flash_read_uint16(next_base+sizeof(uintptr_t)));
|
||||
if (next_base == 0x0) { //we are at the end
|
||||
//now we check if we fit in the current sector
|
||||
if (addr_alg <= potential_addr) { //it fits in the current sector
|
||||
@@ -129,7 +129,7 @@ int flash_clear_file(file_t *file) {
|
||||
(uintptr_t)(file->data - sizeof(uintptr_t) - sizeof(uint16_t) - sizeof(uintptr_t));
|
||||
uintptr_t prev_addr = flash_read_uintptr(base_addr + sizeof(uintptr_t));
|
||||
uintptr_t next_addr = flash_read_uintptr(base_addr);
|
||||
//printf("nc %lx->%lx %lx->%lx\r\n",prev_addr,flash_read_uintptr(prev_addr),base_addr,next_addr);
|
||||
//printf("nc %lx->%lx %lx->%lx\n",prev_addr,flash_read_uintptr(prev_addr),base_addr,next_addr);
|
||||
flash_program_uintptr(prev_addr, next_addr);
|
||||
flash_program_halfword((uintptr_t) file->data, 0);
|
||||
if (next_addr > 0) {
|
||||
@@ -138,7 +138,7 @@ int flash_clear_file(file_t *file) {
|
||||
flash_program_uintptr(base_addr, 0);
|
||||
flash_program_uintptr(base_addr + sizeof(uintptr_t), 0);
|
||||
file->data = NULL;
|
||||
//printf("na %lx->%lx\r\n",prev_addr,flash_read_uintptr(prev_addr));
|
||||
//printf("na %lx->%lx\n",prev_addr,flash_read_uintptr(prev_addr));
|
||||
return CCID_OK;
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ int flash_write_data_to_file_offset(file_t *file, const uint8_t *data, uint16_t
|
||||
}
|
||||
|
||||
uintptr_t new_addr = allocate_free_addr(len, (file->type & FILE_PERSISTENT) == FILE_PERSISTENT);
|
||||
//printf("na %x\r\n",new_addr);
|
||||
//printf("na %x\n",new_addr);
|
||||
if (new_addr == 0x0) {
|
||||
return CCID_ERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user