Lines Matching refs:block

53 	struct bt_mesh_blob_block block;  member
193 } while (++idx < cli->block.chunk_count); in next_missing_chunk()
203 memset(cli->block.missing, 0, sizeof(cli->block.missing)); in update_missing_chunks()
210 for (size_t idx = 0; idx < cli->block.chunk_count; idx++) { in update_missing_chunks()
211 bool missing = blob_chunk_missing_get(cli->block.missing, idx) || in update_missing_chunks()
213 blob_chunk_missing_set(cli->block.missing, idx, missing); in update_missing_chunks()
219 const struct bt_mesh_blob_block *block, in chunk_size() argument
222 if ((chunk_idx == block->chunk_count - 1) && in chunk_size()
223 (block->size % xfer->chunk_size)) { in chunk_size()
224 return block->size % xfer->chunk_size; in chunk_size()
266 cli->block.number = block_idx; in block_set()
267 cli->block.offset = block_idx * (1UL << cli->xfer->block_size_log); in block_set()
268 cli->block.size = blob_block_size(cli->xfer->size, cli->xfer->block_size_log, in block_set()
270 cli->block.chunk_count = in block_set()
271 DIV_ROUND_UP(cli->block.size, cli->xfer->chunk_size); in block_set()
274 blob_chunk_missing_set_all(&cli->block); in block_set()
279 memset(cli->block.missing, 0, sizeof(cli->block.missing)); in block_set()
286 LOG_DBG("%u size: %u chunks: %u", block_idx, cli->block.size, in block_set()
287 cli->block.chunk_count); in block_set()
667 net_buf_simple_add_le16(&buf, cli->block.number); in block_start_tx()
682 chunk.size = chunk_size(cli->xfer, &cli->block, cli->chunk_idx); in chunk_tx()
686 err = cli->io->rd(cli->io, cli->xfer, &cli->block, &chunk); in chunk_tx()
866 LOG_DBG("%u (%u chunks, %u/%u)", cli->block.number, in block_start()
867 cli->block.chunk_count, cli->block.number + 1, cli->block_count); in block_start()
886 cli->io->block_start(cli->io, cli->xfer, &cli->block); in block_start()
906 if (chunk_idx < cli->block.chunk_count) { in chunk_tx_complete()
952 LOG_DBG("%u / %u size: %u", cli->chunk_idx + 1, cli->block.chunk_count, in chunk_send()
953 chunk_size(cli->xfer, &cli->block, cli->chunk_idx)); in chunk_send()
966 blob_chunk_missing_set(cli->block.missing, cli->chunk_idx, false); in chunk_send_end()
969 cli->chunk_idx = next_missing_chunk(cli, cli->block.missing, cli->chunk_idx + 1); in chunk_send_end()
970 if (cli->chunk_idx < cli->block.chunk_count) { in chunk_send_end()
1008 if (next_missing_chunk(cli, cli->block.missing, 0) >= cli->block.chunk_count) { in block_report_wait()
1038 cli->chunk_idx = next_missing_chunk(cli, cli->block.missing, 0); in block_check_end()
1039 if (cli->chunk_idx < cli->block.chunk_count) { in block_check_end()
1044 LOG_DBG("No more missing chunks for block %u", cli->block.number); in block_check_end()
1047 cli->io->block_end(cli->io, cli->xfer, &cli->block); in block_check_end()
1053 if (cli->block.number == cli->block_count - 1) { in block_check_end()
1064 block_set(cli, cli->block.number + 1); in block_check_end()
1138 struct block_status *block) in rx_block_status() argument
1147 LOG_DBG("0x%04x: block: %u status: %u", target->addr, block->block.number, block->status); in rx_block_status()
1149 if (block->status != BT_MESH_BLOB_SUCCESS) { in rx_block_status()
1150 target_drop(cli, target, block->status); in rx_block_status()
1155 if (block->block.number != cli->block.number) { in rx_block_status()
1156 LOG_DBG("Invalid block num (expected %u)", cli->block.number); in rx_block_status()
1160 if (block->missing == BT_MESH_BLOB_CHUNKS_MISSING_NONE) { in rx_block_status()
1169 } else if (block->missing == BT_MESH_BLOB_CHUNKS_MISSING_ALL) { in rx_block_status()
1170 blob_chunk_missing_set_all(&cli->block); in rx_block_status()
1172 memcpy(target->pull->missing, block->block.missing, sizeof(block->block.missing)); in rx_block_status()
1174 LOG_DBG("Missing: %s", bt_hex(target->pull->missing, cli->block.chunk_count)); in rx_block_status()
1183 for (int i = 0; i < ARRAY_SIZE(block->block.missing); ++i) { in rx_block_status()
1184 cli->block.missing[i] |= block->block.missing[i]; in rx_block_status()
1284 .block.number = cli->block.number, in handle_block_report()
1314 blob_chunk_missing_set(status.block.missing, idx, true); in handle_block_report()
1320 if (next_missing_chunk(cli, target->pull->missing, 0) >= cli->block.chunk_count) { in handle_block_report()
1351 status.block.number = net_buf_simple_pull_le16(buf); in handle_block_status()
1353 status.block.chunk_count = in handle_block_status()
1354 DIV_ROUND_UP(cli->block.size, chunk_size); in handle_block_status()
1357 status.block.number, status.missing); in handle_block_status()
1361 blob_chunk_missing_set_all(&status.block); in handle_block_status()
1366 if (buf->len > sizeof(status.block.missing)) { in handle_block_status()
1371 memcpy(status.block.missing, net_buf_simple_pull_mem(buf, len), in handle_block_status()
1374 LOG_DBG("Missing: %s", bt_hex(status.block.missing, len)); in handle_block_status()
1386 if (idx < 0 || idx >= status.block.chunk_count) { in handle_block_status()
1393 blob_chunk_missing_set(status.block.missing, idx, true); in handle_block_status()
1543 if (cli->block.chunk_count > CONFIG_BT_MESH_BLOB_CHUNK_COUNT_MAX) { in bt_mesh_blob_cli_send()
1647 return (100U * cli->block.number) / cli->block_count; in bt_mesh_blob_cli_xfer_progress_active_get()