{
}
+/*
+ * The purpose of the dfu_error_callback() function is to
+ * provide callback for dfu user
+ */
+__weak void dfu_error_callback(struct dfu_entity *dfu, const char *msg)
+{
+}
+
/*
* The purpose of the dfu_usb_get_reset() function is to
* provide information if after USB_DETACH request
printf("%s: Wrong sequence number! [%d] [%d]\n",
__func__, dfu->i_blk_seq_num, blk_seq_num);
dfu_transaction_cleanup(dfu);
+ dfu_error_callback(dfu, "Wrong sequence number");
return -1;
}
ret = dfu_write_buffer_drain(dfu);
if (ret) {
dfu_transaction_cleanup(dfu);
+ dfu_error_callback(dfu, "DFU write error");
return ret;
}
}
pr_err("Buffer overflow! (0x%p + 0x%x > 0x%p)\n", dfu->i_buf,
size, dfu->i_buf_end);
dfu_transaction_cleanup(dfu);
+ dfu_error_callback(dfu, "Buffer overflow");
return -1;
}
ret = dfu_write_buffer_drain(dfu);
if (ret) {
dfu_transaction_cleanup(dfu);
+ dfu_error_callback(dfu, "DFU write error");
return ret;
}
}
*/
void dfu_flush_callback(struct dfu_entity *dfu);
+/**
+ * dfu_error_callback() - weak callback called at the DFU write error
+ *
+ * It is a callback function called by DFU stack after DFU write error.
+ * This function allows to manage some board specific behavior on DFU targets
+ *
+ * @dfu: pointer to the dfu_entity which cause the error
+ * @msg: the message of the error
+ */
+void dfu_error_callback(struct dfu_entity *dfu, const char *msg);
+
int dfu_transaction_initiate(struct dfu_entity *dfu, bool read);
void dfu_transaction_cleanup(struct dfu_entity *dfu);