summaryrefslogtreecommitdiffstats
path: root/include/usb
diff options
context:
space:
mode:
authorEdmund Henniges <eh@emlix.com>2020-05-14 20:21:54 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-05-20 15:43:59 +0200
commit2879373370eb3685cd6622f5d800e9f72ec81df1 (patch)
treed57b9103755336b550b7e8397dfeb586e728ef02 /include/usb
parent754f2e0d106d44dc89fdb4edbb54641d9525e62c (diff)
downloadbarebox-2879373370eb3685cd6622f5d800e9f72ec81df1.tar.gz
barebox-2879373370eb3685cd6622f5d800e9f72ec81df1.tar.xz
fastboot: split generic code from USB gadget
The fastboot specification describes other protocols beyond USB. Allow these to reuse the generic parts of the existing fastboot code when they are implemented. Most of the changes in common/fastboot.c are due to the renaming of struct f_fastboot *f_fb to struct fastboot *fb. Signed-off-by: Edmund Henniges <eh@emlix.com> Signed-off-by: Daniel Glöckner <dg@emlix.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/usb')
-rw-r--r--include/usb/fastboot.h34
-rw-r--r--include/usb/gadget-multi.h2
2 files changed, 4 insertions, 32 deletions
diff --git a/include/usb/fastboot.h b/include/usb/fastboot.h
index c0775c67dd..a3609ba5db 100644
--- a/include/usb/fastboot.h
+++ b/include/usb/fastboot.h
@@ -1,45 +1,17 @@
#ifndef _USB_FASTBOOT_H
#define _USB_FASTBOOT_H
-#include <linux/types.h>
-#include <file-list.h>
#include <usb/composite.h>
-
-struct f_fastboot;
+#include <fastboot.h>
/**
* struct f_fastboot_opts - options to configure the fastboot gadget
+ * @common: Options common to all fastboot protocol variants
* @func_inst: The USB function instance to register on
- * @files: A file_list containing the files (partitions) to export via fastboot
- * @export_bbu: Automatically include the partitions provided by barebox update (bbu)
*/
struct f_fastboot_opts {
+ struct fastboot_opts common;
struct usb_function_instance func_inst;
- struct file_list *files;
- bool export_bbu;
- int (*cmd_exec)(struct f_fastboot *, const char *cmd);
- int (*cmd_flash)(struct f_fastboot *, struct file_list_entry *entry,
- const char *filename, const void *buf, size_t len);
-};
-
-/*
- * Return codes for the exec_cmd callback above:
- *
- * FASTBOOT_CMD_FALLTHROUGH - Not handled by the external command dispatcher,
- * handle it with internal dispatcher
- * Other than these negative error codes mean errors handling the command and
- * zero means the command has been successfully handled.
- */
-#define FASTBOOT_CMD_FALLTHROUGH 1
-
-enum fastboot_msg_type {
- FASTBOOT_MSG_OKAY,
- FASTBOOT_MSG_FAIL,
- FASTBOOT_MSG_INFO,
- FASTBOOT_MSG_DATA,
};
-int fastboot_tx_print(struct f_fastboot *f_fb, enum fastboot_msg_type type,
- const char *fmt, ...);
-
#endif /* _USB_FASTBOOT_H */
diff --git a/include/usb/gadget-multi.h b/include/usb/gadget-multi.h
index 030e604fe7..9bb6c889f3 100644
--- a/include/usb/gadget-multi.h
+++ b/include/usb/gadget-multi.h
@@ -6,7 +6,7 @@
#include <usb/usbserial.h>
struct f_multi_opts {
- struct f_fastboot_opts fastboot_opts;
+ struct fastboot_opts fastboot_opts;
struct f_dfu_opts dfu_opts;
int create_acm;
void (*release)(struct f_multi_opts *opts);