summaryrefslogtreecommitdiff
path: root/include/fastboot.h
diff options
context:
space:
mode:
authorAlex Kiernan <alex.kiernan@gmail.com>2018-05-29 15:30:41 +0000
committerMarek Vasut <marex@denx.de>2018-05-30 11:59:21 +0200
commitd2df2abbcd4b88539605f8329edd244e6474d7a0 (patch)
tree572a2ecdd83b6f84715ad5033e60dd95f6373b4d /include/fastboot.h
parentc4ded03ef608be37db105200010d2f3f88195bd6 (diff)
fastboot: Extract fastboot_okay/fail to fb_common.c
Add drivers/fastboot/fb_common.c, where fastboot_okay/fail are implemented so we can call them from a non-USB implementation. Introduce fastboot_response which takes varargs parameters so we can use it to generate formatted response strings. Refactor fastboot_okay/fail to use it. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'include/fastboot.h')
-rw-r--r--include/fastboot.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/fastboot.h b/include/fastboot.h
index ed52daeb1b..6cd44d2ab9 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -15,7 +15,31 @@
/* The 64 defined bytes plus \0 */
#define FASTBOOT_RESPONSE_LEN (64 + 1)
+/**
+ * fastboot_response() - Writes a response of the form "$tag$reason".
+ *
+ * @tag: The first part of the response
+ * @response: Pointer to fastboot response buffer
+ * @format: printf style format string
+ */
+void fastboot_response(const char *tag, char *response,
+ const char *format, ...)
+ __attribute__ ((format (__printf__, 3, 4)));
+
+/**
+ * fastboot_fail() - Write a FAIL response of the form "FAIL$reason".
+ *
+ * @reason: Pointer to returned reason string
+ * @response: Pointer to fastboot response buffer
+ */
void fastboot_fail(const char *reason, char *response);
+
+/**
+ * fastboot_okay() - Write an OKAY response of the form "OKAY$reason".
+ *
+ * @reason: Pointer to returned reason string, or NULL to send a bare "OKAY"
+ * @response: Pointer to fastboot response buffer
+ */
void fastboot_okay(const char *reason, char *response);
#endif /* _FASTBOOT_H_ */