/* Copies the data of one whole block of a NAND Flash device to another block.  */
uint32_t nand_flash_raw_copy_block(const struct nand_flash_raw *raw, uint16_t source_block, uint16_t dest_block)
/* Copies the data of one whole block of a NAND Flash device to another block.  */
uint32_t nand_flash_raw_copy_block(const struct nand_flash_raw *raw, uint16_t source_block, uint16_t dest_block)
{
	uint16_t num_page =
			nand_flash_model_get_block_size_in_pages(MODEL(raw));
	uint32_t i;
	Assert(source_block != dest_block);
	for (i = 0; i < num_page; i++) {
		if (nand_flash_raw_copy_page(raw, source_block, i, dest_block, i)) {
			return NAND_COMMON_ERROR_BADBLOCK;
		}
	}
	return 0;
}