Lines Matching refs:uf2

156                                         struct bootuf2_BLOCK *uf2, uint32_t block_max)  in bootuf2block_check_writable()  argument
158 if (uf2->NumberOfBlock) { in bootuf2block_check_writable()
159 if (uf2->BlockIndex < block_max) { in bootuf2block_check_writable()
160 uint8_t mask = 1 << (uf2->BlockIndex % 8); in bootuf2block_check_writable()
161 uint32_t pos = uf2->BlockIndex / 8; in bootuf2block_check_writable()
173 struct bootuf2_BLOCK *uf2, uint32_t block_max) in bootuf2block_state_update() argument
175 if (uf2->NumberOfBlock) { in bootuf2block_state_update()
176 if (STATE->NumberOfBlock != uf2->NumberOfBlock) { in bootuf2block_state_update()
177 if ((uf2->NumberOfBlock >= BOOTUF2_BLOCKSMAX) || in bootuf2block_state_update()
183 STATE->NumberOfBlock = uf2->NumberOfBlock; in bootuf2block_state_update()
187 if (uf2->BlockIndex < block_max) { in bootuf2block_state_update()
188 uint8_t mask = 1 << (uf2->BlockIndex % 8); in bootuf2block_state_update()
189 uint32_t pos = uf2->BlockIndex / 8; in bootuf2block_state_update()
199 uf2->NumberOfBllock, STATE->NumberOfWritten, uf2->BlockIndex); in bootuf2block_state_update()
229 int bootuf2_flash_write_internal(struct bootuf2_data *ctx, struct bootuf2_BLOCK *uf2) in bootuf2_flash_write_internal() argument
233 if ((ctx->cached_bytes && ((ctx->cached_address + ctx->cached_bytes) != uf2->TargetAddress)) || in bootuf2_flash_write_internal()
241 memcpy(ctx->cache + ctx->cached_bytes, uf2->Data, uf2->PayloadSize); in bootuf2_flash_write_internal()
243 ctx->cached_address = uf2->TargetAddress - ctx->cached_bytes; in bootuf2_flash_write_internal()
244 ctx->cached_bytes += uf2->PayloadSize; in bootuf2_flash_write_internal()
413 struct bootuf2_BLOCK *uf2 = (void *)buff; in bootuf2_write_sector() local
415 if (!((uf2->MagicStart0 == BOOTUF2_MAGIC_START0) && in bootuf2_write_sector()
416 (uf2->MagicStart1 == BOOTUF2_MAGIC_START1) && in bootuf2_write_sector()
417 (uf2->MagicEnd == BOOTUF2_MAGIC_END) && in bootuf2_write_sector()
418 (uf2->Flags & BOOTUF2_FLAG_FAMILID_PRESENT) && in bootuf2_write_sector()
419 !(uf2->Flags & BOOTUF2_FLAG_NOT_MAIN_FLASH))) { in bootuf2_write_sector()
423 if (uf2->FamilyID == CONFIG_BOOTUF2_FAMILYID) { in bootuf2_write_sector()
424 if (bootuf2block_check_writable(ctx->STATE, uf2, CONFIG_BOOTUF2_FLASHMAX)) { in bootuf2_write_sector()
425 bootuf2_flash_write_internal(ctx, uf2); in bootuf2_write_sector()
426 bootuf2block_state_update(ctx->STATE, uf2, CONFIG_BOOTUF2_FLASHMAX); in bootuf2_write_sector()
429 uf2->BlockIndex); in bootuf2_write_sector()
432 USB_LOG_DBG("UF2 block illegal id %08x\r\n", uf2->FamilyID); in bootuf2_write_sector()