DFU_FS_EXT3,
DFU_FS_EXT4,
DFU_RAM_ADDR,
+ DFU_SKIP,
+ DFU_SCRIPT,
};
enum dfu_op {
};
struct ram_internal_data {
- void *start;
+ unsigned long start;
unsigned int size;
};
};
#define DFU_NAME_SIZE 32
-#ifndef CONFIG_SYS_DFU_DATA_BUF_SIZE
-#define CONFIG_SYS_DFU_DATA_BUF_SIZE (1024*1024*8) /* 8 MiB */
-#endif
-#ifndef CONFIG_SYS_DFU_MAX_FILE_SIZE
-#define CONFIG_SYS_DFU_MAX_FILE_SIZE CONFIG_SYS_DFU_DATA_BUF_SIZE
-#endif
#ifndef DFU_DEFAULT_POLL_TIMEOUT
#define DFU_DEFAULT_POLL_TIMEOUT 0
#endif
unsigned int inited:1;
};
+struct list_head;
+extern struct list_head dfu_list;
+
#ifdef CONFIG_SET_DFU_ALT_INFO
/**
* set_dfu_alt_info() - set dfu_alt_info environment variable
*/
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);
}
#endif
+extern bool dfu_reinit_needed;
+
+#if CONFIG_IS_ENABLED(DFU_WRITE_ALT)
/**
- * dfu_tftp_write() - write TFTP data to DFU medium
+ * dfu_write_by_name() - write data to DFU medium
+ * @dfu_entity_name: Name of DFU entity to write
+ * @addr: Address of data buffer to write
+ * @len: Number of bytes
+ * @interface: Destination DFU medium (e.g. "mmc")
+ * @devstring: Instance number of destination DFU medium (e.g. "1")
+ *
+ * This function is storing data received on DFU supported medium which
+ * is specified by @dfu_entity_name.
*
- * This function is storing data received via TFTP on DFU supported medium.
+ * Return: 0 - on success, error code - otherwise
+ */
+int dfu_write_by_name(char *dfu_entity_name, void *addr,
+ unsigned int len, char *interface, char *devstring);
+
+/**
+ * dfu_write_by_alt() - write data to DFU medium
+ * @dfu_alt_num: DFU alt setting number
+ * @addr: Address of data buffer to write
+ * @len: Number of bytes
+ * @interface: Destination DFU medium (e.g. "mmc")
+ * @devstring: Instance number of destination DFU medium (e.g. "1")
*
- * @dfu_entity_name: name of DFU entity to write
- * @addr: address of data buffer to write
- * @len: number of bytes
- * @interface: destination DFU medium (e.g. "mmc")
- * @devstring: instance number of destination DFU medium (e.g. "1")
+ * This function is storing data received on DFU supported medium which
+ * is specified by @dfu_alt_name.
*
- * Return: 0 on success, otherwise error code
+ * Return: 0 - on success, error code - otherwise
*/
-#if CONFIG_IS_ENABLED(DFU_TFTP)
-int dfu_tftp_write(char *dfu_entity_name, unsigned int addr, unsigned int len,
- char *interface, char *devstring);
+int dfu_write_by_alt(int dfu_alt_num, void *addr, unsigned int len,
+ char *interface, char *devstring);
#else
-static inline int dfu_tftp_write(char *dfu_entity_name, unsigned int addr,
- unsigned int len, char *interface,
- char *devstring)
+static inline int dfu_write_by_name(char *dfu_entity_name, void *addr,
+ unsigned int len, char *interface,
+ char *devstring)
+{
+ puts("write support for DFU not available!\n");
+ return -ENOSYS;
+}
+
+static inline int dfu_write_by_alt(int dfu_alt_num, void *addr,
+ unsigned int len, char *interface,
+ char *devstring)
{
- puts("TFTP write support for DFU not available!\n");
+ puts("write support for DFU not available!\n");
return -ENOSYS;
}
#endif