/* This function transfers the USB MSC data to the memory.  */
Ctrl_status nand_flash_usb_write_10(uint32_t addr, uint16_t nb_sector)
/* This function transfers the USB MSC data to the memory.  */
Ctrl_status nand_flash_usb_write_10(uint32_t addr, uint16_t nb_sector)
{
	uint8_t nb_sector_trans;
	uint16_t page_data_size
		= nand_flash_model_get_page_data_size(MODEL(&nf_translation));
	if (nand_flash_status == NAND_FLASH_READY) {
		while (nb_sector) {
			nb_sector_trans
				= min(nb_sector,
					(page_data_size / SECTOR_SIZE));
			udi_msc_trans_block(false,
					(uint8_t *)nand_flash_usb_buffer,
					(nb_sector_trans * SECTOR_SIZE), NULL);
			if (nand_flash_write((addr * SECTOR_SIZE),
					nand_flash_usb_buffer,
					(nb_sector_trans * SECTOR_SIZE))) {
				return CTRL_FAIL;
			}
			nb_sector -= nb_sector_trans;
			addr += nb_sector_trans;
		}
		return CTRL_GOOD;
	}
	return CTRL_BUSY;
}