/* Translates address/size access of a nand_flash_model to block, page and offset values.  */
uint32_t nand_flash_model_translate_access(const struct nand_flash_model *model, uint32_t address, uint32_t size, uint16_t *block, uint16_t *page, uint16_t *offset)
/* Translates address/size access of a nand_flash_model to block, page and offset values.  */
uint32_t nand_flash_model_translate_access(const struct nand_flash_model *model, uint32_t address, uint32_t size, uint16_t *block, uint16_t *page, uint16_t *offset)
{
	if ((address + size) > nand_flash_model_get_device_size_in_bytes(model)) {
		return NAND_COMMON_ERROR_OUTOFBOUNDS;
	}
	uint32_t block_size = nand_flash_model_get_block_size_in_bytes(model);
	uint32_t page_size = nand_flash_model_get_page_data_size(model);
	uint16_t temp_block = address / block_size;
	address -= (temp_block * block_size);
	uint16_t temp_page = address / page_size;
	address -= (temp_page * page_size);
	uint16_t temp_Offset = address;
	if (block) {
		*block = temp_block;
	}
	if (page) {
		*page = temp_page;
	}
	if (offset) {
		*offset = temp_Offset;
	}
	return 0;
}