/* get the status of a given memory and store in buffer  */
uint8_t dfu_mem_getstatus(uint32_t addr, uint8_t cmd, uint8_t *buffer)
/* get the status of a given memory and store in buffer  */
uint8_t dfu_mem_getstatus(uint32_t addr, uint8_t cmd, uint8_t *buffer)
{
    uint32_t mem_index = dfu_mem_checkaddr(addr);
    if (mem_index < MAX_USED_MEMORY_MEDIA) {
        if (cmd & 0x01U) {
            POLLING_TIMEOUT_SET(mem_tab[mem_index]->write_timeout);
        } else {
            POLLING_TIMEOUT_SET(mem_tab[mem_index]->erase_timeout);
        }
        return MEM_OK;
    } else {
        return MEM_FAIL;
    }
}