/* Function for preparing swap before receiving application or bootloader image. 
This function will erase current swap area to ensure flash is ready for storage of the Application or Bootloader image. Upon erase complete a callback will be done. See dfu_bank_prepare_t for further details.  */
static void dfu_prepare_func_swap_erase(uint32_t image_size)
/* Function for preparing swap before receiving application or bootloader image. 
This function will erase current swap area to ensure flash is ready for storage of the Application or Bootloader image. Upon erase complete a callback will be done. See dfu_bank_prepare_t for further details.  */
static void dfu_prepare_func_swap_erase(uint32_t image_size)
{
    uint32_t err_code;
    mp_storage_handle_active = &m_storage_handle_swap;
    m_dfu_state = DFU_STATE_PREPARING;
    err_code    = pstorage_clear(&m_storage_handle_swap, DFU_IMAGE_MAX_SIZE_BANKED);
    APP_ERROR_CHECK(err_code);
}